send sample message to child from Leader/Router

294 views
Skip to first unread message

Praveen Kumar

unread,
Aug 17, 2016, 12:57:50 AM8/17/16
to openthread-users

Hi,


I want to send/receive message to Child from Leader/router, can any one help me in this regard.
here is My Working set-up,
by cli application, configured 1-Leader, 1-Router, 1-Child, where i am able to work with commands listed in CLI- application. Now i want to send sample Hi message to Child to Leader (How can child receive send by leader/Router or How can Leader/Router send message to Child). How i can integrate messages with leader or Child.

Thanks,
Praveen

Jonathan Hui

unread,
Aug 17, 2016, 1:03:02 AM8/17/16
to Praveen Kumar, openthread-users
Hi Praveen,

You can use OpenThread's UDP APIs for sending/receiving UDP messages.  If you are used to socket programming, then the following mechanisms should be familiar:
1) On both ends, you need to open a UDP socket using otOpenUdpSocket().
2) On the receiving end, you can to bind to a specific port using otBindUdpSocket().
3) On the sending end, you can send UDP messages using otSendUdp() to a destination IPv6 address and port.

--
Jonathan Hui


--
You received this message because you are subscribed to the Google Groups "openthread-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openthread-users+unsubscribe@googlegroups.com.
To post to this group, send email to openthread-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/583a815b-d71d-4ee3-8c3f-1aee58d4be1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Praveen Kumar

unread,
Aug 17, 2016, 1:49:42 AM8/17/16
to openthread-users
Thanks @Jonathan Hui,

I am very new to C++, I am facing lot of difficulties to integrate API's with CLI-application code. Please could you tell Elaborately how to integrate API of UDP to CLI-Appliaction.
My requirement is to communicate with two nodes with simple Hi message. I am unable to find where i should enter text "Hi" in message macro structure, Let me know please  how to do it.

Thanks,
Praveen

Message has been deleted

Praveen Kumar

unread,
Aug 24, 2016, 7:13:19 AM8/24/16
to openthread-users

Hi all,


In cli.cpp I have added a command called udp and process for it also.

Inside the udp process, initially checking mode of operation Leader/Child


if leader :

opening port and sending udpmsg by functions --- otOpenUdpSocket(), otSendUdp().


If child:

opening port and bind by functions----- otOpenUdpSocket(), otBindUdpSocket().


Problem is, when opening port I am unable to understand how argument should be passed as function handler, and weather I should write “otUdpReceive aCallback” function.

Please any one let me know.


Is this approach is ok or not, let me know.



Thanks and Regards,

Praveen.


Reply all
Reply to author
Forward
0 new messages