Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libmDot-Custom MTS-Serial
Fork of mDot_AT_firmware_CUSTOM by
Command.h
00001 /** 00002 ****************************************************************************** 00003 * File Name : Command.h 00004 * Date : 18/04/2014 10:57:12 00005 * Description : This file provides code for command line prompt 00006 ****************************************************************************** 00007 * 00008 * COPYRIGHT(c) 2014 MultiTech Systems, Inc. 00009 * 00010 * Redistribution and use in source and binary forms, with or without modification, 00011 * are permitted provided that the following conditions are met: 00012 * 1. Redistributions of source code must retain the above copyright notice, 00013 * this list of conditions and the following disclaimer. 00014 * 2. Redistributions in binary form must reproduce the above copyright notice, 00015 * this list of conditions and the following disclaimer in the documentation 00016 * and/or other materials provided with the distribution. 00017 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00018 * may be used to endorse or promote products derived from this software 00019 * without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00022 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00023 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00024 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00025 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00026 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00027 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00028 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00029 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00030 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 * 00032 ****************************************************************************** 00033 */ 00034 00035 #include "mbed.h" 00036 #include "mDot.h" 00037 #include "MTSSerial.h" 00038 #include "MTSText.h" 00039 #include <cstdlib> 00040 #include <string> 00041 #include <vector> 00042 #include "limits.h" 00043 #include "CommandTerminal.h" 00044 00045 00046 /* Define to prevent recursive inclusion -------------------------------------*/ 00047 #ifndef __command_H 00048 #define __command_H 00049 00050 #define KEY_LENGTH 16 00051 #define EUI_LENGTH 8 00052 #define PASSPHRASE_LENGTH 128 00053 00054 class Command { 00055 00056 public: 00057 00058 Command(); 00059 Command(const char* name, const char* text, const char* desc, const char* usage); 00060 virtual ~Command() {}; 00061 00062 const char* name() const { return _name; }; 00063 const char* text() const { return _text; }; 00064 const char* desc() const { return _desc; }; 00065 const std::string help() const { 00066 return std::string(text()) + ": " + std::string(desc()); 00067 }; 00068 00069 std::string usage() const; 00070 const std::string& errorMessage() const; 00071 bool queryable() const; 00072 00073 static const char newline[]; 00074 static void readByteArray(const std::string& input, std::vector<uint8_t>& out, size_t len); 00075 00076 static bool isHexString(const std::string& str, size_t bytes); 00077 static bool isBaudRate(uint32_t baud); 00078 00079 protected: 00080 00081 bool _queryable; 00082 00083 private: 00084 00085 const char* _name; 00086 const char* _text; 00087 const char* _desc; 00088 const char* _usage; 00089 00090 }; 00091 00092 #endif /*__ command_H */ 00093 00094 /************************ (C) COPYRIGHT MultiTech Systems, Inc *****END OF FILE****/
Generated on Tue Jul 12 2022 20:42:48 by
1.7.2
