Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MTS-Cellular by
Diff: Utils/CellUtils.h
- Revision:
- 2:10e72dce251d
- Child:
- 11:4e428f689069
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Utils/CellUtils.h Mon May 19 14:40:54 2014 -0500 @@ -0,0 +1,38 @@ +#ifndef CELLUTILS_H +#define CELLUTILS_H + +//Special Payload Character Constants (ASCII Values) +const char ETX = 0x03; //Ends socket connection +const char DLE = 0x10; //Escapes ETX and DLE within Payload +const char CR = 0x0D; //Carriage Return +const char NL = 0x0A; //Newline +const char CTRL_Z = 0x1A; //Control-Z + +/// An enumeration for common responses. +enum Code { + SUCCESS, ERROR, FAILURE, NO_RESPONSE +}; + +/** A static method for getting a string representation for the Code +* enumeration. +* +* @param code a Code enumeration. +* @returns the enumeration name as a string. +*/ +static std::string getCodeNames(Code code) +{ + switch(code) { + case SUCCESS: + return "SUCCESS"; + case ERROR: + return "ERROR"; + case NO_RESPONSE: + return "NO_RESPONSE"; + case FAILURE: + return "FAILURE"; + default: + return "UNKNOWN ENUM"; + } +} + +#endif