Skip to content
Snippets Groups Projects
Commit 9955333e authored by Pierre Minssen's avatar Pierre Minssen
Browse files

Update cam_poo.py

parent 7aa6b9ee
Branches
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ class Camera:
# nouvelle coordonnée réelle après itération
return [payloadtype, payload]
def payload2message(self, payloadL : list) -> hex
def payload2message(self, payloadL : list) -> string #hex
payloadtype = payload[0]
payload = payloadL[1]
payloadlenght = "0F" # a coder
......@@ -24,3 +24,39 @@ class Camera:
message = header + payload
return message
def send(self, message : string): -> bool
sock.sendto(bytes.fromhex(message.replace(' ','')),(UDP_IP,UDP_PORT))
self.seq_num +=1 #ballec de l'hexa pour l'instant
print("fait "+ seq_num)
return True
def zqsd2payload(self, x : string) -> string #hex
payload = "FF" #message d'erreur à refaire
if(command=='d'):
# payload = "81 01 06 03 VV WW 0Y 0Y 0Y 0Y 00 00 00 00 FF YYYY de DE00 à 2200 center 0000
payload = "81 01 06 03 09 09 00 01 02 02 00 00 00 00 FF"
if(command =='q'):
payload = "81 01 06 03 09 09 0F 0E 0D 0E 00 00 00 00 FF"
if(command =='z'):
payload = "81 01 06 03 09 09 0F 0E 0D 0E 00 00 00 00 FF" #nonfonctionnel
if(command =='s'):
payload = "81 01 06 03 09 09 0F 0E 0D 0E 00 00 00 00 FF" #nonfonctionnel
payloadtype = "01 00"
return [payloadtype, payload]
def zoom2payload(self, n :int) -> string #hex #faire une version zoom + / zoom -
if(n==0):
payload="81 01 04 47 00 00 00 00 FF"
if(n==2):
payload="81 01 04 47 01 06 0A 01 FF"
return [payloadtype, payload]
def focus(self, b : bool) -> string #hex #focus2payload(0) = autofocus
if bool:
payload="81 01 04 38 02 FF" #autofocus
else:
payload="81 01 04 38 03 FF"
payloadtype = "01 00"
return [payloadtype, payload]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment