1
votes

I'm looking for a way to send packets with Contiki using the uIP interface. To give you an idea of my current state, I feel like a blind man who bangs against the walls. The below code shows what I would like to do. If you could share a hint I would be grateful.

PROCESS(allo_process, "allo process");
AUTOSTART_PROCESSES(&allo_process);
PROCESS_THREAD(allo_process, ev, data)
{
    PROCESS_BEGIN();
    SENSORS_ACTIVATE(button_sensor);
    for (;;) {
        PROCESS_WAIT_EVENT();
        if (ev == sensors_event && data == &button_sensor) {
            uip_send("allo", 4);
        }
    }
    PROCESS_END();
}

Edit

I finally managed to send packets with the rime interface using this example: contikidoc. For people who care, don't forget to add this line to your makefile: CONTIKI_WITH_RIME = 1. Packets are printed to the "radio messages" panel.

However, the original question remains open: how to use the uip interface? I tried to reproduce the first example in the doc but part of the code is missing :-/

1

1 Answers

0
votes

at first, you should open a connection and then send your packet through that connection. take a look at "uip_udp_conn" and "uip_udp_packet_send" in Contiki document.