Test of USSD commands transmission over the Vodafone network with the Vodafone library

Dependencies:   VodafoneUSBModem mbed-rtos mbed

Fork of VodafoneK3770USSDTestBeta by Donatien Garnier

Revision:
1:e5d64ece3a8c
Parent:
0:5c60462d9282
--- a/main.cpp	Thu May 31 16:12:08 2012 +0000
+++ b/main.cpp	Fri Aug 17 16:39:54 2012 +0000
@@ -1,94 +1,38 @@
-/* net_ussd_test.cpp */
-/*
-Copyright (C) 2012 ARM Limited.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-#define __DEBUG__ 4 //Maximum verbosity
-#ifndef __MODULE__
-#define __MODULE__ "net_ussd_test.cpp"
-#endif
+#include "mbed.h"
+#include "VodafoneUSBModem.h"
 
 #define USSD_COMMAND "*#134#"
 
-#include "core/fwk.h"
-#include "mbed.h"
+void test(void const*) 
+{
+    VodafoneUSBModem modem;
+    char result[32];
 
-#include "rtos.h"
+    printf("Sending %s on USSD channel\n", USSD_COMMAND);
 
-#include "if/VodafoneK3770.h"
+    int ret = modem.sendUSSD(USSD_COMMAND, result, 32);
+    if(ret)
+    {
+      printf("Send USSD command returned %d\n", ret);
+    } 
 
-extern "C" void HardFault_Handler() {
-    error("Hard Fault!\n");
+    printf("Result of command: %s\n", result);
+
+
+    while(1) {
+    }
 }
 
-DigitalOut led1(LED1);
-DigitalOut led2(LED2);
-DigitalOut led3(LED3);
-DigitalOut led4(LED4);
 
-void test(void const*) {
-  VodafoneK3770 threeg;
-
-  DBG("Hello!");
-    
-  char result[32];
-
-  DBG("Sending %s on USSD channel", USSD_COMMAND);
-
-  int ret = threeg.sendUSSD(USSD_COMMAND, result, 32);
-  if(ret != OK)
+int main()
+{
+  Thread testTask(test, NULL, osPriorityNormal, 1024 * 4);
+  DigitalOut led(LED1);
+  while(1)
   {
-    ERR("Send USSD command returned %d", ret);
+    led=!led;
+    Thread::wait(1000);  
   }
 
-  DBG("Result of command: %s", result);
-
-  while(true)
-  {
-    Thread::wait(1000);
-  }
-
-}
-
-void keepAlive(void const*) {
-   while(1)
-   {
-     led1=!led1;
-     Thread::wait(500);
-   }
+  return 0;
 }
-
-void tick()
-{
-  led4=!led4;
-}
-
-int main() {
-  Ticker t;
-  t.attach(tick,1);
-  DBG_INIT();
-
-  Thread testTask(test, NULL, osPriorityNormal, 1024*4);
-  keepAlive(NULL);
-
-    
-    return 0;
-}