This CLSID returns the current throttle position as a percentage.
Throttle position
Read, shareable or exclusive
Type: | VT_UI2 (unsigned short fixed point decimal) |
Low: | 0.0 |
High: | 99.2 |
None
Type: | VT_UI2 (unsigned short fixed point decimal) |
Measurement: | VIOMEASUREMENT_PERCENTAGE |
Units: | VIOUNITS_PERCENT |
The actual range of throttle position may not reach the high and low bounds.
API device objects expect the following data types and sizes when sending data to and from the mini-drivers:
None
Type: | USHORT * |
Size: | 2 bytes |
Description: | Throttle position in 0.1% increments |
HRESULT hr;
IVIO_Device *pThrottlePosition;
VIODEVICEMETRICS dmMetrics;
VARIANT vDeviceData;
USHORT usThrottlePct;
float fThrottlePos, fMultiplier;
//Create an instance of the throttle position device and get its
//IVIO_Device interface.
hr = CoCreateInstance(CLSID_VIO_THROTTLE_POSITION, NULL,
CLSCTX_INPROC_SERVER, IID_VIODEVICE,
&pThrottlePosition);
//Get the metrics for the throttle position device.
pThrottlePosition->get_Metrics(&dmMetrics);
//From the metrics, get the power of 10 to multiply the data value by.
fMultiplier = 10.0 ^ dmMetrics.lExponent;
//Ask the device for throttle position.
pThrottlePosition->GetData(&vDeviceData, 3000);
//Get the percentage for the fixed-point throttle position.
usThrottlePct = vDeviceData.uiVal;
//Release the reference to the interface.
pThrottlePosition->Release();