Program for test the tcp/ip communication between mbed and Android phone

Dependencies:   EthernetInterface mbed-rtos mbed

Notebook page HERE

Committer:
edodm85
Date:
Wed Jul 20 20:24:15 2016 +0000
Revision:
0:149b394928f3
First commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
edodm85 0:149b394928f3 1 #pragma once
edodm85 0:149b394928f3 2 #include "mbed.h"
edodm85 0:149b394928f3 3 #include "EthernetInterface.h"
edodm85 0:149b394928f3 4 #include "eth_status.h"
edodm85 0:149b394928f3 5
edodm85 0:149b394928f3 6
edodm85 0:149b394928f3 7 #define ECHO_SERVER_PORT 2000
edodm85 0:149b394928f3 8
edodm85 0:149b394928f3 9
edodm85 0:149b394928f3 10 bool new_send = false;
edodm85 0:149b394928f3 11 bool checketh = false;
edodm85 0:149b394928f3 12
edodm85 0:149b394928f3 13 DigitalOut led1(LED1); // broken cable
edodm85 0:149b394928f3 14 DigitalOut led2(LED2); // ARM is alive?
edodm85 0:149b394928f3 15 DigitalOut led3(LED3); // 0 = established connection
edodm85 0:149b394928f3 16 DigitalOut led4(LED4); //
edodm85 0:149b394928f3 17
edodm85 0:149b394928f3 18
edodm85 0:149b394928f3 19 Serial pc(USBTX, USBRX);
edodm85 0:149b394928f3 20
edodm85 0:149b394928f3 21
edodm85 0:149b394928f3 22 //ETHERNET
edodm85 0:149b394928f3 23 char* ip = "192.168.153.153"; // ip
edodm85 0:149b394928f3 24 char* mask = "255.255.255.0"; // mask
edodm85 0:149b394928f3 25 char* gateway = "192.168.153.254"; // gateway
edodm85 0:149b394928f3 26 EthernetInterface eth;
edodm85 0:149b394928f3 27 TCPSocketConnection client;
edodm85 0:149b394928f3 28 TCPSocketServer server;
edodm85 0:149b394928f3 29
edodm85 0:149b394928f3 30
edodm85 0:149b394928f3 31 //ETHERNET BUFFER
edodm85 0:149b394928f3 32 char bufferRX[20];
edodm85 0:149b394928f3 33 char bufferTX[4800];
edodm85 0:149b394928f3 34
edodm85 0:149b394928f3 35 //RESET
edodm85 0:149b394928f3 36 extern "C" void mbed_reset();
edodm85 0:149b394928f3 37
edodm85 0:149b394928f3 38
edodm85 0:149b394928f3 39
edodm85 0:149b394928f3 40 //THREAD
edodm85 0:149b394928f3 41 void net_thread(void const *argument);
edodm85 0:149b394928f3 42 osThreadId tencid;
edodm85 0:149b394928f3 43 osThreadDef(net_thread, osPriorityNormal, DEFAULT_STACK_SIZE);
edodm85 0:149b394928f3 44
edodm85 0:149b394928f3 45
edodm85 0:149b394928f3 46
edodm85 0:149b394928f3 47 //FUNCTION
edodm85 0:149b394928f3 48 void parse_cmd(int sizeCMD);