| 1234567891011121314151617181920212223242526272829303132 |
- class BxError:
- def __init__(self, error_code, name, description):
- self.ErrorCode = error_code
- self.Name = name
- self.Description = description
- # 错误码定义
- bxErrors = {
- 0: BxError(0, "ERR_NO", "No Err"),
- 1: BxError(1, "ERR_OUTOFGROUP", "Command Group Err"),
- 2: BxError(2, "ERR_NOCMD", "Not Found"),
- 3: BxError(3, "ERR_BUSY", "The Controller is busy now"),
- 4: BxError(4, "ERR_MEMORYVOLUME", "Out of the Memory Volume"),
- 5: BxError(5, "ERR_CHECKSUM", "CRC16 Checksum Err"),
- 6: BxError(6, "ERR_FILENOTEXIST", "File Not Exist"),
- 7: BxError(7, "ERR_FLASH", "Flash Access Err"),
- 8: BxError(8, "ERR_FILE_DOWNLOAD", "File Download Err"),
- 9: BxError(9, "ERR_FILE_NAME", "Filename Err"),
- 10: BxError(10, "ERR_FILE_TYPE", "File type Err"),
- 11: BxError(11, "ERR_FILE_CRC16", "File CRC16 Err"),
- 12: BxError(12, "ERR_FONT_NOT_EXIST", "Font Library Not Exist"),
- 13: BxError(13, "ERR_FIRMWARE_TYPE", "Firmware Type Err (Check the controller type)"),
- 14: BxError(14, "ERR_DATE_TIME_FORMAT", "Date Time format Err"),
- 15: BxError(15, "ERR_FILE_EXIST", "File Exist for File overwrite"),
- 16: BxError(16, "ERR_FILE_BLOCK_NUM", "File block number Err"),
- }
- def GetError(code):
- """根据错误码获取错误信息"""
- return bxErrors.get(code, BxError(code, "未知错误", "Unknown error code"))
|