Documentation
For Arduino users
NexCheckbox.cpp
Go to the documentation of this file.
1 
15 #include "NexCheckbox.h"
16 
17 NexCheckbox::NexCheckbox(uint8_t pid, uint8_t cid, const char *name)
18  :NexTouch(pid, cid, name)
19 {
20 }
21 
22 uint32_t NexCheckbox::getValue(uint32_t *number)
23 {
24  String cmd = String("get ");
25  cmd += getObjName();
26  cmd += ".val";
27  sendCommand(cmd.c_str());
28  return recvRetNumber(number);
29 }
30 
31 bool NexCheckbox::setValue(uint32_t number)
32 {
33  char buf[10] = {0};
34  String cmd;
35 
36  utoa(number, buf, 10);
37  cmd += getObjName();
38  cmd += ".val=";
39  cmd += buf;
40 
41  sendCommand(cmd.c_str());
42  return recvRetCommandFinished();
43 }
44 
45 uint32_t NexCheckbox::Get_background_color_bco(uint32_t *number)
46 {
47  String cmd;
48  cmd += "get ";
49  cmd += getObjName();
50  cmd += ".bco";
51  sendCommand(cmd.c_str());
52  return recvRetNumber(number);
53 }
54 
56 {
57  char buf[10] = {0};
58  String cmd;
59 
60  utoa(number, buf, 10);
61  cmd += getObjName();
62  cmd += ".bco=";
63  cmd += buf;
64  sendCommand(cmd.c_str());
65 
66  cmd="";
67  cmd += "ref ";
68  cmd += getObjName();
69  sendCommand(cmd.c_str());
70  return recvRetCommandFinished();
71 }
72 
73 uint32_t NexCheckbox::Get_font_color_pco(uint32_t *number)
74 {
75  String cmd;
76  cmd += "get ";
77  cmd += getObjName();
78  cmd += ".pco";
79  sendCommand(cmd.c_str());
80  return recvRetNumber(number);
81 }
82 
83 bool NexCheckbox::Set_font_color_pco(uint32_t number)
84 {
85  char buf[10] = {0};
86  String cmd;
87 
88  utoa(number, buf, 10);
89  cmd += getObjName();
90  cmd += ".pco=";
91  cmd += buf;
92  sendCommand(cmd.c_str());
93 
94  cmd = "";
95  cmd += "ref ";
96  cmd += getObjName();
97  sendCommand(cmd.c_str());
98  return recvRetCommandFinished();
99 }
bool setValue(uint32_t number)
Set val attribute of component.
Definition: NexCheckbox.cpp:31
bool Set_background_color_bco(uint32_t number)
Set bco attribute of component.
Definition: NexCheckbox.cpp:55
bool Set_font_color_pco(uint32_t number)
Set pco attribute of component.
Definition: NexCheckbox.cpp:83
uint32_t Get_background_color_bco(uint32_t *number)
Get bco attribute of component.
Definition: NexCheckbox.cpp:45
uint32_t Get_font_color_pco(uint32_t *number)
Get pco attribute of component.
Definition: NexCheckbox.cpp:73
The definition of class NexCheckbox.
uint32_t getValue(uint32_t *number)
Get val attribute of component.
Definition: NexCheckbox.cpp:22
NexCheckbox(uint8_t pid, uint8_t cid, const char *name)
Constructor.
Definition: NexCheckbox.cpp:17
Father class of the components with touch events.
Definition: NexTouch.h:53