# Supervisor API goes wrong

**URL:** <https://forum.sierrawireless.com/t/supervisor-api-goes-wrong/12014>\
**Category:** Uncategorized\
**Created:** [March 24, 2015, 6:02pm UTC](https://forum.sierrawireless.com/t/supervisor-api-goes-wrong/12014 "2015-03-24T18:02:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![idroj13](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@idroj13](https://forum.sierrawireless.com/u/idroj13)\
**Post date:** [March 24, 2015, 6:02pm UTC](https://forum.sierrawireless.com/t/supervisor-api-goes-wrong/12014/1 "2015-03-24T18:02:22Z")

</div>

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):

```auto
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!

---

<div class="post-metadata">

**Author:** ![jchitty](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@jchitty](https://forum.sierrawireless.com/u/jchitty)\
**Post date:** [March 25, 2015, 4:42pm UTC](https://forum.sierrawireless.com/t/supervisor-api-goes-wrong/12014/2 "2015-03-25T16:42:22Z")

</div>

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:

```auto
    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

---

<div class="post-metadata">

**Author:** ![idroj13](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@idroj13](https://forum.sierrawireless.com/u/idroj13)\
**Post date:** [March 27, 2015, 8:15am UTC](https://forum.sierrawireless.com/t/supervisor-api-goes-wrong/12014/3 "2015-03-27T08:15:27Z")

</div>

Thank you for your good explanation!

I have already tested, and it works properly. 😉.
