
A Anhang
1 /* * * ** *** *** ** * ** * ** *** *** ** * ** * ** *** *** ** * ** * ** *** *** *** **
2 Copyright ( c) 2011 , Swedish Institute of Computer Science .
3 All rights reserved .
4
5 Modified by Mirco Kern , FH Duess e ldorf
6 * ** *** *** ** * ** * ** *** *** ** * ** * ** *** *** ** * ** * ** *** *** ** * ** * * */
7
8
9 /* exampl e : sending broadc a s ts */
10 /* * * *** *** * *** *** * ** * *** *** * *** */
11
12 /* includ e header files */
13 # inclu de " contiki .h"
14 # inclu de " sys / etimer .h"
15 # inclu de " net / uip .h "
16 # inclu de " net / uip - ds6 .h"
17 # inclu de " simple - udp . h "
18 # inclu de < stdio .h>
19 # inclu de < string .h >
20
21 /* define d estinatio n port */
22 # define UDP_PORT 4321
23
24 /* define send interval */
25 # define S END_IN T ERVAL (20 * C L OCK_SEC O ND )
26
27 /* struct storing co n n ection */
28 static struct sim p le_ u dp_ c onn e cti o n b roa d cas t _con nect ion ;
29
30 /* * *** *** ** * ** *** *** ** * ** * ** *** ** * ** * ** *** *** ** * ** *** *** ** * ** *** * */
31 /* declarate process */
32 PROCESS ( bro a dcast_e x ample_ p rocess , " UDP broadcast example process " );
33
34 /* start process automa t icly */
35 A UTOS TART _ PROC ESSE S (& b roa dca s t_e xamp le_ p roc ess );
36
37 /* * *** *** ** * ** *** *** ** * ** * ** *** ** * ** * ** *** *** ** * ** *** *** ** * ** *** * */
38 /* storin g connectio n data */
39 static void
40 receiver ( struct si m ple _ udp _ con n ect i on *c ,
41 const u ip_ipad d r_t * sender_addr ,
42 uint16_t sender_port ,
43 const u ip_ipad d r_t * receiver_addr ,
44 uint16_t receiver_port ,
45 const uint8_t * data ,
46 uint16_t datalen )
47
48 /* * *** *** ** * ** *** *** ** * ** * ** *** ** * ** * ** *** *** ** * ** *** *** ** * ** *** * */
45
Kommentare zu diesen Handbüchern