FIAP (IEEE1888) library
Dependents: Fetch_IEEE1888_Storage IEEE1888_MULTI_SENSOR_GW
Fork of FiapV2 by
fiap.h
- Committer:
- strysd
- Date:
- 2013-03-02
- Revision:
- 19:101d8775b33d
- Parent:
- 15:3bd6f70e57e2
File content as of revision 19:101d8775b33d:
// IEEE1888 / FIAP Uploader Library for Arduino // // 2011/09/19 ver.1 H.Inoue & H.Ochiai // 2011/12/31 Ver.1 for mbed Y.Tauchi // 2013/02 inherited repository by S.Yoshida // --------- FIAP.h --------- #ifndef MBED_FIAP_H #define MBED_FIAP_H #include "mbed.h" #include "HTTPClient.h" // return code of post method #define FIAP_UPLOAD_OK 0 // Succeeded #define FIAP_UPLOAD_CONNFAIL 1 // Connection faild (Socket I/O error) #define FIAP_UPLOAD_DNSERR 2 // DNS error #define FIAP_UPLOAD_HTTPERR 3 // HTTP Server error (The response was not "200 OK") #define FIAP_UPLOAD_FIAPERR 4 // FIAP Server error // use fetch_last_data() if true #define USE_FETCH true /** fiap_element *@param char* cid Point ID *@param char* value data *@param uint16_t year nnnn *@param uint8_t month 1-12 *@param uint8_t day 1-31 *@param uint8_t hour 0-23 *@param uint8_t minute 0-59 *@param uint8_t second 0-59 *@param char* timezone -nn:nn, +nn:nn */ struct fiap_element { char* cid; char* value; uint16_t year; uint8_t month; uint8_t day; uint8_t hour; uint8_t minute; uint8_t second; char* timezone; }; /** FIAP Class */ class FIAP { public: /** Create fiap object * @param Storage FIAP Storage Addrees * @param _use_fetch use fetch mode if true, write mode if false */ FIAP(char Storage[], bool _use_fetch); FIAP(char Storage[]); FIAP(); /** Set Storage URL * @param Storage FIAP Storage Addrees */ void setStorage(char Storage[]); /* Set mode * @param _use_fetch use fetch mode if true, write mode if false */ void setMode(bool _use_fetch); /** post * @param v data vaule * @param esize number of data */ int post(struct fiap_element* v, unsigned int esize); /** fetch last data * @param v Return Values * @return network_error */ int fetch_last_data(struct fiap_element* v /*, unsigned int esize*/); /** get status text * @param r HTTPResult * @preturn status text */ char* HTTPStatusText(HTTPResult r); /** debug_mode * Output XML and Error */ bool debug_mode; private: bool _use_fetch;//use fetch mode if true, write mode if false char _fiap_storage[100];//FIAP Storage Addrees char _soap_header[256]; char _soap_footer[256]; char _soap_action[32]; char _soap_text[2000]; void myprintf(char*); }; #endif