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
GitLab 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
Compare revisions
d56b4e0a440e9f08716be263cfc42c836da33c94 to a4923a86716ca18918406378ead4ed4f3aa381f4
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
Teckids/hacknfun/libs/mynit
Select target project
No results found
a4923a86716ca18918406378ead4ed4f3aa381f4
Select Git revision
Branches
bleak
master
2 results
Swap
Target
Teckids/hacknfun/libs/mynit
Select target project
Teckids/hacknfun/libs/mynit
schubisu/esp-init
2 results
d56b4e0a440e9f08716be263cfc42c836da33c94
Select Git revision
Branches
bleak
master
2 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source
3
Fix syntax
· b677a131
Nik | Klampfradler
authored
Jun 26, 2022
Verified
b677a131
Fix dependencies in Makefile
· e50ec570
Nik | Klampfradler
authored
Jun 26, 2022
Verified
e50ec570
[WIP] Turn device list into buttons
· a4923a86
Nik | Klampfradler
authored
Jun 26, 2022
Verified
a4923a86
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
companion/Makefile
+7
-1
7 additions, 1 deletion
companion/Makefile
companion/app.py
+22
-3
22 additions, 3 deletions
companion/app.py
companion/bluetooth.py
+4
-3
4 additions, 3 deletions
companion/bluetooth.py
companion/mynitcompanion.kv
+8
-3
8 additions, 3 deletions
companion/mynitcompanion.kv
with
41 additions
and
10 deletions
companion/Makefile
View file @
a4923a86
...
...
@@ -6,7 +6,13 @@ VERSION_FULL := $(VERSION)
ARCH
:=
arm64-v8a
$(DIST)-debug-$(VERSION_FULL)-$(ARCH).apk
:
SOURCES
:=
\
app.py
\
bluetooth.py
\
main.py
\
mynitcompanion.kv
$(DIST)-debug-$(VERSION_FULL)-$(ARCH).apk
:
$(SOURCES)
p4a apk
\
--dist_name
$(
DIST
)
\
--private
.
\
...
...
This diff is collapsed.
Click to expand it.
companion/app.py
View file @
a4923a86
from
kivy.app
import
App
from
kivy.logger
import
Logger
from
kivy.properties
import
ObjectProperty
from
kivy.uix.button
import
Button
from
kivy.uix.widget
import
Widget
from
bluetooth
import
MynitBluetooth
class
DeviceListWidget
(
Widget
):
app
=
ObjectProperty
()
device_buttons
=
None
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
_devices_buttons_map
=
{}
def
update_device_buttons
(
self
,
devices
):
Logger
.
debug
(
"
Updating device buttons
"
)
self
.
_devices_buttons_map
=
devices
self
.
device_buttons
.
clear_widgets
()
for
label
,
device
in
self
.
_devices_buttons_map
.
items
():
Logger
.
debug
(
"
Adding button for %s
"
%
label
)
btn
=
Button
(
text
=
label
)
self
.
device_buttons
.
add_widget
(
btn
)
class
MynitCompanionApp
(
App
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -14,7 +32,8 @@ class MynitCompanionApp(App):
self
.
_bluetooth
=
MynitBluetooth
(
self
)
def
update_device_list
(
self
,
devices
):
pass
self
.
widget
.
update_device_buttons
({
device
.
getAddress
():
device
for
device
in
devices
})
def
build
(
self
):
return
DeviceListWidget
(
app
=
self
)
self
.
widget
=
DeviceListWidget
()
return
self
.
widget
This diff is collapsed.
Click to expand it.
companion/bluetooth.py
View file @
a4923a86
...
...
@@ -20,11 +20,12 @@ class MynitBluetooth(BluetoothDispatcher):
self
.
_characteristics
=
None
,
None
Logger
.
info
(
"
Starting BLE scanning
"
)
self
.
start_scan
(
filters
=
[
ServiceUUIDFilter
(
_UART_SERVICE_UUID
)])
# self.start_scan(filters=[ServiceUUIDFilter(_UART_SERVICE_UUID)])
self
.
start_scan
()
def
on_device
(
self
,
device
,
rssi
,
advertisement
):
Logger
.
debug
(
"
BLE device discovered: %s
"
%
device
.
getAddress
())
self
.
stop_scan
()
if
device
not
in
self
.
_available_devices
:
Logger
.
info
(
"
New BLE device discovered: %s
"
%
device
.
getAddress
())
self
.
_available_devices
.
add
(
device
)
...
...
@@ -45,4 +46,4 @@ class MynitBluetooth(BluetoothDispatcher):
self
.
_characteristics
=
None
,
None
def
on_services
(
self
,
status
,
services
):
self
.
_characteristics
=
(
services
.
search
(
_UART_SERVICE_TX_UUID
),
services
.
search
(
_UART_SERVICE_RX_UUID
)
self
.
_characteristics
=
(
services
.
search
(
_UART_SERVICE_TX_UUID
),
services
.
search
(
_UART_SERVICE_RX_UUID
)
)
This diff is collapsed.
Click to expand it.
companion/mynitcompanion.kv
View file @
a4923a86
#:kivy 1.0.9
<DeviceListWidget>:
cols: 1
device_buttons: device_buttons
BoxLayout:
Label:
text: str(root.app._bluetooth._available_devices)
text: "Device List"
BoxLayout:
id: device_buttons
This diff is collapsed.
Click to expand it.