Fork HTTPClient and Modfiy code for mbed 6.0

Dependents:   mbed-demo-http-get-json

Revision:
40:bcb19f8dbba3
Parent:
39:21fc7a4b6927
Child:
41:37e7df011c1f
--- a/data/HTTPiCal.cpp	Fri Mar 10 02:53:09 2017 +0000
+++ b/data/HTTPiCal.cpp	Tue Mar 14 02:59:32 2017 +0000
@@ -1,6 +1,6 @@
 #include "HTTPiCal.h"
 
-#define DEBUG "iCal"
+//#define DEBUG "iCal"
 #include <cstdio>
 #if (defined(DEBUG) && !defined(TARGET_LPC11U24))
 #define DBG(x, ...)  std::printf("[DBG %s %3d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
@@ -47,6 +47,7 @@
 void HTTPiCal::writeReset() {
     //INFO("writeReset()");
     EventCount = 0;
+    seeking = idle;
     lineBuf[0] = '\0';
 }
 
@@ -57,13 +58,14 @@
         
     pEOL = strchr(pStart, '\n');
     //INFO("\r\n\r\nwrite[%d:%d] = \r\n%s\r\nend-write\r\n", len, pEOL - pStart, buf);
+    //printf("lineBuf:[%d] %s\r\n", len, buf);
     while (pEOL && (pEOL - pStart) < len) {
         int lbLen = strlen(lineBuf);
         strncpy(lineBuf + lbLen, pStart, (pEOL - pStart));
         lineBuf[lbLen + (pEOL - pStart) + 1] = '\0';
         if (lineBuf[pEOL - pStart + lbLen - 1] == '\r')
             lineBuf[pEOL - pStart + lbLen - 1] = '\0';
-        //INFO("lineBuf:[%s]", lineBuf);
+        //printf("lineBuf:[%s]\r\n", lineBuf);
         ParseICalStream(lineBuf, gridStartTime, gridEndTime, -300);
         //INFO("");
         lineBuf[0] = '\0';
@@ -107,10 +109,6 @@
 
 const char * RPT_DAYS[] = { "SU", "MO", "TU", "WE", "TH", "FR", "SA", "" };
 
-int HTTPiCal::GetNumEvents(void)
-{
-    return EventCount;
-}
 
 const char * HTTPiCal::RepeatDayAbbrev(int i)
 {
@@ -598,19 +596,6 @@
     return tzo;
 }
 
-void HTTPiCal::ParseICalStart(void) {
-    tzAdjusted = false;
-    seeking = idle;
-    EventCount = 0;
-
-}
-
-int HTTPiCal::ParseICalClose(void) {
-    if (EventCount > 0)
-        SortEvents();
-    return GetNumEvents();
-}
-
 int HTTPiCal::ParseICalStream(const char * pStart, time_t gridStartTime, time_t gridEndTime, tz_min_t tzoMin, bool showEvents)
 {
     INFO("Parse(%s)", pStart);
@@ -667,8 +652,10 @@
                             EventList[EventCount].End += (60 * tzoMin);
                     }
                     // Process it
-                    if (showEvents)
+                    if (showEvents) {
+                        //printf("ev: %d\r\n", EventCount);
                         ShowEventInfo(EventList[EventCount]);
+                    }
                     // Force to ALWAYS
                     time_t aStart = EventList[EventCount].Start;
                     time_t aEnd   = EventList[EventCount].End;