0.8.0 • Published 7 years ago

cordova-plugin-ocf v0.8.0

Weekly downloads
5
License
Apache 2.0
Repository
github
Last release
7 years ago

cordova-plugin-ocf

A Cordova plugin to expose the OCF specification to cross platform applications written in JavaScript.

Purpose

To provide a plugin which allows using the OCF specification across all mobile platforms without requiring the user to deal with implementing and compiling the native code for each operating system.

Current platforms:

  • Android

Building

As this is a Cordova plugin, you will build it as part of an app. For a demo app, please see the cordova-plugin-ocf-demo app. Build instructions are located at its README file.

Running tests

This plugin contains a test suite that runs as a Cordova app. Pleae find it at the cordova-plugin-ocf-tests project page.

Quick start with the API

var plugin = cordova.require('cordova/plugin/ocf');

plugin.onresourcefound = function(event) {
    var resource = event.resource;
    // Do something with the resource.

    resource.onupdate = function(event) {
        var updates = event.updates;
        // Update your UI when changes have occurred.
    };
};

plugin.setBackend('iotivity').then(function() {
    plugin.findResources();
});

More details can be found at the OCF JS spec for the Soletta project.