How to use the bindings.BluetoothWrap function in bindings

To help you get started, we’ve selected a few bindings examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yodaos-project / yoda.js / deprecated / bluetooth / index.js View on Github external
'use strict';

const property = require('@rokid/property');
const logger = require('@rokid/logger')('bluetooth');
const context = require('@rokid/context');
const BluetoothWrap = require('bindings')('bluetooth').BluetoothWrap;
const EventEmitter = require('events').EventEmitter;

const id = property.serialno ? property.serialno.slice(-6) : 'xxxxxx';
const name = context.deviceConfig.namePrefix + id;
let handle;

const BT_EVENTS = {
  // a2dp source events
  A2DP_SOURCE_OPEN: 1,
  A2DP_SOURCE_CLOSE: 2,
  A2DP_SOURCE_START: 3,
  A2DP_SOURCE_STOP: 4,
  // a2dp sink events
  A2DP_SINK_OPEN: 21,
  A2DP_SINK_CLOSE: 22,
  A2DP_SINK_STREAM_OPEN: 23,