mirror of
https://github.com/itead/ITEADLIB_Arduino_Nextion.git
synced 2026-03-07 02:26:49 +01:00
Modified: class tree structure.
Signed-off-by: shennongmin <wupangfee@gmail.com>
This commit is contained in:
82
NexTouch.cpp
82
NexTouch.cpp
@@ -19,85 +19,19 @@
|
||||
/**
|
||||
* Constructor of Nextouch.
|
||||
*
|
||||
* @param pid - page id.
|
||||
* @param cid - component id.
|
||||
* @param name - component name.
|
||||
* @param pop - pop event function pointer.
|
||||
* @param pop_ptr - the parameter was transmitted to pop event function pointer.
|
||||
* @param push - push event function pointer.
|
||||
* @param push_ptr - the parameter was transmitted to push event function pointer.
|
||||
*
|
||||
*/
|
||||
NexTouch::NexTouch(NexPid pid, NexCid cid, const char *name,
|
||||
NexTouchEventCb pop, void *pop_ptr,
|
||||
NexTouchEventCb push, void *push_ptr)
|
||||
NexTouch::NexTouch(NexPid pid, NexCid cid, const char *name)
|
||||
:NexObject(pid, cid, name)
|
||||
{
|
||||
this->pid = pid;
|
||||
this->cid = cid;
|
||||
this->name = name;
|
||||
this->cbPush = push;
|
||||
this->cbPop = pop;
|
||||
this->__cbpop_ptr = pop_ptr;
|
||||
this->__cbpush_ptr = push_ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get page id.
|
||||
*
|
||||
* @return the id of page.
|
||||
*/
|
||||
NexPid NexTouch::getPid(void)
|
||||
{
|
||||
return pid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get component id.
|
||||
*
|
||||
* @return the id of component.
|
||||
*/
|
||||
NexCid NexTouch::getCid(void)
|
||||
{
|
||||
return cid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get component name.
|
||||
*
|
||||
* @return the name of component.
|
||||
*/
|
||||
const char* NexTouch::getObjName(void)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print current object address,page id,component id,
|
||||
* component name,pop event function address,push event function address.
|
||||
*
|
||||
*/
|
||||
void NexTouch::print(void)
|
||||
{
|
||||
dbSerialPrint("[");
|
||||
dbSerialPrint((uint32_t)this);
|
||||
dbSerialPrint(":");
|
||||
dbSerialPrint(pid);
|
||||
dbSerialPrint(",");
|
||||
dbSerialPrint(cid);
|
||||
dbSerialPrint(",");
|
||||
if (name)
|
||||
{
|
||||
dbSerialPrint(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
dbSerialPrint("(null)");
|
||||
}
|
||||
dbSerialPrint(",");
|
||||
dbSerialPrint((uint32_t)cbPush);
|
||||
dbSerialPrint(",");
|
||||
dbSerialPrint((uint32_t)cbPop);
|
||||
dbSerialPrintln("]");
|
||||
this->cbPush = NULL;
|
||||
this->cbPop = NULL;
|
||||
this->__cbpop_ptr = NULL;
|
||||
this->__cbpush_ptr = NULL;
|
||||
}
|
||||
|
||||
void NexTouch::attachPush(NexTouchEventCb push, void *ptr)
|
||||
@@ -152,9 +86,9 @@ void NexTouch::iterate(NexTouch **list, NexPid pid, NexCid cid, NexEventType eve
|
||||
|
||||
for(i = 0; (e = list[i]) != NULL; i++)
|
||||
{
|
||||
if (e->getPid() == pid && e->getCid() == cid)
|
||||
if (e->getObjPid() == pid && e->getObjCid() == cid)
|
||||
{
|
||||
e->print();
|
||||
e->printObjInfo();
|
||||
if (NEX_EVENT_PUSH == event)
|
||||
{
|
||||
e->push();
|
||||
|
||||
Reference in New Issue
Block a user