diff --git a/NexButton.cpp b/NexButton.cpp index 291471c..3fe7988 100755 --- a/NexButton.cpp +++ b/NexButton.cpp @@ -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; diff --git a/NexButton.h b/NexButton.h old mode 100644 new mode 100755 index 8dae2ac..838f246 --- a/NexButton.h +++ b/NexButton.h @@ -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); }; /** * @} diff --git a/NexCheckbox.cpp b/NexCheckbox.cpp new file mode 100755 index 00000000..3e358d7 --- /dev/null +++ b/NexCheckbox.cpp @@ -0,0 +1,99 @@ +/** + * @file NexCheckbox.cpp + * + * The implementation of class NexCheckbox. + * + * @author huang xiaoming (email:) + * @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(); +} \ No newline at end of file diff --git a/NexCheckbox.h b/NexCheckbox.h new file mode 100755 index 00000000..ec10d00 --- /dev/null +++ b/NexCheckbox.h @@ -0,0 +1,104 @@ +/** + * @file NexCheckbox.h + * + * The definition of class NexCheckbox. + * + * @author huang xiaoming (email:) + * @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__ */ \ No newline at end of file diff --git a/NexCrop.cpp b/NexCrop.cpp old mode 100644 new mode 100755 index 90b6a24..651b915 --- a/NexCrop.cpp +++ b/NexCrop.cpp @@ -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; diff --git a/NexCrop.h b/NexCrop.h old mode 100644 new mode 100755 index 4b1d1ea..a1be5ba --- a/NexCrop.h +++ b/NexCrop.h @@ -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); }; /** diff --git a/NexDualStateButton.cpp b/NexDualStateButton.cpp old mode 100644 new mode 100755 index debf709..e938b9a --- a/NexDualStateButton.cpp +++ b/NexDualStateButton.cpp @@ -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(); +} + diff --git a/NexDualStateButton.h b/NexDualStateButton.h old mode 100644 new mode 100755 index ebda9e7..cd9446b --- a/NexDualStateButton.h +++ b/NexDualStateButton.h @@ -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); }; /** * @} diff --git a/NexGauge.cpp b/NexGauge.cpp old mode 100644 new mode 100755 index 906f9fe..11e8d21 --- a/NexGauge.cpp +++ b/NexGauge.cpp @@ -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(); +} + diff --git a/NexGauge.h b/NexGauge.h old mode 100644 new mode 100755 index 5abf7f7..ee1d877 --- a/NexGauge.h +++ b/NexGauge.h @@ -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); }; /** diff --git a/NexNumber.cpp b/NexNumber.cpp old mode 100644 new mode 100755 index c372b7e..dd9e610 --- a/NexNumber.cpp +++ b/NexNumber.cpp @@ -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(); +} \ No newline at end of file diff --git a/NexNumber.h b/NexNumber.h old mode 100644 new mode 100755 index 7b3cd75..63446ff --- a/NexNumber.h +++ b/NexNumber.h @@ -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); }; /** diff --git a/NexPicture.cpp b/NexPicture.cpp old mode 100644 new mode 100755 index ad4cd50..1317f01 --- a/NexPicture.cpp +++ b/NexPicture.cpp @@ -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; diff --git a/NexPicture.h b/NexPicture.h old mode 100644 new mode 100755 index 19f86a0..2b04719 --- a/NexPicture.h +++ b/NexPicture.h @@ -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); }; /** diff --git a/NexProgressBar.cpp b/NexProgressBar.cpp old mode 100644 new mode 100755 index 50c403f..a7c5cf0 --- a/NexProgressBar.cpp +++ b/NexProgressBar.cpp @@ -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(); +} diff --git a/NexProgressBar.h b/NexProgressBar.h old mode 100644 new mode 100755 index af13b95..1b28330 --- a/NexProgressBar.h +++ b/NexProgressBar.h @@ -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); }; /** diff --git a/NexRadio.cpp b/NexRadio.cpp new file mode 100755 index 00000000..09cb9c4 --- /dev/null +++ b/NexRadio.cpp @@ -0,0 +1,99 @@ +/** + * @file NexRadio.cpp + * + * The implementation of class NexRadio. + * + * @author huang xiaoming (email:) + * @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(); +} \ No newline at end of file diff --git a/NexRadio.h b/NexRadio.h new file mode 100755 index 00000000..f3bf3f7 --- /dev/null +++ b/NexRadio.h @@ -0,0 +1,104 @@ +/** + * @file NexRadio.h + * + * The definition of class NexRadio. + * + * @author huang xiaoming (email:) + * @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__ */ \ No newline at end of file diff --git a/NexScrolltext.cpp b/NexScrolltext.cpp new file mode 100755 index 00000000..7852b5d --- /dev/null +++ b/NexScrolltext.cpp @@ -0,0 +1,351 @@ +/** + * @file NexScrolltext.cpp + * + * The implementation of class NexScrolltext. + * + * @author Wu Pengfei (email:) + * @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(); +} diff --git a/NexScrolltext.h b/NexScrolltext.h new file mode 100755 index 00000000..9b59bd4 --- /dev/null +++ b/NexScrolltext.h @@ -0,0 +1,244 @@ +/** + * @file NexScrolltext.h + * + * The definition of class NexScrolltext. + * + * @author Wu Pengfei (email:) + * @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__ */ \ No newline at end of file diff --git a/NexSlider.cpp b/NexSlider.cpp old mode 100644 new mode 100755 index e714662..d4601e3 --- a/NexSlider.cpp +++ b/NexSlider.cpp @@ -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(); +} \ No newline at end of file diff --git a/NexSlider.h b/NexSlider.h old mode 100644 new mode 100755 index 7b22b6a..a85fa57 --- a/NexSlider.h +++ b/NexSlider.h @@ -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); }; /** * @} diff --git a/NexText.cpp b/NexText.cpp old mode 100644 new mode 100755 index b59c475..95a05b1 --- a/NexText.cpp +++ b/NexText.cpp @@ -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(); +} + + diff --git a/NexText.h b/NexText.h old mode 100644 new mode 100755 index 44dc7c4..e5afd2d --- a/NexText.h +++ b/NexText.h @@ -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); }; /** diff --git a/NexTimer.cpp b/NexTimer.cpp old mode 100644 new mode 100755 index 2f2b57e..6e24a9e --- a/NexTimer.cpp +++ b/NexTimer.cpp @@ -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; diff --git a/NexTimer.h b/NexTimer.h old mode 100644 new mode 100755 index c37d776..03b714d --- a/NexTimer.h +++ b/NexTimer.h @@ -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. diff --git a/NexVariable.cpp b/NexVariable.cpp new file mode 100755 index 00000000..187ba11 --- /dev/null +++ b/NexVariable.cpp @@ -0,0 +1,64 @@ +/** + * @file NexVariable.cpp + * + * The implementation of class NexText. + * + * @author huang xiaoming (email:) + * @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(); +} \ No newline at end of file diff --git a/NexVariable.h b/NexVariable.h new file mode 100755 index 00000000..77f553c --- /dev/null +++ b/NexVariable.h @@ -0,0 +1,85 @@ +/** + * @file NexButton.h + * + * The definition of class NexButton. + * + * @author huang xiaoming (email:) + * @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__*/ diff --git a/NexWaveform.cpp b/NexWaveform.cpp old mode 100644 new mode 100755 index ac868d6..f515f85 --- a/NexWaveform.cpp +++ b/NexWaveform.cpp @@ -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(); +} diff --git a/NexWaveform.h b/NexWaveform.h old mode 100644 new mode 100755 index 02f3a78..f7ac20e --- a/NexWaveform.h +++ b/NexWaveform.h @@ -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); }; /** diff --git a/Nextion.h b/Nextion.h old mode 100644 new mode 100755 index 16ed1eb..3848db1 --- a/Nextion.h +++ b/Nextion.h @@ -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__ */