Home/Support/Support Forum/C Ansi library socket APIs

C Ansi library socket APIs

0 votes
Hi,
I am working with the Xbee3 LTE-M module and microcontroller unit.

I want to make a network interface layer using the LTE module and in doing so I need to implement socket calls(create, send, receive, etc) which interns talk to Xbee hardware using AT command via USART.

To do so I am referring https://github.com/digidotcom/xbee_ansic_library/ library.

I am not able to connect the dots for callbacks given here.

My query is there anyone who has any reference code in c for the same or document to start with?

Is anyone able to achieve socket communication on any embedded microcontroller device so far?

Any help would be greatly appreciable.

Thanks & Reg.
asked Apr 30 in RF Solutions and XBee by rutvij.trivedi New to the Community (1 point)
recategorized May 5 by LeonidM

Please log in or register to answer this question.

2 Answers

0 votes
Rutvij,

This code requires the XBee to be in API mode (ATAP1) and at a baud rate of 115.2kbps (ATBD7).

As for sockets, you don't control it like you would think. You only need to send the TX request (IPV4) which will have the IP address and port number for the device you want to send the data to. The radio will keep the socket open for the timeout period set on the radio and the remote device.

The data will be sent back on what ever port number the xbee is set to (DE and CO).

Digi Support
answered Apr 30 by mvut Veteran of the Digi Community (12,351 points)
Hi,
Thank you for the quick replay.

So here I am trying to enable Amazon Freertos with LTE-M.
AWS freeRTOS wants socket API stubs to be filled in order to communicate.

What I believe it should be like below starting from forming MQTT packets to UART packet for radio

1.MQTT msgs
|
2.MBEDTLS (encryption done here)
|
3.SSL -> socket apis stubs
|
4.xbee_ansic_library xbee_socket.c
|
5.AT+ Commands harwadere + (encrypted) PAYLOAD )
|
6.AWS

Is my understanding right here (?)

In the above dia. 3 and 4 steps socket stubs can be interconnected as shown?

i.e.
Socket APIS | Xbee Apis
-----------------------------
SOCK_Create--|-> Xbee_sock_create
SOCK_recv----|-> Xbee_sock_recv
SOCK_Send----|-> Xbee_sock_send

Help would be appreciable.

Thanks & Reg.
I know there is an example for Micro python at  https://www.digi.com/resources/documentation/digidocs/90002219/default.htm#container/cont_aws.htm%3FTocPath%3DUse%2520AWS%2520IoT%2520from%2520MicroPython%7C_____0

I would suggest you go thru that first and see how it works as the process should be similar.
Hi,
Thanks for the replay.

https://github.com/digidotcom/xbee-python

Earlier I did go through that but it is written in python, where I don't have much knowledge in.

Also, my MCU will gonna support only C lan.

So is there any C lan. example available?

Thanks
Not that I am aware of.
Hi,

No satisfying answer, as Title is it slef says "C Ansi library socket APIs"

Thanks.
0 votes
Hi,
is there anyone who can help with xbee_socket.c or any doc available ?

Thanks,
answered May 4 by rutvij.trivedi New to the Community (1 point)
All of the available documentation can be found at https://github.com/digidotcom/xbee_ansic_library
From the link given,
can this be used as reference ?
xbee_ansic_library/samples/common/socket_test.c

Thanks,
Sure it can.
Hi,
Thanks for conforming,
I Will give it a shot and will let you know.


Thanks.
...