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

Dependents:   mtsas mtsas mtsas mtsas

Utils/CellUtils.h

Committer:
Mike Fiore
Date:
2014-05-19
Revision:
2:10e72dce251d
Child:
11:4e428f689069

File content as of revision 2:10e72dce251d:

#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