Version: Smart Feature Phone 3.0

DeviceCapabilityManager service

Instanciating the service#

Load the following scripts:

<script src="http://127.0.0.1/api/v1/shared/core.js"></script>
<script src="http://127.0.0.1/api/v1/shared/session.js"></script>
<script src="http://127.0.0.1/api/v1/devicecapability/service.js"></script>

You can then get an instance of the service with code similar to:

const session = new lib_session.Session();
const sessionstate = {};
let _devicecapabilityManager = null;
sessionstate.onsessionconnected = function () {
console.log(`DeviceCapabilityManager onsessionconnected`);
lib_devicecapability.DeviceCapabilityManager.get(session).then((DeviceCapabilityManagerService) => {
console.log(`Got DeviceCapabilityManager : #DeviceCapabilityManagerService.service_id}`);
_devicecapabilityManager = DeviceCapabilityManagerService;
}).catch((e) => {
console.log(`Error calling DeviceCapabilityManager service${JSON.stringify(e)}`);
_devicecapabilityManager = null;
});
};
sessionstate.onsessiondisconnected = function () {
console.log(`DeviceCapabilityManager onsessiondisconnected Daemon Crashed`);
};
// On desktop version, set ENV WS_RUNTIME_TOKEN=secrettoken
session.open('websocket', 'localhost', 'secrettoken', sessionstate, true);

Then the developer can use _devicecapabilityManager as DeviceCapabilityManager service instance.

This service implements the DeviceCapabilityFactory interface.




DeviceCapabilityFactory Interface#

Methods#

  get

// feature: string
get(feature)

Resolves with json

Rejects with void


Sample code#

New APIs sample code