@kano/devices-sdk-uwp

1.0.0-alpha.12 • Public • Published

@kano/devices-sdk-uwp

UWP implementation of the Kano devices SDK. Uses the JS UWP bindings to access the Windows Bluetooth API. Use in your JS UWP projects.

Usage

Create a new project in Visual Studio, choose Javascript > Progressive Web App.

Open the package.appxmanifest file and set the main URL to the URl of your web server. Make sure you enable Bluetooth in the Capabilities.

In a JS module in your project, insert the following (You must have server side module resolution or bundling):

import Devices from '@kano/devices-sdk-uwp/index.js';

Devices.searchForClosestDevice('wand', 5000)
    .then((dev) => {
        return dev.getSoftwareVersion()
            .then((v) => {
                console.log(v);
                return dev.setLed(1, 0x00ff00);
            })
            .then(dev.getAdvertisementName())
            .then((name) => {
                console.log(name)
                dev.on('position', (p) => {
                    console.log(p)
                });
                return dev.subscribePosition();
            });
    })
    .catch(e => console.error(e.message));

Demo

To run the demo, start the web server with node ./demo/wand/server.js. Then open the solution KanoDevicesSdk.sln in visual studio and start the project on your local machine.

Readme

Keywords

none

Package Sidebar

Install

npm i @kano/devices-sdk-uwp

Weekly Downloads

1

Version

1.0.0-alpha.12

License

ISC

Unpacked Size

54.6 kB

Total Files

24

Last publish

Collaborators

  • thefijimonster
  • dianlin61
  • jacobmorgan99
  • alexnklein
  • ellenw3lsh
  • camuskano
  • alexfiennes
  • kanocomputing
  • jamie_old_plantain