from enum import Enum

#Enum for I3C supported decoding modes
class DecodingModes(Enum):
    SDR = 0
    DDR = 1
    BT  = 2

#Enum for DDR error types and its associated text
class DDRErrorNames(str, Enum):
    CRC_ERROR = 'CRC Error'
    UNKNOWN_ERROR = 'Unknown Transaction Error'
    PARITY_ERROR = 'Parity Error'
    TOKEN_ERROR = 'CRC Token Error'

#Enum for I3C versions and its associated text
class I3cVersions(str, Enum):
    VERSION1_0 = 'I3C Version 1.0'
    VERSION1_1 = 'I3C Version 1.1'
    VERSION1_1_1 = 'I3C Version 1.1.1'
    VERSION1_2 = 'I3C Version 1.2'

class I3CDictionaries:
    ccc_text_v1_0 = {
        0x00: 'BC ENEC',
        0x01: 'BC DISEC',
        0x02: 'BC ENTAS0',
        0x03: 'BC ENTAS1',
        0x04: 'BC ENTAS2',
        0x05: 'BC ENTAS3',
        0x06: 'BC RSTDAA',
        0x07: 'BC ENTDAA',
        0x08: 'BC DEFSLVS',
        0x09: 'BC SETMWL',
        0x0A: 'BC SETMRL',
        0x0B: 'BC ENTTM',
        # 0x0C – 0x1F - MIPI Reserved
        0x0C: 'MIPI RES 0x0C',
        0x0D: 'MIPI RES 0x0D',
        0x0E: 'MIPI RES 0x0E',
        0x0F: 'MIPI RES 0x0F',
        0x10: 'MIPI RES 0x10',
        0x11: 'MIPI RES 0x11',
        0x12: 'MIPI RES 0x12',
        0x13: 'MIPI RES 0x13',
        0x14: 'MIPI RES 0x14',
        0x15: 'MIPI RES 0x15',
        0x16: 'MIPI RES 0x16',
        0x17: 'MIPI RES 0x17',
        0x18: 'MIPI RES 0x18',
        0x19: 'MIPI RES 0x19',
        0x1A: 'MIPI RES 0x1A',
        0x1B: 'MIPI RES 0x1B',
        0x1C: 'MIPI RES 0x1C',
        0x1D: 'MIPI RES 0x1D',
        0x1E: 'MIPI RES 0x1E',
        0x1F: 'MIPI RES 0x1F',
        #
        0x20: 'BC ENTHDR0',
        0x21: 'BC ENTHDR1',
        0x22: 'BC ENTHDR2',
        0x23: 'BC ENTHDR3',
        0x24: 'BC ENTHDR4',
        0x25: 'BC ENTHDR5',
        0x26: 'BC ENTHDR6',
        0x27: 'BC ENTHDR7',
        0x28: 'BC SETXTIME',
        # 0x29 – 0x48 - MIPI Sensor WG Reserved
        0x29: 'MIPI SENS WG RES 0x29',
        0x2A: 'MIPI SENS WG RES 0x2A',
        0x2B: 'MIPI SENS WG RES 0x2B',
        0x2C: 'MIPI SENS WG RES 0x2C',
        0x2D: 'MIPI SENS WG RES 0x2D',
        0x2E: 'MIPI SENS WG RES 0x2E',
        0x2F: 'MIPI SENS WG RES 0x2F',
        0x30: 'MIPI SENS WG RES 0x30',
        0x31: 'MIPI SENS WG RES 0x31',
        0x32: 'MIPI SENS WG RES 0x32',
        0x33: 'MIPI SENS WG RES 0x33',
        0x34: 'MIPI SENS WG RES 0x34',
        0x35: 'MIPI SENS WG RES 0x35',
        0x36: 'MIPI SENS WG RES 0x36',
        0x37: 'MIPI SENS WG RES 0x37',
        0x38: 'MIPI SENS WG RES 0x38',
        0x39: 'MIPI SENS WG RES 0x39',
        0x3A: 'MIPI SENS WG RES 0x3A',
        0x3B: 'MIPI SENS WG RES 0x3B',
        0x3C: 'MIPI SENS WG RES 0x3C',
        0x3D: 'MIPI SENS WG RES 0x3D',
        0x3E: 'MIPI SENS WG RES 0x3E',
        0x3F: 'MIPI SENS WG RES 0x3F',
        0x40: 'MIPI SENS WG RES 0x40',
        0x41: 'MIPI SENS WG RES 0x41',
        0x42: 'MIPI SENS WG RES 0x42',
        0x43: 'MIPI SENS WG RES 0x43',
        0x44: 'MIPI SENS WG RES 0x44',
        0x45: 'MIPI SENS WG RES 0x45',
        0x46: 'MIPI SENS WG RES 0x46',
        0x47: 'MIPI SENS WG RES 0x47',
        0x48: 'MIPI SENS WG RES 0x48',
        # 0x49 – 0x57 - MIPI Reserved for other WG – Broadcast CCCs
        0x49: 'MIPI OTHER WG RES 0x49',
        0x4A: 'MIPI OTHER WG RES 0x4A',
        0x4B: 'MIPI OTHER WG RES 0x4B',
        0x4C: 'MIPI OTHER WG RES 0x4C',
        0x4D: 'MIPI OTHER WG RES 0x4D',
        0x4E: 'MIPI OTHER WG RES 0x4E',
        0x4F: 'MIPI OTHER WG RES 0x4F',
        0x50: 'MIPI OTHER WG RES 0x50',
        0x51: 'MIPI OTHER WG RES 0x51',
        0x52: 'MIPI OTHER WG RES 0x52',
        0x53: 'MIPI OTHER WG RES 0x53',
        0x54: 'MIPI OTHER WG RES 0x54',
        0x55: 'MIPI OTHER WG RES 0x55',
        0x56: 'MIPI OTHER WG RES 0x56',
        0x57: 'MIPI OTHER WG RES 0x57',
        # 0x58 – 0x5B - MIPI Debug WG Reserved – Broadcast CCCs
        0x58: 'MIPI DEB WG RES 0x58',
        0x59: 'MIPI DEB WG RES 0x59',
        0x5A: 'MIPI DEB WG RES 0x5A',
        0x5B: 'MIPI DEB WG RES 0x5B',
        # 0x5C – 0x60 - MIPI RIO WG Reserved – Broadcast CCCs
        0x5C: 'MIPI RIO WG RES 0x5C',
        0x5D: 'MIPI RIO WG RES 0x5D',
        0x5E: 'MIPI RIO WG RES 0x5E',
        0x5F: 'MIPI RIO WG RES 0x5F',
        0x60: 'MIPI RIO WG RES 0x60',
        # 0x61 – 0x7F - Vendor / Standards Extension – Broadcast CCCs
        0x61: 'BC VENCCC 0x61',
        0x62: 'BC VENCCC 0x62',
        0x63: 'BC VENCCC 0x63',
        0x64: 'BC VENCCC 0x64',
        0x65: 'BC VENCCC 0x65',
        0x66: 'BC VENCCC 0x66',
        0x67: 'BC VENCCC 0x67',
        0x68: 'BC VENCCC 0x68',
        0x69: 'BC VENCCC 0x69',
        0x6A: 'BC VENCCC 0x6A',
        0x6B: 'BC VENCCC 0x6B',
        0x6C: 'BC VENCCC 0x6C',
        0x6D: 'BC VENCCC 0x6D',
        0x6E: 'BC VENCCC 0x6E',
        0x6F: 'BC VENCCC 0x6F',
        0x70: 'BC VENCCC 0x70',
        0x71: 'BC VENCCC 0x71',
        0x72: 'BC VENCCC 0x72',
        0x73: 'BC VENCCC 0x73',
        0x74: 'BC VENCCC 0x74',
        0x75: 'BC VENCCC 0x75',
        0x76: 'BC VENCCC 0x76',
        0x77: 'BC VENCCC 0x77',
        0x78: 'BC VENCCC 0x78',
        0x79: 'BC VENCCC 0x79',
        0x7A: 'BC VENCCC 0x7A',
        0x7B: 'BC VENCCC 0x7B',
        0x7C: 'BC VENCCC 0x7C',
        0x7D: 'BC VENCCC 0x7D',
        0x7E: 'BC VENCCC 0x7E',
        0x7F: 'BC VENCCC 0x7F',
        #
        0x80: 'ENEC',
        0x81: 'DISEC',
        0x82: 'ENTAS0',
        0x83: 'ENTAS1',
        0x84: 'ENTAS2',
        0x85: 'ENTAS3',
        0x86: 'RSTDAA',
        0x87: 'SETDASA',
        0x88: 'SETNEWDA',
        0x89: 'SETMWL',
        0x8A: 'SETMRL',
        0x8B: 'GETMWL',
        0x8C: 'GETMRL',
        0x8D: 'GETPID',
        0x8E: 'GETBCR',
        0x8F: 'GETDCR',
        0x90: 'GETSTATUS',
        0x91: 'GETACCMST',
        # 0x92 - MIPI Sensor WG Reserved
        0x92: 'MIPI SENS WG RES 0x92',
        #
        0x93: 'SETBRGTGT',
        0x94: 'GETMXDS',
        0x95: 'GETHDRCAP',
        # 0x96 - 0x97 - MIPI Sensor WG Reserved
        0x96: 'MIPI SENS WG RES 0x96',
        0x97: 'MIPI SENS WG RES 0x97',
        #
        0x98: 'SETXTIME',
        0x99: 'GETXTIME',
        # 0x9A - 0xBF - MIPI Sensor WG Reserved
        0x9A: 'MIPI SENS WG RES 0x9A',
        0x9B: 'MIPI SENS WG RES 0x9B',
        0x9C: 'MIPI SENS WG RES 0x9C',
        0x9D: 'MIPI SENS WG RES 0x9D',
        0x9E: 'MIPI SENS WG RES 0x9E',
        0x9F: 'MIPI SENS WG RES 0x9F',
        0xA0: 'MIPI SENS WG RES 0xA0',
        0xA1: 'MIPI SENS WG RES 0xA1',
        0xA2: 'MIPI SENS WG RES 0xA2',
        0xA3: 'MIPI SENS WG RES 0xA3',
        0xA4: 'MIPI SENS WG RES 0xA4',
        0xA5: 'MIPI SENS WG RES 0xA5',
        0xA6: 'MIPI SENS WG RES 0xA6',
        0xA7: 'MIPI SENS WG RES 0xA7',
        0xA8: 'MIPI SENS WG RES 0xA8',
        0xA9: 'MIPI SENS WG RES 0xA9',
        0xAA: 'MIPI SENS WG RES 0xAA',
        0xAB: 'MIPI SENS WG RES 0xAB',
        0xAC: 'MIPI SENS WG RES 0xAC',
        0xAD: 'MIPI SENS WG RES 0xAD',
        0xAE: 'MIPI SENS WG RES 0xAE',
        0xAF: 'MIPI SENS WG RES 0xAF',
        0xB0: 'MIPI SENS WG RES 0xB0',
        0xB1: 'MIPI SENS WG RES 0xB1',
        0xB2: 'MIPI SENS WG RES 0xB2',
        0xB3: 'MIPI SENS WG RES 0xB3',
        0xB4: 'MIPI SENS WG RES 0xB4',
        0xB5: 'MIPI SENS WG RES 0xB5',
        0xB6: 'MIPI SENS WG RES 0xB6',
        0xB7: 'MIPI SENS WG RES 0xB7',
        0xB8: 'MIPI SENS WG RES 0xB8',
        0xB9: 'MIPI SENS WG RES 0xB9',
        0xBA: 'MIPI SENS WG RES 0xBA',
        0xBB: 'MIPI SENS WG RES 0xBB',
        0xBC: 'MIPI SENS WG RES 0xBC',
        0xBD: 'MIPI SENS WG RES 0xBD',
        0xBE: 'MIPI SENS WG RES 0xBE',
        0xBF: 'MIPI SENS WG RES 0xBF',
        # 0xC0 – 0xD6 - MIPI Reserved for Other WG – Direct CCCs
        0xC0: 'MIPI OTHER WG RES 0xC0',
        0xC1: 'MIPI OTHER WG RES 0xC1',
        0xC2: 'MIPI OTHER WG RES 0xC2',
        0xC3: 'MIPI OTHER WG RES 0xC3',
        0xC4: 'MIPI OTHER WG RES 0xC4',
        0xC5: 'MIPI OTHER WG RES 0xC5',
        0xC6: 'MIPI OTHER WG RES 0xC6',
        0xC7: 'MIPI OTHER WG RES 0xC7',
        0xC8: 'MIPI OTHER WG RES 0xC8',
        0xC9: 'MIPI OTHER WG RES 0xC9',
        0xCA: 'MIPI OTHER WG RES 0xCA',
        0xCB: 'MIPI OTHER WG RES 0xCB',
        0xCC: 'MIPI OTHER WG RES 0xCC',
        0xCD: 'MIPI OTHER WG RES 0xCD',
        0xCE: 'MIPI OTHER WG RES 0xCE',
        0xCF: 'MIPI OTHER WG RES 0xCF',
        0xD0: 'MIPI OTHER WG RES 0xD0',
        0xD1: 'MIPI OTHER WG RES 0xD1',
        0xD2: 'MIPI OTHER WG RES 0xD2',
        0xD3: 'MIPI OTHER WG RES 0xD3',
        0xD4: 'MIPI OTHER WG RES 0xD4',
        0xD5: 'MIPI OTHER WG RES 0xD5',
        0xD6: 'MIPI OTHER WG RES 0xD6',
        # 0xD7 – 0xDA - MIPI Debug WG Reserved – Direct CCCs
        0xD7: 'MIPI DEB WG RES 0xD7',
        0xD8: 'MIPI DEB WG RES 0xD8',
        0xD9: 'MIPI DEB WG RES 0xD9',
        0xDA: 'MIPI DEB WG RES 0xDA',
        # 0xDB – 0xDF - MIPI RIO WG Reserved – Direct CCCs
        0xDB: 'MIPI RIO WG RES 0xDB',
        0xDC: 'MIPI RIO WG RES 0xDC',
        0xDD: 'MIPI RIO WG RES 0xDD',
        0xDE: 'MIPI RIO WG RES 0xDE',
        0xDF: 'MIPI RIO WG RES 0xDF',
        # 0xE0 – 0xFE - Vendor / Standards Extension – Direct CCCs
        0xE0: 'DIR VENCCC 0xE0',
        0xE1: 'DIR VENCCC 0xE1',
        0xE2: 'DIR VENCCC 0xE2',
        0xE3: 'DIR VENCCC 0xE3',
        0xE4: 'DIR VENCCC 0xE4',
        0xE5: 'DIR VENCCC 0xE5',
        0xE6: 'DIR VENCCC 0xE6',
        0xE7: 'DIR VENCCC 0xE7',
        0xE8: 'DIR VENCCC 0xE8',
        0xE9: 'DIR VENCCC 0xE9',
        0xEA: 'DIR VENCCC 0xEA',
        0xEB: 'DIR VENCCC 0xEB',
        0xEC: 'DIR VENCCC 0xEC',
        0xED: 'DIR VENCCC 0xED',
        0xEE: 'DIR VENCCC 0xEE',
        0xEF: 'DIR VENCCC 0xEF',
        0xF0: 'DIR VENCCC 0xF0',
        0xF1: 'DIR VENCCC 0xF1',
        0xF2: 'DIR VENCCC 0xF2',
        0xF3: 'DIR VENCCC 0xF3',
        0xF4: 'DIR VENCCC 0xF4',
        0xF5: 'DIR VENCCC 0xF5',
        0xF6: 'DIR VENCCC 0xF6',
        0xF7: 'DIR VENCCC 0xF7',
        0xF8: 'DIR VENCCC 0xF8',
        0xF9: 'DIR VENCCC 0xF9',
        0xFA: 'DIR VENCCC 0xFA',
        0xFB: 'DIR VENCCC 0xFB',
        0xFC: 'DIR VENCCC 0xFC',
        0xFD: 'DIR VENCCC 0xFD',
        0xFE: 'DIR VENCCC 0xFE',
        # 0xFF - MIPI Sensor WG Reserved
        0xFF: 'MIPI SENS WG RES 0xFF'
    }

    ccc_text_v1_1 = {
        0x0C: 'BC SETBUSCON',
        0x12: 'BC ENDXFER',
        0x29: 'BC SETAASA',
        0x2A: 'BC RSTACT',
        0x2B: 'BC DEFGRPA',
        0x2C: 'BC RSTGRPA',
        0x2D: 'BC MLANE',
        # 0x49 – 0x4C - MIPI Camera WG Reserved – Broadcast CCCs
        0x49: 'MIPI CAM WG RES 0x49',
        0x4A: 'MIPI CAM WG RES 0x4A',
        0x4B: 'MIPI CAM WG RES 0x4B',
        0x4C: 'MIPI CAM WG RES 0x4C',
        # 0x86 - DEPRECATED: RSTDAA Direct. Reset Dynamic Address Assignment
        0x86: 'DEPRECATED: RSTDAA',
        #
        0x92: 'ENDXFER',
        0x95: 'GETCAPS',
        0x96: 'SETROUTE',
        0x97: 'D2DXFER',
        0x9A: 'RSTACT',
        0x9B: 'SETGRPA',
        0x9C: 'RSTGRPA',
        0x9D: 'MLANE',
        # 0xC0 – 0xC3 - MIPI Camera WG Reserved – Direct CCCs
        0xC0: 'MIPI CAM WG RES 0xC0',
        0xC1: 'MIPI CAM WG RES 0xC1',
        0xC2: 'MIPI CAM WG RES 0xC2',
        0xC3: 'MIPI CAM WG RES 0xC3',
    }

    ccc_text_v1_1_1 = {
        0x08: 'BC DEFTGTS',
        # 0x1F - Reserved for HDR Modes
        0x1F: 'MIPI RES HDR 0x1F',
        # 0x2E – 0x48 - MIPI I3C WG Reserved
        0x2E: 'MIPI I3C WG RES 0x2E',
        0x2F: 'MIPI I3C WG RES 0x2F',
        0x30: 'MIPI I3C WG RES 0x30',
        0x31: 'MIPI I3C WG RES 0x31',
        0x32: 'MIPI I3C WG RES 0x32',
        0x33: 'MIPI I3C WG RES 0x33',
        0x34: 'MIPI I3C WG RES 0x34',
        0x35: 'MIPI I3C WG RES 0x35',
        0x36: 'MIPI I3C WG RES 0x36',
        0x37: 'MIPI I3C WG RES 0x37',
        0x38: 'MIPI I3C WG RES 0x38',
        0x39: 'MIPI I3C WG RES 0x39',
        0x3A: 'MIPI I3C WG RES 0x3A',
        0x3B: 'MIPI I3C WG RES 0x3B',
        0x3C: 'MIPI I3C WG RES 0x3C',
        0x3D: 'MIPI I3C WG RES 0x3D',
        0x3E: 'MIPI I3C WG RES 0x3E',
        0x3F: 'MIPI I3C WG RES 0x3F',
        0x40: 'MIPI I3C WG RES 0x40',
        0x41: 'MIPI I3C WG RES 0x41',
        0x42: 'MIPI I3C WG RES 0x42',
        0x43: 'MIPI I3C WG RES 0x43',
        0x44: 'MIPI I3C WG RES 0x44',
        0x45: 'MIPI I3C WG RES 0x45',
        0x46: 'MIPI I3C WG RES 0x46',
        0x47: 'MIPI I3C WG RES 0x47',
        0x48: 'MIPI I3C WG RES 0x48',
        #
        0x91: 'GETACCCR',
        # 0x9E - 0xBF - MIPI I3C WG Reserved
        0x9E: 'MIPI I3C WG RES 0x9E',
        0x9F: 'MIPI I3C WG RES 0x9F',
        0xA0: 'MIPI I3C WG RES 0xA0',
        0xA1: 'MIPI I3C WG RES 0xA1',
        0xA2: 'MIPI I3C WG RES 0xA2',
        0xA3: 'MIPI I3C WG RES 0xA3',
        0xA4: 'MIPI I3C WG RES 0xA4',
        0xA5: 'MIPI I3C WG RES 0xA5',
        0xA6: 'MIPI I3C WG RES 0xA6',
        0xA7: 'MIPI I3C WG RES 0xA7',
        0xA8: 'MIPI I3C WG RES 0xA8',
        0xA9: 'MIPI I3C WG RES 0xA9',
        0xAA: 'MIPI I3C WG RES 0xAA',
        0xAB: 'MIPI I3C WG RES 0xAB',
        0xAC: 'MIPI I3C WG RES 0xAC',
        0xAD: 'MIPI I3C WG RES 0xAD',
        0xAE: 'MIPI I3C WG RES 0xAE',
        0xAF: 'MIPI I3C WG RES 0xAF',
        0xB0: 'MIPI I3C WG RES 0xB0',
        0xB1: 'MIPI I3C WG RES 0xB1',
        0xB2: 'MIPI I3C WG RES 0xB2',
        0xB3: 'MIPI I3C WG RES 0xB3',
        0xB4: 'MIPI I3C WG RES 0xB4',
        0xB5: 'MIPI I3C WG RES 0xB5',
        0xB6: 'MIPI I3C WG RES 0xB6',
        0xB7: 'MIPI I3C WG RES 0xB7',
        0xB8: 'MIPI I3C WG RES 0xB8',
        0xB9: 'MIPI I3C WG RES 0xB9',
        0xBA: 'MIPI I3C WG RES 0xBA',
        0xBB: 'MIPI I3C WG RES 0xBB',
        0xBC: 'MIPI I3C WG RES 0xBC',
        0xBD: 'MIPI I3C WG RES 0xBD',
        0xBE: 'MIPI I3C WG RES 0xBE',
        0xBF: 'MIPI I3C WG RES 0xBF',
        # 0xFF - MIPI I3C WG Reserved
        0xFF: 'MIPI I3C WG RES 0xFF'
    }

    result_types = {
        'Message':
        {   # Message covers legacy I2C messages and I3C messages that don't include the 0x7E marker
            'format':  'Message - Address [{{data.Address}}] - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'Message - Address [{Address}] - Payload [{Length}]: [ {Data} ]'
        },
        'Message Aborted':
        {   #Aborted version of the 'Message' message
            'format':  'Aborted Message - Address [{{data.Address}}] - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'Aborted Message - Address [{Address}] - Payload [{Length}]: [ {Data} ] Aborted'
        },
        'I3C Transaction':
        {
            'format':  'I3C Transaction - Address [{{data.Address}}] - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'I3C Transaction - Address [{Address}] - Payload [{Length}]: [ {Data} ]',
        },
        'Aborted I3C Transaction':
        {
            'format':  'Aborted I3C Transaction - Address [{{data.Address}}] - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'Aborted I3C Transaction - Address [{Address}] - Payload [{Length}]: [ {Data} ]',
        },
        'I3C Direct CCC Transaction':
        {
            'format':  'Command [{{data.Info}}] - Address [{{data.Address}}] - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'CCC Command [{Info}] - Address [{Address}] - Payload [{Length}]: [ {Data} ]',
        },
        'I3C GETPID Transaction':
        {
            'format':  'GETPID [{{data.Address}}]: {{data.Data}}',
            'console': 'GETPID [{Address}]: {Data}\n',
        },
        'I3C GETBCR Transaction':
        {
            'format':  'GETBCR [{{data.Address}}]: {{data.Data}}',
            'console': 'GETBCR [{Address}]: \n{DataVerbose}\n',
        },
        'I3C GETDCR Transaction':
        {
            'format':  'GETDCR [{{data.Address}}]: {{data.Data}}',
            'console': 'GETDCR [{Address}]: {Data}\n',
        },
        'I3C RSTDAA Transaction':
        {
            'format':  'BC RSTDAA',
            'console': 'BC RSTDAA\n',
        },
        'I3C BC SETAASA Transaction':
        {
            'format':  'BC SETAASA',
            'console': 'BC SETAASA — Set All Addresses to Static Address\n',
        },
        'I3C BC ENTAS0 Transaction':
        {
            'format':  'BC ENTAS0 (1 µs)',
            'console': 'BC ENTAS0 — Activity state 0 (1 µs)\n',
        },
        'I3C BC ENTAS1 Transaction':
        {
            'format':  'BC ENTAS1 (100 µs)',
            'console': 'BC ENTAS1 — Activity state 1 (100 µs)\n',
        },
        'I3C BC ENTAS2 Transaction':
        {
            'format':  'BC ENTAS2 (2 ms)',
            'console': 'BC ENTAS2 — Activity state 2 (2 ms)\n',
        },
        'I3C BC ENTAS3 Transaction':
        {
            'format':  'BC ENTAS3 (50 ms)',
            'console': 'BC ENTAS3 — Activity state 3 (50 ms)\n',
        },
        'I3C ENTAS0 Transaction':
        {
            'format':  'ENTAS0 [{{data.Address}}] (1 µs)',
            'console': 'ENTAS0 [{Address}] — Activity state 0 (1 µs)\n',
        },
        'I3C ENTAS1 Transaction':
        {
            'format':  'ENTAS1 [{{data.Address}}] (100 µs)',
            'console': 'ENTAS1 [{Address}] — Activity state 1 (100 µs)\n',
        },
        'I3C ENTAS2 Transaction':
        {
            'format':  'ENTAS2 [{{data.Address}}] (2 ms)',
            'console': 'ENTAS2 [{Address}] — Activity state 2 (2 ms)\n',
        },
        'I3C ENTAS3 Transaction':
        {
            'format':  'ENTAS3 [{{data.Address}}] (50 ms)',
            'console': 'ENTAS3 [{Address}] — Activity state 3 (50 ms)\n',
        },
        'I3C BC ENEC Transaction':
        {
            'format':  'BC ENEC: {{data.Data}}',
            'console': 'BC ENEC: {Data}\n',
        },
        'I3C BC DISEC Transaction':
        {
            'format':  'BC DISEC: {{data.Data}}',
            'console': 'BC DISEC: {Data}\n',
        },
        'I3C ENEC Transaction':
        {
            'format':  'ENEC [{{data.Address}}]: {{data.Data}}',
            'console': 'ENEC [{Address}]: {Data}\n',
        },
        'I3C DISEC Transaction':
        {
            'format':  'DISEC [{{data.Address}}]: {{data.Data}}',
            'console': 'DISEC [{Address}]: {Data}\n',
        },
        'I3C SETDASA Transaction':
        {
            'format':  'SETDASA [{{data.Address}}]: {{data.Data}}',
            'console': 'SETDASA [{Address}]: {Data}\n',
        },
        'I3C SETNEWDA Transaction':
        {
            'format':  'SETNEWDA [{{data.Address}}]: {{data.Data}}',
            'console': 'SETNEWDA [{Address}]: {Data}\n',
        },
        'I3C BC SETMWL Transaction':
        {
            'format':  'BC SETMWL: {{data.Data}}',
            'console': 'BC SETMWL: {Data}\n',
        },
        'I3C SETMWL Transaction':
        {
            'format':  'SETMWL [{{data.Address}}]: {{data.Data}}',
            'console': 'SETMWL [{Address}]: {Data}\n',
        },
        'I3C GETMWL Transaction':
        {
            'format':  'GETMWL [{{data.Address}}]: {{data.Data}}',
            'console': 'GETMWL [{Address}]: {Data}\n',
        },
        'I3C BC SETMRL Transaction':
        {
            'format':  'BC SETMRL: {{data.Data}}',
            'console': 'BC SETMRL: {Data}\n',
        },
        'I3C SETMRL Transaction':
        {
            'format':  'SETMRL [{{data.Address}}]: {{data.Data}}',
            'console': 'SETMRL [{Address}]: {Data}\n',
        },
        'I3C GETMRL Transaction':
        {
            'format':  'GETMRL [{{data.Address}}]: {{data.Data}}',
            'console': 'GETMRL [{Address}]: {Data}\n',
        },
        'I3C GETSTATUS Transaction':
        {
            'format':  'GETSTATUS [{{data.Address}}]: {{data.Data}}',
            'console': 'GETSTATUS [{Address}]: \n{DataVerbose}\n',
        },
        'I3C GETMXDS Transaction':
        {
            'format':  'GETMXDS [{{data.Address}}]: {{data.Data}}',
            'console': 'GETMXDS [{Address}]: \n{DataVerbose}\n',
        },
        'I3C GETCAPS Transaction':
        {
            'format':  'GETCAPS [{{data.Address}}]: {{data.Data}}',
            'console': 'GETCAPS [{Address}]:\n{DataVerbose}\n',
        },
        'I3C BC SETXTIME Transaction':
        {
            'format':  'BC SETXTIME: {{data.Data}}',
            'console': 'BC SETXTIME: \n{DataVerbose}\n',
        },
        'I3C SETXTIME Transaction':
        {
            'format':  'SETXTIME [{{data.Address}}]: {{data.Data}}',
            'console': 'SETXTIME [{Address}]: \n{DataVerbose}\n',
        },
        'I3C GETXTIME Transaction':
        {
            'format':  'GETXTIME [{{data.Address}}]: {{data.Data}}',
            'console': 'GETXTIME [{Address}]: \n{DataVerbose}\n',
        },
        'I3C BC RSTACT Transaction': {
            'format':  'BC RSTACT: {{data.Data}}',
            'console': 'BC RSTACT: \n{DataVerbose}\n',
        },
        'I3C RSTACT Transaction': {
            'format':  'RSTACT [{{data.Address}}]: {{data.Data}}',
            'console': 'RSTACT [{Address}]: \n{DataVerbose}\n',
        },
        'I3C BC RSTGRPA Transaction': {
            'format':  'BC RSTGRPA',
            'console': 'BC RSTGRPA\n',
        },
        'I3C RSTGRPA Transaction': {
            'format':  'RSTGRPA [{{data.Address}}]',
            'console': 'RSTGRPA [{Address}]\n',
        },
        'I3C SETGRPA Transaction': {
            'format':  'SETGRPA [{{data.Address}}]: {{data.Data}}',
            'console': 'SETGRPA [{Address}]: {Data}\n',
        },
        'I3C BC SETBUSCON Transaction': {
            'format':  'BC SETBUSCON: {{data.Data}}',
            'console': 'BC SETBUSCON: {Data}\n{DataVerbose}\n',
        },
        'I3C BC MLANE Transaction': {
            'format':  'BC MLANE: {{data.Data}}',
            'console': 'BC MLANE: {Data}\n{DataVerbose}\n',
        },
        'I3C MLANE Transaction': {
            'format':  'MLANE [{{data.Address}}]: {{data.Data}}',
            'console': 'MLANE [{Address}]: {Data}\n{DataVerbose}\n',
        },
        'Aborted I3C Direct CCC Transaction':
        {   #Aborted version of the 'Aborted I3C Direct CCC Transaction' message
            'format':  'Aborted Command [{{data.Info}}] - Address [{{data.Address}}] - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'Aborted CCC Command [{Info}] - Address [{Address}] - Payload [{Length}]: [ {Data} ]',
        },
        'I3C BC CCC Transaction':
        {
            'format':  'Command [{{data.Info}}] - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'CCC Command [{Info}] - Payload [{Length}]: [ {Data} ]',
        },
        'I3C ENTDAA Transaction':
        {
            'format':  'ENTDAA - {{data.Length}} device(s): [ {{data.Data}} ]',
            'console': 'ENTDAA - {Length} device(s):\n{DataVerbose}\n',
        },
        'I3C HDR Transaction':
        {
           'format':  'Payload [{{data.Length}}]: [ {{data.Data}} ]',
           'console': 'Payload [{Length}]: [ {Data} ]',
        },
        'I3C HDR Pattern':
        {
           'format':  '{{data.Info}}',
           'console': '{Info}',
        },
        'Hot-Join':
        {
           'format':  'Hot-Join',
           'console': 'Hot-Join',
        },
        'Target Reset Pattern':
        {
           'format':  'Target Reset Pattern',
           'console': 'Target Reset Pattern',
        },
        'Incomplete Transaction':
        {
            'format': 'Incomplete Transaction - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'Incomplete Transaction - Payload [{Length}]: [ {Data} ]',
        },
        'I3C IBI Transaction':
        {
            'format':  'IBI - Address [{{data.Address}}] - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'IBI - Address [{Address}] - Payload [{Length}]: [ {Data} ]',
        },
        'Aborted I3C IBI Transaction':
        {
            'format':  'Aborted IBI - Address [{{data.Address}}] - Payload [{{data.Length}}]: [ {{data.Data}} ]',
            'console': 'Aborted IBI - Address [{Address}] - Payload [{Length}]: [ {Data} ]',
        },
        'DDR Write to address':
        {
            'format':  'DDR Write to Address  [{{data.Address}}] - Command [{{data.Command}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'DDR Write to Address [{Address}] - Command [{Command}] - Payload [{Length}]: [ {Data} ]'
        },
        'DDR Read from address':
        {
            'format':  'DDR Read from Address [{{data.Address}}] - Command [{{data.Command}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'DDR Read from Address [{Address}] - Command [{Command}] - Payload [{Length}]: [ {Data} ]'
        },
        'DDR BC CCC Transaction':
        {
            'format':  'DDR BC CCC Transaction [{{data.Info}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'DDR BC CCC Transaction [{Info}] - Payload [{Length}]: [ {Data} ]'
        },
        'DDR Direct CCC Transaction':
        {
            'format':  'DDR Direct CCC Transaction [{{data.Info}}] - Address [{{data.Address}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'DDR Direct CCC Transaction [{Info}] - [{Address}] - Payload [{Length}]: [ {Data} ]'
        },
        'Aborted Read DDR':
        {
            'format':  'DDR Aborted Read from Address [{{data.Address}}] - Command [{{data.Command}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'DDR Aborted Read from Address [{Address}] - Command [{Command}] - Payload [{Length}]: [ {Data} ]'
        },
        'Aborted Write DDR':
        {
            'format':  'DDR Aborted Write to Address  [{{data.Address}}] - Command [{{data.Command}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'DDR Aborted Write to Address [{Address}] - Command [{Command}] - Payload [{Length}]: [ {Data} ]'
        },
        'DDR Abort':
        {
            'format':  'DDR Abort',
            'console': 'DDR Abort'
        },
        'DDR Unknown Transaction':
        {
            'format':  'DDR Unknown transaction',
            'console': 'DDR Unknown transaction'
        },
        'BT Write':
        {
            'format':  'BT Write [{{data.Address}}] Cmd [{{data.Command}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'BT Write [{Address}] Cmd [{Command}] - Payload [{Length}]: [ {Data} ]',
        },
        'BT Read':
        {
            'format':  'BT Read [{{data.Address}}] Cmd [{{data.Command}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'BT Read [{Address}] Cmd [{Command}] - Payload [{Length}]: [ {Data} ]',
        },
        'Aborted BT Write':
        {
            'format':  'Aborted BT Write [{{data.Address}}] Cmd [{{data.Command}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'Aborted BT Write [{Address}] Cmd [{Command}] - Payload [{Length}]: [ {Data} ]',
        },
        'Aborted BT Read':
        {
            'format':  'Aborted BT Read [{{data.Address}}] Cmd [{{data.Command}}] - Payload [{{data.Length}}]: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'Aborted BT Read [{Address}] Cmd [{Command}] - Payload [{Length}]: [ {Data} ]',
        },
        'BT Abort':
        {
            'format':  'BT Abort',
            'console': 'BT Abort',
        },
        'BT Unknown Transaction':
        {
            'format':  'BT Unknown transaction',
            'console': 'BT Unknown transaction',
        },
        'BT Header':
        {
            'format':  'BT Hdr Addr:{{data.Address}}/{{data.Direction}} | Cmd0:{{data.Cmd0}} {{data.CCCName}} Cmd1:{{data.Cmd1}} Cmd2:{{data.Cmd2}} Cmd3:{{data.Cmd3}} | Ctrl: {{data.CTRLDirection}} {{data.CRCType}} {{data.SCLSource}} {{data.CCCCont}} {{data.NewFraming}} | Tr: {{data.ACK}} {{data.Delay}}',
            'console': 'BT Header Addr: {Address}/{Direction} | Cmd0:{Cmd0} {CCCName} Cmd1:{Cmd1} Cmd2:{Cmd2} Cmd3:{Cmd3} | Ctrl: {CTRLDirection} {CRCType} {SCLSource} {CCCCont} {NewFraming}| Tr: {ACK} {Delay}',
        },
        'BT Data Block':
        {
            'format':  'BT Block [{{data.BlockIndex}}] TC:{{data.TCByte}} ({{data.TCFlags}}) {{data.ValidBytes}}B: [ {{data.Data}} ]{{data.Error}}',
            'console': 'BT Data Block [{BlockIndex}] TC:{TCByte} ({TCFlags}) {ValidBytes}B: [ {Data} ]{Error}',
        },
        'BT CRC Block':
        {
            'format':  'BT CRC {{data.CRCType}}: [{{data.CRCValue}}] {{data.VerifyResult}}{{data.Terminated}}{{data.Error}}',
            'console': 'BT CRC {CRCType}: [{CRCValue}] {VerifyResult}{Terminated}{Error}',
        },
        'Aborted BT Header':
        {
            'format':  'Aborted BT Hdr Addr: {{data.Address}}/{{data.Direction}} Cmd [{{data.Command}}] - Error: [{{data.Error}}]',
            'console': 'Aborted BT Header Addr: {Address}/{Direction} Cmd [{Command}]',
        },
        'Aborted BT Data Block':
        {
            'format':  'Aborted BT Block [{{data.BlockIndex}}] {{data.ValidBytes}}B: [ {{data.Data}} ] - Error: [{{data.Error}}]',
            'console': 'Aborted BT Data Block [{BlockIndex}] {ValidBytes}B: [ {Data} ]',
        },
        'Aborted BT CRC Block':
        {
            'format':  'Aborted BT CRC {{data.CRCType}} - Error: [{{data.Error}}]',
            'console': 'Aborted BT CRC {CRCType}',
        },
        'UNSUPPORTED':
        {
            'format':  'Upgrade License',
            'console': 'Upgrade License'
        },

    }

    # Dictionary to map each I3C version with the CCC texts dicts that must include. The key-value pairs show how each version
    # builds upon the previous ones by including the text representations of CCCs from earlier versions
    ccc_text_version_map = {
        I3cVersions.VERSION1_0:     [ccc_text_v1_0],
        I3cVersions.VERSION1_1:     [ccc_text_v1_0, ccc_text_v1_1],
        I3cVersions.VERSION1_1_1:   [ccc_text_v1_0, ccc_text_v1_1, ccc_text_v1_1_1],
        I3cVersions.VERSION1_2:     [ccc_text_v1_0, ccc_text_v1_1, ccc_text_v1_1_1]
    }

    @staticmethod
    def getCCCDict(i3c_version: I3cVersions):
        """
        Merge dictionary by unpacking them and replacing the values of the repeated keys in ccc_text with values from ccc_text_to_add
        """
        ccc_text = {}
        ccc_texts_to_add = I3CDictionaries.ccc_text_version_map[i3c_version]
        for ccc_text_to_add in ccc_texts_to_add:
            ccc_text = {**ccc_text, **ccc_text_to_add}

        return ccc_text

    dcr_dict = {
        0x00: "Generic (v1.0)",
        0x01: "Do Not Use",
        0x02: "Heart Rate Sensor",
        0x03: "ECG Sensor",
        0x04: "EEG Sensor",
        0x05: "GSR Sensor",
        0x06: "Breathalyzer",
        0x07: "Glucose Sensor",
        0x08: "Oxymeter",
        0x09: "ENG Sensor",
        0x20: "Do Not Use",
        0x21: "Touch",
        0x22: "Gesture (Touchless)",
        0x23: "Grip",
        0x24: "Fingerprint",
        0x25: "Haptic",
        0x26: "Gesture (Acoustic)",
        0x27: "Audio Alarm",
        0x28: "HID",
        0x40: "Do Not Use",
        0x41: "Accelerometer",
        0x42: "Gyroscope",
        0x43: "Magnetometer",
        0x44: "Accel/Gyro Combo",
        0x45: "Accel/Mag Combo",
        0x46: "Accel/Gyro/Mag Combo",
        0x60: "Do Not Use",
        0x61: "Ambient Light",
        0x62: "Pressure",
        0x63: "Temperature",
        0x64: "Humidity",
        0x65: "UV Sensor",
        0x66: "Air Quality",
        0x67: "IR Sensor",
        0x80: "Do Not Use",
        0x81: "Proximity",
        0x82: "RGB",
        0x83: "Shock Accelerometer",
        0x84: "Oxygen Sensor",
        0x85: "Mass Flow Sensor",
        0x86: "Switch/Solenoid Valve",
        0x87: "Goniometer",
        0x88: "Position Sensor",
        0x89: "Throttle Control",
        0x8A: "Force/Stress Sensor",
        0xA0: "Do Not Use",
        0xA1: "NFC",
        0xA2: "IR Data Link",
        0xA3: "RF Data Link",
        0xA4: "RF Ranging/Localization",
        0xB8: "Do Not Use",
        0xBA: "Security Device (SSP)",
        0xBB: "Security Device (UICC)",
        0xBC: "Embedded Secure Element",
        0xBD: "OCP Recovery",
        0xC1: "Bridge",
        0xC2: "Hub",
        0xC3: "Bus Monitor",
        0xC4: "Secondary Controller",
        0xC5: "Memory",
        0xC6: "Microcontroller",
        0xC7: "PMIC",
        0xC8: "IO Expander",
        0xC9: "Debug Target System",
        0xCA: "Debug and Test System",
        0xCB: "Dual Role Debug System",
        0xCC: "MCTP",
        0xCD: "Retimer",
        0xD0: "Reserved (JEDEC DTI=0000)",
        0xD1: "Reserved (JEDEC DTI=0001)",
        0xD2: "Thermal Sensor",
        0xD3: "Reserved (JEDEC DTI=0011)",
        0xD4: "DIMM Memory Buffer (1st)",
        0xD5: "DIMM Memory Buffer (2nd)",
        0xD6: "Thermal Sensor (2nd)",
        0xD7: "Reserved (JEDEC DTI=0111)",
        0xD8: "PMIC (2nd)",
        0xD9: "PMIC (1st)",
        0xDA: "SPD Hub",
        0xDB: "Registered Clock Divider",
        0xDC: "PMIC (3rd)",
        0xDD: "Reserved (JEDEC DTI=1101)",
        0xDE: "Reserved (JEDEC DTI=1110)",
        0xDF: "Reserved (JEDEC DTI=1111)",
        0xE0: "Do Not Use",
        0xE1: "FPGA/PLD Configuration",
        0xE2: "Camera Photometer",
        0xE3: "Camera Shutter Control",
        0xE4: "Camera Focus Control",
    }