Transport
Basic transmission layer, indicating a abstract communication back end
Open the device
/*
@note: Open the device and use the device path to open
@param path: the path of the image
@return returns 1 if successful, -1 if an error occurs
*/
int open(char *path);
Get the device firmware id
/*
@note: Get the device firmware id
@param lenth: firmware number length (default is 512)
@return returns 1 if successful, -1 if an error occurs
*/
unsigned char *getInputReport(int lenth);
Read the device feedback information
/*
/*
@note: Read the feedback information of the device
Key event
byte content value description
data[0] reply format 0x41-A
data[1] reply format 0x43-C
data[2] reply format 0x4B-K
data[3-4] reserved
data[5] reply format 0x4F-O
data[6] reply format 0x4B-K
data[7-8] reserved
data[9] key index 0x01-0x0F
data[10] key event 0x00-0x01 0x00 key lifted, 0x01 key pressed
Response message
data[0] reply format 0x41-A
data[1] reply format 0x43-C
data[2] reply format 0x4B-K
data[3-4] Reserved
data[5] Response format 0x4F-O
data[6] Response format 0x4B-K
data[7-8] Reserved
data[9] Indicates response 0x00
data[10-13] Reserved
@param data: unsigned char array used to receive feedback information
@param lenth: array length
@return Return 1 if successful, -1 if error occurs
*/
int read(unsigned char *data,unsigned long lenth);
Send information to the device
/*
@note: Send information to the device
@param data: unsigned char array containing data
@param lenth: length of array
@return returns 1 if successful, -1 if an error occurs
*/
int write(unsigned char *data,unsigned long lenth);
Destroy the device information list returned by enumerate
/*
@note: Destroy the device information list returned by enumerate
@param devs: linked list containing device information
@return Return 1 if successful, -1 if error
*/
void freeEnumerate(hid_device_info *devs);
Get device information list
/*
@note: Get device information list
@param vid: device vid
@param pid: device pid
@return Return 1 if successful, -1 if error
*/
hid_device_info *enumerate(int vid, int pid);
Set device screen brightness 1-100
/*
@note: Set device screen brightness 0-100
@param percent: brightness 0-100
@return Return 1 if successful, -1 if error
*/
int setBrightness(int percent);
Set the background image of the device screen
/*
@note: Set the background image of the device screen
@param buffer: unsigned buffer containing BGR data char array address
@param size: array size
@return Success returns 1, if an error returns -1
*/
int setBackgroundImg(unsigned char *buffer);
Set the icon of a key of the device
/*
@note: Set the icon of a key of the device
@param path: image path
@param key: key label
@return Success returns 1, if an error returns -1
*/
int setKeyImg(std::string path,int key);
Set the icon of a key of the device
/*
@note: Set the icon of a key of the device
@param buffer, unsigned char array with image information
@param key: key label
@param width: image length
@param height: image height
@return Success returns 1, if an error returns -1
*/
int setKeyImgdata(unsigned char* buffer, int key, int width, int height);
Clear the icon of a certain key 1-15
/*
@note: Clear the icon of a certain key
@param index: key number (1-15)
@return Success returns 1, if an error returns -1
*/
int keyClear(int i);
Clear the icons of all keys
/*
@note: Clear the icons of all keys
@return Success returns 1, if an error returns -1
*/
int keyAllClear();
Wake up the screen
/*
@note: Wake up the screen
@return Success returns 1, if an error returns -1
*/
int wakeScreen();
After data transmission is completed, this can be used to refresh the display
/*
@note: After data transmission is completed, this can be used to refresh the display
@return Success returns 1, if an error returns -1
*/
int refresh();
Disconnect
/*
@note: Disconnect
@return 1 if successful, -1 if error
*/
int disconnected();
Close the device
/*
@note: Close the device
@return 1 if successful, -1 if error
*/
void close();