Supervisor API goes wrong

Hi,

I have tried to use the API’s supervisor ( le_sup_ctrl.api, le_sup_state.api, le_sup_wdog.api) in a Legato Application. The idea is that we will have several apps, and one of this apps will be responsible of keep the status, and shutdown the others when necessary. In order to do that, we seek on the documentation, and we found that there is an API to interact with the supervisor

COMPONENT
The first step was to ‘add’ the api’s files through the .cdef of the Component (appComponent):

requires: { api: { le_sup_ctrl.api  le_sup_state.api le_sup_wdog.api} }

Also, within the appComponent.c file, I’ve added the following line:

#include "legato.h" #include "interfaces.h"

APPLICATION
Then, I have included a reference of the Component: appAplication -> References -> Edit dependencies … -> check appComponent
I also have included:

appAplication.appComponent.le_sup_ctrl -> supervisor.le_sup_ctrl appAplication.appComponent.le_sup_state -> supervisor.le_sup_state appAplication.appComponent.le_sup_wdog -> supervisor.le_sup_wdog

After doing all this things, the app does nothing. If we just comment the supervisor part, it works normally (starting, geting output of info from the logger, etc).
But when we add the supervisor part, it stops doing anything. App keeps running, but we can’t see any log. Obviously, we’re doing something wrong.

But what? We’re suspicious of the binding:
Is correct the name of “supervisor” service? Do we need to add some permission to use the service supervisor?

Thanks in advantage and regards!

Hi,

First of all, the “sdir list” command (on the target command-line) is your friend in situations like this. It will tell you if your client is waiting for a service to appear or if it is waiting for a binding to be created. You can also use “sdir list” to find the names of the applications (or users) that are offering the services that you want.

Because all of these services are offered by the Supervisor, and the Supervisor is not an app, you have to use the Supervisor’s user account name “” in the binding instead of the application name “supervisor”. So, your bindings should look like this:

    appAplication.appComponent.le_sup_ctrl -> <root>.le_sup_ctrl
    appAplication.appComponent.le_sup_state -> <root>.le_sup_state

Keep in mind that “le_sup_wdog.api” is really intended for use by the Watchdog Daemon to talk to the Supervisor. If you want to use the Watchdog API, you should use “le_wdog.api” instead. This API and the le_cfg.api are treated specially, and their bindings are done for you automatically, so you don’t need to bind them. That’s why I didn’t include le_wdog in the example above.

I hope this helps!

–Jen

Thank you for your good explanation!

I have already tested, and it works properly. :wink:.