A library for talking to Multi-Tech's Cellular SocketModem Devices.
Dependents: M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more
Vars.h
00001 /* Universal Socket Modem Interface Library 00002 * Copyright (c) 2013 Multi-Tech Systems 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef VARS_H 00018 #define VARS_H 00019 00020 #include <string> 00021 00022 namespace mts 00023 { 00024 00025 #ifndef MAX 00026 #define MAX(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; }) 00027 #endif 00028 00029 #ifndef MIN 00030 #define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; }) 00031 #endif 00032 00033 00034 /// An enumeration for common responses. 00035 enum Code { 00036 MTS_SUCCESS, MTS_ERROR, MTS_FAILURE, MTS_NO_RESPONSE 00037 }; 00038 00039 /** A static method for getting a string representation for the Code 00040 * enumeration. 00041 * 00042 * @param code a Code enumeration. 00043 * @returns the enumeration name as a string. 00044 */ 00045 static std::string getCodeNames(Code code) 00046 { 00047 switch(code) { 00048 case MTS_SUCCESS: 00049 return "SUCCESS"; 00050 case MTS_ERROR: 00051 return "ERROR"; 00052 case MTS_NO_RESPONSE: 00053 return "NO_RESPONSE"; 00054 case MTS_FAILURE: 00055 return "FAILURE"; 00056 default: 00057 return "UNKNOWN ENUM"; 00058 } 00059 } 00060 00061 const unsigned int PINGDELAY = 3; //Time to wait on each ping for a response before timimg out (seconds) 00062 const unsigned int PINGNUM = 4; //Number of pings to try on ping command 00063 00064 //Special Payload Characters 00065 const char ETX = 0x03; //Ends socket connection 00066 const char DLE = 0x10; //Escapes ETX and DLE within Payload 00067 const char CR = 0x0D; 00068 const char NL = 0x0A; 00069 const char CTRL_Z = 0x1A; 00070 00071 00072 /** This class holds several enum types and other static variables 00073 * that are used throughout the rest of the SDK. 00074 */ 00075 class Vars 00076 { 00077 public: 00078 /// Enumeration for different cellular radio types. 00079 enum Radio {NA, E1, G2, EV2, H4, EV3, H5}; 00080 00081 enum RelationalOperator {GREATER, LESS, EQUAL, GREATER_EQUAL, LESS_EQUAL}; 00082 }; 00083 00084 } 00085 00086 //Test Commit!!! 00087 00088 #endif /* VARS_H */
Generated on Tue Jul 12 2022 21:46:23 by 1.7.2