17 #ifndef _TIPRO_TIPROHIDAPI_TIPROHIDDEVICE_H_ 18 #define _TIPRO_TIPROHIDAPI_TIPROHIDDEVICE_H_ 25 typedef unsigned char UCHAR;
41 terrInvalidHandleValue,
47 terrCmdNotSupportedAtFWLevel,
48 terrFWLevelNotAvailable,
49 terrFWLevelChangeFailed,
51 terrWrongSignatureBytes,
52 terrResponseTimoutExpired,
56 terrExchStatusReqReject,
57 terrExchStatusReqFail,
58 terrExchStatusReqSucc,
59 terrExchStatusAnsPend,
61 terrExchStatusAnsReject,
62 terrExchStatusAnsFail,
68 static const UCHAR FRCMD_RESET = 0x00;
69 static const UCHAR FRCMD_TMC_IF_DISABLE = 0x01;
70 static const UCHAR FRCMD_TMC_IF_ENABLE = 0x02;
71 static const UCHAR FRCMD_TMC_IF_V2_ENABLE = 0x03;
72 static const UCHAR FRCMD_LEVEL1_CMD = 0x04;
73 static const UCHAR FRCMD_CLR_SERIAL_NO = 0x05;
74 static const UCHAR FRCMD_OPT_IF = 0x06;
75 static const UCHAR FRCMD_FW_LEVEL = 0x07;
76 static const UCHAR FRCMD_MID_EXCH = 0x08;
131 virtual int SendCommandToConnectedDeviceEx(
const UCHAR nCommand,
const UCHAR nDest,
const UCHAR *pParameters,
const int nLen, UCHAR *pResponse,
int *nResponseLen);
198 virtual int GetModuleVersion(
int nIndex,
unsigned char *nVerMaj,
unsigned char *nVerMin,
unsigned char *nVerBuild);
210 virtual int GetModuleVersionEx(
int nIndex,
unsigned char *nVerMaj,
unsigned char *nVerMin,
unsigned char *nVerBuild,
unsigned char *nModuleType,
unsigned char *nModuleID);
221 virtual int GetControllerInfo(
int *nVerMaj,
int *nVerMin,
int *nVerBuild,
int *nVerCustom,
int *nFWLevel);
224 static const unsigned int REPORT_LEN = 65;
225 std::string _path =
"";
226 hid_device *_device = NULL;
227 unsigned int _report_length = 0;
228 unsigned short _signature = 0;
235 hid_device* HidOpenPath();
249 int HidSendFeatureReport(
const unsigned char *data,
size_t length);
257 int HidGetFeatureReport(
unsigned char *data,
size_t length);
267 int SendCommand(
const unsigned char data_send[],
size_t length_send,
unsigned char data_receive[],
size_t& length_receive);
274 int SetFwLevel(
int fwlevel);
virtual int GetModuleVersion(int nIndex, unsigned char *nVerMaj, unsigned char *nVerMin, unsigned char *nVerBuild)
Gets module version from device, based on module index.
virtual int GetControllerInfo(int *nVerMaj, int *nVerMin, int *nVerBuild, int *nVerCustom, int *nFWLevel)
Gets controller version of device.
virtual ~TiproHidDevice()
Destructor.
virtual int SendCommandToConnectedDeviceEx(const UCHAR nCommand, const UCHAR nDest, const UCHAR *pParameters, const int nLen, UCHAR *pResponse, int *nResponseLen)
Sends command to the device.
virtual int GetSerialNumberString(wchar_t *pString, int lBufferLen)
Gets serial number string from device.
virtual int GetManufacturerString(wchar_t *pString, int lBufferLen)
Gets manufacturer string from device.
virtual int HIDEnumerateModules()
Enumerates modules of the device.
virtual int Close()
Closes device.
TiproHidDevice()
Constructor.
virtual int GetModuleVersionEx(int nIndex, unsigned char *nVerMaj, unsigned char *nVerMin, unsigned char *nVerBuild, unsigned char *nModuleType, unsigned char *nModuleID)
Gets module version, type and ID from device, based on module index.
virtual hid_device * GetHidDevice()
Returns hid_device handle of the device.
virtual int Reset()
Resets the device.
virtual const char * GetPath()
Returns path name of the device.
virtual int Open()
Opens device for communication.
virtual TiproHidDevice & operator=(const TiproHidDevice &other)
Compare operator.
Definition: TiproHidDevice.h:32
virtual int GetProductString(wchar_t *pString, int lBufferLen)
Gets product string from device.
virtual int GetIndexedStringDescriptor(int lStrIx, wchar_t *pString, int lBufferLen)
Gets a string from device, based on its string index.