API
For Arduino developers
Public Member Functions | Static Public Member Functions | List of all members
NexTouch Class Reference

Root Class of Nextion Components. More...

#include <NexTouch.h>

Inheritance diagram for NexTouch:
NexButton NexHotspot NexPage NexPicture NexPointer NexProgressBar NexSlice NexText

Public Member Functions

 NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
 Constructor of Nextouch. More...
 
NexPid getPid (void)
 Get page id. More...
 
NexCid getCid (void)
 Get component id. More...
 
const char * getObjName (void)
 Get component name. More...
 
void print (void)
 Print current object address,page id,component id, component name,pop event function address,push event function address.
 

Static Public Member Functions

static uint8_t mainEventLoop (NexTouch **list)
 Watting for Nextion's touch event. More...
 
static void sendCommand (const char *cmd)
 Send command to Nextion. More...
 
static bool recvRetCommandFinished (uint32_t timeout=100)
 Command is executed successfully. More...
 
static uint16_t recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
 Receive string data. More...
 
static bool recvRetNumber (uint32_t *number, uint32_t timeout=500)
 Receive uint32_t data. More...
 

Detailed Description

Root Class of Nextion Components.

Examples:
CompButton.ino, CompHotspot.ino, CompPage.ino, CompPicture.ino, CompPointer.ino, CompProgressBar.ino, CompSlice.ino, and CompText.ino.

Definition at line 57 of file NexTouch.h.

Constructor & Destructor Documentation

NexTouch::NexTouch ( NexPid  pid,
NexCid  cid,
char *  name,
NexTouchEventCb  pop = NULL,
void *  pop_ptr = NULL,
NexTouchEventCb  push = NULL,
void *  push_ptr = NULL 
)

Constructor of Nextouch.

Parameters
pid- page id.
cid- component id.
name- component name.
pop- pop event function pointer.
pop_ptr- the parameter was transmitted to pop event function pointer.
push- push event function pointer.
push_ptr- the parameter was transmitted to push event function pointer.

Definition at line 74 of file NexTouch.cpp.

Member Function Documentation

NexCid NexTouch::getCid ( void  )

Get component id.

Returns
the id of component.

Definition at line 102 of file NexTouch.cpp.

const char * NexTouch::getObjName ( void  )

Get component name.

Returns
the name of component.

Definition at line 112 of file NexTouch.cpp.

NexPid NexTouch::getPid ( void  )

Get page id.

Returns
the id of page.

Definition at line 92 of file NexTouch.cpp.

uint8_t NexTouch::mainEventLoop ( NexTouch **  list)
static

Watting for Nextion's touch event.

Parameters
list- index to Nextion Components list.

Definition at line 26 of file NexTouch.cpp.

bool NexTouch::recvRetCommandFinished ( uint32_t  timeout = 100)
static

Command is executed successfully.

Parameters
timeout- set timeout time.
Return values
true- success.
false- failed.

Definition at line 224 of file NexTouch.cpp.

bool NexTouch::recvRetNumber ( uint32_t *  number,
uint32_t  timeout = 500 
)
static

Receive uint32_t data.

Parameters
number- save uint32_t data.
timeout- set timeout time.
Return values
true- success.
false- failed.

Definition at line 356 of file NexTouch.cpp.

uint16_t NexTouch::recvRetString ( char *  buffer,
uint16_t  len,
uint32_t  timeout = 500 
)
static

Receive string data.

Parameters
buffer- save string data.
len- string buffer length.
timeout- set timeout time.
Returns
the length of string buffer.

Definition at line 284 of file NexTouch.cpp.

void NexTouch::sendCommand ( const char *  cmd)
static

Send command to Nextion.

Parameters
cmd- the string of command.

Definition at line 261 of file NexTouch.cpp.


The documentation for this class was generated from the following files: