Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GPRS by
Diff: gprs.cpp
- Revision:
- 2:16985da3a446
- Parent:
- 1:642a8dbe076c
- Child:
- 3:48ee24a4b0f3
--- a/gprs.cpp Fri Nov 15 03:40:35 2013 +0000
+++ b/gprs.cpp Mon Nov 18 06:05:17 2013 +0000
@@ -39,7 +39,7 @@
#define DEFALUT_TIMEOUT 5
-int gprs::init(void)
+int GPRS::init(void)
{
wait(0.5);
if(0 != checkSIMStatus()) { //check SIM card status
@@ -58,7 +58,7 @@
return 0;
}
-int gprs::readBuffer(char *buffer,int count)
+int GPRS::readBuffer(char *buffer,int count)
{
int i = 0;
timeCnt.start(); // start timer
@@ -90,12 +90,12 @@
}
}
-void gprs::sendCmd(char *cmd)
+void GPRS::sendCmd(char *cmd)
{
gprsSerial.puts(cmd);
}
-int gprs::waitForResp(char *resp, int timeout)
+int GPRS::waitForResp(char *resp, int timeout)
{
int len = strlen(resp);
int sum=0;
@@ -125,13 +125,13 @@
-int gprs::sendCmdAndWaitForResp(char *cmd, char *resp, int timeout)
+int GPRS::sendCmdAndWaitForResp(char *cmd, char *resp, int timeout)
{
sendCmd(cmd);
return waitForResp(resp,timeout);
}
-int gprs::checkSIMStatus(void)
+int GPRS::checkSIMStatus(void)
{
char gprsBuffer[30];
int count = 0;
@@ -154,7 +154,7 @@
return 0;
}
-int gprs::checkSignalStrength(void)
+int GPRS::checkSignalStrength(void)
{
char gprsBuffer[100];
int index,count = 0;
@@ -177,7 +177,7 @@
return index;
}
-int gprs::networkInit(void)
+int GPRS::networkInit(void)
{
//for GPRS
if(0 != sendCmdAndWaitForResp("AT+CGREG?\r\n","+CGREG: 0,1",DEFALUT_TIMEOUT)) { //Open GPRS
@@ -192,7 +192,7 @@
return 0;
}
-int gprs::sendSMS(char *number, char *data)
+int GPRS::sendSMS(char *number, char *data)
{
char cmd[64];
if(0 != sendCmdAndWaitForResp("AT+CMGF=1\r\n", "OK", DEFALUT_TIMEOUT)) { // Set message mode to ASCII
@@ -213,7 +213,7 @@
return 0;
}
-int gprs::readSMS(char *buffer, char *message, bool check)
+int GPRS::readSMS(char *buffer, char *message, bool check)
{
int index,i = 0;
char gprsBuffer[100];
@@ -253,7 +253,7 @@
return 0;
}
-int gprs::deleteSMS(int index)
+int GPRS::deleteSMS(int index)
{
char cmd[64];
snprintf(cmd,sizeof(cmd),"AT+CMGD=%d\r\n",index);
@@ -261,7 +261,7 @@
return 0;
}
-int gprs::callUp(char *number)
+int GPRS::callUp(char *number)
{
if(0 != sendCmdAndWaitForResp("AT+COLP=1\r\n","OK",5)) {
ERROR("COLP");
@@ -272,13 +272,13 @@
return 0;
}
-int gprs::answer(void)
+int GPRS::answer(void)
{
gprsSerial.printf("ATA\r\n");
return 0;
}
-int gprs::loop(bool check)
+int GPRS::loop(bool check)
{
char gprsBuffer[100];
int i = 0;
@@ -325,7 +325,7 @@
/****************************************GPRS TCP CONNECT************************************/
-int gprs::connectTCP(char *ip, char *port)
+int GPRS::connectTCP(char *ip, char *port)
{
char cipstart[50];
//char ipaddr[20];
@@ -357,7 +357,7 @@
#endif
return 0;
}
-int gprs::sendTCPData(char *data)
+int GPRS::sendTCPData(char *data)
{
char cmd[64];
int len = strlen(data);
@@ -374,20 +374,20 @@
return 0;
}
-int gprs::closeTCP(void)
+int GPRS::closeTCP(void)
{
sendCmd("AT+CIPCLOSE\r\n");
return 0;
}
-int gprs::shutTCP(void)
+int GPRS::shutTCP(void)
{
sendCmd("AT+CIPSHUT\r\n");
return 0;
}
/****************************************GPRS DEBUG******************************************/
-void gprs::serialDebug(PinName tx, PinName rx)
+void GPRS::serialDebug(PinName tx, PinName rx)
{
char buffer[64];
int count = 0;
