Custom Channel Plan version of MTDOT Box firmware
Dependencies: DOGS102 GpsParser ISL29011 MMA845x MPL3115A2 MTS-Serial NCP5623B libmDot-Custom mDot_Channel_Plans
Fork of MTDOT-BOX-EVB-Factory-Firmware by
Command.h
00001 /* Copyright (c) <2016> <MultiTech Systems>, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00005 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00006 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00007 * furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 /** 00020 ****************************************************************************** 00021 * File Name : Command.h 00022 * Date : 18/04/2014 10:57:12 00023 * Description : This file provides code for command line prompt 00024 ****************************************************************************** 00025 * 00026 * COPYRIGHT(c) 2014 MultiTech Systems, Inc. 00027 * 00028 * Redistribution and use in source and binary forms, with or without modification, 00029 * are permitted provided that the following conditions are met: 00030 * 1. Redistributions of source code must retain the above copyright notice, 00031 * this list of conditions and the following disclaimer. 00032 * 2. Redistributions in binary form must reproduce the above copyright notice, 00033 * this list of conditions and the following disclaimer in the documentation 00034 * and/or other materials provided with the distribution. 00035 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00036 * may be used to endorse or promote products derived from this software 00037 * without specific prior written permission. 00038 * 00039 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00040 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00041 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00042 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00043 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00044 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00045 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00046 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00047 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00048 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00049 * 00050 ****************************************************************************** 00051 */ 00052 00053 #include "mbed.h" 00054 #include "mDot.h" 00055 #include "MTSSerial.h" 00056 #include "MTSText.h" 00057 #include <cstdlib> 00058 #include <string> 00059 #include <vector> 00060 #include "limits.h" 00061 00062 /* Define to prevent recursive inclusion -------------------------------------*/ 00063 #ifndef __command_H 00064 #define __command_H 00065 00066 #define KEY_LENGTH 16 00067 #define EUI_LENGTH 8 00068 #define PASSPHRASE_LENGTH 128 00069 00070 class Command { 00071 00072 public: 00073 00074 Command(mDot* dot); 00075 Command(mDot* dot, const char* name, const char* text, const char* desc); 00076 virtual ~Command() {}; 00077 00078 const char* name() const { return _name; }; 00079 const char* text() const { return _text; }; 00080 const char* desc() const { return _desc; }; 00081 const char* help() const { return _help.c_str(); }; 00082 00083 virtual uint32_t action(std::vector<std::string> args) = 0; 00084 virtual bool verify(std::vector<std::string> args); 00085 const std::string usage() const; 00086 std::string& errorMessage(); 00087 const bool queryable(); 00088 00089 static const char newline[]; 00090 static void readByteArray(const std::string& input, std::vector<uint8_t>& out, size_t len); 00091 00092 static bool isHexString(const std::string& str, size_t bytes); 00093 static bool isBaudRate(uint32_t baud); 00094 00095 protected: 00096 00097 void setErrorMessage(const char* message); 00098 void setErrorMessage(const std::string& message); 00099 std::string _help; 00100 std::string _usage; 00101 bool _queryable; 00102 mDot* _dot; 00103 00104 private: 00105 00106 const char* _name; 00107 const char* _text; 00108 const char* _desc; 00109 std::string _errorMessage; 00110 00111 }; 00112 00113 #endif /*__ command_H */ 00114 00115 /************************ (C) COPYRIGHT MultiTech Systems, Inc *****END OF FILE****/
Generated on Tue Jul 12 2022 13:07:49 by 1.7.2