Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
dos
flow3r firmware
Commits
1bb75fcc
Commit
1bb75fcc
authored
1 year ago
by
ave
Committed by
ave
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
st3m/application: enforce wifi preference from app bundle
parent
9e9af8b7
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
python_payload/st3m/application.py
+18
-2
18 additions, 2 deletions
python_payload/st3m/application.py
with
18 additions
and
2 deletions
python_payload/st3m/application.py
+
18
−
2
View file @
1bb75fcc
from
st3m.ui.view
import
(
BaseView
,
ViewTransitionSwipeRight
,
ViewTransitionSwipeLeft
,
ViewManager
,
)
from
st3m.ui.menu
import
MenuItem
from
st3m.input
import
InputState
from
st3m.goose
import
Optional
,
List
,
Enum
,
Dict
import
st3m.wifi
from
st3m.goose
import
Optional
,
List
,
Dict
from
st3m.logging
import
Log
from
ctx
import
Context
...
...
@@ -47,8 +47,24 @@ class ApplicationContext:
class
Application
(
BaseView
):
def
__init__
(
self
,
app_ctx
:
ApplicationContext
)
->
None
:
self
.
_app_ctx
=
app_ctx
self
.
_wifi_preference
=
app_ctx
.
bundle_metadata
[
"
app
"
].
get
(
"
wifi_preference
"
)
super
().
__init__
()
def
on_enter
(
self
,
vm
:
Optional
[
ViewManager
])
->
None
:
# Try to connect/disconnect from wifi if requested by app
if
self
.
_wifi_preference
is
True
and
not
st3m
.
wifi
.
is_connected
():
st3m
.
wifi
.
setup_wifi
()
elif
self
.
_wifi_preference
is
False
:
st3m
.
wifi
.
disable
()
super
().
on_enter
(
vm
)
def
on_exit
(
self
)
->
None
:
# If the app requested to change wifi state
# fall back to system defaults on exit
if
self
.
_wifi_preference
is
not
None
:
st3m
.
wifi
.
_onoff_wifi_update
()
super
().
on_exit
()
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
super
().
think
(
ins
,
delta_ms
)
...
...
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