hid_GetDigitalByte
This function reads a complete byte from a digital input port of a device by
USB.
Declaration
BOOL
hid_GetDigitalByte ( HANDLE hDevice,
DWORD
dwPort,
LPBYTE
lpbyPortState
);
Parameters
hDevice
A valid device handle, previously obtained from hid_OpenDeviceDevice
dwPort T
he index of the port on the card to manipulate. The first port has index 0.
For more information, please see “Read Address Table” following below.
lpbyPortState
A pointer to a variable of type BYTE receiving the new state of the port
Return value
TRUE if successful, FALSE otherwise.
If an error occurred, GetLastError() may return the following values:
ERROR_INVALID_PARAMETER – The handle passed was invalid, or the port number was out of
range for the device selected.
Example
HANDLE hDevice = hid_OpenDevice(0x01,0); if (hDevice != INVALID_HANDLE_VALUE)
{
hid_GetDigitalByte( hDevice, 0, &byState); // reads the state of the first input port hid_
CloseDevice(hDevice);
}