User Tools

Site Tools


sensorweaver:bluetooth-feeder

Bluetooth Feeder

The Bluetooth Feeder is an OSGi bundle designed to log BLE beacon messages. Specifically, the Bluetoot Feeder provides the following functionalities

  • Detect iBeacon, EddyStone, EddyStone TLM
  • Publish the beacon messages on the middleware
  • (optionally to test) write the beacon messages on a DB
  • log on a file the beacon messages
  • enable the USB dongle to send beacon messages

The bundle requires to interact with a BLE USB dongle (detected via RXTX serial lib) through which the Bluetooth Feeder can listen for BLE messages. The Bluetooth Feeder interacts with the USB dongle by means of the bglib protocolhttps://github.com/SINTEF-9012/bglib/tree/master/bglib-protocol-1.0.3-43 (provided by SINTEF). As soon as a new message is received, the Bluetooth Feeder parses and publishes it through the middleware API. The topic used for publishing the messages is:

dataFeed/context/beaconX

Where X is the ID of the receiving device (see below).

The data feed describing the messages is:

sender
rssi
packet_type

Installation

You need a BLE USB dongle plugged on the instance you are provisioning with the Bluetooth Feeder.

  • On windows OS: the USB dongle is usually recognized as COM port (ex: COM3)
  • On Unix OS: the USB dongle is added to the /dev dir (ex /dev/ttyACM0)

Be sure the following MVN repositories are added on your karaf instnace

    http://repository.springsource.com/maven/bundles/external@id=spring-ebr-repository@snapshots@noreleases, \
    http://ala.isti.cnr.it:8081/nexus/content/repositories/wnlab-releases@id=wnlab-releases, \
    http://ala.isti.cnr.it:8081/nexus/content/repositories/wnlab-snapshots@id=wnlab-snapshots@snapshots, \
    http://maven.thingml.org/thingml-release/

Add the following feature URL on the Karaf console:

feature:repo-add mvn:it.cnr.isti.sensorweaver.bluetooth/bluetooth-features/1.0.0-SNAPSHOT/xml/features
karaf@root()> feature:list | grep bluetooth
bluetooth-feeder              | 1.0.0.SNAPSHOT   | x        | Started     | bluetooth1.0.0-SNAPSHOT  |
karaf@root()>

Install the bluetooth-feeder feature:

karaf@root()>feature:install bluetooth-feeder
karaf@root()> WARNING:  RXTX Version mismatch
        Jar version = RXTX-2.2pre2
        native lib Version = RXTX-2.2pre3

Please not that, since the Bluetooth Feeder relies on a configuration file, such file might contain default settings not valid for you instance. If you need to update the configuration:

  1. edit the file (KARAF_HOME/etc/it.cnr.isti.sensorweaver.bluetooth.bluetoothproducer.cfg
  2. stop the bluetooth-feeder bundle
  3. start the bluetooth-feeder bundle

Configuration

The installation of the Bluetooth Feeder deploys the following configuration file on the KARAF_HOME/etc folder

it.cnr.isti.sensorweaver.bluetooth.bluetoothproducer.cfg

With the following default settings:

#Bluetooth dongle
serial_port=COM3 (replace with the serial port bound with te USB dongle)
 
#Logging
#The ID used to build an unique topic, every instance must have a different ID)
id_receiver = 0 
 
#DB Not used, it is possibile to enable a db writer together with the middleware publisher
enable_db_writer=false 
#jdbc_class=com.mysql.jdbc.Driver
jdbc_class=com.mysql.cj.jdbc.Driver
db_connection=jdbc:mysql://gallina.isti.cnr.it/sniffer
db_user=sniffer_user
db_passwd=fyQ3V8tpoaMmImrl
batch_size=1000
remove_file_after_upload=true
 
#Sender properties: it is possibile to enable the dongle beaconing
sender_enabled=false
#adv frequency as range. Minimum advertisement interval in units of 625us Range: 0x20 to 0x4000
Default: 0x200 (320ms)
adv_interval_min=300
adv_interval_max=340
#power of transmission
tx_power=15
 
#Type of beacon sent
beacon_type=iBeacon
 
#Settings for EddyStone beacon format
#Eddystone frame_type: UUID, TLM, URL
frame_type=UUID
# EddystoneUUID
namespace_id=2f234454f4911ba9ffa6
instance_id=15
 
#Settings of iBeacon format
# iBeacon
uuid=ef977fc020c64e1c9141f6dd2eeb7e49
major=0
minor=10
sensorweaver/bluetooth-feeder.txt · Last modified: 2017-09-26 10:01 by michele