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-18
Revision:
2:3b735ebe88b0
Parent:
1:65d3c8a4a166
Child:
3:e07b56b8b637

File content as of revision 2:3b735ebe88b0:

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

#define SERIAL_DEBUG            0
#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"

GPRS  gprsTest(P0_19, P0_18, 115200, "10086");

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

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

#if CALL_UP_TEST
    gprsTest.callUp("10086");
#endif

#if ANSWER_TEST || READ_SMS_TEST
    gprsTest.loop(0);
#endif

#if TCP_TEST
    gprsTest.connectTCP(IP_ADDRSS,PORT);
    gprsTest.sendTCPData("hello,lawliet test");
#endif

#if SERIAL_DEBUG
    gprsTest.serialDebug(USBTX,USBRX);
#endif

    return 0;
}