a library to use GPRS like ethernet or wifi, which makes it possible to connect to the internet with your GPRS module
Dependents:
Seeed_GPRS_Library_HelloWorld
Seeed_GPRS_Xively_HelloWorld
Seeed_ARCH_GPRS_V2_Xively_HelloWorld
Seeed_ARCH_GPRS_V2_ThingSpeak_HelloWorld
... more
« Back to documentation index
Modem Class Reference
Modem class.
More...
#include <modem.h >
Inherited by GPRS.
Public Member Functions
Modem (PinName tx, PinName rx, int baudRate)
Create Modem Instance.
Protected Member Functions
void preInit (void)
Power on Modem .
bool readable ()
check serialModem is readable or not
char readByte (void)
read one byte from serialModem
int readBuffer (char *buffer, int count, unsigned int timeOut)
read from Modem module and save to buffer array
void cleanBuffer (char *buffer, int count)
clean Buffer
void sendCmd (const char *cmd)
send AT command to Modem module
void sendATTest (void)
send "AT" to Modem module
bool respCmp (const char *resp, unsigned int len, unsigned int timeout)
compare the response from GPRS module with a string
int waitForResp (const char *resp, unsigned int timeout, DataType type)
check Modem module response before time out
int sendCmdAndWaitForResp (const char *data, const char *resp, unsigned timeout, DataType type)
send AT command to GPRS module and wait for correct response
Detailed Description
Modem class.
Used for Modem communication. attention that Modem module communicate with MCU in serial protocol
Definition at line 38 of file modem.h .
Constructor & Destructor Documentation
Modem
(
PinName
tx ,
PinName
rx ,
int
baudRate
)
Create Modem Instance.
Parameters:
tx uart transmit pin to communicate with Modem
rx uart receive pin to communicate with Modem
baudRate baud rate of uart communication
Definition at line 47 of file modem.h .
Member Function Documentation
void cleanBuffer
(
char *
buffer ,
int
count
)
[protected]
clean Buffer
Parameters:
buffer buffer to clean
count number of bytes to clean
Definition at line 55 of file modem.cpp .
void preInit
(
void
)
[protected]
bool readable
(
void
)
[protected]
check serialModem is readable or not
Returns: true on readable false on not readable
Definition at line 30 of file modem.cpp .
int readBuffer
(
char *
buffer ,
int
count ,
unsigned int
timeOut
)
[protected]
read from Modem module and save to buffer array
Parameters:
buffer buffer array to save what read from Modem module
count the maximal bytes number read from Modem module
timeOut time to wait for reading from Modem module
Returns: 0 on success -1 on error
Definition at line 35 of file modem.cpp .
char readByte
(
void
)
[protected]
read one byte from serialModem
Returns: one byte read from serialModem
Definition at line 25 of file modem.cpp .
bool respCmp
(
const char *
resp ,
unsigned int
len ,
unsigned int
timeout
)
[protected]
compare the response from GPRS module with a string
Parameters:
resp buffer to be compared
len length that will be compared
timeout waiting seconds till timeout
Definition at line 72 of file modem.cpp .
void sendATTest
(
void
)
[protected]
void sendCmd
(
const char *
cmd )
[protected]
send AT command to Modem module
Parameters:
cmd command array which will be send to GPRS module
Definition at line 62 of file modem.cpp .
int sendCmdAndWaitForResp
(
const char *
data ,
const char *
resp ,
unsigned
timeout ,
DataType
type
)
[protected]
send AT command to GPRS module and wait for correct response
Parameters:
*cmd AT command which will be send to GPRS module
*resp correct response which GPRS module will return
*timeout waiting seconds till timeout
Returns: 0 on success -1 on error
Definition at line 125 of file modem.cpp .
int waitForResp
(
const char *
resp ,
unsigned int
timeout ,
DataType
type
)
[protected]
check Modem module response before time out
Parameters:
*resp correct response which Modem module will return
*timeout waiting seconds till timeout
Returns: 0 on success -1 on error
Definition at line 95 of file modem.cpp .