I'm using Contiki-ng and the examples udp-server and udp-client. I want to do a couple of things: 1- I want the client node to sniff packets and then send a packet to the server once it does. I managed to do that but there is somethings that I don't understand: a- When I start the sniffing in the udp-client, by adding this bit to the code:
radio_value_t radio_rx_mode;
NETSTACK_RADIO.get_value(RADIO_PARAM_RX_MODE, &radio_rx_mode);
NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, radio_rx_mode & (~RADIO_RX_MODE_ADDRESS_FILTER));
This only seems to catch the packets on the udp-client app level, and when I increase the QUEUEBUF_CONF_NUM to allow the server to receive these packets it only captures the node's own packets. Any idea why this is happening?
b- When I did the same in the csma.c file within the input_packet function it works and it does capture all the packets, however, I'm not sure how to set up so that once a packet is captured in the csma level a node can send a packet from the app level?
2- Just a quick question to confirm if what I'm doing is correct, I wanted to enable the ReTx in this example so I add this to the project-config file:
#define CSMA_MAX_FRAME_RETRIES 7
Will this enable the retransmission of packets? or is it doing something else?
Any help in this regard is appreciated. Thank you.
From the CSMA code, you can try explicitly calling a function defined in your application's code, or send an event to the application's process. If this seems too ugly, perhaps the cleanest (but not as efficient) way is to call process_post()
with PROCESS_BROADCAST
as the first argument. This will broadcast the event to all active processes, including the application's process.
CSMA does up to 7 retransmissions by default. To disable that of or change the number of retransmissions, #define CSMA_CONF_MAX_FRAME_RETRIES
to some non-default value in the project-conf.h
file. Notice the CONF
in the name of this preprocessor directive.