API
For Arduino developers
NexPointer.cpp
1 #include "NexPointer.h"
2 
7 NexPointer::NexPointer(NexPid pid, NexCid cid, char *name)
8  :NexTouch(pid, cid, name)
9 {
10 }
11 
20 bool NexPointer::getValue(uint32_t *number)
21 {
22  String cmd = String("get ");
23  cmd += getObjName();
24  cmd += ".val";
25  sendCommand(cmd.c_str());
26  return recvRetNumber(number);
27 }
28 
37 bool NexPointer::setValue(uint32_t number)
38 {
39  char buf[10] = {0};
40  String cmd;
41 
42  utoa(number, buf, 10);
43  cmd += getObjName();
44  cmd += ".val=";
45  cmd += buf;
46 
47  sendCommand(cmd.c_str());
48  return recvRetCommandFinished();
49 }
50 
bool getValue(uint32_t *number)
Get the value of pointer.
Definition: NexPointer.cpp:20
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
static bool recvRetNumber(uint32_t *number, uint32_t timeout=500)
Receive uint32_t data.
Definition: NexTouch.cpp:351
NexPointer(NexPid pid, NexCid cid, char *name)
Constructor,inherited NexTouch's constructor function.
Definition: NexPointer.cpp:7
bool setValue(uint32_t number)
Set the value of pointer.
Definition: NexPointer.cpp:37
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
Root Class of Nextion Components.
Definition: NexTouch.h:57