| Documentation For Arduino users

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

- File List
- File Members

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