fetch last data from IEEE1888 (FIAP) Storage.
Dependencies: EthernetInterface Fiap HTTPClientForFIAP mbed-rtos mbed spxml
Fork of temp_FIAP_fetch by
This program fetches last data from FIAP storage with IEEE1888 format.
Currently, You can confirm the data in console when FIAP_DEBUG_MODE is set to true.
Note: You should locate storage.txt into mbed memory at least before using this program. The storage.txt contains storage url, see example at IEEE1888_MULTI_SENSOR_GW/main.h .
And you should define FIAP_DEBUG_MODE and other constants in Fetch_IEEE1888_Storage/main.h file.
You can launch an AMI ( Amazon Machine Image ) on Amazon Web Service ( http://aws.amazon.com/ ) as the FIAP storage. The AMI is named as "IEEE1888 Storage", registered at Tokyo region.
If You need more information about the AMI, see http://d.hatena.ne.jp/satoruyoshida/20130210/1360508112 .
from here, in Japanese. このプログラムは IEEE1888 形式で FIAP Storage からデータを取得する例です。 現在、その値は FIAP_DEBUG_MODE を true に設定するとコンソールで確認できます。
このプログラムを使用する前に、少なくとも FIAP Storage の url を記載した sotrage.txt をメモリに格納しておく必要があります。 url の例は、 IEEE1888_MULTI_SENSOR_GW の main.h ファイルにあります。
FIAP_DEBUG_MODE およびその他の定数は Fetch_IEEE1888_Storage/main.h に存在します。
Amazon Web Service に用意した AMI を利用して FIAP Storage を起動することができます。IEEE1888 Storage という名前の公開 AMI です。
この AMI について詳しくは、http://d.hatena.ne.jp/satoruyoshida/20130210/1360508112 をご覧ください。
main.cpp@1:d62d57f9a180, 2012-08-20 (annotated)
- Committer:
- yueee_yt
- Date:
- Mon Aug 20 12:53:57 2012 +0000
- Revision:
- 1:d62d57f9a180
- Parent:
- 0:27cf9683af17
- Child:
- 3:9a1a6ebcdaa7
1st Fetch Sample Program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yueee_yt | 0:27cf9683af17 | 1 | #include "mbed.h" |
yueee_yt | 0:27cf9683af17 | 2 | #include "TextLCD.h" |
yueee_yt | 0:27cf9683af17 | 3 | #include "EthernetInterface.h" |
yueee_yt | 0:27cf9683af17 | 4 | #include "fiap.h" |
yueee_yt | 0:27cf9683af17 | 5 | |
yueee_yt | 0:27cf9683af17 | 6 | EthernetInterface eth; |
yueee_yt | 0:27cf9683af17 | 7 | |
yueee_yt | 0:27cf9683af17 | 8 | TextLCD lcd(p24, p26, p27, p28, p29, p30); |
yueee_yt | 0:27cf9683af17 | 9 | DigitalOut led(LED1); |
yueee_yt | 0:27cf9683af17 | 10 | char timezone[] = "+09:00"; // JST |
yueee_yt | 0:27cf9683af17 | 11 | FIAP fiap("http://192.168.1.3/axis2/services/FIAPStorage"); |
yueee_yt | 1:d62d57f9a180 | 12 | char atemp[10]; |
yueee_yt | 0:27cf9683af17 | 13 | struct fiap_element element[]= { |
yueee_yt | 1:d62d57f9a180 | 14 | {"http://csse-tech.jp/temp_tauchi",atemp,NULL,NULL,NULL,NULL,NULL,NULL,timezone}, |
yueee_yt | 0:27cf9683af17 | 15 | }; |
yueee_yt | 0:27cf9683af17 | 16 | |
yueee_yt | 0:27cf9683af17 | 17 | |
yueee_yt | 0:27cf9683af17 | 18 | void tick(void ) |
yueee_yt | 0:27cf9683af17 | 19 | { |
yueee_yt | 0:27cf9683af17 | 20 | float temp; |
yueee_yt | 0:27cf9683af17 | 21 | led=!led; |
yueee_yt | 1:d62d57f9a180 | 22 | fiap.fetch_last_data(element,1); |
yueee_yt | 1:d62d57f9a180 | 23 | temp=atof(element[0].value); |
yueee_yt | 0:27cf9683af17 | 24 | lcd.locate(0,1); |
yueee_yt | 1:d62d57f9a180 | 25 | lcd.printf("%2d:%2d:%2d %4.1fDeg",element[0].hour,element[0].minute,element[0].second,temp); |
yueee_yt | 1:d62d57f9a180 | 26 | } |
yueee_yt | 0:27cf9683af17 | 27 | |
yueee_yt | 0:27cf9683af17 | 28 | int main() |
yueee_yt | 0:27cf9683af17 | 29 | { |
yueee_yt | 0:27cf9683af17 | 30 | eth.init(); //Use DHCP |
yueee_yt | 0:27cf9683af17 | 31 | eth.connect(); |
yueee_yt | 0:27cf9683af17 | 32 | lcd.cls(); |
yueee_yt | 0:27cf9683af17 | 33 | lcd.locate(0,0); |
yueee_yt | 0:27cf9683af17 | 34 | lcd.printf("%s", eth.getIPAddress()); |
yueee_yt | 0:27cf9683af17 | 35 | //fiap.debug_mode=true; |
yueee_yt | 0:27cf9683af17 | 36 | while(true) { |
yueee_yt | 0:27cf9683af17 | 37 | tick(); |
yueee_yt | 0:27cf9683af17 | 38 | wait(2); |
yueee_yt | 0:27cf9683af17 | 39 | } |
yueee_yt | 0:27cf9683af17 | 40 | } |