test for quby
Dependencies: WIZnet_Library mbed-rtos mbed
Revision 0:76d86dc82d90, committed 2016-03-30
- Comitter:
- Franco67
- Date:
- Wed Mar 30 17:40:47 2016 +0000
- Commit message:
- test 1 mbed;
Changed in this revision
diff -r 000000000000 -r 76d86dc82d90 WIZnet_Library.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WIZnet_Library.lib Wed Mar 30 17:40:47 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/WIZnet/code/WIZnet_Library/#cb8808b47e69
diff -r 000000000000 -r 76d86dc82d90 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 30 17:40:47 2016 +0000 @@ -0,0 +1,45 @@ +#include "mbed.h" +#include <TCPSocketConnection.h> +#include "rtos.h" + +#define VARSIZE 3 +static char vars[VARSIZE][50]={"personPassed","lightCondition","humidity"}; +int vals[VARSIZE]={10,20,30}; +char buffer[2048]; + +void prepareUpdate() +{ + char tmp[512]; + int i; + strcpy(buffer,"<update>\n"); + for (i=0;i<VARSIZE;i++) + { + sprintf(tmp,"\t<%s>%d</%s>\n",vars[i],vals[i],vars[i]); + strcat(buffer,tmp); + } + strcat(buffer,"</update>\n"); +} + +void vTCPSend(char *s,const size_t size) +{ + TCPSocketConnection tcp; + if (tcp.connect("127.0.0.1",6423)==0) + { + size_t transmitted; + int sent=0; + for (transmitted=0;(transmitted<size)&(sent>=0);transmitted+=sent) + sent=tcp.send(&s[transmitted],size-transmitted); + } + tcp.close(); +} + +int main(void) +{ + while (1) + { + prepareUpdate(); + vTCPSend(buffer,strlen(buffer)); + wait(15); + } +} +
diff -r 000000000000 -r 76d86dc82d90 mbed-rtos.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Wed Mar 30 17:40:47 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#bdd541595fc5
diff -r 000000000000 -r 76d86dc82d90 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 30 17:40:47 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/99a22ba036c9 \ No newline at end of file