![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
UDPversion
Dependencies: XBee mbed NetServicesMin
tcpip/net_routing.cpp@0:84a3b029656e, 2012-04-14 (annotated)
- Committer:
- recotana
- Date:
- Sat Apr 14 03:53:45 2012 +0000
- Revision:
- 0:84a3b029656e
- Child:
- 1:3a46d2725374
UDPversion
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
recotana | 0:84a3b029656e | 1 | #include "net_routing.h" |
recotana | 0:84a3b029656e | 2 | #include "types.h" |
recotana | 0:84a3b029656e | 3 | #include "config.h" |
recotana | 0:84a3b029656e | 4 | #include "xbee_lib.h" |
recotana | 0:84a3b029656e | 5 | #include "tcp_client.h" |
recotana | 0:84a3b029656e | 6 | |
recotana | 0:84a3b029656e | 7 | |
recotana | 0:84a3b029656e | 8 | extern PrefServer pref; |
recotana | 0:84a3b029656e | 9 | extern Serial pc; |
recotana | 0:84a3b029656e | 10 | |
recotana | 0:84a3b029656e | 11 | void netRouting(Payload *_payload) |
recotana | 0:84a3b029656e | 12 | { |
recotana | 0:84a3b029656e | 13 | |
recotana | 0:84a3b029656e | 14 | |
recotana | 0:84a3b029656e | 15 | #ifdef _SERVER_TEST_MODE_ |
recotana | 0:84a3b029656e | 16 | tcpSendPayload(_payload); |
recotana | 0:84a3b029656e | 17 | |
recotana | 0:84a3b029656e | 18 | #else |
recotana | 0:84a3b029656e | 19 | |
recotana | 0:84a3b029656e | 20 | dumpPayload(_payload); |
recotana | 0:84a3b029656e | 21 | |
recotana | 0:84a3b029656e | 22 | uint32_t xbeeAdr=0; |
recotana | 0:84a3b029656e | 23 | |
recotana | 0:84a3b029656e | 24 | switch(_payload->frame.message.device) |
recotana | 0:84a3b029656e | 25 | { |
recotana | 0:84a3b029656e | 26 | case LED_SENDER: |
recotana | 0:84a3b029656e | 27 | { |
recotana | 0:84a3b029656e | 28 | xbeeAdr = kLedSender; |
recotana | 0:84a3b029656e | 29 | xbeeSend(xbeeAdr,_payload); |
recotana | 0:84a3b029656e | 30 | break; |
recotana | 0:84a3b029656e | 31 | } |
recotana | 0:84a3b029656e | 32 | |
recotana | 0:84a3b029656e | 33 | case LED_RECIEVER: |
recotana | 0:84a3b029656e | 34 | { |
recotana | 0:84a3b029656e | 35 | xbeeAdr = kLedReciever; |
recotana | 0:84a3b029656e | 36 | xbeeSend(xbeeAdr,_payload); |
recotana | 0:84a3b029656e | 37 | break; |
recotana | 0:84a3b029656e | 38 | } |
recotana | 0:84a3b029656e | 39 | case SERVER: |
recotana | 0:84a3b029656e | 40 | { |
recotana | 0:84a3b029656e | 41 | if(_payload->frame.message.command==PING){ |
recotana | 0:84a3b029656e | 42 | memcpy(_payload->frame.message.data,&pref,sizeof(pref)); |
recotana | 0:84a3b029656e | 43 | _payload->frame.message.device=SERVER; |
recotana | 0:84a3b029656e | 44 | udpSendPayload(_payload); |
recotana | 0:84a3b029656e | 45 | pc.printf("******* ping! **************\r\n"); |
recotana | 0:84a3b029656e | 46 | } |
recotana | 0:84a3b029656e | 47 | break; |
recotana | 0:84a3b029656e | 48 | } |
recotana | 0:84a3b029656e | 49 | |
recotana | 0:84a3b029656e | 50 | } |
recotana | 0:84a3b029656e | 51 | |
recotana | 0:84a3b029656e | 52 | |
recotana | 0:84a3b029656e | 53 | |
recotana | 0:84a3b029656e | 54 | #endif |
recotana | 0:84a3b029656e | 55 | |
recotana | 0:84a3b029656e | 56 | } |