Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Robobin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plw1g21
Robobin
Commits
8afe5e8b
Commit
8afe5e8b
authored
5 months ago
by
plw1g21
Browse files
Options
Downloads
Patches
Plain Diff
So this code was working, but now I need to remember which commands to run to enable BLE.
parent
b5b7008e
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
App now has a basic structure and BLE support
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Connectivity/RPiBluetooth.py
+4
-2
4 additions, 2 deletions
Connectivity/RPiBluetooth.py
with
4 additions
and
2 deletions
Connectivity/RPiBluetooth.py
+
4
−
2
View file @
8afe5e8b
...
...
@@ -16,7 +16,7 @@ class PairingCharacteristic(dbus.service.Object):
'
Service
'
:
dbus
.
ObjectPath
(
service
.
path
),
'
Flags
'
:
dbus
.
Array
([
'
read
'
,
'
write
'
],
signature
=
'
s
'
)
}
super
().
__init__
(
service
.
bus
,
self
.
path
)
super
().
__init__
(
self
.
service
.
bus
,
self
.
path
)
# Use self.service.bus here
@dbus.service.method
(
'
org.bluez.GattCharacteristic1
'
,
in_signature
=
''
,
out_signature
=
'
a{sv}
'
)
def
GetProperties
(
self
):
...
...
@@ -33,6 +33,7 @@ class PairingCharacteristic(dbus.service.Object):
class
BLEService
(
dbus
.
service
.
Object
):
def
__init__
(
self
,
bus
,
index
):
self
.
bus
=
bus
# Store the bus object as an attribute of the BLEService
self
.
path
=
f
"
/org/bluez/example/service
{
index
}
"
self
.
props
=
{
'
UUID
'
:
dbus
.
String
(
SERVICE_UUID
),
...
...
@@ -53,6 +54,7 @@ def main():
DBusGMainLoop
(
set_as_default
=
True
)
bus
=
dbus
.
SystemBus
()
# Create the BLE service
service
=
BLEService
(
bus
,
0
)
print
(
"
BLE Service running. Press Ctrl+C to stop.
"
)
...
...
@@ -60,4 +62,4 @@ def main():
mainloop
.
run
()
if
__name__
==
'
__main__
'
:
main
()
\ No newline at end of file
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment