Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VISCA Over IP
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
Container registry
Model registry
Operate
Environments
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
Amalio Coron
VISCA Over IP
Commits
b2164b43
Commit
b2164b43
authored
6 years ago
by
Pierre Minssen
Browse files
Options
Downloads
Patches
Plain Diff
commentaire de code
parent
45af73a6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
viscaoveriplib/controleur.py
+25
-8
25 additions, 8 deletions
viscaoveriplib/controleur.py
viscaoveriplib/inquiry_responds_library.py
+3
-1
3 additions, 1 deletion
viscaoveriplib/inquiry_responds_library.py
viscaoveriplib/responds_messages.py
+2
-2
2 additions, 2 deletions
viscaoveriplib/responds_messages.py
with
30 additions
and
11 deletions
viscaoveriplib/controleur.py
+
25
−
8
View file @
b2164b43
...
@@ -3,25 +3,42 @@ from viscaoveriplib.listener import Listener
...
@@ -3,25 +3,42 @@ from viscaoveriplib.listener import Listener
import
viscaoveriplib.inquiry_responds_library
as
inq_resp
import
viscaoveriplib.inquiry_responds_library
as
inq_resp
import
viscaoveriplib.responds_messages
as
default_resp
import
viscaoveriplib.responds_messages
as
default_resp
class
Controller
:
class
Controller
:
def
__init__
(
self
,
c
:
Camera
,
l
:
Listener
):
def
__init__
(
self
,
c
:
Camera
,
l
:
Listener
):
self
.
camera
=
c
self
.
camera
=
c
self
.
listener
=
l
self
.
listener
=
l
def
decompose_reception
(
self
):
@staticmethod
reception
=
self
.
listener
.
message
def
decompose_reception
(
reception
:
str
):
"""
decomposes the hex received messaged
:param reception: str hex eg
'
01110003000085029051ff
'
:return: list of str hex [payload_type, payload_length, sequence_number, payload] eg [
'
0111
'
,
'
0003
'
,
'
00008502
'
,
'
9051ff
'
]
"""
payload_type
=
reception
[
0
:
4
]
payload_type
=
reception
[
0
:
4
]
payload_length
=
reception
[
4
:
8
]
payload_length
=
reception
[
4
:
8
]
sequence_number
=
reception
[
8
:
16
]
sequence_number
=
reception
[
8
:
16
]
payload
=
reception
[
16
:]
payload
=
reception
[
16
:]
return
[
payload_type
,
payload_length
,
sequence_number
,
payload
]
return
[
payload_type
,
payload_length
,
sequence_number
,
payload
]
def
payload2meaning
(
self
,
payload
:
str
,
comandetype
=
"
default
"
):
@staticmethod
#TODO
def
payload2meaning
(
payload
:
str
,
command_type
=
"
default
"
):
if
comandetype
in
inq_resp
.
inq_list
:
"""
return
inq_resp
.
inq_list
.
get
(
comandetype
).
get
(
payload
)
Reveal the meaning of the visca respond
:param payload: payload recieved in str hex eg
'
9051ff
'
:param command_type: type of command, the respond
'
s meaning depends on the inquiry/command
:return: the meaning in str
"""
meaning
=
"
Not known
"
if
command_type
in
inq_resp
.
inq_list
:
# if payload is not in the dictionary meaning = None
meaning
=
inq_resp
.
inq_list
.
get
(
command_type
).
get
(
payload
)
else
:
else
:
return
default_resp
.
liste_respond
.
get
(
payload
)
meaning
=
default_resp
.
liste_respond
.
get
(
payload
)
if
meaning
is
None
:
meaning
=
"
Respond not understood
"
return
meaning
This diff is collapsed.
Click to expand it.
viscaoveriplib/inquiry_responds_library.py
+
3
−
1
View file @
b2164b43
# liste de dico non exaustif
"""
Dictionary of responds depending on the inquiry command
"""
respond
=
{
'
y05002FF
'
:
"
On
"
,
'
y05003FF
'
:
"
Off
"
,
"
y05000FF
"
:
"
auto/standard
"
}
respond
=
{
'
y05002FF
'
:
"
On
"
,
'
y05003FF
'
:
"
Off
"
,
"
y05000FF
"
:
"
auto/standard
"
}
...
...
This diff is collapsed.
Click to expand it.
viscaoveriplib/responds_messages.py
+
2
−
2
View file @
b2164b43
liste_respond
=
{
'
904yff
'
:
"
Ack
k
nowledge
"
,
'
905yff
'
:
"
Completion
"
,
"
006002ff
"
:
"
Syntax Error
"
,
liste_respond
=
{
'
904yff
'
:
"
Acknowledge
"
,
'
905yff
'
:
"
Completion
"
,
"
006002ff
"
:
"
Syntax Error
"
,
"
906003ff
"
:
"
Command Buffer Full
"
,
"
906y04ff
"
:
"
Command C
o
nceled
"
,
"
906y05ff
"
:
"
No Socket
"
,
"
906003ff
"
:
"
Command Buffer Full
"
,
"
906y04ff
"
:
"
Command C
a
nceled
"
,
"
906y05ff
"
:
"
No Socket
"
,
"
906y41ff
"
:
"
Command Not Executable
"
}
"
906y41ff
"
:
"
Command Not Executable
"
}
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