Low Level message API Opening Session Fails

`Preformatted text`
Client--------------------------------------- Code
le_msg_ProtocolRef_t protocolRef;
le_msg_SessionRef_t sessionRef;
LE_INFO("==================>Client Start:\n");
// Open a session.
protocolRef = le_msg_GetProtocolRef(PROTOCOL_ID, sizeof(myproto_Msg_t));
LE_INFO("==================>Client :le_msg_GetProtocolRef\n");
sessionRef = le_msg_CreateSession(protocolRef, SERVER_INTERFACE_NAME);
LE_INFO("==================>Client :le_msg_CreateSession %p \n",sessionRef);
le_msg_SetSessionRecvHandler(sessionRef, NotifyHandlerFunc, NULL);
LE_INFO("==================>Client :le_msg_SetSessionRecvHandler\n");
LE_INFO("==================>Client le_msg_OpenSessionSync\n");

Server Code-----------------------
le_msg_ProtocolRef_t protocolRef;
le_msg_ServiceRef_t serviceRef;
LE_INFO("==================>Server Start:\n");
// Create my service and advertise it.
protocolRef = le_msg_GetProtocolRef(PROTOCOL_ID, sizeof(myproto_Msg_t));
LE_INFO("==================>Server le_msg_GetProtocolRef:\n");
serviceRef = le_msg_CreateService(protocolRef, SERVER_INTERFACE_NAME);
LE_INFO("==================>Server le_msg_CreateService:\n");
le_msg_SetServiceRecvHandler(serviceRef, RequestMsgHandlerFunc, NULL);
LE_INFO("==================>Server le_msg_SetServiceRecvHandler:\n");
LE_INFO("==================>Server: le_msg_AdvertiseService\n");

I am new to Legato/mangoh WP76XX
Can some one please help by providing simple Example.

I’m having problems with this myself. Maybe your are like me having a missing binding? If you open a terminal on the target and do “sdir list” you get a list of services and waiting clients.

Although how to then bind them correctly to each other I don’t know. According to https://forum.legato.io/t/low-level-messaging-api/2589/2 in the client adef file something like

bindings: { *.ClientName -> ServerProcess.ServerInterface }

Is required, but I haven’t gotten it working yet…

I managed to get it working with the above binding by starting the client first and then the server.

Hi epsragh,
I’ll try to help you on your issue but first I wonder why you want to use the low level message APIs.

Usually, these APIs are internal use in Legato and server/clients development in rather done in a bit higher level. Have a look at daemon developments in Legato code to get a better idea (example: le_cellnet.api, le_spi.api).

Hope this helps,

Thanks for suggestion, I will explore on daemon method.

I used bindings to get it working
*.serviceinterface_name → *.serviceinterface_name