Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems

Dependents:   mtsas mtsas mtsas mtsas

Revision:
2:10e72dce251d
Child:
11:4e428f689069
diff -r f155d94d6f3a -r 10e72dce251d Utils/CellUtils.h
--- /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