Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Files at this revision

API Documentation at this revision

Comitter:
ashleymills
Date:
Wed Sep 19 09:52:46 2012 +0000
Parent:
45:f68fea0831d7
Child:
47:85c30274cc9b
Commit message:
Updated to latest version of bleeding edge dongle library.; Added code for DNS test.

Changed in this revision

Tests/Test08.cpp Show annotated file Show diff for this revision Revisions of this file
VodafoneUSBModem_bleedingedge.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Tests/Test08.cpp	Tue Sep 18 15:38:54 2012 +0000
+++ b/Tests/Test08.cpp	Wed Sep 19 09:52:46 2012 +0000
@@ -17,8 +17,34 @@
       LOG("Failed to connect to internet");
       outcome = false;
    }
-       
-   LOG("Doing DNS lookup for X");
+   struct hostent *server;
+   do {
+      while(1) {
+         LOG("Getting host address");
+         server = ::gethostbyname("m2mthings.com");
+         if(server==NULL) {
+            LOG("Failure getting host address!");
+            outcome = false;
+            //break;
+         } else {
+            LOG("got host address, length %d",server->h_length);
+            break;
+         }
+      }
+      
+      if(server->h_length==4) {
+         LOG("DNS lookup returned %d.%d.%d.%d",
+            server->h_addr[0],
+            server->h_addr[1],
+            server->h_addr[2],
+            server->h_addr[3]
+         );
+      } else {
+         LOG("Only IPv4 addresses are supported.");
+         outcome = false;
+         break;
+      }
+   } while(0);
    
    _modem->disconnect();
    return outcome;
--- a/VodafoneUSBModem_bleedingedge.lib	Tue Sep 18 15:38:54 2012 +0000
+++ b/VodafoneUSBModem_bleedingedge.lib	Wed Sep 19 09:52:46 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/donatien/code/VodafoneUSBModem_bleedingedge/#be311326ee06
+http://mbed.org/users/donatien/code/VodafoneUSBModem_bleedingedge/#45c3b5cb0234
--- a/main.cpp	Tue Sep 18 15:38:54 2012 +0000
+++ b/main.cpp	Wed Sep 19 09:52:46 2012 +0000
@@ -37,7 +37,7 @@
   LOG("Running tests.");
   TestManager *m = new TestManager(&modem);
   m->runTestProfile(TESTS_AUTOMATED);
-  //m->executeTest(25);
+  //m->runTest(8);
   //m->executeTest(26);
   //m->executeTest(10);
   //m->executeTest(21);
@@ -46,14 +46,12 @@
 
 void setTime() {
   struct tm t;
-  t.tm_year  = 2012;
-  t.tm_mon   = 8;
-  t.tm_mday  = 23;
-  t.tm_hour  = 9;
-  t.tm_min   = 19;
+  t.tm_year  = 2000;
+  t.tm_mon   = 0;
+  t.tm_mday  = 0;
+  t.tm_hour  = 0;
+  t.tm_min   = 0;
   t.tm_sec   = 0;
-  t.tm_year -= 1900;
-  t.tm_mon  -= 1;
   set_time(mktime(&t));
 }
 
@@ -63,7 +61,7 @@
   DBG_SET_SPEED(115200);
   DBG_SET_NEWLINE("\r\n");
 
-  //setTime();
+  setTime();
   size_t currentTime = time(NULL);
   fprintf(stdout,"Invocation time: %s\r\n",ctime(&currentTime));