Skip to content

Instantly share code, notes, and snippets.

@gonium
Created August 5, 2011 10:03
Show Gist options
  • Save gonium/1127251 to your computer and use it in GitHub Desktop.
Save gonium/1127251 to your computer and use it in GitHub Desktop.
Process startup
PROCESS_THREAD(udp_handler_process, ev, data) {
uip_ipaddr_t ipaddr;
PROCESS_POLLHANDLER(pollhandler());
PROCESS_EXITHANDLER(exithandler());
// see: http://senstools.gforge.inria.fr/doku.php?id=contiki:examples
PROCESS_BEGIN();
PRINTF("udp_handler: process startup.\r\n");
// wait 3 second, in order to have the IP addresses well configured
etimer_set(&udp_periodic_timer, CLOCK_CONF_SECOND*3);
// wait until the timer has expired
PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER);
// Define Address of the server that receives our heartbeats.
// TODO: Make this dynamic
#ifdef UDP_ADDR_A
uip_ip6addr(&ipaddr,
UDP_ADDR_A,UDP_ADDR_B,UDP_ADDR_C,UDP_ADDR_D,
UDP_ADDR_E,UDP_ADDR_F,UDP_ADDR_G,UDP_ADDR_H);
#else /* UDP_ADDR_A */
uip_ip6addr(&ipaddr,0xbbbb,0,0,0,0xd69a,0x20ff,0xfe07,0x7664);
#endif /* UDP_ADDR_A */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment