![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
UDPversion
Dependencies: XBee mbed NetServicesMin
Diff: tcpip/net_routing.cpp
- Revision:
- 0:84a3b029656e
- Child:
- 1:3a46d2725374
diff -r 000000000000 -r 84a3b029656e tcpip/net_routing.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tcpip/net_routing.cpp Sat Apr 14 03:53:45 2012 +0000 @@ -0,0 +1,56 @@ +#include "net_routing.h" +#include "types.h" +#include "config.h" +#include "xbee_lib.h" +#include "tcp_client.h" + + +extern PrefServer pref; +extern Serial pc; + +void netRouting(Payload *_payload) +{ + + + #ifdef _SERVER_TEST_MODE_ + tcpSendPayload(_payload); + + #else + + dumpPayload(_payload); + + uint32_t xbeeAdr=0; + + switch(_payload->frame.message.device) + { + case LED_SENDER: + { + xbeeAdr = kLedSender; + xbeeSend(xbeeAdr,_payload); + break; + } + + case LED_RECIEVER: + { + xbeeAdr = kLedReciever; + xbeeSend(xbeeAdr,_payload); + break; + } + case SERVER: + { + if(_payload->frame.message.command==PING){ + memcpy(_payload->frame.message.data,&pref,sizeof(pref)); + _payload->frame.message.device=SERVER; + udpSendPayload(_payload); + pc.printf("******* ping! **************\r\n"); + } + break; + } + + } + + + + #endif + +} \ No newline at end of file