Axeda Ready Demo for Freescale FRDM-KL46Z as accident alert system

Dependencies:   FRDM_MMA8451Q KL46Z-USBHost MAG3110 SocketModem TSI mbed FATFileSystem

Fork of AxedaGo-Freescal_FRDM-KL46Z revert by Axeda Corp

Committer:
AxedaCorp
Date:
Wed Jul 02 15:59:38 2014 +0000
Revision:
1:5ad12c581db4
Parent:
0:65004368569c
url ip switch
;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AxedaCorp 0:65004368569c 1 /* Universal Socket Modem Interface Library
AxedaCorp 0:65004368569c 2 * Copyright (c) 2013 Multi-Tech Systems
AxedaCorp 0:65004368569c 3 *
AxedaCorp 0:65004368569c 4 * Licensed under the Apache License, Version 2.0 (the "License");
AxedaCorp 0:65004368569c 5 * you may not use this file except in compliance with the License.
AxedaCorp 0:65004368569c 6 * You may obtain a copy of the License at
AxedaCorp 0:65004368569c 7 *
AxedaCorp 0:65004368569c 8 * http://www.apache.org/licenses/LICENSE-2.0
AxedaCorp 0:65004368569c 9 *
AxedaCorp 0:65004368569c 10 * Unless required by applicable law or agreed to in writing, software
AxedaCorp 0:65004368569c 11 * distributed under the License is distributed on an "AS IS" BASIS,
AxedaCorp 0:65004368569c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AxedaCorp 0:65004368569c 13 * See the License for the specific language governing permissions and
AxedaCorp 0:65004368569c 14 * limitations under the License.
AxedaCorp 0:65004368569c 15 */
AxedaCorp 0:65004368569c 16
AxedaCorp 0:65004368569c 17 #ifndef VARS_H
AxedaCorp 0:65004368569c 18 #define VARS_H
AxedaCorp 0:65004368569c 19
AxedaCorp 0:65004368569c 20 #include <string>
AxedaCorp 0:65004368569c 21
AxedaCorp 0:65004368569c 22 namespace mts
AxedaCorp 0:65004368569c 23 {
AxedaCorp 0:65004368569c 24
AxedaCorp 0:65004368569c 25 #ifndef MAX
AxedaCorp 0:65004368569c 26 #define MAX(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
AxedaCorp 0:65004368569c 27 #endif
AxedaCorp 0:65004368569c 28
AxedaCorp 0:65004368569c 29 #ifndef MIN
AxedaCorp 0:65004368569c 30 #define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
AxedaCorp 0:65004368569c 31 #endif
AxedaCorp 0:65004368569c 32
AxedaCorp 0:65004368569c 33
AxedaCorp 0:65004368569c 34 /// An enumeration for common responses.
AxedaCorp 0:65004368569c 35 enum Code {
AxedaCorp 0:65004368569c 36 SUCCESS, ERROR, FAILURE, NO_RESPONSE
AxedaCorp 0:65004368569c 37 };
AxedaCorp 0:65004368569c 38
AxedaCorp 0:65004368569c 39 /** A static method for getting a string representation for the Code
AxedaCorp 0:65004368569c 40 * enumeration.
AxedaCorp 0:65004368569c 41 *
AxedaCorp 0:65004368569c 42 * @param code a Code enumeration.
AxedaCorp 0:65004368569c 43 * @returns the enumeration name as a string.
AxedaCorp 0:65004368569c 44 */
AxedaCorp 0:65004368569c 45 static std::string getCodeNames(Code code)
AxedaCorp 0:65004368569c 46 {
AxedaCorp 0:65004368569c 47 switch(code) {
AxedaCorp 0:65004368569c 48 case SUCCESS:
AxedaCorp 0:65004368569c 49 return "SUCCESS";
AxedaCorp 0:65004368569c 50 case ERROR:
AxedaCorp 0:65004368569c 51 return "ERROR";
AxedaCorp 0:65004368569c 52 case NO_RESPONSE:
AxedaCorp 0:65004368569c 53 return "NO_RESPONSE";
AxedaCorp 0:65004368569c 54 case FAILURE:
AxedaCorp 0:65004368569c 55 return "FAILURE";
AxedaCorp 0:65004368569c 56 default:
AxedaCorp 0:65004368569c 57 return "UNKNOWN ENUM";
AxedaCorp 0:65004368569c 58 }
AxedaCorp 0:65004368569c 59 }
AxedaCorp 0:65004368569c 60
AxedaCorp 0:65004368569c 61 const unsigned int PINGDELAY = 3; //Time to wait on each ping for a response before timimg out (seconds)
AxedaCorp 0:65004368569c 62 const unsigned int PINGNUM = 4; //Number of pings to try on ping command
AxedaCorp 0:65004368569c 63
AxedaCorp 0:65004368569c 64 //Special Payload Characters
AxedaCorp 0:65004368569c 65 const char ETX = 0x03; //Ends socket connection
AxedaCorp 0:65004368569c 66 const char DLE = 0x10; //Escapes ETX and DLE within Payload
AxedaCorp 0:65004368569c 67 const char CR = 0x0D;
AxedaCorp 0:65004368569c 68 const char NL = 0x0A;
AxedaCorp 0:65004368569c 69 const char CTRL_Z = 0x1A;
AxedaCorp 0:65004368569c 70
AxedaCorp 0:65004368569c 71
AxedaCorp 0:65004368569c 72 /** This class holds several enum types and other static variables
AxedaCorp 0:65004368569c 73 * that are used throughout the rest of the SDK.
AxedaCorp 0:65004368569c 74 */
AxedaCorp 0:65004368569c 75 class Vars
AxedaCorp 0:65004368569c 76 {
AxedaCorp 0:65004368569c 77 public:
AxedaCorp 0:65004368569c 78 /// Enumeration for different cellular radio types.
AxedaCorp 0:65004368569c 79 enum Radio {NA, E1, G2, EV2, H4, EV3, H5};
AxedaCorp 0:65004368569c 80
AxedaCorp 0:65004368569c 81 enum RelationalOperator {GREATER, LESS, EQUAL, GREATER_EQUAL, LESS_EQUAL};
AxedaCorp 0:65004368569c 82 };
AxedaCorp 0:65004368569c 83
AxedaCorp 0:65004368569c 84 }
AxedaCorp 0:65004368569c 85
AxedaCorp 0:65004368569c 86 //Test Commit!!!
AxedaCorp 0:65004368569c 87
AxedaCorp 0:65004368569c 88 #endif /* VARS_H */