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
Diff: utils/Vars.h
- Revision:
- 87:5db6c084adc7
- Parent:
- 71:82205735732b
- Child:
- 141:571e0ef6c8dc
--- a/utils/Vars.h Fri Dec 27 15:55:35 2013 +0000 +++ b/utils/Vars.h Fri Dec 27 16:47:09 2013 +0000 @@ -3,12 +3,13 @@ #include <string> -namespace mts { +namespace mts +{ #ifndef MAX #define MAX(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; }) #endif - + #ifndef MIN #define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; }) #endif @@ -19,6 +20,27 @@ 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"; + } +} const unsigned int PINGDELAY = 3; //Time to wait on each ping for a response before timimg out (seconds) const unsigned int PINGNUM = 4; //Number of pings to try on ping command @@ -47,4 +69,4 @@ //Test Commit!!! -#endif /* VARS_H */ \ No newline at end of file +#endif /* VARS_H */ \ No newline at end of file