dreamscreen
v0.4.1
Published
A high level abstraction to communitcate with the DreamScreen BLE stick
Downloads
6
Readme
DreamScreen BLE Interface
Provides a convenient high level abstraction to the BLE interface of the DreamScreen
Uses the command set from the DIY Board
Uses noble as the interface layer
Install
It's on npm
npm install --save dreamscreen
Usage
const DreamScreen = require('dreamscreen');
DreamScreen.getInstance()
.then(ds =>
ds.setMode('video')
.then(() => ds.setBrightness(50))
)
Options
Current options that can be passed to getInstance():
| option | default | description | |----------------|-------------|------------------------------------------------------------------------------------------------------| | discoverByName | false | The default operation is to try to directly connect to the device by its ID If this is set to true, it will instead discover all devices and stops when one of them matches options.localName | | localName | DreamScreen | The default name of the device. Only relevant in conjunction with discoverByName = true | | debug | false | Prints out relevant information |
Events
The resulting instance extends the node EventEmitter class and follows the following events:
| name | arguments | description | |------------|-----------|-------------| | disconnect | | The peripheral has disconnected | | read | {data, isNotification} | A read has occurred. These generally happen after sendRead operations | | send | code | Any code gets written to the peripheral |
Caveats
Noble does not play nice with multiple instances so this package hijacks it.
Things are probably not going to go well if this is used together with other noble packages.
Tested on OSX and on Raspberry PI 3