wistudent / bluetooth-low-energy-led-matrix Goto Github PK
View Code? Open in Web Editor NEWTurns a Raspberry Pi 3 into a Bluetooth LE peripheral that controls an LED matrix.
License: GNU General Public License v2.0
Turns a Raspberry Pi 3 into a Bluetooth LE peripheral that controls an LED matrix.
License: GNU General Public License v2.0
There are several things need to be updated in bluez_components.py
file as to support latest functionalities in the latest stack. Also several functionalities are missing like setting data values and local name in the advertisement.
For example, I have below changes in my local branch.
diff --git a/src/bluez_components.py b/src/bluez_components.py
index cbe1f2a..ab2f6be 100644
--- a/src/bluez_components.py
+++ b/src/bluez_components.py
@@ -241,12 +241,14 @@ class Advertisement(dbus.service.Object):
def __init__(self, bus, index, advertising_type):
self.path = self.PATH_BASE + str(index)
self.bus = bus
+ self.local_name = None
self.ad_type = advertising_type
self.service_uuids = None
self.manufacturer_data = None
self.solicit_uuids = None
self.service_data = None
self.include_tx_power = None
+ self.data = None
dbus.service.Object.__init__(self, bus, self.path)
def get_properties(self):
@@ -260,14 +262,21 @@ class Advertisement(dbus.service.Object):
signature='s')
if self.manufacturer_data is not None:
properties['ManufacturerData'] = dbus.Dictionary(
- self.manufacturer_data, signature='qay')
+ self.manufacturer_data, signature='qv')
if self.service_data is not None:
properties['ServiceData'] = dbus.Dictionary(self.service_data,
- signature='say')
+ signature='sv')
+ if self.local_name is not None:
+ properties['LocalName'] = dbus.String(self.local_name)
if self.include_tx_power is not None:
properties['IncludeTxPower'] = dbus.Boolean(self.include_tx_power)
return {LE_ADVERTISEMENT_IFACE: properties}
+ if self.data is not None:
+ properties['Data'] = dbus.Dictionary(
+ self.data, signature='yv')
+ return {LE_ADVERTISEMENT_IFACE: properties}
+
def get_path(self):
return dbus.ObjectPath(self.path)
@@ -283,13 +292,23 @@ class Advertisement(dbus.service.Object):
def add_manufacturer_data(self, manuf_code, data):
if not self.manufacturer_data:
- self.manufacturer_data = dict()
- self.manufacturer_data[manuf_code] = data
+ self.manufacturer_data = dbus.Dictionary({}, signature='qv')
+ self.manufacturer_data[manuf_code] = dbus.Array(data, signature='y')
def add_service_data(self, uuid, data):
if not self.service_data:
- self.service_data = dict()
- self.service_data[uuid] = data
+ self.service_data = dbus.Dictionary({}, signature='sv')
+ self.service_data[uuid] = dbus.Array(data, signature='y')
+
+ def add_local_name(self, name):
+ if not self.local_name:
+ self.local_name = ""
+ self.local_name = dbus.String(name)
+
+ def add_data(self, ad_type, data):
+ if not self.data:
+ self.data = dbus.Dictionary({}, signature='yv')
+ self.data[ad_type] = dbus.Array(data, signature='y')
@dbus.service.method(DBUS_PROP_IFACE,
in_signature='s',
I have tested above changes for Bluez5-5.50 stack and they are working fine. I am also looking at changes to set advertising params as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.