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:
- 30:06c756af6c5c
- Parent:
- 27:8e6188cbcfd4
- Parent:
- 29:7408b1bdad37
- Child:
- 33:e04aa7c013c9
--- a/cellular/Cellular.cpp Tue Dec 17 23:58:50 2013 +0000 +++ b/cellular/Cellular.cpp Wed Dec 18 16:11:36 2013 +0000 @@ -33,10 +33,19 @@ , local_port(0) , host_port(0) { + // the radio's DCD signal is mapped to PTA4 + // the radio will raise and lower this line + dcd = new DigitalIn(PTA4); + // the DTR line to the radio is mapped PTC9 + // this line should be lowered when we want to talk to the radio and raised when we're done + // for now we will lower it in the constructor and raise it in the destructor + dtr = new DigitalOut(PTC9); + dtr->write(0); } Cellular::~Cellular() { + dtr->write(1); } bool Cellular::connect() { @@ -217,7 +226,7 @@ char buffer[2] = { 0x03, 0x00 }; Code code = sendBasicCommand(buffer, 1000, NONE); if(code != OK) { - printf("[ERROR] Radio did not accept close socket command"); + printf("[ERROR] Radio did not accept close socket command\r\n"); return false; } socketOpened = false; @@ -314,7 +323,13 @@ } void Cellular::reset() { - + disconnect(); + Code code = sendBasicCommand("AT#RESET=0", 10000); + if(code != OK) { + printf("[ERROR] Socket Modem did not accept RESET command\n\r"); + } else { + printf("[WARNING] Socket Modem is resetting, allow 30 seconds for it to come back\n\r"); + } } Cellular::Code Cellular::test() @@ -332,7 +347,7 @@ return OK; } -Cellular::Code Cellular::echoOff(bool state) +Cellular::Code Cellular::echo(bool state) { Code code; if (state) {