/** * @file NexButton.cpp * * The implementation of class NexButton. * * @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 "NexButton.h" /** * Constructor,inherited NexTouch's constructor function. * */ NexButton::NexButton(uint8_t pid, uint8_t cid, const char *name) :NexTouch(pid, cid, name) { } /** * Get text value from button component. * * @param buffer - text buffer. * @param len - text buffer length. * * @return the text buffer length */ uint16_t NexButton::getText(char *buffer, uint16_t len) { String cmd; cmd += "get "; cmd += getObjName(); cmd += ".txt"; sendCommand(cmd.c_str()); return recvRetString(buffer,len); } /** * Set text value of button component. * * @param buffer - text buffer. * * @retval true - success. * @retval false - failed. */ bool NexButton::setText(const char *buffer) { String cmd; cmd += getObjName(); cmd += ".txt=\""; cmd += buffer; cmd += "\""; sendCommand(cmd.c_str()); return recvRetCommandFinished(); }