How to add new service?


#1

Hi all,

How can I add new service .api files into the development environment? I want to add the gpioExpanderService from https://github.com/mangOH/GpioExpander into the legato framework. I put the folder in legato/apps/platformServices, but the service cannot be found by the build tool.

How can I do this right?

Thx.

Already solved. It was because I wrote the binding wrong.


#2

Hi Lichen,

You don’t need to move the location of the GpioExpader app. You can clone it to any location and then just add a references to it in your system definitions file. Alternatively, you can just built the app by itself. I always prefer to build a system though because the Legato build tools can catch errors in application binding that way.


#3

Thank you dfrey. By building the app do you mean install it onto the wp module (or any other target that’s feasible) ?

BTW, the system definition file that I have to add the reference in is default.sdef or localhost.sdef? After adding it I have to mksys right?


#4

It would be more the default.sdef. The localhost.sdef is only used when doing make localhost.

Note that you can already create your own sdef that includes modules/WiFi/wifi.sdef (or default.sdef if you do not want WiFi).

For instance you have a look at the mangOH sdef files: https://github.com/mangOH/mangOH/blob/master/
They also demonstrate how to build things through a Makefile: https://github.com/mangOH/mangOH/blob/master/Makefile


#5

Thank you CoRfr. Regarding the makefile, when I make it, an error message always appears saying “unexpected character “#””, while the # is from the line in mangOH_Green.sdef including wifi.sdef

#include “$LEGATO_ROOT/modules/WiFi/wifi.sdef”

Well, how can this happen?


#6

Hi @lichen

AFAIR “Xdef” files inclusion is supported from Legato 17.05, not earlier.
If you’re using an older Legato version, unfortunately you’ll have to replicate the content of wifi.sdef into your own sdef.


#7

Hi lichen,

As daav mentioned, including other sdefs is a Legato 17.05 feature. The mangOH SDEFs have been updated to use this feature and thus the mangOH SDEFs must be built using Legato 17.05 or newer.