Low Level Messaging API binding woes

Hi All,

I’m using legato framework 20.04, and I’m trying to use the low level messaging API to communicate between 2 different processes in the same app. I’ve followed the instructions in the following posts:


However, I am still unable to connect the client to the server side. This is the pertinent info from my adef file:

    components:
    {
        UEventManager
        UsbManager
    }
    executables:
    {
        UEventManagerExe = ( UEventManager )
        UsbManagerExe = ( UsbManager )
    }
    bindings:
    {
        *.UEvtMgrSvc -> *.UEvtMgrSvc
    }
    sandboxed: false

My UEventManager component has a class with this initialization:

   void _initialize()
    {
        le_msg_ProtocolRef_t protocolRef = le_msg_GetProtocolRef(UEVENT_PROTO_ID, sizeof(struct UEVENT_T));
        mServiceRef                      = le_msg_CreateService(protocolRef, UEVENT_MANAGER_SERVICE);
        le_msg_AddServiceOpenHandler(mServiceRef, &pUEventManagerServer::_new_client_session, this);
        le_msg_AddServiceCloseHandler(mServiceRef, &pUEventManagerServer::_close_client_session, this);
        Debug::Log(Debug::LogLevel::DEBUG_INFO, "Advertising service %p (%s)", mServiceRef, UEVENT_MANAGER_SERVICE);
        le_msg_AdvertiseService(mServiceRef);
    }

My UsbManager has a class with the following method:

    void _initialize()
    {
        le_msg_ProtocolRef_t protocolRef = le_msg_GetProtocolRef(UEVENT_PROTO_ID, sizeof(UEVENT_T));
        mSessionRef                      = le_msg_CreateSession(protocolRef, UEVENT_MANAGER_SERVICE);
        le_msg_SetSessionRecvHandler(mSessionRef, &pUEventManagerClient::_incoming_message_handler, this);
        le_msg_OpenSessionSync(mSessionRef);
        Debug::Log(Debug::LogLevel::DEBUG_INFO, "Opened UEventManagerClient session.");
    }

When I execute my code I get the following in sdir:

    BINDINGS

            <root>.sdirTool -> <root>.sdirTool
            ...
            <root>.UEvtMgrSvc -> <root>.UEvtMgrSvc
            ...

    SERVICES
            ...

    WAITING CLIENTS

            [pid  4201] <root>.UEvtMgrSvc WAITING for <root>.UEvtMgrSvc  (protocol ID = 'UEVENT_MESSAGEv1.0')

Where the bindings are showing up, but the services are not there, and the client is still waiting on the server. However, in logread I get the following lines:

Jan 5 23:42:07 swi-mdm9x28-wp user.info Legato: INFO | UEventManagerExe[7202]/UEventManager T=UEvent Messaging Servic | debug.cpp Log() 37 | UEventManager: Advertising service 0x7f56f870 (UEvtMgrSvc)

So it seems that though I am calling le_msg_AdvertiseService, and even though the bindings are there, and the client is waiting to connect, the service never appears. What am I missing?

Thanks,
Chris

I have never used message API, but will you consider to use Ipc communication between components or applications?

I’ve taken your suggestion, and I’ve been able to use IPC communications as you’ve outlined in the issue you’ve linked to. It seems to be working, but I will need to dig a little deeper to determine why some handlers seem to go missing.