Add functions for new items based on the IDE.

This commit is contained in:
huangxiaoming
2016-09-27 16:04:39 +08:00
parent d6c42dbf62
commit f104dd861b
31 changed files with 3345 additions and 33 deletions

View File

@@ -42,7 +42,7 @@ bool NexButton::setText(const char *buffer)
}
uint32_t NexButton::getBco(uint32_t *number)
uint32_t NexButton::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -52,7 +52,7 @@ uint32_t NexButton::getBco(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setBco(uint32_t number)
bool NexButton::Set_background_color_bco(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -70,7 +70,7 @@ bool NexButton::setBco(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexButton::getBco2(uint32_t *number)
uint32_t NexButton::Get_press_background_color_bco2(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -80,7 +80,7 @@ uint32_t NexButton::getBco2(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setBco2(uint32_t number)
bool NexButton::Set_press_background_color_bco2(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -98,7 +98,7 @@ bool NexButton::setBco2(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexButton::getPco(uint32_t *number)
uint32_t NexButton::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -108,7 +108,7 @@ uint32_t NexButton::getPco(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setPco(uint32_t number)
bool NexButton::Set_font_color_pco(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -126,7 +126,7 @@ bool NexButton::setPco(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexButton::getPco2(uint32_t *number)
uint32_t NexButton::Get_press_font_color_pco2(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -136,7 +136,7 @@ uint32_t NexButton::getPco2(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setPco2(uint32_t number)
bool NexButton::Set_press_font_color_pco2(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -154,7 +154,7 @@ bool NexButton::setPco2(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexButton::getXcen(uint32_t *number)
uint32_t NexButton::Get_place_xcen(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -164,7 +164,7 @@ uint32_t NexButton::getXcen(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setXcen(uint32_t number)
bool NexButton::Set_place_xcen(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -182,7 +182,7 @@ bool NexButton::setXcen(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexButton::getYcen(uint32_t *number)
uint32_t NexButton::Get_place_ycen(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -192,7 +192,7 @@ uint32_t NexButton::getYcen(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setYcen(uint32_t number)
bool NexButton::Set_place_ycen(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -238,7 +238,7 @@ bool NexButton::setFont(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexButton::getPicc(uint32_t *number)
uint32_t NexButton::Get_background_cropi_picc(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -248,7 +248,7 @@ uint32_t NexButton::getPicc(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setPicc(uint32_t number)
bool NexButton::Set_background_crop_picc(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -266,7 +266,7 @@ bool NexButton::setPicc(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexButton::getPicc2(uint32_t *number)
uint32_t NexButton::Get_press_background_crop_picc2(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -276,7 +276,7 @@ uint32_t NexButton::getPicc2(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setPicc2(uint32_t number)
bool NexButton::Set_press_background_crop_picc2(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -294,7 +294,7 @@ bool NexButton::setPicc2(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexButton::getPic(uint32_t *number)
uint32_t NexButton::Get_background_image_pic(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -304,7 +304,7 @@ uint32_t NexButton::getPic(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setPic(uint32_t number)
bool NexButton::Set_background_image_pic(uint32_t number)
{
char buf[10] = {0};
String cmd;
@@ -322,7 +322,7 @@ bool NexButton::setPic(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexButton::getPic2(uint32_t *number)
uint32_t NexButton::Get_press_background_image_pic2(uint32_t *number)
{
String cmd;
cmd += "get ";
@@ -332,7 +332,7 @@ uint32_t NexButton::getPic2(uint32_t *number)
return recvRetNumber(number);
}
bool NexButton::setPic2(uint32_t number)
bool NexButton::Set_press_background_image_pic2(uint32_t number)
{
char buf[10] = {0};
String cmd;

199
NexButton.h Normal file → Executable file
View File

@@ -56,7 +56,204 @@ public: /* methods */
* @param buffer - text buffer terminated with '\0'.
* @return true if success, false for failure.
*/
bool setText(const char *buffer);
bool setText(const char *buffer);
/*
* Get bco attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get bco2 attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_press_background_color_bco2(uint32_t *number);
/*
* Set bco2 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_press_background_color_bco2(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
/*
* Get pco2 attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_press_font_color_pco2(uint32_t *number);
/*
* Set pco2 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_press_font_color_pco2(uint32_t number);
/*
* Get xcen attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_place_xcen(uint32_t *number);
/*
* Set xcen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_xcen(uint32_t number);
/*
* Get ycen attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_place_ycen(uint32_t *number);
/*
* Set ycen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_ycen(uint32_t number);
/*
* Get font attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t getFont(uint32_t *number);
/*
* Set font attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setFont(uint32_t number);
/*
* Get picc attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_background_cropi_picc(uint32_t *number);
/*
* Set picc attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_crop_picc(uint32_t number);
/*
* Get picc2 attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_press_background_crop_picc2(uint32_t *number);
/*
* Set picc2 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_press_background_crop_picc2(uint32_t number);
/*
* Get pic attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_background_image_pic(uint32_t *number);
/*
* Set pic attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_image_pic(uint32_t number);
/*
* Get pic2 attribute of component
*
* @param number - buffer storing data return
* @return the length of the data
*/
uint32_t Get_press_background_image_pic2(uint32_t *number);
/*
* Set pic2 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_press_background_image_pic2(uint32_t number);
};
/**
* @}

99
NexCheckbox.cpp Executable file
View File

@@ -0,0 +1,99 @@
/**
* @file NexCheckbox.cpp
*
* The implementation of class NexCheckbox.
*
* @author huang xiaoming (email:<xiaoming.huang@itead.cc>)
* @date 2016/9/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 "NexCheckbox.h"
NexCheckbox::NexCheckbox(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
uint32_t NexCheckbox::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexCheckbox::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 NexCheckbox::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexCheckbox::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 NexCheckbox::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexCheckbox::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();
}

104
NexCheckbox.h Executable file
View File

@@ -0,0 +1,104 @@
/**
* @file NexCheckbox.h
*
* The definition of class NexCheckbox.
*
* @author huang xiaoming (email:<xiaoming.huang@itead.cc>)
* @date 2016/9/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.
*/
#ifndef __NEXCHECKBOX_H__
#define __NEXCHECKBOX_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexButton component.
*
* Commonly, you want to do something after push and pop it. It is recommanded that only
* call @ref NexTouch::attachPop to satisfy your purpose.
*
* @warning Please do not call @ref NexTouch::attachPush on this component, even though you can.
*/
class NexCheckbox: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexCheckbox(uint8_t pid, uint8_t cid, const char *name);
/*
* Get val attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getValue(uint32_t *number);
/*
* Set val attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setValue(uint32_t number);
/*
* Get bco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXCHECKBOX_H__ */

4
NexCrop.cpp Normal file → Executable file
View File

@@ -20,7 +20,7 @@ NexCrop::NexCrop(uint8_t pid, uint8_t cid, const char *name)
{
}
bool NexCrop::getPic(uint32_t *number)
bool NexCrop::Get_background_crop_picc(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
@@ -29,7 +29,7 @@ bool NexCrop::getPic(uint32_t *number)
return recvRetNumber(number);
}
bool NexCrop::setPic(uint32_t number)
bool NexCrop::Set_background_crop_picc(uint32_t number)
{
char buf[10] = {0};
String cmd;

4
NexCrop.h Normal file → Executable file
View File

@@ -44,7 +44,7 @@ public: /* methods */
* @retval true - success.
* @retval false - failed.
*/
bool getPic(uint32_t *number);
bool Get_background_crop_picc(uint32_t *number);
/**
* Set the number of picture.
@@ -54,7 +54,7 @@ public: /* methods */
* @retval true - success.
* @retval false - failed.
*/
bool setPic(uint32_t number);
bool Set_background_crop_picc(uint32_t number);
};
/**

301
NexDualStateButton.cpp Normal file → Executable file
View File

@@ -43,4 +43,305 @@ bool NexDSButton::setValue(uint32_t number)
return recvRetCommandFinished();
}
uint16_t NexDSButton::getText(char *buffer, uint16_t len)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".txt";
sendCommand(cmd.c_str());
return recvRetString(buffer,len);
}
bool NexDSButton::setText(const char *buffer)
{
String cmd;
cmd += getObjName();
cmd += ".txt=\"";
cmd += buffer;
cmd += "\"";
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexDSButton::Get_state0_color_bco0(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco0";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::Set_state0_color_bco0(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".bco0=";
cmd += buf;
sendCommand(cmd.c_str());
cmd="";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexDSButton::Get_state1_color_bco1(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco1";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::Set_state1_color_bco1(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".bco1=";
cmd += buf;
sendCommand(cmd.c_str());
cmd="";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexDSButton::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::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 NexDSButton::Get_place_xcen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".xcen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::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 NexDSButton::Get_place_ycen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".ycen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::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 NexDSButton::getFont(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".font";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::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 NexDSButton::Get_state0_crop_picc0(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".picc0";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::Set_state0_crop_picc0(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".picc0=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexDSButton::Get_state1_crop_picc1(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".picc1";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::Set_state1_crop_picc1(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".picc1=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexDSButton::Get_state0_image_pic0(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pic0";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::Set_state0_image_pic0(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".pic0=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexDSButton::Get_state1_image_pic1(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pic1";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::Set_state1_image_pic1(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".pic1=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

199
NexDualStateButton.h Normal file → Executable file
View File

@@ -57,6 +57,205 @@ public: /* methods */
* @return true if success, false for failure.
*/
bool setValue(uint32_t number);
/**
* Get text attribute of component.
*
* @param buffer - buffer storing text returned.
* @param len - length of buffer.
* @return The real length of text returned.
*/
uint16_t getText(char *buffer, uint16_t len);
/**
* Set text attribute of component.
*
* @param buffer - text buffer terminated with '\0'.
* @return true if success, false for failure.
*/
bool setText(const char *buffer);
/*
* Get bco0 attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_state0_color_bco0(uint32_t *number);
/*
* Set bco0 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_state0_color_bco0(uint32_t number);
/*
* Get bco1 attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_state1_color_bco1(uint32_t *number);
/*
* Set bco1 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_state1_color_bco1(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
/*
* Get xcen attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_place_xcen(uint32_t *number);
/*
* Set xcen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_xcen(uint32_t number);
/*
* Get ycen attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_place_ycen(uint32_t *number);
/*
* Set ycen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_ycen(uint32_t number);
/*
* Get font attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getFont(uint32_t *number);
/*
* Set font attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setFont(uint32_t number);
/*
* Get picc0 attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_state0_crop_picc0(uint32_t *number);
/*
* Set picc0 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_state0_crop_picc0(uint32_t number);
/*
* Get picc1 attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_state1_crop_picc1(uint32_t *number);
/*
* Set picc1 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_state1_crop_picc1(uint32_t number);
/*
* Get pic0 attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_state0_image_pic0(uint32_t *number);
/*
* Set pic0 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_state0_image_pic0(uint32_t number);
/*
* Get pic1 attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_state1_image_pic1(uint32_t *number);
/*
* Set pic1 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_state1_image_pic1(uint32_t number);
};
/**
* @}

113
NexGauge.cpp Normal file → Executable file
View File

@@ -42,4 +42,117 @@ bool NexGauge::setValue(uint32_t number)
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexGauge::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexGauge::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 NexGauge::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexGauge::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 NexGauge::Get_pointer_thickness_wid(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".wid";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexGauge::Set_pointer_thickness_wid(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".wid=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexGauge::Get_background_cropi_picc(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".picc";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexGauge::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();
}

72
NexGauge.h Normal file → Executable file
View File

@@ -54,6 +54,78 @@ public: /* methods */
* @retval false - failed.
*/
bool setValue(uint32_t number);
/*
* Get bco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
/*
* Get wid attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_pointer_thickness_wid(uint32_t *number);
/*
* Set wid attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_pointer_thickness_wid(uint32_t number);
/*
* Get picc attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_cropi_picc(uint32_t *number);
/*
* Set picc attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_crop_picc(uint32_t number);
};
/**

218
NexNumber.cpp Normal file → Executable file
View File

@@ -42,3 +42,221 @@ bool NexNumber::setValue(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexNumber::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexNumber::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 NexNumber::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexNumber::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 NexNumber::Get_place_xcen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".xcen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexNumber::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 NexNumber::Get_place_ycen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".ycen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexNumber::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 NexNumber::getFont(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".font";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexNumber::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 NexNumber::Get_number_lenth(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".lenth";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexNumber::Set_number_lenth(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".lenth=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexNumber::Get_background_crop_picc(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".picc";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexNumber::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 NexNumber::Get_background_image_pic(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".pic";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexNumber::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();
}

144
NexNumber.h Normal file → Executable file
View File

@@ -51,6 +51,150 @@ public: /* methods */
* @return true if success, false for failure.
*/
bool setValue(uint32_t number);
/*
* Get bco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
/*
* Get xcen attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_place_xcen(uint32_t *number);
/*
* Set xcen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_xcen(uint32_t number);
/*
* Get ycen attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_place_ycen(uint32_t *number);
/*
* Set ycen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_ycen(uint32_t number);
/*
* Get font attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getFont(uint32_t *number);
/*
* Set font attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setFont(uint32_t number);
/*
* Get lenth attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_number_lenth(uint32_t *number);
/*
* Set lenth attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_number_lenth(uint32_t number);
/*
* Get picc attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_crop_picc(uint32_t *number);
/*
* Set picc attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_crop_picc(uint32_t number);
/*
* Get pic attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_image_pic(uint32_t *number);
/*
* Set pic attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_image_pic(uint32_t number);
};
/**

4
NexPicture.cpp Normal file → Executable file
View File

@@ -20,7 +20,7 @@ NexPicture::NexPicture(uint8_t pid, uint8_t cid, const char *name)
{
}
bool NexPicture::getPic(uint32_t *number)
bool NexPicture::Get_background_image_pic(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
@@ -29,7 +29,7 @@ bool NexPicture::getPic(uint32_t *number)
return recvRetNumber(number);
}
bool NexPicture::setPic(uint32_t number)
bool NexPicture::Set_background_image_pic(uint32_t number)
{
char buf[10] = {0};
String cmd;

4
NexPicture.h Normal file → Executable file
View File

@@ -43,7 +43,7 @@ public: /* methods */
* @retval true - success.
* @retval false - failed.
*/
bool getPic(uint32_t *number);
bool Get_background_image_pic(uint32_t *number);
/**
* Set picture's number.
@@ -53,7 +53,7 @@ public: /* methods */
* @retval true - success.
* @retval false - failed.
*/
bool setPic(uint32_t number);
bool Set_background_image_pic(uint32_t number);
};
/**

55
NexProgressBar.cpp Normal file → Executable file
View File

@@ -43,3 +43,58 @@ bool NexProgressBar::setValue(uint32_t number)
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();
}

36
NexProgressBar.h Normal file → Executable file
View File

@@ -54,6 +54,42 @@ public: /* methods */
* @retval false - failed.
*/
bool setValue(uint32_t number);
/*
* Get bco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
};
/**

99
NexRadio.cpp Executable file
View File

@@ -0,0 +1,99 @@
/**
* @file NexRadio.cpp
*
* The implementation of class NexRadio.
*
* @author huang xiaoming (email:<xiaoming.huang@itead.cc>)
* @date 2016/9/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 "NexRadio.h"
NexRadio::NexRadio(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
uint32_t NexRadio::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexRadio::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 NexRadio::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexRadio::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 NexRadio::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexRadio::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();
}

104
NexRadio.h Executable file
View File

@@ -0,0 +1,104 @@
/**
* @file NexRadio.h
*
* The definition of class NexRadio.
*
* @author huang xiaoming (email:<xiaoming.huang@itead.cc>)
* @date 2016/9/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.
*/
#ifndef __NEXRADIO_H__
#define __NEXRADIO_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexRadio component.
*
* Commonly, you want to do something after push and pop it. It is recommanded that only
* call @ref NexTouch::attachPop to satisfy your purpose.
*
* @warning Please do not call @ref NexTouch::attachPush on this component, even though you can.
*/
class NexRadio:public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexRadio(uint8_t pid, uint8_t cid, const char *name);
/*
* Get val attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getValue(uint32_t *number);
/*
* Set val attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setValue(uint32_t number);
/*
* Get bco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXRADION_H__ */

351
NexScrolltext.cpp Executable file
View File

@@ -0,0 +1,351 @@
/**
* @file NexScrolltext.cpp
*
* The implementation of class NexScrolltext.
*
* @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 "NexScrolltext.h"
NexScrolltext::NexScrolltext(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
uint16_t NexScrolltext::getText(char *buffer, uint16_t len)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".txt";
sendCommand(cmd.c_str());
return recvRetString(buffer,len);
}
bool NexScrolltext::setText(const char *buffer)
{
String cmd;
cmd += getObjName();
cmd += ".txt=\"";
cmd += buffer;
cmd += "\"";
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexScrolltext::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::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 NexScrolltext::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::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 NexScrolltext::Get_place_xcen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".xcen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::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 NexScrolltext::Get_place_ycen(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".ycen";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::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 NexScrolltext::getFont(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".font";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::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 NexScrolltext::Get_background_crop_picc(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".picc";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::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 NexScrolltext::Get_background_image_pic(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".pic";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::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());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexScrolltext::Get_scroll_dir(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".dir";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::Set_scroll_dir(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".dir=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexScrolltext::Get_scroll_distance(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".dis";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::Set_scroll_distance(uint32_t number)
{
char buf[10] = {0};
String cmd;
if (number < 2)
{
number = 2;
}
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".dis=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexScrolltext::Get_cycle_tim(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".tim";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexScrolltext::Set_cycle_tim(uint32_t number)
{
char buf[10] = {0};
String cmd;
if (number < 8)
{
number = 8;
}
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".tim=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexScrolltext::enable(void)
{
char buf[10] = {0};
String cmd;
utoa(1, buf, 10);
cmd += getObjName();
cmd += ".en=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexScrolltext::disable(void)
{
char buf[10] = {0};
String cmd;
utoa(0, buf, 10);
cmd += getObjName();
cmd += ".en=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

244
NexScrolltext.h Executable file
View File

@@ -0,0 +1,244 @@
/**
* @file NexScrolltext.h
*
* The definition of class NexScrolltext.
*
* @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.
*/
#ifndef __NEXSCROLLTEXT_H__
#define __NEXSCROLLTEXT_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexText component.
*/
class NexScrolltext: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexScrolltext(uint8_t pid, uint8_t cid, const char *name);
/**
* Get text attribute of component.
*
* @param buffer - buffer storing text returned.
* @param len - length of buffer.
* @return The real length of text returned.
*/
uint16_t getText(char *buffer, uint16_t len);
/**
* Set text attribute of component.
*
* @param buffer - text buffer terminated with '\0'.
* @return true if success, false for failure.
*/
bool setText(const char *buffer);
/*
* Get bco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
/*
* Get xcen attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_place_xcen(uint32_t *number);
/*
* Set xcen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_xcen(uint32_t number);
/*
* Get ycen attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_place_ycen(uint32_t *number);
/*
* Set ycen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_ycen(uint32_t number);
/*
* Get font attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getFont(uint32_t *number);
/*
* Set font attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setFont(uint32_t number);
/*
* Get picc attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_crop_picc(uint32_t *number);
/*
* Set picc attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_crop_picc(uint32_t number);
/*
* Get pic attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_image_pic(uint32_t *number);
/*
* Set pic attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_image_pic(uint32_t number);
/*
* Get dir attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_scroll_dir(uint32_t *number);
/*
* Set dir attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_scroll_dir(uint32_t number);
/*
* Get dis attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_scroll_distance(uint32_t *number);
/*
* Set dis attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_scroll_distance(uint32_t number);
/*
* Get tim attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_cycle_tim(uint32_t *number);
/*
* Set tim attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_cycle_tim(uint32_t number);
bool enable(void);
bool disable(void);
};
/**
* @}
*/
#endif /* #ifndef __NEXSCROLLTEXT_H__ */

167
NexSlider.cpp Normal file → Executable file
View File

@@ -42,3 +42,170 @@ bool NexSlider::setValue(uint32_t number)
return recvRetCommandFinished();
}
uint32_t NexSlider::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexSlider::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 NexSlider::Get_font_color_pco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexSlider::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 NexSlider::Get_pointer_thickness_wid(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".wid";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexSlider::Set_pointer_thickness_wid(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".wid=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexSlider::Get_cursor_height_hig(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".hig";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexSlider::Set_cursor_height_hig(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".hig=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexSlider::getMaxval(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".maxval";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexSlider::setMaxval(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".maxval=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexSlider::getMinval(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".minval";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexSlider::setMinval(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".minval=";
cmd += buf;
sendCommand(cmd.c_str());
cmd = "";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

108
NexSlider.h Normal file → Executable file
View File

@@ -54,6 +54,114 @@ public: /* methods */
* @retval false - failed.
*/
bool setValue(uint32_t number);
/*
* Get bco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
/*
* Get wid attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_pointer_thickness_wid(uint32_t *number);
/*
* Set wid attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_pointer_thickness_wid(uint32_t number);
/*
* Get hig attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_cursor_height_hig(uint32_t *number);
/*
* Set hig attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_cursor_height_hig(uint32_t number);
/*
* Get maxval attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getMaxval(uint32_t *number);
/*
* Set maxval attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setMaxval(uint32_t number);
/*
* Get minval attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getMinval(uint32_t *number);
/*
* Set minval attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setMinval(uint32_t number);
};
/**
* @}

192
NexText.cpp Normal file → Executable file
View File

@@ -40,3 +40,195 @@ bool NexText::setText(const char *buffer)
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();
}

126
NexText.h Normal file → Executable file
View File

@@ -51,6 +51,132 @@ public: /* methods */
* @return true if success, false for failure.
*/
bool setText(const char *buffer);
/*
* Get bco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get pco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_font_color_pco(uint32_t *number);
/*
* Set pco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_font_color_pco(uint32_t number);
/*
* Get xcen attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_place_xcen(uint32_t *number);
/*
* Set xcen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_xcen(uint32_t number);
/*
* Get ycen attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_place_ycen(uint32_t *number);
/*
* Set ycen attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_place_ycen(uint32_t number);
/*
* Get font attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getFont(uint32_t *number);
/*
* Set font attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setFont(uint32_t number);
/*
* Get picc attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_crop_picc(uint32_t *number);
/*
* Set picc attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_crop_picc(uint32_t number);
/*
* Get pic attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_image_pic(uint32_t *number);
/*
* Set pic attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_image_pic(uint32_t number);
};
/**

4
NexTimer.cpp Normal file → Executable file
View File

@@ -30,7 +30,7 @@ void NexTimer::detachTimer(void)
NexTouch::detachPop();
}
bool NexTimer::getCycle(uint32_t *number)
bool NexTimer::Get_cycle_tim(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
@@ -39,7 +39,7 @@ bool NexTimer::getCycle(uint32_t *number)
return recvRetNumber(number);
}
bool NexTimer::setCycle(uint32_t number)
bool NexTimer::Set_cycle_tim(uint32_t number)
{
char buf[10] = {0};
String cmd;

4
NexTimer.h Normal file → Executable file
View File

@@ -66,7 +66,7 @@ public: /* methods */
* @retval true - success.
* @retval false - failed.
*/
bool getCycle(uint32_t *number);
bool Get_cycle_tim(uint32_t *number);
/**
* Set the value of timer cycle val.
@@ -78,7 +78,7 @@ public: /* methods */
*
* @warning the cycle value must be greater than 50.
*/
bool setCycle(uint32_t number);
bool Set_cycle_tim(uint32_t number);
/**
* contorl timer enable.

64
NexVariable.cpp Executable file
View File

@@ -0,0 +1,64 @@
/**
* @file NexVariable.cpp
*
* The implementation of class NexText.
*
* @author huang xiaoming (email:<xiaoming.huang@itead.cc>)
* @date 2016/9/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 "NexVariable.h"
NexVariable::NexVariable(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
uint32_t NexVariable::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexVariable::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 NexVariable::getText(char *buffer, uint32_t len)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".txt";
sendCommand(cmd.c_str());
return recvRetString(buffer,len);
}
bool NexVariable::setText(const char *buffer)
{
String cmd;
cmd += getObjName();
cmd += ".txt=\"";
cmd += buffer;
cmd += "\"";
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

85
NexVariable.h Executable file
View File

@@ -0,0 +1,85 @@
/**
* @file NexButton.h
*
* The definition of class NexButton.
*
* @author huang xiaoming (email:<xiaoming.huang@itead.cc>)
* @date 2016/9/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.
*/
#ifndef __NEXVARRIABLE_H__
#define __NEXVARRIABLE_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexButton component.
*
* Commonly, you want to do something after push and pop it. It is recommanded that only
* call @ref NexTouch::attachPop to satisfy your purpose.
*
* @warning Please do not call @ref NexTouch::attachPush on this component, even though you can.
*/
class NexVariable: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexVariable(uint8_t pid, uint8_t cid, const char *name);
/**
* Get text attribute of component.
*
* @param buffer - buffer storing text returned.
* @param len - length of buffer.
* @return The real length of text returned.
*/
uint32_t getText(char *buffer, uint32_t len);
/**
* Set text attribute of component.
*
* @param buffer - text buffer terminated with '\0'.
* @return true if success, false for failure.
*/
bool setText(const char *buffer);
/*
* Get val attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getValue(uint32_t *number);
/*
* Set val attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool setValue(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXVARRIABLE_H__*/

140
NexWaveform.cpp Normal file → Executable file
View File

@@ -33,4 +33,144 @@ bool NexWaveform::addValue(uint8_t ch, uint8_t number)
sendCommand(buf);
return true;
}
uint32_t NexWaveform::Get_background_color_bco(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".bco";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexWaveform::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 NexWaveform::Get_grid_color_gdc(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".gdc";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexWaveform::Set_grid_color_gdc(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".gdc=";
cmd += buf;
sendCommand(cmd.c_str());
cmd="";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexWaveform::Get_grid_width_gdw(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".gdw";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexWaveform::Set_grid_width_gdw(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".gdw=";
cmd += buf;
sendCommand(cmd.c_str());
cmd="";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexWaveform::Get_grid_height_gdh(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".gdh";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexWaveform::Set_grid_height_gdh(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".gdh=";
cmd += buf;
sendCommand(cmd.c_str());
cmd="";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
uint32_t NexWaveform::Get_channel_0_color_pco0(uint32_t *number)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".pco0";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexWaveform::Set_channel_0_color_pco0(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".pco0=";
cmd += buf;
sendCommand(cmd.c_str());
cmd="";
cmd += "ref ";
cmd += getObjName();
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}

90
NexWaveform.h Normal file → Executable file
View File

@@ -44,6 +44,96 @@ public: /* methods */
* @retval false - failed.
*/
bool addValue(uint8_t ch, uint8_t number);
/*
* Get bco attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_background_color_bco(uint32_t *number);
/*
* Set bco attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_background_color_bco(uint32_t number);
/*
* Get gdc attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_grid_color_gdc(uint32_t *number);
/*
* Set gdc attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_grid_color_gdc(uint32_t number);
/*
* Get gdw attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_grid_width_gdw(uint32_t *number);
/*
* Set gdw attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_grid_width_gdw(uint32_t number);
/*
* Get gdh attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_grid_height_gdh(uint32_t *number);
/*
* Set gdh attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_grid_height_gdh(uint32_t number);
/*
* Get pco0 attribute of component
*
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t Get_channel_0_color_pco0(uint32_t *number);
/*
* Set pco0 attribute of component
*
* @param number - To set up the data
* @return true if success, false for failure
*/
bool Set_channel_0_color_pco0(uint32_t number);
};
/**

4
Nextion.h Normal file → Executable file
View File

@@ -35,6 +35,10 @@
#include "NexTimer.h"
#include "NexNumber.h"
#include "NexDualStateButton.h"
#include "NexVariable.h"
#include "NexCheckbox.h"
#include "NexRadio.h"
#include "NexScrolltext.h"
#endif /* #ifndef __NEXTION_H__ */