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
d3547c9f
Commit
d3547c9f
authored
6 years ago
by
Pierre Minssen
Browse files
Options
Downloads
Patches
Plain Diff
Ajout reception + refomatage des responds_library
parent
7bccceee
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/camera.py
+20
-15
20 additions, 15 deletions
viscaoveriplib/camera.py
viscaoveriplib/inquiry_commands_library.py
+2
-1
2 additions, 1 deletion
viscaoveriplib/inquiry_commands_library.py
viscaoveriplib/inquiry_responds_library.py
+17
-17
17 additions, 17 deletions
viscaoveriplib/inquiry_responds_library.py
with
39 additions
and
33 deletions
viscaoveriplib/camera.py
+
20
−
15
View file @
d3547c9f
import
socket
import
socket
#Both protocols (input and outpout are UD
B
#
Both protocols (input and outpout are UD
P
"
192.168.0.100
"
"
192.168.0.100
"
UDP_PORT
=
52381
UDP_PORT
=
52381
...
@@ -50,22 +50,27 @@ class Camera:
...
@@ -50,22 +50,27 @@ class Camera:
:param payload:
:param payload:
:return: header without prefix = payloadlength + seq_num
:return: header without prefix = payloadlength + seq_num
"""
"""
length
=
hex
(
len
(
payload
.
replace
(
'
'
,
''
)))
payloadlength
=
length
[
2
:]
if
len
(
length
)
==
1
:
payloadlength
=
'
0
'
+
payloadlength
lenght
=
hex
(
len
(
payload
.
replace
(
'
'
,
''
)))
header
=
payloadlength
payloadlenght
=
lenght
[
2
:]
if
len
(
lenght
)
==
1
:
payloadlenght
=
'
0
'
+
payloadlenght
header
=
payloadlenght
header
=
header
+
(
'
0
'
*
(
8
-
len
(
str
(
self
.
seq_num
)))
+
str
(
self
.
seq_num
))
header
=
header
+
(
'
0
'
*
(
8
-
len
(
str
(
self
.
seq_num
)))
+
str
(
self
.
seq_num
))
return
header
return
header
def
receive
(
self
):
# non fonctionnel
def
receive
(
self
):
# non fonctionnel
"""
recoper avec le multi-thread avec ça
https://python.developpez.com/cours/TutoSwinnen/?page=page_20
Data in : b
'
\x01\x11\x00\x03\x00\x00\x85\x00\x90
A
\xff
'
:return: Data out :
'
02000002000013610f01
'
"""
sock
=
socket
.
socket
(
socket
.
AF_INET
,
# Internet
sock
=
socket
.
socket
(
socket
.
AF_INET
,
# Internet
socket
.
SOCK_DGRAM
)
# UDP
socket
.
SOCK_DGRAM
)
# UDP
self
.
camera_sock
.
bind
((
self
.
CAMERA_IP_OUT
,
self
.
CAMERA_PORT
))
sock
.
bind
((
self
.
CAMERA_IP_OUT
,
self
.
CAMERA_PORT
))
print
(
"
ok
"
)
data
,
addr
=
sock
.
recvfrom
(
1024
)
# buffer size is 1024 bytes<
while
True
:
message
=
data
.
hex
()
data
,
addr
=
sock
.
recvfrom
(
1024
)
# buffer size is 1024 bytes
return
message
print
(
"
received message:
"
,
data
.
hex
())
\ No newline at end of file
This diff is collapsed.
Click to expand it.
viscaoveriplib/inquiry_commands_library.py
+
2
−
1
View file @
d3547c9f
from
camera
import
*
import
camera
class
Camera
:
class
Camera
:
...
@@ -15,6 +15,7 @@ class Camera:
...
@@ -15,6 +15,7 @@ class Camera:
def
power
(
self
):
def
power
(
self
):
payload
=
'
81 09 04 00 FF
'
payload
=
'
81 09 04 00 FF
'
self
.
send_inquiry
(
payload
)
self
.
send_inquiry
(
payload
)
self
.
camera
.
recieve
()
def
zoom_pos
(
self
):
def
zoom_pos
(
self
):
payload
=
'
81 09 04 47 FF
'
payload
=
'
81 09 04 47 FF
'
...
...
This diff is collapsed.
Click to expand it.
viscaoveriplib/inquiry_responds_library.py
+
17
−
17
View file @
d3547c9f
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