Simple test for USSD message.

Dependencies:   C027 UbloxUSBModem mbed

Fork of C027_USSDTest by u-blox

main.cpp

Committer:
nherriot
Date:
2014-02-24
Revision:
8:f1553dd1d597
Parent:
7:6047f1c64e8d
Child:
10:6379202ce3cb

File content as of revision 8:f1553dd1d597:

#include "mbed.h"
#include "C027.h"
#include "UbloxUSBGSMModem.h"
#include "UbloxUSBCDMAModem.h"

#define USSD_COMMAND "*#100#"

C027 c027;

void test(void const*)
{
    printf("Starting USSD test on Ublox C027, first calling mdmPower for the modem \n");
    c027.mdmPower(true);
    printf("Waiting for modem to settle after power on...\n");
    wait(5000);
    
    printf("Creating modem object...\n");
    UbloxUSBGSMModem modem; // for LISA-C use the UbloxUSBCDMAModem instead
    char result[32];
    printf("Waiting for modem to settle, just created the modem object.\n");
    wait(5000);
    
    printf("....wait over!\n");
    printf("Sending %s on USSD channel\n", USSD_COMMAND);
    int ret = modem.sendUSSD(USSD_COMMAND, result, 32);
    
    if(ret) {
        printf("Send USSD command returned %d\n", ret);
    }

    printf("Result of command: %s\n", result);

    c027.mdmPower(false);
    
    while(1) {
    }
}


int main()
{
    Thread testTask(test, NULL, osPriorityNormal, 1024 * 4);
    DigitalOut led(LED); // on rev A you should reasign the signal to A0
    while(1) {
        led=!led;
        Thread::wait(1000);
    }

    return 0;
}