This reads a thermistor bead using mDot module
Dependencies: DHT GPS MTS-Serial mbed-rtos mbed
Fork of mDot_LoRa_Connect_Example by
Command.h@5:11863539202f, 2016-06-10 (annotated)
- Committer:
- Mehrad
- Date:
- Fri Jun 10 00:21:48 2016 +0000
- Revision:
- 5:11863539202f
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mehrad | 5:11863539202f | 1 | /** |
Mehrad | 5:11863539202f | 2 | ****************************************************************************** |
Mehrad | 5:11863539202f | 3 | * File Name : Command.h |
Mehrad | 5:11863539202f | 4 | * Date : 18/04/2014 10:57:12 |
Mehrad | 5:11863539202f | 5 | * Description : This file provides code for command line prompt |
Mehrad | 5:11863539202f | 6 | ****************************************************************************** |
Mehrad | 5:11863539202f | 7 | * |
Mehrad | 5:11863539202f | 8 | * COPYRIGHT(c) 2014 MultiTech Systems, Inc. |
Mehrad | 5:11863539202f | 9 | * |
Mehrad | 5:11863539202f | 10 | * Redistribution and use in source and binary forms, with or without modification, |
Mehrad | 5:11863539202f | 11 | * are permitted provided that the following conditions are met: |
Mehrad | 5:11863539202f | 12 | * 1. Redistributions of source code must retain the above copyright notice, |
Mehrad | 5:11863539202f | 13 | * this list of conditions and the following disclaimer. |
Mehrad | 5:11863539202f | 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Mehrad | 5:11863539202f | 15 | * this list of conditions and the following disclaimer in the documentation |
Mehrad | 5:11863539202f | 16 | * and/or other materials provided with the distribution. |
Mehrad | 5:11863539202f | 17 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Mehrad | 5:11863539202f | 18 | * may be used to endorse or promote products derived from this software |
Mehrad | 5:11863539202f | 19 | * without specific prior written permission. |
Mehrad | 5:11863539202f | 20 | * |
Mehrad | 5:11863539202f | 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Mehrad | 5:11863539202f | 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Mehrad | 5:11863539202f | 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Mehrad | 5:11863539202f | 24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Mehrad | 5:11863539202f | 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Mehrad | 5:11863539202f | 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Mehrad | 5:11863539202f | 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Mehrad | 5:11863539202f | 28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Mehrad | 5:11863539202f | 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Mehrad | 5:11863539202f | 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Mehrad | 5:11863539202f | 31 | * |
Mehrad | 5:11863539202f | 32 | ****************************************************************************** |
Mehrad | 5:11863539202f | 33 | */ |
Mehrad | 5:11863539202f | 34 | |
Mehrad | 5:11863539202f | 35 | #include "mbed.h" |
Mehrad | 5:11863539202f | 36 | #include "mDot.h" |
Mehrad | 5:11863539202f | 37 | #include "MTSSerial.h" |
Mehrad | 5:11863539202f | 38 | #include "MTSText.h" |
Mehrad | 5:11863539202f | 39 | #include <cstdlib> |
Mehrad | 5:11863539202f | 40 | #include <string> |
Mehrad | 5:11863539202f | 41 | #include <vector> |
Mehrad | 5:11863539202f | 42 | #include "limits.h" |
Mehrad | 5:11863539202f | 43 | #include "debug.h" |
Mehrad | 5:11863539202f | 44 | |
Mehrad | 5:11863539202f | 45 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Mehrad | 5:11863539202f | 46 | #ifndef __command_H |
Mehrad | 5:11863539202f | 47 | #define __command_H |
Mehrad | 5:11863539202f | 48 | |
Mehrad | 5:11863539202f | 49 | #define KEY_LENGTH 16 |
Mehrad | 5:11863539202f | 50 | #define EUI_LENGTH 8 |
Mehrad | 5:11863539202f | 51 | #define PASSPHRASE_LENGTH 128 |
Mehrad | 5:11863539202f | 52 | |
Mehrad | 5:11863539202f | 53 | class Command { |
Mehrad | 5:11863539202f | 54 | |
Mehrad | 5:11863539202f | 55 | public: |
Mehrad | 5:11863539202f | 56 | |
Mehrad | 5:11863539202f | 57 | Command(mDot* dot); |
Mehrad | 5:11863539202f | 58 | Command(mDot* dot, const char* name, const char* text, const char* desc); |
Mehrad | 5:11863539202f | 59 | virtual ~Command() {}; |
Mehrad | 5:11863539202f | 60 | |
Mehrad | 5:11863539202f | 61 | const char* name() const { return _name; }; |
Mehrad | 5:11863539202f | 62 | const char* text() const { return _text; }; |
Mehrad | 5:11863539202f | 63 | const char* desc() const { return _desc; }; |
Mehrad | 5:11863539202f | 64 | const char* help() const { return _help.c_str(); }; |
Mehrad | 5:11863539202f | 65 | |
Mehrad | 5:11863539202f | 66 | virtual uint32_t action(std::vector<std::string> args) = 0; |
Mehrad | 5:11863539202f | 67 | virtual bool verify(std::vector<std::string> args); |
Mehrad | 5:11863539202f | 68 | const std::string usage() const; |
Mehrad | 5:11863539202f | 69 | std::string& errorMessage(); |
Mehrad | 5:11863539202f | 70 | const bool queryable(); |
Mehrad | 5:11863539202f | 71 | |
Mehrad | 5:11863539202f | 72 | static const char newline[]; |
Mehrad | 5:11863539202f | 73 | static void readByteArray(const std::string& input, std::vector<uint8_t>& out, size_t len); |
Mehrad | 5:11863539202f | 74 | |
Mehrad | 5:11863539202f | 75 | static bool isHexString(const std::string& str, size_t bytes); |
Mehrad | 5:11863539202f | 76 | static bool isBaudRate(uint32_t baud); |
Mehrad | 5:11863539202f | 77 | |
Mehrad | 5:11863539202f | 78 | protected: |
Mehrad | 5:11863539202f | 79 | |
Mehrad | 5:11863539202f | 80 | void setErrorMessage(const char* message); |
Mehrad | 5:11863539202f | 81 | void setErrorMessage(const std::string& message); |
Mehrad | 5:11863539202f | 82 | std::string _help; |
Mehrad | 5:11863539202f | 83 | std::string _usage; |
Mehrad | 5:11863539202f | 84 | bool _queryable; |
Mehrad | 5:11863539202f | 85 | mDot* _dot; |
Mehrad | 5:11863539202f | 86 | |
Mehrad | 5:11863539202f | 87 | private: |
Mehrad | 5:11863539202f | 88 | |
Mehrad | 5:11863539202f | 89 | const char* _name; |
Mehrad | 5:11863539202f | 90 | const char* _text; |
Mehrad | 5:11863539202f | 91 | const char* _desc; |
Mehrad | 5:11863539202f | 92 | std::string _errorMessage; |
Mehrad | 5:11863539202f | 93 | |
Mehrad | 5:11863539202f | 94 | }; |
Mehrad | 5:11863539202f | 95 | |
Mehrad | 5:11863539202f | 96 | #endif /*__ command_H */ |
Mehrad | 5:11863539202f | 97 | |
Mehrad | 5:11863539202f | 98 | /************************ (C) COPYRIGHT MultiTech Systems, Inc *****END OF FILE****/ |