Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KWH40
fml40-reference-implementation
Commits
0c292f97
Commit
0c292f97
authored
Mar 30, 2021
by
Jiahang Chen
Browse files
add function to update broker token
parent
f871a215
Pipeline
#437871
passed with stages
in 52 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ml/thing.py
View file @
0c292f97
...
...
@@ -426,17 +426,21 @@ def receive():
threading
.
Thread
(
target
=
receive
).
start
()
else
:
self
.
broker
=
Broker
(
auth_form
=
"Username/Password"
,
username
=
" "
,
password
=
self
.
__access_token
,
host
=
BaseVariable
.
BROKER_HOST
,
)
if
self
.
broker
is
None
:
# first time to build a broker instance
self
.
broker
=
Broker
(
auth_form
=
"Username/Password"
,
username
=
" "
,
password
=
self
.
__access_token
,
host
=
BaseVariable
.
BROKER_HOST
,
)
threading
.
Thread
(
target
=
self
.
broker
.
receive
,
args
=
(
self
.
__endpoint
,
self
.
__on_broker_callback
),
).
start
()
threading
.
Thread
(
target
=
self
.
broker
.
receive
,
args
=
(
self
.
__endpoint
,
self
.
__on_broker_callback
),
).
start
()
else
:
self
.
broker
.
update_token
(
self
.
access_token
)
def
__on_broker_callback
(
self
,
ch
,
method
,
properties
,
body
):
"""Parses body (content of a S3I-B message) and delegates the
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment