MurataTypeYD_RPC_Sample fixed version for 050314
Dependencies: PowerControl SNICInterface_mod2 mbed-rtos mbed
Fork of HTTPClient_WiFi_HelloWorld by
Diff: main.cpp
- Revision:
- 6:6c49fdc29825
- Parent:
- 5:3dbedd084f79
--- a/main.cpp Sat Jan 31 13:49:47 2015 +0000 +++ b/main.cpp Thu Mar 12 12:27:31 2015 +0000 @@ -1,7 +1,11 @@ #include "mbed.h" #include "SNIC_WifiInterface.h" -#include "HTTPClient.h" +// KTEC MOD START +//#include "HTTPClient.h" +#include "HTTPServer.h" +#include "RPC_Function.h" +// KTEC MOD END #if defined(TARGET_LPC1768) #include "PowerControl/EthernetPowerControl.h" #endif @@ -9,6 +13,9 @@ #define DEMO_AP_SSID "SSID" #define DEMO_AP_SECURITY_TYPE e_SEC_WPA2_AES #define DEMO_AP_SECUTIRY_KEY "PASSWORD" +// KTEC ADD START +#define PORT_NUMBER 80 +// KTEC ADD END C_SNIC_WifiInterface wifi( p9, p10, NC, NC, p30 ); @@ -16,8 +23,12 @@ Serial pc(USBTX, USBRX); #endif +// KTEC DEL START +/* HTTPClient http; char str[512]; +*/ +// KTEC DEL END int main() { @@ -30,21 +41,43 @@ wait(0.5); int s = wifi.disconnect(); if( s != 0 ) { +// KTEC ADD START + printf("wifi.disconnect error.\r\n"); +// KTEC ADD END return -1; } wait(0.3); // Connect AP - wifi.connect( DEMO_AP_SSID +// KTEC MOD START + s = wifi.connect( DEMO_AP_SSID , strlen(DEMO_AP_SSID) , DEMO_AP_SECURITY_TYPE , DEMO_AP_SECUTIRY_KEY , strlen(DEMO_AP_SECUTIRY_KEY) ); + if( s != 0 ) { + printf("wifi.connect error.\r\n"); + return -1; + } +// KTEC MOD END wait(0.5); wifi.setIPConfig( true ); wait(0.5); printf("IP Address is %s\n", wifi.getIPAddress()); + +// KTEC ADD START + HTTPServer srv; + printf("server init.\r\n"); + srv.init(PORT_NUMBER); + + wait(1); + printf("server running.\r\n"); + srv.run(); +// KTEC ADD END + +// KTEC DEL START +/* //GET data printf("\nTrying to fetch page...\n"); int ret = http.get("http://developer.mbed.org/media/uploads/donatien/hello.txt", str, 128); @@ -109,4 +142,6 @@ while(1) { } +*/ +// KTEC DEL END }