How to send a confirmable packet

Hi,

I have bunch of SEDs (sensors/clients) and one or more FTDs (hosts) working on CoAP protocol. SEDs send data packets once in a while and mostly sleeping. I have few questions.

1. Does confirmable packets consume more battery power from the SEDs?

2. Can we set a application call back when ACK fails?

3. The 'coap_send_request ()' function in coap_utils.c seems hardwired to send non-confirmable packets. How can we send confirmable packets in this case? (I dont want to modify SDK functions as they can get overwritten if we update the SDK). Do we have to implement our own version of  'coap_send_request ()' function?

4. 'coap_send_request ()' function has a reply call back as a parameter. How does this function in a non-confirmable/confirmable packets?

Cheers,

Kaushalya

Parents
  • Hi Kaushalya,

    1. Does confirmable packets consume more battery power from the SEDs?

    In theory, it should be since the traffic increased and more power be used for conformable packets, but I suggest you to do power evaluation in a practical measurement so you would get impression how big effect this will bring to you application.

    2. Can we set a application call back when ACK fails?

    coap_client_response_cb_t should give some error codes when ACK not get.

    3. The 'coap_send_request ()' function in coap_utils.c seems hardwired to send non-confirmable packets. How can we send confirmable packets in this case? (I dont want to modify SDK functions as they can get overwritten if we update the SDK). Do we have to implement our own version of  'coap_send_request ()' function?

    The coap_send_request() function in the CoAP utils library is indeed designed to send non-confirmable CoAP requests, which is specified in the API documentation for this function.

    If you need to send confirmable CoAP packets, you want to write your own function referring to coap_send_request. The Zephyr Project's CoAP API provides a coap_packet_init() function that allows you to specify the type of the message (confirmable or non-confirmable) as one of its parameters. In the CoAP client API reference, there is a confirmable field in the coap_client_request structure, which can be set to true to send a confirmable message.

    4. 'coap_send_request ()' function has a reply call back as a parameter. How does this function in a non-confirmable/confirmable packets?
    Since it only handles sending non-confirmable CoAP requests, the reply call back will be trigger when it gets a reply. Search through NCS source codes, you will find one "n_provisioning_reply"
    example shows how to handle the reply after sending 'provisioning' request.
    Since the CoAP library is original provided by zephyr project, I suggest you check the usage of it with the authors directly in Issues · zephyrproject-rtos/zephyr (github.com).
    Best regards,
    Charlie
Reply
  • Hi Kaushalya,

    1. Does confirmable packets consume more battery power from the SEDs?

    In theory, it should be since the traffic increased and more power be used for conformable packets, but I suggest you to do power evaluation in a practical measurement so you would get impression how big effect this will bring to you application.

    2. Can we set a application call back when ACK fails?

    coap_client_response_cb_t should give some error codes when ACK not get.

    3. The 'coap_send_request ()' function in coap_utils.c seems hardwired to send non-confirmable packets. How can we send confirmable packets in this case? (I dont want to modify SDK functions as they can get overwritten if we update the SDK). Do we have to implement our own version of  'coap_send_request ()' function?

    The coap_send_request() function in the CoAP utils library is indeed designed to send non-confirmable CoAP requests, which is specified in the API documentation for this function.

    If you need to send confirmable CoAP packets, you want to write your own function referring to coap_send_request. The Zephyr Project's CoAP API provides a coap_packet_init() function that allows you to specify the type of the message (confirmable or non-confirmable) as one of its parameters. In the CoAP client API reference, there is a confirmable field in the coap_client_request structure, which can be set to true to send a confirmable message.

    4. 'coap_send_request ()' function has a reply call back as a parameter. How does this function in a non-confirmable/confirmable packets?
    Since it only handles sending non-confirmable CoAP requests, the reply call back will be trigger when it gets a reply. Search through NCS source codes, you will find one "n_provisioning_reply"
    example shows how to handle the reply after sending 'provisioning' request.
    Since the CoAP library is original provided by zephyr project, I suggest you check the usage of it with the authors directly in Issues · zephyrproject-rtos/zephyr (github.com).
    Best regards,
    Charlie
Children
No Data
Related