mirror of
https://github.com/itead/ITEADLIB_Arduino_Nextion.git
synced 2026-03-03 00:34:01 +01:00
88 lines
1.6 KiB
C++
88 lines
1.6 KiB
C++
/**
|
|
* @file NexObject.cpp
|
|
*
|
|
* The root of all classes in Nextion library.
|
|
*
|
|
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
|
|
* @date 2015/8/13
|
|
* @copyright
|
|
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; either version 2 of
|
|
* the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#include "NexObject.h"
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param pid - page id.
|
|
* @param cid - component id.
|
|
* @param name - component name.
|
|
*/
|
|
NexObject::NexObject(NexPid pid, NexCid cid, const char *name)
|
|
{
|
|
this->pid = pid;
|
|
this->cid = cid;
|
|
this->name = name;
|
|
dbSerialPrintln("NexObject called");
|
|
}
|
|
|
|
/**
|
|
* Get page id.
|
|
*
|
|
* @return the id of page.
|
|
*/
|
|
NexPid NexObject::getObjPid(void)
|
|
{
|
|
return pid;
|
|
}
|
|
|
|
/**
|
|
* Get component id.
|
|
*
|
|
* @return the id of component.
|
|
*/
|
|
NexCid NexObject::getObjCid(void)
|
|
{
|
|
return cid;
|
|
}
|
|
|
|
/**
|
|
* Get component name.
|
|
*
|
|
* @return the name of component.
|
|
*/
|
|
const char* NexObject::getObjName(void)
|
|
{
|
|
return name;
|
|
}
|
|
|
|
/**
|
|
* Print current object address,page id,component id,
|
|
* component name,pop event function address,push event function address.
|
|
*
|
|
*/
|
|
void NexObject::printObjInfo(void)
|
|
{
|
|
dbSerialPrint("[");
|
|
dbSerialPrint((uint32_t)this);
|
|
dbSerialPrint(":");
|
|
dbSerialPrint(pid);
|
|
dbSerialPrint(",");
|
|
dbSerialPrint(cid);
|
|
dbSerialPrint(",");
|
|
if (name)
|
|
{
|
|
dbSerialPrint(name);
|
|
}
|
|
else
|
|
{
|
|
dbSerialPrint("(null)");
|
|
}
|
|
dbSerialPrintln("]");
|
|
}
|
|
|