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
You are viewing an older revision! See the latest version
Homepage
Import libraryGPRSInterface
a library to use GPRS like ethernet or wifi, which makes it possible to connect to the internet with your GPRS module
API¶
Import library
Public Member Functions |
|
GPRSInterface (PinName tx, PinName rx, int baudRate, const char *apn, const char *userName=NULL, const char *passWord=NULL) | |
Constructor.
|
|
int | init () |
Initialize the interface(no connection at this point).
|
|
int | connect () |
Connect to the network and get IP address.
|
|
int | disconnect () |
Disconnect with the network.
|
|
char * | getIPAddress () |
Get IP address.
|
|
bool | join (void) |
Connect the GPRS module to the network.
|
|
bool | close (int socket) |
Close a tcp connection.
|
|
bool | connect (int socket, Protocol ptl, const char *host, int port, int timeout=DEFAULT_TIMEOUT) |
Open a tcp/udp connection with the specified host on the specified port.
|
|
bool | setProtocol (int socket, Protocol p) |
Set the protocol (UDP or TCP)
|
|
void | reset () |
Reset the GPRS module.
|
|
bool | readable (void) |
check if GPRS module is readable or not
|
|
int | wait_readable (int socket, int wait_time) |
wait a few time to check if GPRS module is readable or not
|
|
int | wait_writeable (int socket, int req_size) |
wait a few time to check if GPRS module is writeable or not
|
|
bool | is_connected (int socket) |
Check if a tcp link is active.
|
|
int | send (int socket, const char *str, int len) |
send data to socket
|
|
int | recv (int socket, char *buf, int len) |
read data from socket
|
|
bool | gethostbyname (const char *host, uint32_t *ip) |
convert the host to ip
|
|
Static Public Member Functions |
|
static GPRS * | getInstance () |
get instance of GPRS class
|
|
Protected Member Functions |
|
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
|