CLSID_VIO_BATTERY_VOLTAGE

This CLSID returns the current battery output voltage.

Name

Battery voltage

Access

Read, shareable or exclusive

Range

Type: VT_UI2 (unsigned short fixed point decimal)
Low: 0.00
High: 32.77

Input

None

Output

Type: VT_UI2 (unsigned short fixed point decimal)
Measurement: VIOMEASUREMENT_VOLTAGE
Units: VIOUNITS_VOLTS

Remarks

API device objects expect the following data types and sizes when sending data to and from the mini-drivers:

Mini-driver input

None

Mini-driver output

Type: SHORT *
Size: 2 bytes
Description: Battery voltage in 0.001 volt increments.

Example

HRESULT hr;
IVIO_Device *pBatteryVoltage;
VIODEVICEMETRICS dmBattery;
VARIANT vDeviceData;
USHORT usFixedPointVoltage;
float fFloatVoltage;
//Create an instance of the battery voltage device and get its 
//IVIO_Device interface.
hr = CoCreateInstance(CLSID_VIO_BATTERY_VOLTAGE, NULL,
                     CLSCTX_INPROC_SERVER, IID_VIODEVICE,
                     &pBatteryVoltage);
//Get the metrics for the battery voltage device.
pBatteryVoltage->get_Metrics(&dmBattery);
//Ask the device for current voltage.
pBatteryVoltage->GetData(&vDeviceData, 3000);
//Fetch the battery voltage as a fixed-point value from the VARIANT.
usVoltage = vDeviceData.uiVal;
//Convert the fixed-point value to a float value.
fFloatVoltage = ((float) usVoltage) * (10 ^ dmBattery.lExponent);
//Release the reference to the interface.
pBatteryVoltage->Release();