# Documentation: NexProgressBar.cpp Source File

NexProgressBar.cpp
Go to the documentation of this file.
#include "NexProgressBar.h"
NexProgressBar::NexProgressBar(uint8_t pid, uint8_t cid, const char *name)
:NexObject(pid, cid, name)
{
}
bool NexProgressBar::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexProgressBar::setValue(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".val=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexProgressBar::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexProgressBar::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 NexProgressBar::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexProgressBar::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();
}
NexProgressBar::Set_background_color_bco
bool Set_background_color_bco(uint32_t number)
Set bco attribute of component.
Definition: NexProgressBar.cpp:56
NexProgressBar::setValue
bool setValue(uint32_t number)
Set the value of progress bar.
Definition: NexProgressBar.cpp:32
NexProgressBar::getValue
bool getValue(uint32_t *number)
Get the value of progress bar.
Definition: NexProgressBar.cpp:23
NexObject
Root class of all Nextion components.
Definition: NexObject.h:32
NexProgressBar::Set_font_color_pco
bool Set_font_color_pco(uint32_t number)
Set pco attribute of component.
Definition: NexProgressBar.cpp:84
NexProgressBar::Get_background_color_bco
uint32_t Get_background_color_bco(uint32_t *number)
Get bco attribute of component.
Definition: NexProgressBar.cpp:46
NexProgressBar.h
The definition of class NexProgressBar.
NexProgressBar::NexProgressBar
NexProgressBar(uint8_t pid, uint8_t cid, const char *name)
Constructor.
Definition: NexProgressBar.cpp:18
NexProgressBar::Get_font_color_pco
uint32_t Get_font_color_pco(uint32_t *number)
Get pco attribute of component.
Definition: NexProgressBar.cpp:74