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: NyFileSystems libMiMic mbed-rtos mbed
Fork of TcpSocketClientSamlpe by
Revision 28:dd350a9a5221, committed 2015-09-15
- Comitter:
- nyatla
- Date:
- Tue Sep 15 09:28:25 2015 +0000
- Parent:
- 27:c5900bcee344
- Commit message:
- update libMiMic
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NyFileSystems.lib Tue Sep 15 09:28:25 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/nyatla/code/NyFileSystems/#509d2ac0ba4f
--- a/NySDFileSystem.lib Wed Oct 23 04:53:25 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/nyatla/code/NySDFileSystem/#22ce3449b224
--- a/libMiMic.lib Wed Oct 23 04:53:25 2013 +0000 +++ b/libMiMic.lib Tue Sep 15 09:28:25 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/nyatla/code/libMiMic/#258e84040262 +http://mbed.org/users/nyatla/code/libMiMic/#e40058804062
--- a/main.cpp Wed Oct 23 04:53:25 2013 +0000
+++ b/main.cpp Tue Sep 15 09:28:25 2015 +0000
@@ -13,18 +13,18 @@
#include "fsdata.h"
LocalFileSystem2 lf("local");
-NetConfig cfg; //create network configulation
-Net* net;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
+ MiMicNetIf netif;
+ NetConfig cfg; //create network configulation with onchip-setting.
int main()
{
- net=new Net();//Net constructor must be created after started RTOS
+ Net net(netif);//Net constructor must be created after started RTOS
// manual setting
cfg.setIpAddr(192,168,128,39);
@@ -36,11 +36,12 @@
// Create http client.
// Socket must create between "net.start" with "new Net()"
HttpClient http;
+led1=1;
//Start network
- net->start(cfg);
-
- if(http.connect(IpAddr(192,168,128,195),80)){
+ net.start(cfg);
+led2=2;
+ if(http.connect(IpAddr(192,168,128,1),80)){
if(http.sendMethod(HttpClient::HTTP_GET,"/mimic/")){
FILE *fp=fopen("/local/out.txt", "w");
if(fp!=NULL){
@@ -72,6 +73,21 @@
}
http.close();
}
+ if(http.connect(IpAddr(192,168,128,254),80)){
+ if(http.sendMethod(HttpClient::HTTP_POST,"/mimic/")){
+ const char* DATA="{json}";
+ if(http.write(DATA,strlen(DATA))){
+ if(http.getStatus()==200){
+ char buf[256];
+ short len;
+ if(http.read(buf,256,len)){
+ printf("%.*s",len,buf);
+ }
+ }
+ }
+ }
+ http.close();
+ }
for(int c=0;;c=(c+1)%2){
led4=c;
Thread::wait(500);
--- a/mbed-rtos.lib Wed Oct 23 04:53:25 2013 +0000 +++ b/mbed-rtos.lib Tue Sep 15 09:28:25 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#53e6cccd8782 +http://mbed.org/users/mbed_official/code/mbed-rtos/#21b438192b0f
--- a/mbed.bld Wed Oct 23 04:53:25 2013 +0000 +++ b/mbed.bld Tue Sep 15 09:28:25 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad \ No newline at end of file
