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: cellular/Cellular.cpp
- Revision:
- 56:e5e5351f14b3
- Parent:
- 43:3cacf019ed7d
- Child:
- 57:88b07490d7e8
--- a/cellular/Cellular.cpp Thu Dec 19 22:11:16 2013 +0000 +++ b/cellular/Cellular.cpp Fri Dec 20 20:26:46 2013 +0000 @@ -17,13 +17,12 @@ } -Cellular* Cellular::getInstance(MTSBufferedIO* io) { - if(instance == NULL) { - instance = new Cellular(io); - } else { - instance->io = io; +bool Cellular::init(MTSBufferedIO* io) { + if (io == NULL) { + return false; } - return instance; + instance->io = io; + return true; } Cellular::Cellular(MTSBufferedIO* io) @@ -759,4 +758,40 @@ return result; } +std::string Cellular::getCodeNames(Code code) +{ + switch(code) { + case CELL_OK: + return "CELL_OK"; + case CELL_ERROR: + return "CELL_ERROR"; + case CELL_NO_RESPONSE: + return "CELL_NO_RESPONSE"; + case CELL_FAILURE: + return "CELL_FAILURE"; + default: + return "UNKNOWN ENUM"; + } +} + +std::string Cellular::getRegistrationNames(Registration registration) +{ + switch(registration) { + case NOT_REGISTERED: + return "NOT_REGISTERED"; + case REGISTERED: + return "REGISTERED"; + case SEARCHING: + return "SEARCHING"; + case DENIED: + return "DENIED"; + case UNKNOWN: + return "UNKNOWN"; + case ROAMING: + return "ROAMING"; + default: + return "UNKNOWN ENUM"; + } +} + #endif /* CELLULAR_CPP */ \ No newline at end of file