Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface FiapV2 HTTPClientForSOAP NTPClient mbed-rtos mbed spxml
Fork of FIAPHelloWorld by
Diff: main.cpp
- Revision:
- 1:e3d31b5dee7a
- Parent:
- 0:0c7f2ea60a75
diff -r 0c7f2ea60a75 -r e3d31b5dee7a main.cpp
--- a/main.cpp Sun Jan 01 14:46:02 2012 +0000
+++ b/main.cpp Mon Apr 13 09:15:30 2015 +0000
@@ -1,40 +1,49 @@
#include "mbed.h"
-#include "EthernetNetIf.h"
+#include "EthernetInterface.h"
#include "NTPClient.h"
#include "fiap.h"
-#define ntp_server "ntp server address"
+#define NtpServer "ntp.nict.jp"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
-EthernetNetIf eth;
+EthernetInterface eth;
NTPClient ntp;
-FIAP fiap("http://192.168.1.5/axis2/services/FIAPStorage","http://test.fiap.org/mbed_hello/");
+//FIAP fiap("http://192.168.1.5/axis2/services/FIAPStorage","http://test.fiap.org/mbed_hello/");
+FIAP fiap("http://192.168.1.3/axis2/services/FIAPStorage");
char timezone[] = "+09:00"; // JST
-struct fiap_element element[]={
- {"P1",NULL,NULL,timezone},
- {"P2",NULL,NULL,timezone},
+struct fiap_element element[]= {
+ {"P1",NULL,NULL,NULL,NULL,NULL,NULL,NULL,timezone},
+ {"P2",NULL,NULL,NULL,NULL,NULL,NULL,NULL,timezone},
};
+//struct fiap_element element[]={
+// {"P1",NULL,NULL,timezone},
+// {"P2",NULL,NULL,timezone},
+//};
+
int main() {
led1=led2=led3=led4=0;
fiap.debug_mode=true;
//EthernetNetIf initialize
- EthernetErr ethErr = eth.setup();
- if (ethErr) {
+// EthernetErr ethErr = eth.setup();
+ eth.init(); //Use DHCP
+ eth.connect();
+ //if (ethErr) {
// lcd.locate(0,1);
// lcd.printf("Error %d in setup.\n", ethErr);
- return -1;
- }
+ // return -1;
+ //}
led1=1;
//NTPClient initia,lize
- Host server(IpAddr(), 123, ntp_server);
- NTPResult Ntpr=ntp.setTime(server);
+ //Host server(IpAddr(), 123, ntp_server);
+ //NTPResult Ntpr=ntp.setTime(server);
+ ntp.setTime(NtpServer);
//UTC-->JST +9Hour(32400Sec)
time_t ctTime;
ctTime = time(NULL);
@@ -52,7 +61,15 @@
int s=j*pow((double)10,i);
sprintf(data,"%03d",s);
element[i].value=data;
- element[i].t=localtime(&seconds);
+ struct tm t = *localtime(&ctTime);
+ element[0].year=t.tm_year+1900;
+ element[0].month=t.tm_mon+1;
+ element[0].day=t.tm_mday;
+ element[0].hour=t.tm_hour;
+ element[0].minute=t.tm_min;
+ element[0].second=t.tm_sec;
+ fiap.post(element,1);
+// element[i].t=localtime(&seconds);
}
//do post
int ret=fiap.post(element,2);
