| Documentation For Arduino users

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

- File List
- File Members

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