Interaction library for the Amp smart lighting controller. Uses RxJS observables to communicate changes from the Amp.
const Amp = require('amp-smart-light')
let amp = new Amp()
amp.connection.subscribe(connection => {
switch (connection) {
case ConnectionState.DISCONNECTED:
break;
case ConnectionState.CONNECTING:
break;
case ConnectionState.DISCOVERING_SERVICES:
break;
case ConnectionState.READY:
alert('connected to amp')
break;
}
})
// the following line will only work from a user gesture
// see: https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web#user_gesture_required
const device = navigator.bluetooth.requestDevice(amp.getDeviceOptions())
await amp.connect(device)
[TODO]: add library documentation