All Projects → song940 → Node Bluetooth

song940 / Node Bluetooth

Licence: mit
🔷😬Bluetooth serial port communication for Node.js

Projects that are alternatives of or similar to Node Bluetooth

GoFIT SDK Android
GoFIT SDK for Android — GOLiFE 手環 App 介接 SDK
Stars: ✭ 32 (-77.93%)
Mutual labels:  bluetooth, iot-device
Pedalino
Smart wireless MIDI foot controller for guitarists and more.
Stars: ✭ 105 (-27.59%)
Mutual labels:  bluetooth, iot-device
ble-serial
"RFCOMM for BLE" a UART over Bluetooth low energy (4.0+) bridge for Linux, Mac and Windows
Stars: ✭ 134 (-7.59%)
Mutual labels:  bluetooth, serialport
bluetooth-iot-service-python
This application connects two devices over Bluetooth and allows one to send messages to the other using json. Raspberry Pi Bluetooth interfacing with Linux via RFCOMM BT network
Stars: ✭ 23 (-84.14%)
Mutual labels:  bluetooth, iot-device
Blynk Library
Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.
Stars: ✭ 3,305 (+2179.31%)
Mutual labels:  serialport, bluetooth
Drivety
Drivety: Smart App Assistant to Secure Inside Car Activity. #AndroidDevChallenge
Stars: ✭ 62 (-57.24%)
Mutual labels:  bluetooth, iot-device
Node Escpos
🖨️ ESC/POS Printer driver for node
Stars: ✭ 752 (+418.62%)
Mutual labels:  serialport, bluetooth
Usbserial
Usb serial controller for Android
Stars: ✭ 1,301 (+797.24%)
Mutual labels:  serialport, iot-device
Slide Beacon App
Share links from your Mac using this app to broadcast them as a Physical Web Eddystone URL bluetooth beacon or mDNS.
Stars: ✭ 131 (-9.66%)
Mutual labels:  bluetooth
Ble.net
Cross-platform Bluetooth Low Energy (BLE) library for Android, iOS, and UWP
Stars: ✭ 137 (-5.52%)
Mutual labels:  bluetooth
Knob
Key Negotiation Of Bluetooth (KNOB) attacks on Bluetooth BR/EDR and BLE [CVE-2019-9506]
Stars: ✭ 131 (-9.66%)
Mutual labels:  bluetooth
Simplebluetoothlibrary
Android library for simplifying bluetooth usage.
Stars: ✭ 131 (-9.66%)
Mutual labels:  bluetooth
Pedalinomini
Same features of Pedalino™ in a compact form.
Stars: ✭ 139 (-4.14%)
Mutual labels:  bluetooth
Printerdemo
Android蓝牙连打印机
Stars: ✭ 131 (-9.66%)
Mutual labels:  bluetooth
Serialporthelper
Android串口通讯助手,使用C++实现。
Stars: ✭ 141 (-2.76%)
Mutual labels:  serialport
Web Bluetooth Terminal
Progressive Web Application for serial communication with your own Bluetooth Low Energy (Smart) devices
Stars: ✭ 130 (-10.34%)
Mutual labels:  bluetooth
Googleserialport
Android串口通信:抱歉,学会它真的可以为所欲为 ! ! !
Stars: ✭ 130 (-10.34%)
Mutual labels:  serialport
Rubyserial
FFI Ruby library for RS-232 serial port communication
Stars: ✭ 142 (-2.07%)
Mutual labels:  serialport
Bluesnooze
Sleeping Mac = Bluetooth off
Stars: ✭ 140 (-3.45%)
Mutual labels:  bluetooth
Shibari
Gaming input peripherals test platform for Windows
Stars: ✭ 136 (-6.21%)
Mutual labels:  bluetooth

node-bluetooth NPM version

Bluetooth serial port communication for Node.js

Requirements

This package require node-gyp installed .

Linux

You'll need libbluetooth-dev. On Ubuntu/Debian : $ sudo apt-get install libbluetooth-dev

Installation

$ npm install node-bluetooth --save

Example

create device

const bluetooth = require('node-bluetooth');

// create bluetooth device instance
const device = new bluetooth.DeviceINQ();

list already paired devices

device.listPairedDevices(console.log);

will output

  node-bluetooth git:(master)  node example/index.js
[ { name: 'Lsong’s Trackpad',
    address: 'd0-a6-37-f1-e7-87',
    services: [ [Object], [Object] ] },
  { name: 'Lsong’s iPhone',
    address: 'dc-2b-2a-82-76-29',
    services: [ [Object], [Object], [Object], [Object] ] },
  { name: 'Lsong’s Keyboard',
    address: '60-c5-47-19-d3-76',
    services: [ [Object], [Object] ] } ]

find devices

device
.on('finished',  console.log.bind(console, 'finished'))
.on('found', function found(address, name){
  console.log('Found: ' + address + ' with name ' + name);
}).scan();

will output

➜  node-bluetooth git:(master) ✗ node example/index.js
Found: 22-22-a3-0d-63-09 with name Meizu MX4 Pro
Found: dc-2b-2a-82-76-29 with name Lsong's iPhone
Found: 38-bc-1a-37-2d-d4 with name MEIZU MX5
finished

find serial port channel

device.findSerialPortChannel(address, function(channel){
  console.log('Found RFCOMM channel for serial port on %s: ', name, channel);

  // make bluetooth connect to remote device
  bluetooth.connect(address, channel, function(err, connection){
    if(err) return console.error(err);
    connection.write(new Buffer('Hello!', 'utf-8'), () => {
      console.log("wrote");
    });
  });

});

create connection to device, read and write

// make bluetooth connect to remote device
bluetooth.connect(address, channel, function(err, connection){
  if(err) return console.error(err);

  connection.on('data', (buffer) => {
    console.log('received message:', buffer.toString());
  });

  connection.write(new Buffer('Hello!', 'utf-8'), () => {
    console.log("wrote");
  });
});

API

Contributing

  • Fork this Repo first
  • Clone your Repo
  • Install dependencies by $ npm install
  • Checkout a feature branch
  • Feel free to add your features
  • Make sure your features are fully tested
  • Publish your local branch, Open a pull request
  • Enjoy hacking <3

MIT license

Copyright (c) 2016 lsong

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].