Example program with HTTPServer and sensor data streaming over TCPSockets, using Donatien Garnier's Net APIs and services code on top of LWIP. Files StreamServer.h and .cpp encapsulate streaming over TCPSockets. Broadcast is done by sendToAll(), and all incoming data is echoed back to the client. Echo code can be replaced with some remote control of the streaming interface. See main() that shows how to periodically send some data to all subscribed clients. To subscribe, a client should open a socket at <mbed_ip> port 123. I used few lines in TCL code to set up a quick sink for the data. HTTP files are served on port 80 concurrently to the streaming.
sys_arch.h
00001 /* 00002 * Author: Adam Dunkels <adam@sics.se> 00003 * 00004 */ 00005 #ifndef __LWIP_SYS_ARCH_H__ 00006 #define __LWIP_SYS_ARCH_H__ 00007 00008 typedef unsigned int u32_t; 00009 00010 #ifdef __cplusplus 00011 extern "C" { 00012 #endif 00013 00014 //DG 2010 00015 void sys_init(void); /* To be called first */ 00016 u32_t sys_jiffies(void); /* since power up. */ 00017 00018 /** Returns the current time in milliseconds, 00019 * may be the same as sys_jiffies or at least based on it. */ 00020 u32_t sys_now(void); 00021 00022 #ifdef __cplusplus 00023 } 00024 #endif 00025 00026 00027 #endif /* __LWIP_ARCH_CC_H__ */
Generated on Tue Jul 12 2022 21:10:26 by 1.7.2