Files
buzzer/tool/core/protocol.py
2026-03-07 08:51:50 +01:00

77 lines
1.4 KiB
Python

# tool/core/protocol.py
VERSION = {
"min_protocol_version": 1,
"max_protocol_version": 1,
"current_protocol_version": None,
}
SYNC_SEQ = b'BUZZ'
ERRORS = {
0x00: "NONE",
0x01: "INVALID_COMMAND",
0x02: "INVALID_PARAMETERS",
0x03: "MISSING_PARAMETERS",
0x10: "FILE_NOT_FOUND",
0x11: "ALREADY_EXISTS",
0x12: "NOT_A_DIRECTORY",
0x13: "IS_A_DIRECTORY",
0x14: "ACCESS_DENIED",
0x15: "NO_SPACE",
0x16: "FILE_TOO_LARGE",
0x20: "IO_ERROR",
0x21: "TIMEOUT",
0x22: "CRC_MISMATCH",
0x23: "TRANSFER_ABORTED",
0x30: "NOT_SUPPORTED",
0x31: "BUSY",
0x32: "INTERNAL_ERROR",
0x40: "NOT_IMPLEMENTED",
}
FRAME_TYPES = {
'request': 0x01,
'ack': 0x10,
'response': 0x11,
'stream_start': 0x12,
'stream_chunk': 0x13,
'stream_end': 0x14,
'list_start': 0x15,
'list_chunk': 0x16,
'list_end': 0x17,
'error': 0xFF,
}
COMMANDS = {
'get_protocol_version': 0x00,
'get_firmware_status': 0x01,
'get_flash_info': 0x02,
'confirm_fw': 0x03,
'reboot': 0x04,
'list_dir': 0x10,
'crc_32': 0x11,
'mkdir': 0x12,
'rm': 0x13,
'stat': 0x18,
'rename': 0x19,
'put_file': 0x20,
'put_fw': 0x21,
'get_file': 0x22,
'put_tags': 0x24,
'get_tags': 0x25,
'play': 0x30,
'stop': 0x31,
'set_setting': 0x40,
'get_setting': 0x41,
}