tes sim 5360

Embed: (wiki syntax)

« Back to documentation index

GSM Class Reference

GSM Class Reference

GSM class. More...

#include <SIM5360.h>

Public Member Functions

 GSM (PinName tx, PinName rx, int baudRate, char *number)
 Create GSM instance.
int init (void)
 init GSM module including SIM card check & signal strength & network check
int registerNet (void)
 Register Network of GSM module including signal strength & network check.
int checkNetStatus (void)
 Check network status of GSM module.
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 join (char *apn, char *userName=NULL, char *passWord=NULL)
 Join GSM network.
int disconnect (void)
 Disconnect from network.
int SetBlocking (int netopen_to=5, int cipopen_to=5, int cipsend_to=5)
 Set blocking of the connection.
int connectTCP (char *ip, int port)
 Build TCP connect.
int sendTCPData (char *data, int len)
 Send data to TCP server.
int receivedTCPData (char *buff, int len)
 Send data to TCP server.
int closeTCP (void)
 Close TCP connection.
void purge (void)
 Clear serial pipe.

Detailed Description

GSM class.

Used for mobile communication. attention that GSM module communicate with MCU in serial protocol

Definition at line 21 of file SIM5360.h.


Constructor & Destructor Documentation

GSM ( PinName  tx,
PinName  rx,
int  baudRate,
char *  number 
)

Create GSM instance.

Parameters:
txuart transmit pin to communicate with GSM module
rxuart receive pin to communicate with GSM module
baudRatebaud rate of uart communication
numberdefault phone number during mobile communication

Definition at line 30 of file SIM5360.h.


Member Function Documentation

int answer ( void   )

Auto answer if coming a call.

Returns:
0 on success, -1 on error

Definition at line 290 of file SIM5360.cpp.

int callUp ( char *  number )

Call someone.

Parameters:
*numberthe phone number which you want to call
Returns:
0 on success, -1 on error

Definition at line 280 of file SIM5360.cpp.

int checkNetStatus ( void   )

Check network status of GSM module.

Returns:
0 on success, -1 on error

Definition at line 152 of file SIM5360.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 196 of file SIM5360.cpp.

int checkSIMStatus ( void   )

Check SIM card' Status.

Returns:
0 on success, -1 on error

Definition at line 175 of file SIM5360.cpp.

int closeTCP ( void   )

Close TCP connection.

Returns:
0 on success, -1 on error

Definition at line 402 of file SIM5360.cpp.

int connectTCP ( char *  ip,
int  port 
)

Build TCP connect.

Parameters:
*ipip address which will connect to
*portTCP server' port number
Returns:
0 on success, -1 on error

Definition at line 351 of file SIM5360.cpp.

int deleteSMS ( int  index )

Delete SMS message on SIM card.

Parameters:
*indexthe index number which SMS message will be delete
Returns:
0 on success, -1 on error

Definition at line 264 of file SIM5360.cpp.

int disconnect ( void   )

Disconnect from network.

Returns:
0 on success, -1 on error

Definition at line 410 of file SIM5360.cpp.

int getSMS ( char *  message )

Read SMS when coming a message,it will be store in messageBuffer.

Parameters:
messagebuffer used to get SMS message

Definition at line 272 of file SIM5360.cpp.

int init ( void   )

init GSM module including SIM card check & signal strength & network check

Returns:
0 on success, -1 on error

Definition at line 86 of file SIM5360.cpp.

int join ( char *  apn,
char *  userName = NULL,
char *  passWord = NULL 
)

Join GSM network.

Parameters:
*apnAccess Point Name to connect network
*userNamegeneral is empty
*passWordgeneral is empty

Definition at line 296 of file SIM5360.cpp.

void purge ( void   )

Clear serial pipe.

Definition at line 35 of file SIM5360.cpp.

int readSMS ( char *  message,
int  index 
)

Read SMS by index.

Parameters:
*messagebuffer used to get SMS message
indexwhich SMS message to read
Returns:
0 on success, -1 on error

Definition at line 243 of file SIM5360.cpp.

int receivedTCPData ( char *  buff,
int  len 
)

Send data to TCP server.

Parameters:
*buffdata that will be received from TCP server
lensize of buffer to read
Returns:
0 on success, -1 on error

Definition at line 393 of file SIM5360.cpp.

int registerNet ( void   )

Register Network of GSM module including signal strength & network check.

Returns:
0 on success, -1 on error

Definition at line 131 of file SIM5360.cpp.

int sendSMS ( char *  number,
char *  data 
)

Send text SMS.

Parameters:
*numberphone number which SMS will be send to
*datamessage that will be send to
Returns:
0 on success, -1 on error

Definition at line 227 of file SIM5360.cpp.

int sendTCPData ( char *  data,
int  len 
)

Send data to TCP server.

Parameters:
*datadata that will be send to TCP server
Returns:
0 on success, -1 on error

Definition at line 373 of file SIM5360.cpp.

int SetBlocking ( int  netopen_to = 5,
int  cipopen_to = 5,
int  cipsend_to = 5 
)

Set blocking of the connection.

Parameters:
netopen_totime out of open the socket network in second
cipopen_totime out of open the connection to server in second
cipsend_totime out of send data to server in second
Returns:
0 on success, -1 on error

Definition at line 335 of file SIM5360.cpp.

int settingSMS ( void   )

Set SMS format and processing mode.

Returns:
0 on success, -1 on error

Definition at line 216 of file SIM5360.cpp.