device.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef G13MM_DEVICE_H
00020 #define G13MM_DEVICE_H
00021
00022 #include <string>
00023 #include <g13/udev.h>
00024 #include <g13/leds.h>
00025 #include <g13mm/pointer.h>
00026
00029 namespace G13 {
00030
00034 typedef enum LED {
00035 LED_M1 = G13_LED_M1,
00036 LED_M2 = G13_LED_M2,
00037 LED_M3 = G13_LED_M3,
00038 LED_MR = G13_LED_MR,
00039 } LED;
00040
00044 struct Color {
00045 Color(unsigned red=0, unsigned green=0, unsigned blue=0): r(red), g(green), b(blue) { }
00046 unsigned r;
00047 unsigned g;
00048 unsigned b;
00049 };
00050
00054 class Device {
00055 protected:
00056 Device(g13_device* cobj);
00057 public:
00058 typedef G13Pointer<Device> pointer;
00059
00060 static pointer create(g13_device* cobj);
00061 static pointer create(g13_list_entry* list_entry);
00062 static pointer create(const std::string& name);
00063
00064 ~Device();
00065
00066 std::string name();
00067
00068 int set_name(const std::string& name);
00069
00070 int led(int which);
00071
00072 int set_led(int which, bool on=true);
00073
00074 int set_m1(bool enabled=true);
00075
00076 int set_m2(bool enabled=true);
00077
00078 int set_m3(bool enabled=true);
00079
00080 int set_mr(bool enabled=true);
00081
00082 Color backlight();
00083
00084 int set_backlight(const Color& color);
00085
00086 int set_backlight(unsigned r, unsigned g, unsigned b);
00087
00088 g13_device* cobj();
00089
00090 protected:
00091 g13_device* m_cobj;
00092 };
00093
00094 }
00095
00096 #endif