ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
profile.h
Go to the documentation of this file.
1 #ifndef PROFILE_H
2 #define PROFILE_H
3 
4 #include "includes.h"
5 #include "device.h"
6 
7 // Note: Lock dmutex before using profile commands (see device.h).
8 // Allocating/deallocating a profile additionally requires imutex to be locked
9 
10 // Allocate a native profile
11 void allocprofile(usbdevice* kb);
12 // Allocate/load a hardware profile and copy it to native. Returns 0 on success.
13 int loadprofile(usbdevice* kb);
14 // Free a native profile and the corresponding HW profile
15 void freeprofile(usbdevice* kb);
16 
17 // Command: Reset a mode to its default settings
18 void cmd_erase(usbdevice* kb, usbmode* mode, int dummy1, int dummy2, const char* dummy3);
19 // Command: Erase a profile, deleting all of its modes.
20 void cmd_eraseprofile(usbdevice* kb, usbmode* dummy1, int dummy2, int dummy3, const char* dummy4);
21 
22 // Sets a mode's name
23 void cmd_name(usbdevice* kb, usbmode* mode, int dummy1, int dummy2, const char* name);
24 // Sets a profile's name
25 void cmd_profilename(usbdevice* kb, usbmode* dummy1, int dummy2, int dummy3, const char* name);
26 // Get a mode's name. Returns a URL-encoded UTF-8 buffer that needs to be freed later.
27 char* getmodename(usbmode* mode);
28 // Get a profile's name. See above.
29 char* getprofilename(usbprofile* profile);
30 // Get hardware names.
31 char* gethwmodename(hwprofile* profile, int index);
32 char* gethwprofilename(hwprofile* profile);
33 
34 // Updates a profile/mode with the supplied GUID. Returns 1 if valid or 0 if invalid.
35 int setid(usbid* id, const char* guid);
36 // Generates a GUID from the given ID. Returns a string which must be freed later.
37 char* getid(usbid* id);
38 
39 // Converts a hardware profile to a native profile
40 void hwtonative(usbprofile* profile, hwprofile* hw, int modecount);
41 // Converts a native profile to a hardware profile
42 void nativetohw(usbprofile* profile, hwprofile* hw, int modecount);
43 
44 // Command: Set mode ID
45 void cmd_id(usbdevice* kb, usbmode* mode, int dummy1, int dummy2, const char* id);
46 // Command: Set profile ID
47 void cmd_profileid(usbdevice* kb, usbmode* mode, int dummy1, int dummy2, const char* id);
48 
49 // Command: Load profile from hardware. apply = 1 to apply/activate hardware profile, 0 to simply store it. Returns 0 on success.
50 int cmd_hwload_kb(usbdevice* kb, usbmode* dummy1, int dummy2, int apply, const char* dummy3);
51 int cmd_hwload_mouse(usbdevice* kb, usbmode* dummy1, int dummy2, int apply, const char* dummy3);
52 #define hwloadprofile(kb, apply) (kb)->vtable->hwload(kb, 0, 0, apply, 0)
53 // Command: Saves the profile name to hardware. Returns 0 on success.
54 int cmd_hwsave_kb(usbdevice* kb, usbmode* dummy1, int dummy2, int dummy3, const char* dummy4);
55 int cmd_hwsave_mouse(usbdevice* kb, usbmode* dummy1, int dummy2, int dummy3, const char* dummy4);
56 
57 #endif // PROFILE_H
void cmd_profilename(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *name)
Definition: profile.c:128
void freeprofile(usbdevice *kb)
Definition: profile.c:253
char * getmodename(usbmode *mode)
Definition: profile.c:152
void cmd_id(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *id)
Definition: profile.c:168
int cmd_hwload_mouse(usbdevice *kb, usbmode *dummy1, int dummy2, int apply, const char *dummy3)
Definition: profile_mouse.c:6
int cmd_hwsave_mouse(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
Definition: profile_mouse.c:54
char * gethwmodename(hwprofile *profile, int index)
Definition: profile.c:160
void cmd_name(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *name)
Definition: profile.c:117
int cmd_hwload_kb(usbdevice *kb, usbmode *dummy1, int dummy2, int apply, const char *dummy3)
char * gethwprofilename(hwprofile *profile)
Definition: profile.c:164
void nativetohw(usbprofile *profile, hwprofile *hw, int modecount)
Definition: profile.c:277
void cmd_profileid(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *id)
Definition: profile.c:179
void hwtonative(usbprofile *profile, hwprofile *hw, int modecount)
Definition: profile.c:260
void allocprofile(usbdevice *kb)
Definition: profile.c:198
int cmd_hwsave_kb(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
void cmd_erase(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *dummy3)
Definition: profile.c:219
int loadprofile(usbdevice *kb)
Definition: profile.c:208
int setid(usbid *id, const char *guid)
Definition: profile.c:64
char * getid(usbid *id)
Definition: profile.c:79
void cmd_eraseprofile(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
Definition: profile.c:241
char * getprofilename(usbprofile *profile)
Definition: profile.c:156