NodeJS - add device to BLE whitelist - node.js

I am using #abandonware/noble for scanning and interrogating Bluetooth devices on Linux. I could not, however, find a method to add a MAC address to the LE whitelist, similar to hcitool lewladd on Linux. Is there a way to do it using noble?

Related

Scan for discoverable bluetooth devices MAC address on Mac OS

I've been searching for a mac alternative to hcitool for a long time with no success. I just want to be able to scan the area for discoverable bluetooth devices and get a list of the MAC addresses in the area. I'd preferably like to have this functionality usable programmatically. Thanks!

Detect mobile phone presence with Bluetooth usb dongle.

I am using BeagleBone Black and Bluetooth USB dongle V4.0. My dongle is detecting iBeacons with no problems but is there any way to detect mobile phones with bluetooth on. I am using NodeJs and Noble package.
So when I use hcitool lescan it's not finding mobile phone either but with hcitool there is option scan. When I call hcitool scan in terminal I get my mobile as result. Is there any NodeJs package that wraps this option. I have no need to connect to mobile device, I just need to discover it's presence, and see it's MAC address.
If you can see your device with "hcitool scan" and not with "hcitool lescan" it means your phone(or BT stack you use in phone) don't support BLE protocol. Not all BT devices are BLE capable.

Raspberry PI - RT2870 (kernel module mt7601Usta) WiFi SUB dongle - Act as WiFi access point

I have a problem with USB WiFi dongle RT2870 on Raspberry Pi. This is KOM0640 (Quer) model, successfully detected by Linux Kernel mt7601Usta.ko module.
Specification of my Raspberry:
Latest Linux Raspbian distro with kernel 3.12.35+
WiFi dongle 148f:7601 Ralink Technology, Corp.
WiFi dongle is successfuly detected and can be used as client (connect with available access points).
My problem is to switch this USB WiFi dongle to AP (access-point) mode and enable HotSpot mode on Raspberry Pi. Here is result of iwconfig - I've tried to set access point mode by hand from command line:
root#raspberrypi:~/# iwconfig wlan0 mode master
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Invalid argument.
I have read a lot of web pages with a lots of hints, but without success.
If you have any positive results on this issue, please let me know.
Thanks in advance!
Mediatek drivers dont support nl80211 and cant be used with hostapd.
Original drivers from mediatek.com site doesnt contain AP function. You have to compile driver from eywalink github repo.
After compiling/installing driver you can insert mt7601uap module and configure AP settings in /etc/Wireless/RT2870AP/RT2870AP.dat
You need a driver that supports master mode. You can get one from https://github.com/muratdemirtas/MT7601u. Good luck

How to implement Bluetooth LE with Bluez in Linux

I'm working on setting up two Linux systems for a BLE demo. Obviously one system will be the peripheral and one will be the central devices. I have several questions surrounding both of these configurations.
Environment
2x Ubuntu 14.04 systems
2x Pluggable USB-BT4LE dongles (http://plugable.com/products/usb-bt4le)
Peripheral Device Setup
The first order of business is getting the peripheral system setup and advertising with a GATT server configured. At this time, it does not seem possible to configure a GATT server from the command line. So, while it is a simple task bringing a USB dongle up and advertising it, this does not allow the creation of custom services and characteristics. The only example of a GATT server I could find was the gatt-example.c file in the Bluez package. So I downloaded and built the latest bluez-5.23 source. (http://www.linuxfromscratch.org/blfs/view/svn/general/bluez.html). Additionally configured using the --enable-maintainer-mode flag to force build the gatt-example.c plugin into bluetoothd. And I validated post-build from the ~/bluez-5.23/plugins directory that there was a bluetoothd-gat-example.o file. Which tells me that the gatt-example was at least successfully built.
I then modified the configuration file to enable LE and the attribute server.
$ sudo vi /etc/bluetooth/main.conf
EnableLE = true // Enable Low Energy support. Default is false.
AttributeServer = true // Enable the GATT attribute server. Default is false.
Then simply reboot or restart the bluetooth daemon...
Central Device Setup
As the central device does not need any special plugins built like the peripheral, I just installed bluez using apt-get. This appears to have installed v4.101 according to bluetoothd -v.
Session Setup
The connection process then should be fairly simple. I setup the peripheral to advertise and then connect with the central device:
Peripheral:
$ sudo hciconfig hci0 up // Make sure the interface is up
$ sudo hciconfig hci0 leadv // Set the interface to advertise
Central:
$ sudo hcitool -i hci0 lescan // Scan for nearby devices advertising
LE Scan ...
00:02:72:C9:5E:0F (unknown) // Not sure why two of the same MAC are found?
00:02:72:C9:5E:0F (unknown) // but I know this is my device...
$ sudo gatttool -i hci0 -b 00:02:72:C9:5E:0F -m 48 --interactive // Connect interactively
[ ][00:02:72:C9:5E:0F][LE]> connect
[CON][00:02:72:C9:5E:0F][LE]> primary
attr handle: 0x0001, end grp handle: 0x0008 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x0010, end grp handle: 0x0010 uuid: 00001801-0000-1000-8000-00805f9b34fb
[CON][00:02:72:C9:5E:0F][LE]> characteristics
handle: 0x0004, char properties: 0x02, char value handle: 0x0006, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0007, char properties: 0x02, char value handle: 0x0008, uuid: 00002a01-0000-1000-8000-00805f9b34fb
And we see not one of the services or characteristics from the gatt-example are available.
Questions
--Peripheral Device
How would I go about creating my own custom GATT server? Can it be a stand-alone C application or does it need to be built into bluetoothd as a plugin like the gatt-example? The answer to this question (Creating a Gatt Server?) implies you do the following: "start by initializing the GATT library and additional modules" and then "register your GATT database". But there isn't a single example of how to implement those generic statements and the link provided is simply a URL to the Bluetooth website.
The GATT specifications (https://developer.bluetooth.org/gatt/Pages/default.aspx) provide numerous "adopted" services and characteristics that are downloadable in XML format. But there is no instructions for how to use them?!
How do a validate my GATT server is running?
--Central Device
Why is my central device not seeing the services and characteristics from the GATT server running on the peripheral?
I can provide any additional information necessary. Thanks.
To create a GATT server into a separate process you have (at least) two cases:
Bluez v4.x: your GATT service must be a Bluez plugin
Bluez v5.x: your GATT service should use the new GATT DBus API (but it is recommended to use at least Bluez v5.39 (from April 2016). Otherwise it is safer (in term of Bluez GATT Server API) to use the Bluez v4.x plugin approach.
If your Central Device does not see the newly exported GATT service is probably an issue on the periphal rather than to be an issue on the Central Device.
When you will need to implement the GATT client on the Central Device you still have two cases:
Bluez v4.x: Bluez does not expose the GATT API. Either you use a shell script to launch gatttool commands, or you use a GATT library such as gattlib to interact with the BLE device
Bluez v5.x: Same thing, if you cannot migrate to Bluez v5.39 then it is better to use Bluez v4.x methodology.

Using Bluetooth low energy in linux command line

I am working on using the Bluetooth low energy modem with Linux. I am using the command line option for that i.e. hcitool . I am able to the find the devices using the command: $ hcitool scan
It is working fine for me, also I am able to broadcast my device using :
sudo hciconfig hci0 leadv
It is also working fine. But I want to add the services and characteristic to the modem device which can be detected by other device. I have tried sdptool add but it is not working for me. Does anyone know how to add the services and characteristics to the peripheral using the command line tools in ubuntu?
Edit: My modem is broadcasting but not able to explore the services and characteristic to the other BLE device. Now I am able to set the name of device using hcio name command
Edit: Now I am able to render the services and characteristic, by simultaneously running sudo hcidump command. But I am not able to track from where I am getting those services and characteristics. One definite observation is those services are rendering from the machine.
SDP is absent in BLE. Broadcast/advertise frame and GATT client/server are used instead.
Several links:
BlueZ gatttool: command line tool to run common GATT procedures
BlueZ GATT's ready profiles
hint: DBUS
GATT and DBUS example
How can I connect to the FitBit Zip over Bluetooth 4.0 LE on Linux with bluez?
Bluetooth Low Energy: listening for notifications/indications in linux
http://comments.gmane.org/gmane.linux.bluez.kernel/29547
I used to broadcast BT services by following this article. This page not only shouws you how to advertise a profile, but also gives you an example on how to implement the HSP profile.
To know the bt class you need to announce, you can check this other page.

Resources