FIAP (IEEE1888) library
Dependents: Fetch_IEEE1888_Storage IEEE1888_MULTI_SENSOR_GW
Fork of FiapV2 by
fiap.h
00001 // IEEE1888 / FIAP Uploader Library for Arduino 00002 // 00003 // 2011/09/19 ver.1 H.Inoue & H.Ochiai 00004 // 2011/12/31 Ver.1 for mbed Y.Tauchi 00005 // 2013/02 inherited repository by S.Yoshida 00006 00007 // --------- FIAP.h --------- 00008 #ifndef MBED_FIAP_H 00009 #define MBED_FIAP_H 00010 00011 #include "mbed.h" 00012 #include "HTTPClient.h" 00013 00014 // return code of post method 00015 #define FIAP_UPLOAD_OK 0 // Succeeded 00016 #define FIAP_UPLOAD_CONNFAIL 1 // Connection faild (Socket I/O error) 00017 #define FIAP_UPLOAD_DNSERR 2 // DNS error 00018 #define FIAP_UPLOAD_HTTPERR 3 // HTTP Server error (The response was not "200 OK") 00019 #define FIAP_UPLOAD_FIAPERR 4 // FIAP Server error 00020 00021 // use fetch_last_data() if true 00022 #define USE_FETCH true 00023 00024 /** fiap_element 00025 *@param char* cid Point ID 00026 *@param char* value data 00027 *@param uint16_t year nnnn 00028 *@param uint8_t month 1-12 00029 *@param uint8_t day 1-31 00030 *@param uint8_t hour 0-23 00031 *@param uint8_t minute 0-59 00032 *@param uint8_t second 0-59 00033 *@param char* timezone -nn:nn, +nn:nn 00034 */ 00035 struct fiap_element { 00036 char* cid; 00037 char* value; 00038 uint16_t year; 00039 uint8_t month; 00040 uint8_t day; 00041 uint8_t hour; 00042 uint8_t minute; 00043 uint8_t second; 00044 char* timezone; 00045 }; 00046 00047 /** FIAP Class */ 00048 class FIAP { 00049 public: 00050 /** Create fiap object 00051 * @param Storage FIAP Storage Addrees 00052 * @param _use_fetch use fetch mode if true, write mode if false 00053 */ 00054 FIAP(char Storage[], bool _use_fetch); 00055 FIAP(char Storage[]); 00056 FIAP(); 00057 00058 /** Set Storage URL 00059 * @param Storage FIAP Storage Addrees 00060 */ 00061 void setStorage(char Storage[]); 00062 00063 /* Set mode 00064 * @param _use_fetch use fetch mode if true, write mode if false 00065 */ 00066 void setMode(bool _use_fetch); 00067 00068 /** post 00069 * @param v data vaule 00070 * @param esize number of data 00071 */ 00072 int post(struct fiap_element* v, unsigned int esize); 00073 00074 /** fetch last data 00075 * @param v Return Values 00076 * @return network_error 00077 */ 00078 int fetch_last_data(struct fiap_element* v /*, unsigned int esize*/); 00079 00080 /** get status text 00081 * @param r HTTPResult 00082 * @preturn status text 00083 */ 00084 char* HTTPStatusText(HTTPResult r); 00085 00086 /** debug_mode 00087 * Output XML and Error 00088 */ 00089 bool debug_mode; 00090 00091 private: 00092 bool _use_fetch;//use fetch mode if true, write mode if false 00093 char _fiap_storage[100];//FIAP Storage Addrees 00094 char _soap_header[256]; 00095 char _soap_footer[256]; 00096 char _soap_action[32]; 00097 char _soap_text[2000]; 00098 void myprintf(char*); 00099 }; 00100 00101 #endif
Generated on Wed Jul 13 2022 11:03:25 by 1.7.2