Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Python
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xAAL
Code
Python
Commits
a3a33c11
Commit
a3a33c11
authored
7 months ago
by
KERDREUX Jerome
Browse files
Options
Downloads
Patches
Plain Diff
Format
Just a test for new rules
parent
e8c5d98b
No related branches found
No related tags found
1 merge request
!1
First try of type hints
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/monitor/xaal/monitor/monitor.py
+79
-55
79 additions, 55 deletions
libs/monitor/xaal/monitor/monitor.py
with
79 additions
and
55 deletions
libs/monitor/xaal/monitor/monitor.py
+
79
−
55
View file @
a3a33c11
...
...
@@ -7,6 +7,7 @@ from xaal.lib import Message
import
logging
logger
=
logging
.
getLogger
(
__name__
)
# how often we force refresh the devices attributes/description/keyvalues
...
...
@@ -110,8 +111,10 @@ class Device:
result
=
self
.
db
.
get
(
'
name
'
,
result
)
return
result
class
Devices
:
"""
Device List for monitoring
"""
def
__init__
(
self
):
self
.
__devs
=
{}
self
.
__list_cache
=
None
...
...
@@ -224,6 +227,7 @@ class Monitor:
"""
use this class to monitor a xAAL network
"""
def
__init__
(
self
,
device
,
filter_func
=
None
,
db_server
=
None
):
self
.
dev
=
device
self
.
engine
=
device
.
engine
...
...
@@ -347,13 +351,30 @@ class Monitor:
def
request_metadb
(
self
,
addr
):
if
self
.
db_server
:
self
.
engine
.
send_request
(
self
.
dev
,
[
self
.
db_server
,],
'
get_keys_values
'
,
{
'
device
'
:
addr
})
self
.
engine
.
send_request
(
self
.
dev
,
[
self
.
db_server
,
],
'
get_keys_values
'
,
{
'
device
'
:
addr
},
)
def
request_attributes
(
self
,
addr
):
self
.
engine
.
send_get_attributes
(
self
.
dev
,[
addr
,])
self
.
engine
.
send_get_attributes
(
self
.
dev
,
[
addr
,
],
)
def
request_description
(
self
,
addr
):
self
.
engine
.
send_get_description
(
self
.
dev
,[
addr
,])
self
.
engine
.
send_get_description
(
self
.
dev
,
[
addr
,
],
)
def
is_from_metadb
(
self
,
msg
):
if
(
msg
.
is_notify
()
or
msg
.
is_reply
())
and
msg
.
source
==
self
.
db_server
:
...
...
@@ -372,4 +393,7 @@ class Monitor:
def
debug_timers
(
self
):
for
dev
in
self
.
devices
:
print
(
"
%s
\t
%s
\t
%d
\t
%d
\t
%d
"
%
(
dev
.
address
,
dev
.
dev_type
,
dev
.
description
.
last_update
,
dev
.
db
.
last_update
,
dev
.
attributes
.
last_update
))
print
(
"
%s
\t
%s
\t
%d
\t
%d
\t
%d
"
%
(
dev
.
address
,
dev
.
dev_type
,
dev
.
description
.
last_update
,
dev
.
db
.
last_update
,
dev
.
attributes
.
last_update
)
)
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