Communication transmission
Basic transmission layer, representing an abstract communication backend
Open device
/*
@note: Open device
@param path: Path of device
@return: Return 1 if successful, -1 if failed
*/
int open(char *path);
Get device firmware version
/*
@note: Get device firmware version
@param lenth: Length of firmware version
@return Returns the first address of the array where the firmware version number is stored, or NULL if an error occurs
*/
unsigned char *getInputReport(int lenth);
Receive information sent by device
/*
@note: Receive information sent by device
@return Returns the first address of the array obtained if successful, or NULL if an error occurs
*/
int read(unsigned char *data,unsigned long lenth);
Send information to the device
/*
@note: Send information to the device
@return Successfully returns the number of bytes written, if an error returns -1
*/
int write(unsigned char *data,unsigned long lenth);
Clear the information of traversing devices
/*
@note: Clear the information of traversing devices
*/
void freeEnumerate(hid_device_info *devs);
Traversing devices
/*
@note: Traversing devices
@return Successfully returns the address of the device information list, if an error returns NULL
*/
hid_device_info *enumerate(int vid, int pid);
Set the brightness of the device screen
/*
@note: Set the brightness of the device screen. If the value passed in is less than 0, the value will be pulled back to 0. If it is greater than 100, it will be pulled back to 100
@param percent: Brightness value 1-100
@return Success returns 0, if an error returns -1
*/
int setBrightness(int percent);
Set the background image of the device screen
/*
@note: Set the background image of the device screen
@param path: Array for storing image data
@return Success returns 1, if an error returns -1
*/
int setBackgroundImg(unsigned char *buffer);
Set the icon of the device button
/*
@note: Set the icon of the device button
@param path: Path of the image
@return Success returns 1, if an error returns -1
*/
int setKeyImg(std::string path,int key);
Clear a key icon
/*
@note: Clear key icon
@param index: key number
@return: Success returns 1, failure returns -1
*/
int keyClear(int i);
Clear all key icons
/*
@note: Clear all key icons
@return: Success returns 1, failure returns -1
*/
int keyAllClear();
Wake up the screen
/*
@note: Wake up the screen
@return: Success returns 1, failure returns -1
*/
int wakeScreen();
Refresh the display after data transmission is completed
/*
@note: Refresh the display after data transmission is completed
@return: Success returns 1, failure returns -1
*/
int refresh();
Disconnect
/*
@note: Disconnect
@return: 1 if successful, -1 if failed
*/
int disconnected();
Disconnect the device from the program
/*
@note: Disconnect the device from the program
*/
void close();