1
0
mirror of synced 2024-11-24 14:30:09 +01:00

sao: add SaoResponseHeader

This commit is contained in:
Kevin Trocolli 2023-11-09 22:36:33 -05:00
parent 18bf250fd7
commit 3d62b9d372

View File

@ -22,7 +22,7 @@ class SaoBaseRequest:
logging.getLogger('sao').error(f"Expected {self.header.data_len} data bytes byt got {len(data)}!")
# TODO: Raise an error here
class SaoBaseResponse:
class SaoResponseHeader:
def __init__(self, cmd_id: int) -> None:
self.cmd = cmd_id
self.err_status = 0
@ -35,6 +35,13 @@ class SaoBaseResponse:
def make(self) -> bytes:
return struct.pack("!HHIIIII", self.cmd, self.err_status, self.error_type, self.vendor_id, self.game_id, self.version_id, self.length)
class SaoBaseResponse:
def __init__(self, cmd_id: int) -> None:
self.header = SaoResponseHeader(cmd_id)
def make(self) -> bytes:
return self.header.make()
class SaoNoopResponse(SaoBaseResponse):
def __init__(self, cmd: int) -> None:
super().__init__(cmd)