| Documentation For Arduino users

- Main Page
- Related Pages
- Modules
- Classes
- Files
- Examples

- File List
- File Members

NexDualStateButton.cpp
Go to the documentation of this file.
1
16 #include "NexDualStateButton.h"
17
18 NexDSButton::NexDSButton(uint8_t pid, uint8_t cid, const char *name)
19 :NexTouch(pid, cid, name)
20 {
21 }
22
23 bool NexDSButton::getValue(uint32_t *number)
24 {
25 String cmd = String("get ");
26 cmd += getObjName();
27 cmd += ".val";
28 sendCommand(cmd.c_str());
29 return recvRetNumber(number);
30 }
31
32 bool NexDSButton::setValue(uint32_t number)
33 {
34 char buf[10] = {0};
35 String cmd;
36
37 utoa(number, buf, 10);
38 cmd += getObjName();
39 cmd += ".val=";
40 cmd += buf;
41
42 sendCommand(cmd.c_str());
43 return recvRetCommandFinished();
44 }
45
46 uint16_t NexDSButton::getText(char *buffer, uint16_t len)
47 {
48 String cmd;
49 cmd += "get ";
50 cmd += getObjName();
51 cmd += ".txt";
52 sendCommand(cmd.c_str());
53 return recvRetString(buffer,len);
54 }
55
56 bool NexDSButton::setText(const char *buffer)
57 {
58 String cmd;
59 cmd += getObjName();
60 cmd += ".txt=\"";
61 cmd += buffer;
62 cmd += "\"";
63 sendCommand(cmd.c_str());
64 return recvRetCommandFinished();
65 }
66
67 uint32_t NexDSButton::Get_state0_color_bco0(uint32_t *number)
68 {
69 String cmd;
70 cmd += "get ";
71 cmd += getObjName();
72 cmd += ".bco0";
73 sendCommand(cmd.c_str());
74 return recvRetNumber(number);
75 }
76
77 bool NexDSButton::Set_state0_color_bco0(uint32_t number)
78 {
79 char buf[10] = {0};
80 String cmd;
81
82 utoa(number, buf, 10);
83 cmd += getObjName();
84 cmd += ".bco0=";
85 cmd += buf;
86 sendCommand(cmd.c_str());
87
88 cmd="";
89 cmd += "ref ";
90 cmd += getObjName();
91 sendCommand(cmd.c_str());
92 return recvRetCommandFinished();
93 }
94
95 uint32_t NexDSButton::Get_state1_color_bco1(uint32_t *number)
96 {
97 String cmd;
98 cmd += "get ";
99 cmd += getObjName();
100 cmd += ".bco1";
101 sendCommand(cmd.c_str());
102 return recvRetNumber(number);
103 }
104
105 bool NexDSButton::Set_state1_color_bco1(uint32_t number)
106 {
107 char buf[10] = {0};
108 String cmd;
109
110 utoa(number, buf, 10);
111 cmd += getObjName();
112 cmd += ".bco1=";
113 cmd += buf;
114 sendCommand(cmd.c_str());
115
116 cmd="";
117 cmd += "ref ";
118 cmd += getObjName();
119 sendCommand(cmd.c_str());
120 return recvRetCommandFinished();
121 }
122
123 uint32_t NexDSButton::Get_font_color_pco(uint32_t *number)
124 {
125 String cmd;
126 cmd += "get ";
127 cmd += getObjName();
128 cmd += ".pco";
129 sendCommand(cmd.c_str());
130 return recvRetNumber(number);
131 }
132
133 bool NexDSButton::Set_font_color_pco(uint32_t number)
134 {
135 char buf[10] = {0};
136 String cmd;
137
138 utoa(number, buf, 10);
139 cmd += getObjName();
140 cmd += ".pco=";
141 cmd += buf;
142 sendCommand(cmd.c_str());
143
144 cmd = "";
145 cmd += "ref ";
146 cmd += getObjName();
147 sendCommand(cmd.c_str());
148 return recvRetCommandFinished();
149 }
150
151 uint32_t NexDSButton::Get_place_xcen(uint32_t *number)
152 {
153 String cmd;
154 cmd += "get ";
155 cmd += getObjName();
156 cmd += ".xcen";
157 sendCommand(cmd.c_str());
158 return recvRetNumber(number);
159 }
160
161 bool NexDSButton::Set_place_xcen(uint32_t number)
162 {
163 char buf[10] = {0};
164 String cmd;
165
166 utoa(number, buf, 10);
167 cmd += getObjName();
168 cmd += ".xcen=";
169 cmd += buf;
170 sendCommand(cmd.c_str());
171
172 cmd = "";
173 cmd += "ref ";
174 cmd += getObjName();
175 sendCommand(cmd.c_str());
176 return recvRetCommandFinished();
177 }
178
179 uint32_t NexDSButton::Get_place_ycen(uint32_t *number)
180 {
181 String cmd;
182 cmd += "get ";
183 cmd += getObjName();
184 cmd += ".ycen";
185 sendCommand(cmd.c_str());
186 return recvRetNumber(number);
187 }
188
189 bool NexDSButton::Set_place_ycen(uint32_t number)
190 {
191 char buf[10] = {0};
192 String cmd;
193
194 utoa(number, buf, 10);
195 cmd += getObjName();
196 cmd += ".ycen=";
197 cmd += buf;
198 sendCommand(cmd.c_str());
199
200 cmd = "";
201 cmd += "ref ";
202 cmd += getObjName();
203 sendCommand(cmd.c_str());
204 return recvRetCommandFinished();
205 }
206
207 uint32_t NexDSButton::getFont(uint32_t *number)
208 {
209 String cmd;
210 cmd += "get ";
211 cmd += getObjName();
212 cmd += ".font";
213 sendCommand(cmd.c_str());
214 return recvRetNumber(number);
215 }
216
217 bool NexDSButton::setFont(uint32_t number)
218 {
219 char buf[10] = {0};
220 String cmd;
221
222 utoa(number, buf, 10);
223 cmd += getObjName();
224 cmd += ".font=";
225 cmd += buf;
226 sendCommand(cmd.c_str());
227
228 cmd = "";
229 cmd += "ref ";
230 cmd += getObjName();
231 sendCommand(cmd.c_str());
232 return recvRetCommandFinished();
233 }
234
235 uint32_t NexDSButton::Get_state0_crop_picc0(uint32_t *number)
236 {
237 String cmd;
238 cmd += "get ";
239 cmd += getObjName();
240 cmd += ".picc0";
241 sendCommand(cmd.c_str());
242 return recvRetNumber(number);
243 }
244
245 bool NexDSButton::Set_state0_crop_picc0(uint32_t number)
246 {
247 char buf[10] = {0};
248 String cmd;
249
250 utoa(number, buf, 10);
251 cmd += getObjName();
252 cmd += ".picc0=";
253 cmd += buf;
254 sendCommand(cmd.c_str());
255
256 cmd = "";
257 cmd += "ref ";
258 cmd += getObjName();
259 sendCommand(cmd.c_str());
260 return recvRetCommandFinished();
261 }
262
263 uint32_t NexDSButton::Get_state1_crop_picc1(uint32_t *number)
264 {
265 String cmd;
266 cmd += "get ";
267 cmd += getObjName();
268 cmd += ".picc1";
269 sendCommand(cmd.c_str());
270 return recvRetNumber(number);
271 }
272
273 bool NexDSButton::Set_state1_crop_picc1(uint32_t number)
274 {
275 char buf[10] = {0};
276 String cmd;
277
278 utoa(number, buf, 10);
279 cmd += getObjName();
280 cmd += ".picc1=";
281 cmd += buf;
282 sendCommand(cmd.c_str());
283
284 cmd = "";
285 cmd += "ref ";
286 cmd += getObjName();
287 sendCommand(cmd.c_str());
288 return recvRetCommandFinished();
289 }
290
291 uint32_t NexDSButton::Get_state0_image_pic0(uint32_t *number)
292 {
293 String cmd;
294 cmd += "get ";
295 cmd += getObjName();
296 cmd += ".pic0";
297 sendCommand(cmd.c_str());
298 return recvRetNumber(number);
299 }
300
301 bool NexDSButton::Set_state0_image_pic0(uint32_t number)
302 {
303 char buf[10] = {0};
304 String cmd;
305
306 utoa(number, buf, 10);
307 cmd += getObjName();
308 cmd += ".pic0=";
309 cmd += buf;
310 sendCommand(cmd.c_str());
311
312 cmd = "";
313 cmd += "ref ";
314 cmd += getObjName();
315 sendCommand(cmd.c_str());
316 return recvRetCommandFinished();
317 }
318
319 uint32_t NexDSButton::Get_state1_image_pic1(uint32_t *number)
320 {
321 String cmd;
322 cmd += "get ";
323 cmd += getObjName();
324 cmd += ".pic1";
325 sendCommand(cmd.c_str());
326 return recvRetNumber(number);
327 }
328
329 bool NexDSButton::Set_state1_image_pic1(uint32_t number)
330 {
331 char buf[10] = {0};
332 String cmd;
333
334 utoa(number, buf, 10);
335 cmd += getObjName();
336 cmd += ".pic1=";
337 cmd += buf;
338 sendCommand(cmd.c_str());
339
340 cmd = "";
341 cmd += "ref ";
342 cmd += getObjName();
343 sendCommand(cmd.c_str());
344 return recvRetCommandFinished();
345 }
346
347
NexDSButton::Set_state1_color_bco1
bool Set_state1_color_bco1(uint32_t number)
Set bco1 attribute of component.
Definition: NexDualStateButton.cpp:105
NexDSButton::Get_state1_color_bco1
uint32_t Get_state1_color_bco1(uint32_t *number)
Get bco1 attribute of component.
Definition: NexDualStateButton.cpp:95
NexDSButton::Set_place_ycen
bool Set_place_ycen(uint32_t number)
Set ycen attribute of component.
Definition: NexDualStateButton.cpp:189
NexDSButton::Set_state1_image_pic1
bool Set_state1_image_pic1(uint32_t number)
Set pic1 attribute of component.
Definition: NexDualStateButton.cpp:329
NexDSButton::getFont
uint32_t getFont(uint32_t *number)
Get font attribute of component.
Definition: NexDualStateButton.cpp:207
NexDSButton::Get_state1_image_pic1
uint32_t Get_state1_image_pic1(uint32_t *number)
Get pic1 attribute of component.
Definition: NexDualStateButton.cpp:319
NexDSButton::setFont
bool setFont(uint32_t number)
Set font attribute of component.
Definition: NexDualStateButton.cpp:217
NexDSButton::Set_place_xcen
bool Set_place_xcen(uint32_t number)
Set xcen attribute of component.
Definition: NexDualStateButton.cpp:161
NexDSButton::Get_state0_image_pic0
uint32_t Get_state0_image_pic0(uint32_t *number)
Get pic0 attribute of component.
Definition: NexDualStateButton.cpp:291
NexDSButton::Set_state0_crop_picc0
bool Set_state0_crop_picc0(uint32_t number)
Set picc0 attribute of component.
Definition: NexDualStateButton.cpp:245
NexDSButton::Get_state0_color_bco0
uint32_t Get_state0_color_bco0(uint32_t *number)
Get bco0 attribute of component.
Definition: NexDualStateButton.cpp:67
NexDSButton::Set_font_color_pco
bool Set_font_color_pco(uint32_t number)
Set pco attribute of component.
Definition: NexDualStateButton.cpp:133
NexDSButton::Get_font_color_pco
uint32_t Get_font_color_pco(uint32_t *number)
Get pco attribute of component.
Definition: NexDualStateButton.cpp:123
NexDSButton::getValue
bool getValue(uint32_t *number)
Get number attribute of component.
Definition: NexDualStateButton.cpp:23
NexDSButton::Get_place_ycen
uint32_t Get_place_ycen(uint32_t *number)
Get ycen attribute of component.
Definition: NexDualStateButton.cpp:179
NexDSButton::Set_state0_image_pic0
bool Set_state0_image_pic0(uint32_t number)
Set pic0 attribute of component.
Definition: NexDualStateButton.cpp:301
NexDSButton::NexDSButton
NexDSButton(uint8_t pid, uint8_t cid, const char *name)
Constructor.
Definition: NexDualStateButton.cpp:18
NexDSButton::Get_state0_crop_picc0
uint32_t Get_state0_crop_picc0(uint32_t *number)
Get picc0 attribute of component.
Definition: NexDualStateButton.cpp:235
NexDSButton::setValue
bool setValue(uint32_t number)
Set number attribute of component.
Definition: NexDualStateButton.cpp:32
NexDSButton::getText
uint16_t getText(char *buffer, uint16_t len)
Get text attribute of component.
Definition: NexDualStateButton.cpp:46
NexDualStateButton.h
The definition of class NexDSButton.
NexDSButton::Set_state1_crop_picc1
bool Set_state1_crop_picc1(uint32_t number)
Set picc1 attribute of component.
Definition: NexDualStateButton.cpp:273
NexDSButton::setText
bool setText(const char *buffer)
Set text attribute of component.
Definition: NexDualStateButton.cpp:56
NexTouch
Father class of the components with touch events.
Definition: NexTouch.h:53
NexDSButton::Get_state1_crop_picc1
uint32_t Get_state1_crop_picc1(uint32_t *number)
Get picc1 attribute of component.
Definition: NexDualStateButton.cpp:263
NexDSButton::Get_place_xcen
uint32_t Get_place_xcen(uint32_t *number)
Get xcen attribute of component.
Definition: NexDualStateButton.cpp:151
NexDSButton::Set_state0_color_bco0
bool Set_state0_color_bco0(uint32_t number)
Set bco0 attribute of component.
Definition: NexDualStateButton.cpp:77