offer some API for GPRS use, such as call / sms / tcp connect
Dependents:
ARCH_GPRS_Test
ARCH_GPRS_Xively
GPRS_Shield_Test
Seeed_Arch_GPRS_V2_HelloWorld
« Back to documentation index
GPRS Class Reference
GPRS class.
More...
#include <gprs.h >
Public Member Functions
GPRS (PinName tx, PinName rx, int baudRate, char *number)
Create GPRS instance.
int init (void)
init GPRS module including SIM card check & signal strength & network check
int checkSIMStatus (void)
check SIM card' Status
int checkSignalStrength (void)
check signal strength
int settingSMS (void)
set SMS format and processing mode
int sendSMS (char *number, char *data)
send text SMS
int readSMS (char *message, int index)
read SMS by index
int deleteSMS (int index)
delete SMS message on SIM card
int getSMS (char *message)
read SMS when coming a message,it will be store in messageBuffer.
int callUp (char *number)
call someone
int answer (void)
auto answer if coming a call
int loopHandle (void)
a loop to wait for some event.
int networkInit (char *apn, char *userName=NULL, char *passWord=NULL)
gprs network init
int connectTCP (char *ip, char *port)
build TCP connect
int sendTCPData (char *data)
send data to TCP server
int closeTCP (void)
close TCP connection
int shutTCP (void)
close TCP service
Detailed Description
GPRS class.
Used for mobile communication. attention that GPRS module communicate with MCU in serial protocol
Definition at line 43 of file gprs.h .
Constructor & Destructor Documentation
GPRS
(
PinName
tx ,
PinName
rx ,
int
baudRate ,
char *
number
)
Create GPRS instance.
Parameters:
tx uart transmit pin to communicate with GPRS module
rx uart receive pin to communicate with GPRS module
baudRate baud rate of uart communication
number default phone number during mobile communication
Definition at line 52 of file gprs.h .
Member Function Documentation
auto answer if coming a call
Returns: 0 on success -1 on error
Definition at line 232 of file gprs.cpp .
int callUp
(
char *
number )
call someone
Parameters:
*number the phone number which you want to call
Returns: 0 on success -1 on error
Definition at line 222 of file gprs.cpp .
int checkSignalStrength
(
void
)
check signal strength
Returns: signal strength in number(ex 3,4,5,6,7,8...) on success -1 on error
Definition at line 138 of file gprs.cpp .
int checkSIMStatus
(
void
)
check SIM card' Status
Returns: 0 on success -1 on error
Definition at line 117 of file gprs.cpp .
close TCP connection
Returns: 0 on success -1 on error
Definition at line 331 of file gprs.cpp .
int connectTCP
(
char *
ip ,
char *
port
)
build TCP connect
Parameters:
*ip ip address which will connect to
*port TCP server' port number
Returns: 0 on success -1 on error
Definition at line 303 of file gprs.cpp .
int deleteSMS
(
int
index )
delete SMS message on SIM card
Parameters:
*index the index number which SMS message will be delete
Returns: 0 on success -1 on error
Definition at line 206 of file gprs.cpp .
int getSMS
(
char *
message )
read SMS when coming a message,it will be store in messageBuffer.
Parameters:
message buffer used to get SMS message
Definition at line 214 of file gprs.cpp .
init GPRS module including SIM card check & signal strength & network check
Returns: 0 on success -1 on error
Definition at line 99 of file gprs.cpp .
a loop to wait for some event.
if a call comes in, it will auto answer it and if a SMS message comes in, it will read the message
Parameters:
*check whether to check phone number when get event
Returns: 0 on success -1 on error
Definition at line 238 of file gprs.cpp .
int networkInit
(
char *
apn ,
char *
userName = NULL
,
char *
passWord = NULL
)
gprs network init
Parameters:
*apn Access Point Name to connect network
*userName general is empty
*passWord general is empty
Definition at line 293 of file gprs.cpp .
int readSMS
(
char *
message ,
int
index
)
read SMS by index
Parameters:
*message buffer used to get SMS message
index which SMS message to read
Returns: 0 on success -1 on error
Definition at line 185 of file gprs.cpp .
int sendSMS
(
char *
number ,
char *
data
)
send text SMS
Parameters:
*number phone number which SMS will be send to
*data message that will be send to
Returns: 0 on success -1 on error
Definition at line 169 of file gprs.cpp .
int sendTCPData
(
char *
data )
send data to TCP server
Parameters:
*data data that will be send to TCP server
Returns: 0 on success -1 on error
Definition at line 317 of file gprs.cpp .
set SMS format and processing mode
Returns: 0 on success -1 on error
Definition at line 158 of file gprs.cpp .
close TCP service
Returns: 0 on success -1 on error
Definition at line 337 of file gprs.cpp .