mirror of
https://github.com/itead/ITEADLIB_Arduino_Nextion.git
synced 2026-03-03 08:44:00 +01:00
40 lines
760 B
C++
40 lines
760 B
C++
#include "NexButton.h"
|
|
|
|
NexButton::NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop, void *pop_ptr)
|
|
:NexTouch(pid, cid, name, pop, pop_ptr)
|
|
{
|
|
}
|
|
|
|
uint16_t NexButton::getText(char *buffer, uint16_t len)
|
|
{
|
|
String cmd;
|
|
cmd += "get ";
|
|
cmd += getObjName();
|
|
cmd += ".txt";
|
|
sendCommand(cmd.c_str());
|
|
return recvRetString(buffer,len);
|
|
}
|
|
|
|
bool NexButton::setText(const char *buffer)
|
|
{
|
|
String cmd;
|
|
cmd += getObjName();
|
|
cmd += ".txt=\"";
|
|
cmd += buffer;
|
|
cmd += "\"";
|
|
sendCommand(cmd.c_str());
|
|
return recvRetCommandFinished();
|
|
}
|
|
|
|
void NexButton::attachPop(NexTouchEventCb pop, void *ptr)
|
|
{
|
|
NexTouch::attachPop(pop, ptr);
|
|
}
|
|
|
|
void NexButton::detachPop(void)
|
|
{
|
|
NexTouch::detachPop();
|
|
}
|
|
|
|
|