FIAPライブラリ 構造体の内容が変わっています

Dependents:   temp_FIAP temp_FIAP_fetch tepco_demand BlueUSB_f_IEEE1888 ... more

Embed: (wiki syntax)

« Back to documentation index

FIAP Class Reference

FIAP Class Reference

FIAP Class. More...

#include <fiap.h>

Public Member Functions

 FIAP (char Storage[], char PointSetId[])
 Create fiap object(for WRITE)
 FIAP (char Storage[])
 Create fiap object(for FETCH)
int post (struct fiap_element *v, unsigned int esize)
 post
int fetch_last_data (struct fiap_element *v, unsigned int esize)
 fetch_maximum

Data Fields

bool debug_mode
 debug_mode Output XML and Error

Detailed Description

FIAP Class.

for mbed

Example:

 #include "mbed.h"
 #include "EthernetNetIf.h"
 #include "NTPClient.h"
 #include "fiap.h"

 #define ntp_server "ntp server address"

 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
 DigitalOut led3(LED3);
 DigitalOut led4(LED4);

 EthernetNetIf eth;
 NTPClient ntp;
 FIAP ieee1888("http://192.168.1.5/axis2/services/FIAPStorage","http://test.fiap.org/mbed_hello/");

 char timezone[] = "+09:00";  // JST

 struct fiap_element element[]={
     {"P1",NULL,NULL,timezone},
     {"P2",NULL,NULL,timezone},
 };

 int main() {
     led1=led2=led3=led4=0;
     ieee1888.debug_mode=true;
     //EthernetNetIf initialize
     EthernetErr ethErr = eth.setup();
     if (ethErr) {
         //   lcd.locate(0,1);
         //   lcd.printf("Error %d in setup.\n", ethErr);
         return -1;
     }
     led1=1;
     //NTPClient initia,lize
     Host server(IpAddr(), 123, ntp_server);
     NTPResult Ntpr=ntp.setTime(server);
     //UTC-->JST +9Hour(32400Sec)
     time_t ctTime;
     ctTime = time(NULL);
     ctTime+=32400;
     set_time(ctTime);
     led2=1;

     //post
     int i,j;
     for (j=0; j<10; j++) {
         //data initialize
         time_t seconds = time(NULL);
         for (i=0; i<2; i++) {
         char data[5];
             int s=j*pow((double)10,i);
             sprintf(data,"%03d",s);
             element[i].value=data;
             element[i].t=localtime(&seconds);
         }
         //do post
         int ret=ieee1888.post(element,2);
         if(ret!=0){
         while (1) {
         led3=!led3;
         wait(0.5);
     }
         return 0;
         }
         wait(1);
     }
     //finish
     while (1) {
         led4=!led4;
         wait(0.5);
     }
 }
 *

Definition at line 128 of file fiap.h.


Constructor & Destructor Documentation

FIAP ( char  Storage[],
char  PointSetId[] 
)

Create fiap object(for WRITE)

Parameters:
StorageFIAP Storage Addrees (ie. "http://fiap.org/axis2/services/FIAPStorage")
PointSetIdPoint Set ID(ie. http://test.fiap.jp/bldg_1/3F/)
FIAP ( char  Storage[] )

Create fiap object(for FETCH)

Parameters:
StorageFIAP Storage Addrees (ie. "http://fiap.org/axis2/services/FIAPStorage")

Definition at line 54 of file fiap.cpp.


Member Function Documentation

int fetch_last_data ( struct fiap_element v,
unsigned int  esize 
)

fetch_maximum

Parameters:
cidPoint ID s
vReturn Values
esize<=2
Returns:
network_error

Definition at line 60 of file fiap.cpp.

int post ( struct fiap_element v,
unsigned int  esize 
)

post

Parameters:
vdata vaule
esizenumber of data

Definition at line 344 of file fiap.cpp.


Field Documentation

bool debug_mode

debug_mode Output XML and Error

Definition at line 158 of file fiap.h.