Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "contiki.h"
- #include "net/rime.h"
- #include <stdio.h>
- /*---------------------------------------------------------------------------*/
- PROCESS(sinknode_process, "Sink Node unicast");
- AUTOSTART_PROCESSES(&sinknode_process);
- /*---------------------------------------------------------------------------*/
- static void
- recv_uc(struct unicast_conn *c, const rimeaddr_t *from)
- {
- printf("Unicast message received from %d.%d: '%s'\n",
- from->u8[0], from->u8[1],(char *)packetbuf_dataptr());
- }
- static const struct unicast_callbacks unicast_callbacks = {recv_uc};
- static struct unicast_conn uc;
- /*---------------------------------------------------------------------------*/
- PROCESS_THREAD(sinknode_process, ev, data)
- {
- PROCESS_EXITHANDLER(unicast_close(&uc);)
- PROCESS_BEGIN();
- unicast_open(&uc, 146, &unicast_callbacks);
- while(1) {
- static struct etimer et;
- rimeaddr_t addr;
- etimer_set(&et, CLOCK_SECOND);
- PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
- packetbuf_copyfrom("", 0);
- addr.u8[0] = 1;
- addr.u8[1] = 0;
- if(!rimeaddr_cmp(&addr, &rimeaddr_node_addr)) {
- }
- }
- PROCESS_END();
- }
- /*---------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement