API
For Arduino developers
NexPage.cpp
Go to the documentation of this file.
1 
16 #include "NexPage.h"
17 
22 NexPage::NexPage(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop, void *pop_ptr)
23  :NexTouch(pid, cid, name, pop, pop_ptr)
24 {
25 }
26 
33 bool NexPage::show(void)
34 {
35  uint8_t buffer[4] = {0};
36 
37  const char *name = getObjName();
38  if (!name)
39  {
40  return false;
41  }
42 
43  String cmd = String("page ");
44  cmd += name;
45  sendCommand(cmd.c_str());
46  return recvRetCommandFinished();
47 }
48 
55 void NexPage::attachPop(NexTouchEventCb pop, void *ptr)
56 {
57  NexTouch::attachPop(pop, ptr);
58 }
59 
65 {
66  NexTouch::detachPop();
67 }
void detachPop(void)
Unload page pop callback function.
Definition: NexPage.cpp:64
bool show(void)
Change page.
Definition: NexPage.cpp:33
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
API of NexPage.
NexPage(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexPage.cpp:22
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register page pop callback function.
Definition: NexPage.cpp:55
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
Root Class of Nextion Components.
Definition: NexTouch.h:57