Send data to SED devices

Hi, 

I have a functioning CoAP client/server based OpenThread mesh network. My clients are SEDs. I can send data from clients to the CoAP server. Now I want to do the opposite, to send data from server to the SED clients. I have the unicast IPV6 of the SEDs on server side. I am thinking of using 'coap_send_request ()' as used by the clients to send data packet from server. I am not clear how on clients side to receive this. On server side I can see 'srv_context' and 'otCoapResource' structures and 'otCoapStart' used to manage data transmitted by the client. But I dont think I can start another CoAP server on client side, and there is no need for that. May be what we need is a kernel thread to look into packets being received and then set an kernel event or something like that to indicate data receive. What would be the best way of moving foward.

Cheers,

Kaushalya

Parents Reply Children
  • Hi Maria,

    Thanks for your help. Yes my SED wakes up periodically and send the server some data. This is the time I think the server data can be delivered. I think that mechanism is workable. 

    I have gathered the IP6 info of the client (SED) from the data it is sending. I tried to use 'coap_send_request()' in the server, but it failed giving error code 9. I couldn't find what that error code means. I dont have a mechanism in the SED to receive data yet. I dont know if that is the reason for this failure.

    From ther server I can see it initiates server functionality by 'otCoapStart ()' in 'ot_coap_init()' in server FW. I am not sure I have to/can implement this same behavior in the SED. 

    What API mechanism should be used to receive data from a coap server?

    Thanks,

    Kaushalya

  • Hi Maria,

    I have looked at using coap get/put methods to send payloads to SED clients using CLI. 

    1. Client has to create a uri resource 

    2. The host get this resource using 'coap get'

    3. The host use the resource to send payloads to the SED client by using 'coap put'

    I tried decoding the cli_coap.cpp to extract the APIs needed for this. I am not 100% sure on how to do that. Could you please help here?

    Thanks,

    Kaushalya

Related