give example to use GPRS Shield library

Dependencies:   GPRS mbed

Fork of GPRS_Shield_Test by wei zou

main.cpp

Committer:
lawliet
Date:
2013-11-14
Revision:
0:53b4a13adcfb
Child:
1:65d3c8a4a166

File content as of revision 0:53b4a13adcfb:

#include "mbed.h"
#include "string.h"
#include "gprs.h"

#define SERIAL_DEBUG            1
#define SEND_SMS_TEST           0
#define CALL_UP_TEST            0
#define ANSWER_TEST             0
#define READ_SMS_TEST           0
#define TCP_TEST                0

#define IP_ADDRSS               "42.96.164.52"
#define PORT                    "80"

#if 1
gprs    gprsTest;

int main(void)
{
    if(0 != gprsTest.init()){
        return -1;
    }

    #if SEND_SMS_TEST
    gprsTest.sendSMS("13925257382","hello,lawliet"); //define phone number and text
    //gprsTest.sendSMS();   // default pone number and text
    #endif

    #if CALL_UP_TEST
    //gprsTest.callUp("13925257382");
    gprsTest.callUp(NULL);
    #endif

    #if ANSWER_TEST || READ_SMS_TEST
    gprsTest.loop(1);
    #endif
    
    #if TCP_TEST
    gprsTest.connectTCP(IP_ADDRSS,PORT);
    gprsTest.sendTCPData("hello,lawliet test");
    #endif
    
    #if SERIAL_DEBUG
    gprsTest.serialDebug();
    #endif
    
    return 0;
}
#endif