1
Dependencies: Clients_Requests EthernetInterface HTTPServer NTPClient One_Wire_Function SimpleSMTPClient mbed-rpc mbed-rtos mbed
Fork of _PE2E_12-04_EthernetInterfaceServer by
Revision 1:2a82db3db4ae, committed 2017-11-27
- Comitter:
- ChesterLin
- Date:
- Mon Nov 27 06:06:53 2017 +0000
- Parent:
- 0:51b0b8c2af12
- Commit message:
- W
Changed in this revision
diff -r 51b0b8c2af12 -r 2a82db3db4ae Clients_Requests.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Clients_Requests.lib Mon Nov 27 06:06:53 2017 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/ChesterLin/code/Clients_Requests/#cde2733d9088
diff -r 51b0b8c2af12 -r 2a82db3db4ae EthernetInterface.lib --- a/EthernetInterface.lib Fri Dec 09 08:06:33 2016 +0000 +++ b/EthernetInterface.lib Mon Nov 27 06:06:53 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/EthernetInterface/#4d7bff17a592 +https://os.mbed.com/users/ChesterLin/code/EthernetInterface/#ab41dbf9d9cf
diff -r 51b0b8c2af12 -r 2a82db3db4ae NTPClient.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NTPClient.lib Mon Nov 27 06:06:53 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/DieterGraef/code/NTPClient/#584a18640e84
diff -r 51b0b8c2af12 -r 2a82db3db4ae One_Wire_Function.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/One_Wire_Function.lib Mon Nov 27 06:06:53 2017 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/ChesterLin/code/One_Wire_Function/#3e574710804f
diff -r 51b0b8c2af12 -r 2a82db3db4ae SimpleSMTPClient.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SimpleSMTPClient.lib Mon Nov 27 06:06:53 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/bhakti08/code/SimpleSMTPClient/#085f37025cb9
diff -r 51b0b8c2af12 -r 2a82db3db4ae main.cpp --- a/main.cpp Fri Dec 09 08:06:33 2016 +0000 +++ b/main.cpp Mon Nov 27 06:06:53 2017 +0000 @@ -1,26 +1,72 @@ - -/* Program Example: 12.4 mbed file server setup - */ #include "mbed.h" #include "EthernetInterface.h" #include "HTTPServer.h" #include "FsHandler.h" +#include "getData.h" +#include "rtos.h" +#include "OneWire_Functions.h" + EthernetInterface eth; // define Ethernet interface LocalFileSystem fs("webfs"); // define Local file system HTTPServer svr; // define HHTP server object +Thread Threadtemp; +Thread threadsvr; +Serial pc(USBTX,USBRX); +OneWire owp(p21); -int main() { - eth.init("192.168.1.101","255.255.255.0","192.168.1.1"); // initialise Ethernet - eth.connect(); // connect Ethernet - HTTPFsRequestHandler::mount("/webfs/", "/"); // mount file server handler - svr.addHandler<HTTPFsRequestHandler>("/"); // add handler to server object - svr.start(80, ð); // bind server to port 80 - while(1) - { - svr.poll(); // continuously poll for Ethernet messages to server - } +void threadstart() +{ + eth.init(); + eth.connect(); + HTTPFsRequestHandler::mount("/webfs/","/"); + svr.addHandler<HTTPFsRequestHandler>("/"); + //add the path to the request handler + svr.addHandler<getData>("/setreso"); + svr.addHandler<getData>("/get"); + svr.addHandler<getData>("/setalert"); + + svr.start(80,ð);// start the web server + while(1) { + svr.poll();// continuously poll for Ethernet messages to server + +// address to locate index +// http://192.168.1.100/index.htm + } +} +void readData() +{ + pc.printf("\n\rStarting Initilization One Wire Device...\n\r"); + //set resolution and alarm temperature to default. + owp.Change_Res(); + pc.printf("\n\rFinish Initilization.\n\r"); + + + while(1) { + + pc.printf("\n\rNow Searching Alarm...\n\r"); + + if(owp.Read_alarm_Email()) { + + pc.printf("\n\rFound one device is alarming.\n\r"); + //pc.printf("\n\r"); + + } else { + pc.printf("No device is alarming\n\r"); + + } + Threadtemp.wait(10000); + } } -// address to locate HOME.HTM -// http://192.168.1.101/HOME.HTM \ No newline at end of file +int main() +{ + + pc.printf("\n\rStart server"); + threadsvr.start(threadstart); + + pc.printf("\n\rStart read temp"); + Threadtemp.start(readData); + +} +
diff -r 51b0b8c2af12 -r 2a82db3db4ae mbed-rpc.lib --- a/mbed-rpc.lib Fri Dec 09 08:06:33 2016 +0000 +++ b/mbed-rpc.lib Mon Nov 27 06:06:53 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rpc/#a6fe8e713f64 +http://mbed.org/users/mbed_official/code/mbed-rpc/#33e21ae4d434
diff -r 51b0b8c2af12 -r 2a82db3db4ae mbed-rtos.lib --- a/mbed-rtos.lib Fri Dec 09 08:06:33 2016 +0000 +++ b/mbed-rtos.lib Mon Nov 27 06:06:53 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#bdd541595fc5 +http://mbed.org/users/mbed_official/code/mbed-rtos/#5713cbbdb706
diff -r 51b0b8c2af12 -r 2a82db3db4ae mbed.bld --- a/mbed.bld Fri Dec 09 08:06:33 2016 +0000 +++ b/mbed.bld Mon Nov 27 06:06:53 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/99a22ba036c9 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/fd96258d940d \ No newline at end of file