Calling the Kura API methods?

242 Views Asked by At

I am experimenting with the Kura API and would like to use some of the methods within the API in the near future.

For now, I am interested in the SystemService as I would like to create a simple API that returns the Kura version as an example. The custom API is working, the problem is however to use the getKuraVersion() method that actually returns the version.

Does someone have any idea how that can be done because I am unable to call the methods even though I declared SystemService?

1

There are 1 best solutions below

0
On

Eclipse Kura exposes services using the OSGi Declarative Services model. So, in order to use SystemService, you must obtain a reference to the service. There are many examples in the Kura repo of how to do this, but there is a test for the SystemService [1] that should be exactly what you need. A very good overview of OSGi Declarative Services can be found here [2].

[1] https://github.com/eclipse/kura/tree/develop/kura/test/org.eclipse.kura.core.system.test

[2] http://www.vogella.com/tutorials/OSGiServices/article.html#osgi-services