NexText.cpp
Go to the documentation of this file.
#include "NexText.h"
NexText::NexText(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
uint16_t NexText::getText(char *buffer, uint16_t len)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".txt";
sendCommand(cmd.c_str());
return recvRetString(buffer,len);
}
bool NexText::setText(const char *buffer)
{
String cmd;
cmd += getObjName();
cmd += ".txt=\"";
cmd += buffer;
cmd += "\"";
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexText::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexText::Set_background_color_bco(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".bco=";
cmd += buf;
sendCommand(cmd.c_str());
cmd="";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexText::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexText::Set_font_color_pco(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".pco=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexText::Get_place_xcen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".xcen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexText::Set_place_xcen(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".xcen=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexText::Get_place_ycen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".ycen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexText::Set_place_ycen(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".ycen=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexText::getFont(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".font";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexText::setFont(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".font=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexText::Get_background_crop_picc(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".picc";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexText::Set_background_crop_picc(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".picc=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexText::Get_background_image_pic(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".pic";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexText::Set_background_image_pic(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".pic=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
NexText::Set_font_color_pco
bool Set_font_color_pco(uint32_t number)
Set pco attribute of component.
Definition: NexText.cpp:81
NexText::getFont
uint32_t getFont(uint32_t *number)
Get font attribute of component.
Definition: NexText.cpp:155
NexText::NexText
NexText(uint8_t pid, uint8_t cid, const char *name)
Constructor.
Definition: NexText.cpp:17
NexText::setText
bool setText(const char *buffer)
Set text attribute of component.
Definition: NexText.cpp:32
NexText::Get_background_image_pic
uint32_t Get_background_image_pic(uint32_t *number)
Get pic attribute of component.
Definition: NexText.cpp:211
NexText.h
The definition of class NexText.
NexText::Get_place_xcen
uint32_t Get_place_xcen(uint32_t *number)
Get xcen attribute of component.
Definition: NexText.cpp:99
NexText::Get_background_crop_picc
uint32_t Get_background_crop_picc(uint32_t *number)
Get picc attribute of component.
Definition: NexText.cpp:183
NexText::Get_background_color_bco
uint32_t Get_background_color_bco(uint32_t *number)
Get bco attribute of component.
Definition: NexText.cpp:43
NexText::Set_place_ycen
bool Set_place_ycen(uint32_t number)
Set ycen attribute of component.
Definition: NexText.cpp:137
NexText::getText
uint16_t getText(char *buffer, uint16_t len)
Get text attribute of component.
Definition: NexText.cpp:22
NexText::Set_background_crop_picc
bool Set_background_crop_picc(uint32_t number)
Set picc attribute of component.
Definition: NexText.cpp:193
NexText::Get_place_ycen
uint32_t Get_place_ycen(uint32_t *number)
Get ycen attribute of component.
Definition: NexText.cpp:127
NexText::Set_background_color_bco
bool Set_background_color_bco(uint32_t number)
Set bco attribute of component.
Definition: NexText.cpp:53
NexText::Get_font_color_pco
uint32_t Get_font_color_pco(uint32_t *number)
Get pco attribute of component.
Definition: NexText.cpp:71
NexText::Set_place_xcen
bool Set_place_xcen(uint32_t number)
Set xcen attribute of component.
Definition: NexText.cpp:109
NexText::Set_background_image_pic
bool Set_background_image_pic(uint32_t number)
Set pic attribute of component.
Definition: NexText.cpp:220
NexTouch
Father class of the components with touch events.
Definition: NexTouch.h:53
NexText::setFont
bool setFont(uint32_t number)
Set font attribute of component.
Definition: NexText.cpp:165