Smart Clock

Dependencies:   AlarmClock DigitalClock EthernetInterface FourDigitLED HTTPClient NTPClient SDFileSystem TrainStat WeatherInfo XML_aide mbed-rtos mbed picojson wolfSSL

Files at this revision

API Documentation at this revision

Comitter:
takashikojo
Date:
Sun Jun 28 00:17:22 2015 +0000
Parent:
3:2cb03c287c22
Child:
5:e4891827f7b1
Commit message:
Added Weather Hacks

Changed in this revision

HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
TrainStat.lib Show annotated file Show diff for this revision Revisions of this file
WeatherInfo.lib Show annotated file Show diff for this revision Revisions of this file
XMLaide.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/HTTPClient.lib	Sat Jun 27 06:20:59 2015 +0000
+++ b/HTTPClient.lib	Sun Jun 28 00:17:22 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/wolfSSL/code/HTTPClient/#7fd621b83b60
+http://developer.mbed.org/users/wolfSSL/code/HTTPClient/#166aed49abf5
--- a/TrainStat.lib	Sat Jun 27 06:20:59 2015 +0000
+++ b/TrainStat.lib	Sun Jun 28 00:17:22 2015 +0000
@@ -1,1 +1,1 @@
-TrainStat#26a0a9220f01
+TrainStat#58e7fabcba89
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WeatherInfo.lib	Sun Jun 28 00:17:22 2015 +0000
@@ -0,0 +1,1 @@
+WeatherInfo#8655f1720450
--- a/XMLaide.lib	Sat Jun 27 06:20:59 2015 +0000
+++ b/XMLaide.lib	Sun Jun 28 00:17:22 2015 +0000
@@ -1,1 +1,1 @@
-XMLaide#369a19fba8a4
+XMLaide#ad5fd8c29c1f
--- a/main.cpp	Sat Jun 27 06:20:59 2015 +0000
+++ b/main.cpp	Sun Jun 28 00:17:22 2015 +0000
@@ -1,17 +1,21 @@
 #include "mbed.h"
 
 #include "EthernetInterface.h"
+#include "HTTPClient.h"
 #include "NTPClient.h"
 #include "AlarmClock.h"
 #include "TrainStat.h"
+#include "WeatherInfo.h"
 
 AlarmClock alarmclock (                          
     /* Segment 0 - 6, Dot */    D11,D6, D3, D1, D0, D10,D4, D2 , 
     /* Digit 1 - 4        */    D5, D7, D9, D12, 
     /* Alarm, Hour, Min, Tone */D13, D14, D15, PTC11
 )  ;
-
-TrainStat trainstat(YAHOO_TRAIN) ;
+ 
+TrainStat   trainstat(YAHOO_TRAIN) ;
+WeatherInfo weatherinfo(WEATHER_HACKS) ;
+HTTPClient httpClient;
 
 static void ntp(char *site)
 {
@@ -35,20 +39,33 @@
         alarmclock.poll() ;
         Thread::wait(100);
     } 
-}
- 
+} 
+#define BUFF_SIZE 1024*64
+static char recvBuff[BUFF_SIZE] ;
 void net_main(void const *av)
 {
     bool sw ;
-
+    int count = 0 ;
+    
+    trainstat.setBuff(recvBuff, BUFF_SIZE) ;
+    weatherinfo.setBuff(recvBuff, BUFF_SIZE) ;
+    
     trainstat.setLine("千代田線") ;
     while(1) {
+
         sw = !sw ;
+        /*
         if(!trainstat.getStat())
         {    printf("遅れあり\n") ; alarmclock.setBlink(true) ; }
         else
         {    printf("遅れなし\n") ; alarmclock.setBlink(false) ; }
+        */
+        trainstat.getStat() ;
+        if(count%1 ==0)
+            weatherinfo.getInfo() ;
+        
         wait(60.0) ;
+        count++ ;
     }
 }