mbed Weather Platform firmware http://mbed.org/users/okini3939/notebook/mbed-weather-platform-firmware/

Dependencies:   EthernetNetIf SDHCFileSystem I2CLEDDisp Agentbed NTPClient_NetServices mbed BMP085 HTTPClient ConfigFile I2CLCD

Revision:
7:0d3484dc13a9
Parent:
6:060cb9725ce3
Child:
9:8c63e4f3edab
--- a/func.cpp	Wed Jan 12 14:16:20 2011 +0000
+++ b/func.cpp	Thu Jan 13 12:35:51 2011 +0000
@@ -4,9 +4,13 @@
 #include "EthernetNetIf.h"
 #include "NTPClient.h"
 #include "HTTPClient.h"
+#include "conf.h"
 
 #define TIMEZONE 9
 //#define NONBLOCKING
+/** @file
+ * @brief mbed Weather Platform
+ */
 
 #define STATION_URL "http://weather.sugakoubou.com/p"
 #define TWITTER_URL "http://api.supertweet.net/1/statuses/update.xml"
@@ -14,7 +18,7 @@
 extern Serial pc;
 extern int seq;
 extern char filename[];
-extern ConfigFile conf;
+extern Config conf;
 extern DigitalOut led1, led2, led3, led4;
 
 extern EthernetNetIf *eth; 
@@ -211,113 +215,3 @@
     }
 //    ntp->close();
 }
-
-int check_action (char type) {
-    int i, j, count;
-    float value;
-    time_t sec = time(NULL) + (60 * 60 * 9);
-    struct tm *tim = localtime(&sec);
-
-    for(i = 0; i < conf.actionscount; i ++) {
-        if (conf.actions[i].action != type) continue;
-        
-        count = 0;
-        for (j = 0; j < conf.actions[i].count; j ++) {
-            switch (conf.actions[i].exps[j].key) {
-            case 'P':
-                value = pres;
-                break;
-            case 'T':
-                value = temp;
-                break;
-            case 'H':
-                value = humi;
-                break;
-            case 'A':
-                value = anemo;
-                break;
-            case 'V':
-                value = vane;
-                break;
-            case 'R':
-                value = rain;
-                break;
-
-            case 'y':
-                value = tim->tm_year + 1900;
-                break;
-            case 'm':
-                value = tim->tm_mon;
-                break;
-            case 'd':
-                value = tim->tm_mday;
-                break;
-            case 'h':
-                value = tim->tm_hour;
-                break;
-            case 'i':
-                value = tim->tm_min;
-                break;
-            case 's':
-                value = tim->tm_sec;
-                break;
-
-            default:
-                value = 0;
-                break;
-            }
-
-            switch (conf.actions[i].exps[j].expression) {
-            case EXP_EQ:
-                if (value == conf.actions[i].exps[j].value) {
-                    count ++;
-                }
-                break;
-            case EXP_NE:
-                if (value != conf.actions[i].exps[j].value) {
-                    count ++;
-                }
-                break;
-            case EXP_LE:
-                if (value <= conf.actions[i].exps[j].value) {
-                    count ++;
-                }
-                break;
-            case EXP_LT:
-                if (value < conf.actions[i].exps[j].value) {
-                    count ++;
-                }
-                break;
-            case EXP_GE:
-                if (value >= conf.actions[i].exps[j].value) {
-                    count ++;
-                }
-                break;
-            case EXP_GT:
-                if (value > conf.actions[i].exps[j].value) {
-                    count ++;
-                }
-                break;
-            case EXP_MOD:
-                if ((int)value % (int)conf.actions[i].exps[j].value) {
-                    count ++;
-                }
-                break;
-            case EXP_NMOD:
-                if (! (int)value % (int)conf.actions[i].exps[j].value) {
-                    count ++;
-                }
-                break;
-
-            default:
-                count ++;
-                break;
-            }
-        }
-        if (count == conf.actions[i].count) {
-            return 1;
-        }
-    }
-    return 0;
-}
-