Documentation
For Arduino users
NexVariable.cpp
Go to the documentation of this file.
1 
15 #include "NexVariable.h"
16 
17 NexVariable::NexVariable(uint8_t pid, uint8_t cid, const char *name)
18  :NexTouch(pid, cid, name)
19 {
20 }
21 
22 uint32_t NexVariable::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 NexVariable::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 NexVariable::getText(char *buffer, uint32_t len)
46 {
47  String cmd;
48  cmd += "get ";
49  cmd += getObjName();
50  cmd += ".txt";
51  sendCommand(cmd.c_str());
52  return recvRetString(buffer,len);
53 }
54 
55 bool NexVariable::setText(const char *buffer)
56 {
57  String cmd;
58  cmd += getObjName();
59  cmd += ".txt=\"";
60  cmd += buffer;
61  cmd += "\"";
62  sendCommand(cmd.c_str());
63  return recvRetCommandFinished();
64 }
bool setValue(uint32_t number)
Set val attribute of component.
Definition: NexVariable.cpp:31
bool setText(const char *buffer)
Set text attribute of component.
Definition: NexVariable.cpp:55
uint32_t getText(char *buffer, uint32_t len)
Get text attribute of component.
Definition: NexVariable.cpp:45
uint32_t getValue(uint32_t *number)
Get val attribute of component.
Definition: NexVariable.cpp:22
NexVariable(uint8_t pid, uint8_t cid, const char *name)
Constructor.
Definition: NexVariable.cpp:17
Father class of the components with touch events.
Definition: NexTouch.h:53