EEN for Chris

Fork of MTS-Cellular by MultiTech

Committer:
Mike Fiore
Date:
Mon May 19 14:40:54 2014 -0500
Revision:
2:10e72dce251d
Child:
11:4e428f689069
add CellUtils.h, replace inclusion of Vars.h with CellUtils.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Mike Fiore 2:10e72dce251d 1 #ifndef CELLUTILS_H
Mike Fiore 2:10e72dce251d 2 #define CELLUTILS_H
Mike Fiore 2:10e72dce251d 3
Mike Fiore 2:10e72dce251d 4 //Special Payload Character Constants (ASCII Values)
Mike Fiore 2:10e72dce251d 5 const char ETX = 0x03; //Ends socket connection
Mike Fiore 2:10e72dce251d 6 const char DLE = 0x10; //Escapes ETX and DLE within Payload
Mike Fiore 2:10e72dce251d 7 const char CR = 0x0D; //Carriage Return
Mike Fiore 2:10e72dce251d 8 const char NL = 0x0A; //Newline
Mike Fiore 2:10e72dce251d 9 const char CTRL_Z = 0x1A; //Control-Z
Mike Fiore 2:10e72dce251d 10
Mike Fiore 2:10e72dce251d 11 /// An enumeration for common responses.
Mike Fiore 2:10e72dce251d 12 enum Code {
Mike Fiore 2:10e72dce251d 13 SUCCESS, ERROR, FAILURE, NO_RESPONSE
Mike Fiore 2:10e72dce251d 14 };
Mike Fiore 2:10e72dce251d 15
Mike Fiore 2:10e72dce251d 16 /** A static method for getting a string representation for the Code
Mike Fiore 2:10e72dce251d 17 * enumeration.
Mike Fiore 2:10e72dce251d 18 *
Mike Fiore 2:10e72dce251d 19 * @param code a Code enumeration.
Mike Fiore 2:10e72dce251d 20 * @returns the enumeration name as a string.
Mike Fiore 2:10e72dce251d 21 */
Mike Fiore 2:10e72dce251d 22 static std::string getCodeNames(Code code)
Mike Fiore 2:10e72dce251d 23 {
Mike Fiore 2:10e72dce251d 24 switch(code) {
Mike Fiore 2:10e72dce251d 25 case SUCCESS:
Mike Fiore 2:10e72dce251d 26 return "SUCCESS";
Mike Fiore 2:10e72dce251d 27 case ERROR:
Mike Fiore 2:10e72dce251d 28 return "ERROR";
Mike Fiore 2:10e72dce251d 29 case NO_RESPONSE:
Mike Fiore 2:10e72dce251d 30 return "NO_RESPONSE";
Mike Fiore 2:10e72dce251d 31 case FAILURE:
Mike Fiore 2:10e72dce251d 32 return "FAILURE";
Mike Fiore 2:10e72dce251d 33 default:
Mike Fiore 2:10e72dce251d 34 return "UNKNOWN ENUM";
Mike Fiore 2:10e72dce251d 35 }
Mike Fiore 2:10e72dce251d 36 }
Mike Fiore 2:10e72dce251d 37
Mike Fiore 2:10e72dce251d 38 #endif