Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Μ
µnit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Teckids
Projekt Hack-n-Fun
Libs
µnit
Commits
0c152164
Verified
Commit
0c152164
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Write interface definition for displaying devices in UI
parent
3e2858e1
No related branches found
No related tags found
No related merge requests found
Pipeline
#76451
passed
3 years ago
Stage: prepare
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
companion/app.py
+4
-1
4 additions, 1 deletion
companion/app.py
companion/bluetooth.py
+9
-2
9 additions, 2 deletions
companion/bluetooth.py
companion/mynitcompanion.kv
+3
-7
3 additions, 7 deletions
companion/mynitcompanion.kv
with
16 additions
and
10 deletions
companion/app.py
+
4
−
1
View file @
0c152164
from
kivy.app
import
App
from
.
bluetooth
import
MynitBluetooth
from
bluetooth
import
MynitBluetooth
class
MynitCompanionApp
(
App
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
_bluetooth
=
MynitBluetooth
(
self
)
def
update_device_list
(
self
,
devices
):
pass
This diff is collapsed.
Click to expand it.
companion/bluetooth.py
+
9
−
2
View file @
0c152164
from
time
import
sleep
from
able
import
BluetoothDispatcher
from
kivy.logger
import
Logger
class
MynitBluetooth
(
BluetoothDispatcher
):
...
...
@@ -10,8 +11,14 @@ class MynitBluetooth(BluetoothDispatcher):
self
.
_app
=
app
self
.
_available_devices
=
set
()
Logger
.
info
(
"
Starting BLE scanning
"
)
self
.
start_scan
()
def
on_device
(
self
,
device
,
rssi
,
advertisement
):
self
.
_available_devices
.
add
(
device
)
Logger
.
debug
(
"
BLE device discovered: %s
"
%
device
.
getAddress
())
if
device
not
in
self
.
_available_devices
:
Logger
.
info
(
"
New BLE device discovered: %s
"
%
device
.
getAddress
())
self
.
_available_devices
.
add
(
device
)
self
.
_app
.
update_device_list
(
self
.
_available_devices
)
This diff is collapsed.
Click to expand it.
companion/mynitcompanion.kv
+
3
−
7
View file @
0c152164
#:kivy 1.0.9
GridLayout:
cols:
2
cols:
1
Button:
text: "Foo"
Button:
text: "Bar"
\ No newline at end of file
Label:
text: "Device list"
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