Documentation: NexText.cpp Source File

| Documentation For Arduino users

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

- File List
- File Members

NexText.cpp
Go to the documentation of this file.
1
15 #include "NexText.h"
16
17 NexText::NexText(uint8_t pid, uint8_t cid, const char *name)
18 :NexTouch(pid, cid, name)
19 {
20 }
21
22 uint16_t NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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 NexText::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
230 sendCommand(cmd.c_str());
231 return recvRetCommandFinished();
232 }
233
234
235
236
NexText::Set_font_color_pco
bool Set_font_color_pco(uint32_t number)
Set pco attribute of component.
Definition: NexText.cpp:81
NexText::getFont
uint32_t getFont(uint32_t *number)
Get font attribute of component.
Definition: NexText.cpp:155
NexText::NexText
NexText(uint8_t pid, uint8_t cid, const char *name)
Constructor.
Definition: NexText.cpp:17
NexText::setText
bool setText(const char *buffer)
Set text attribute of component.
Definition: NexText.cpp:32
NexText::Get_background_image_pic
uint32_t Get_background_image_pic(uint32_t *number)
Get pic attribute of component.
Definition: NexText.cpp:211
NexText.h
The definition of class NexText.
NexText::Get_place_xcen
uint32_t Get_place_xcen(uint32_t *number)
Get xcen attribute of component.
Definition: NexText.cpp:99
NexText::Get_background_crop_picc
uint32_t Get_background_crop_picc(uint32_t *number)
Get picc attribute of component.
Definition: NexText.cpp:183
NexText::Get_background_color_bco
uint32_t Get_background_color_bco(uint32_t *number)
Get bco attribute of component.
Definition: NexText.cpp:43
NexText::Set_place_ycen
bool Set_place_ycen(uint32_t number)
Set ycen attribute of component.
Definition: NexText.cpp:137
NexText::getText
uint16_t getText(char *buffer, uint16_t len)
Get text attribute of component.
Definition: NexText.cpp:22
NexText::Set_background_crop_picc
bool Set_background_crop_picc(uint32_t number)
Set picc attribute of component.
Definition: NexText.cpp:193
NexText::Get_place_ycen
uint32_t Get_place_ycen(uint32_t *number)
Get ycen attribute of component.
Definition: NexText.cpp:127
NexText::Set_background_color_bco
bool Set_background_color_bco(uint32_t number)
Set bco attribute of component.
Definition: NexText.cpp:53
NexText::Get_font_color_pco
uint32_t Get_font_color_pco(uint32_t *number)
Get pco attribute of component.
Definition: NexText.cpp:71
NexText::Set_place_xcen
bool Set_place_xcen(uint32_t number)
Set xcen attribute of component.
Definition: NexText.cpp:109
NexText::Set_background_image_pic
bool Set_background_image_pic(uint32_t number)
Set pic attribute of component.
Definition: NexText.cpp:220
NexTouch
Father class of the components with touch events.
Definition: NexTouch.h:53
NexText::setFont
bool setFont(uint32_t number)
Set font attribute of component.
Definition: NexText.cpp:165