Skip to content

Commit

Permalink
add api for button
Browse files Browse the repository at this point in the history
  • Loading branch information
hxming123456 committed Sep 26, 2016
1 parent 5d505d5 commit d6c42db
Showing 1 changed file with 308 additions and 0 deletions.
308 changes: 308 additions & 0 deletions NexButton.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,311 @@ bool NexButton::setText(const char *buffer)
return recvRetCommandFinished();
}


uint32_t NexButton::getBco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setBco(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 NexButton::getBco2(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco2";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setBco2(uint32_t number)
{
char buf[10] = {0};
String cmd;

utoa(number, buf, 10);
cmd += getObjName();
cmd += ".bco2=";
cmd += buf;
sendCommand(cmd.c_str());

cmd="";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

uint32_t NexButton::getPco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setPco(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 NexButton::getPco2(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco2";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setPco2(uint32_t number)
{
char buf[10] = {0};
String cmd;

utoa(number, buf, 10);
cmd += getObjName();
cmd += ".pco2=";
cmd += buf;
sendCommand(cmd.c_str());

cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

uint32_t NexButton::getXcen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".xcen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setXcen(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 NexButton::getYcen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".ycen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setYcen(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 NexButton::getFont(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".font";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::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 NexButton::getPicc(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".picc";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setPicc(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 NexButton::getPicc2(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".picc2";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setPicc2(uint32_t number)
{
char buf[10] = {0};
String cmd;

utoa(number, buf, 10);
cmd += getObjName();
cmd += ".picc2=";
cmd += buf;
sendCommand(cmd.c_str());

cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

uint32_t NexButton::getPic(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pic";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setPic(uint32_t number)
{
char buf[10] = {0};
String cmd;

utoa(number, buf, 10);
cmd += getObjName();
cmd += ".pic=";
cmd += buf;
sendCommand(cmd.c_str());

cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

uint32_t NexButton::getPic2(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pic2";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}

bool NexButton::setPic2(uint32_t number)
{
char buf[10] = {0};
String cmd;

utoa(number, buf, 10);
cmd += getObjName();
cmd += ".pic2=";
cmd += buf;
sendCommand(cmd.c_str());

cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

0 comments on commit d6c42db

Please sign in to comment.