davide carboni / Mbed 2 deprecated pymite_http_get

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
dadaista
Date:
Mon Jul 26 15:33:32 2010 +0000
Parent:
0:14e5e829dffe
Commit message:

Changed in this revision

src/platform/mbed/main_nat.c Show annotated file Show diff for this revision Revisions of this file
--- a/src/platform/mbed/main_nat.c	Wed Jul 21 12:50:41 2010 +0000
+++ b/src/platform/mbed/main_nat.c	Mon Jul 26 15:33:32 2010 +0000
@@ -1611,6 +1611,10 @@
   pPmObj_t ptext;
   HTTPText txt;
   HTTPClient http;
+  uint8_t estring[] = "error!";
+  uint8_t const *pestring = estring;
+
+  led1 = led2 = 0;
   
   /* Raise TypeError if wrong number of args */
   if (NATIVE_GET_NUM_ARGS() != 1)
@@ -1622,14 +1626,17 @@
   
   
   
-  printf("AAAA\n");
+  printf("the url is: \n");
   
   printf(((char *)((pPmString_t)purl)->val));
-  printf("BBBB\n");
   
+ 
+  printf("connecting ...\n");
   HTTPResult r = http.get((char *)((pPmString_t)purl)->val, &txt);
+  printf("done\n");
   if(r==HTTP_OK)
   {
+    printf("OK\n");
     retval = string_new(txt.gets(), &ptext); 
     led1=1;
     led2=1;
@@ -1639,9 +1646,11 @@
   else
   {
     //PM_RAISE(retval, PM_RET_EX_TYPE);
+    printf("ERROR\n");
+    retval = string_new(&pestring, &ptext); 
     led1=0;
     led2=1;
-    NATIVE_SET_TOS(PM_NONE);
+    NATIVE_SET_TOS(ptext);
   }  
   return retval;