mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2026-04-18 13:03:31 +00:00
add VBANCMDPacketError to exception hierarchy
raise them when we fail to validate incoming packets. add VbanRTRequestHeader post_init to validate the provided bps value. VbanRTSubscribeHeader and VbanRTRequestHeader properties now return int type. They are then directly packed into the header.
This commit is contained in:
@@ -3,7 +3,8 @@ import threading
|
||||
import time
|
||||
|
||||
from .enums import NBS
|
||||
from .error import VBANCMDConnectionError
|
||||
from .error import VBANCMDConnectionError, VBANCMDPacketError
|
||||
from .packet.enums import SubProtocols
|
||||
from .packet.headers import (
|
||||
HEADER_SIZE,
|
||||
VbanRTPacket,
|
||||
@@ -81,8 +82,13 @@ class Producer(threading.Thread):
|
||||
|
||||
try:
|
||||
header = VbanRTResponseHeader.from_bytes(data[:HEADER_SIZE])
|
||||
except ValueError as e:
|
||||
self.logger.debug(f'Error parsing response packet: {e}')
|
||||
except VBANCMDPacketError as e:
|
||||
match e.protocol:
|
||||
case SubProtocols.SERVICE:
|
||||
# Silently ignore periodic SERVICE packets unrelated to vban-cmd
|
||||
pass
|
||||
case _:
|
||||
self.logger.debug(f'Error parsing response packet: {e}')
|
||||
continue
|
||||
|
||||
match header.format_nbs:
|
||||
|
||||
Reference in New Issue
Block a user