# Copyright (c) 2024 Analog Devices, Inc.
# SPDX-License-Identifier: Apache-2.0
"""Module defines HCI event packet codes.

This module contains the definition of the event codes
used by HCI event packets and the subevent codes used
specifically by HCI LEMeta event packets.

"""
from enum import Enum


class EventCode(Enum):
    """
    Event packet event codes.
    """

    INQUIRY_COMPLETE = 0x1
    INQUIRY_RESULT = 0x2
    CONNECTION_COMPLETE = 0x3
    CONNECTION_REQUEST = 0x4
    DISCONNECTION_COMPLETE = 0x5
    AUTHENTICATION_COMPLETE = 0x6
    REMOTE_NAME_CHANGE_REQUEST_COMPLETE = 0x7
    ENCRYPTION_CHANGE_V1 = 0x8
    CHANGE_CONNECTION_LINK_KEY_COMPLETE = 0x9
    LINK_KEY_TYPE_CHANGED = 0xA
    READ_REMOTE_SUPPORTED_FEATURES_COMPLETE = 0xB
    READ_REMOTE_VERSION_INFORMATION_COMPLETE = 0xC
    QOS_SETUP_COMPLETE = 0xD
    COMMAND_COMPLETE = 0xE
    COMMAND_STATUS = 0xF
    HARDWARE_ERROR = 0x10
    FLUSH_OCCURED = 0x11
    ROLE_CHANGE = 0x12
    NUMBER_OF_COMPLETED_PACKETS = 0x13
    MODE_CHANGE = 0x14
    RETURN_LINK_KEYS = 0x15
    PIN_CODE_REQUEST = 0x16
    LINK_KEY_REQUEST = 0x17
    LINK_KEY_NOTIFICATION = 0x18
    LOOPBACK_COMMAND = 0x19
    DATA_BUFFER_OVERFLOW = 0x1A
    MAX_SLOTS_CHANGE = 0x1B
    READ_CLOCK_OFFSET_COMPLETE = 0x1C
    CONNECTION_PACKET_TYPE_CHANGED = 0x1D
    QOS_VIOLATION = 0x1E
    PAGE_SCAN_REPITITION_MODE_CHANGE = 0x20
    FLOW_SPECIFICATION_COMPLETE = 0x21
    INQUIRY_RESULT_WITH_RSSI = 0x22
    READ_REMOTE_EXTENDED_FEATURES_COMPLETE = 0x23
    SYNCHRONOUS_CONNECTION_COMPLETE = 0x2C
    SYNCHRONOUS_CONNECTION_CHANGED = 0x2D
    SNIFF_SUBRATING = 0x2E
    EXTENDED_INQUIRY_RESULT = 0x2F
    ENCRYPTION_KEY_REFRESH_COMPLETE = 0x30
    IO_CAPABILITY_REQUEST = 0x31
    IO_CAPABILITY_RESPONSE = 0x32
    USER_CONFIRMATION_REQUEST = 0x33
    USER_PASSKEY_REQUEST = 0x34
    REMOTE_OOB_DATA_REQUEST = 0x35
    SIMPLE_PAIRING_COMPLETE = 0x36
    LINK_SUPERVISION_TIMEOUT_CHANGED = 0x38
    ENHANCED_FLUSH_COMPLETE = 0x39
    USER_PASSKEY_NOTIFICATION = 0x3B
    KEYPRESS_NOTIFICATION = 0x3C
    REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION = 0x3D
    LE_META = 0x3E
    NUMBER_OF_COMPLETED_DATA_BLOCKS = 0x48
    TRIGGERED_CLOCK_CAPTURE = 0x4E
    SYNCHRONIZATION_TRAIN_COMPLETE = 0x4F
    SYNCHRONIZATION_TRAIN_RECEIVED = 0x50
    CONNECTIONLESS_PERIPHERAL_BROADCAST_RECEIVE = 0x51
    CONNECTIONLESS_PERIPHERAL_BROADCAST_TIMEOUT = 0x52
    TRUNCATED_PAGE_COMPLETE = 0x53
    PERIPHERAL_PAGE_RESPONSE_TIMEOUT = 0x54
    CONNECTIONLESS_PERIPHERAL_BROADCAST_CHANNEL_MAP_CHANGE = 0x55
    INQUIRY_RESPONSE_NOTIFICATION = 0x56
    AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED = 0x57
    SAM_STATUS_CHANGE = 0x58
    ENCRYPTION_CHANGE_V2 = 0x59


class SubEventCode(Enum):
    """
    Event packet subevent codes.
    """

    LE_CONNECTION_COMPLETE = 0x01
    LE_ADVERTISING_REPORT = 0x02
    LE_CONNECTION_UPDATE = 0x03
    LE_READ_REMOTE_FEATURES_COMPLETE = 0x04
    LE_LONG_TERM_KEY_REQUEST = 0x05
    LE_REMOTE_CONNECTION_PARAMETER_REQUEST = 0x06
    LE_DATA_LENGTH_CHANGE = 0x07
    LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE = 0x08
    LE_GENERATE_DHKEY_COMPLETE = 0x09
    LE_ENHANCED_CONNECTION_COMPLETE_V1 = 0x0A
    LE_DIRECTED_ADVERTISING_REPORT = 0x0B
    LE_PHY_UPDATE_COMPLETE = 0x0C
    LE_EXTENDED_ADVERTISING_REPORT = 0x0D
    LE_PERIODIC_ADVERTISING_SYNC_ESTABLISHED_V1 = 0x0E
    LE_PERIODIC_ADVERTISING_REPORT_V1 = 0x0F
    LE_PERIODIC_ADVERTISING_SYNC_LOST = 0x10
    LE_SCAN_TIMEOUT = 0x11
    LE_ADVERTISING_SET_TERMINATED = 0x12
    LE_SCAN_REQUEST_RECEIVED = 0x13
    LE_CHANNEL_SELECTION_ALGORITHM = 0x14
    LE_CONNECTIONLESS_IQ_REPORT = 0x15
    LE_CONNECTION_IQ_REPORT = 0x16
    LE_CTE_REQUEST_FAILED = 0x17
    LE_PERIODIC_ADVERTISING_SYNC_TRANSFER_RECEIVED_V1 = 0x18
    LE_CIS_ESTABLISHED_V1 = 0x19
    LE_CIS_REQUEST = 0x1A
    LE_CREATE_BIG_COMPLETE = 0x1B
    LE_TERMINATE_BIG_COMPLETE = 0x1C
    LE_BIG_SYNC_ESTABLISHED = 0x1D
    LE_BIG_SYNC_LOST = 0x1E
    LE_REQUEST_PEER_SCA_COMPLETE = 0x1F
    LE_PATH_LOSS_THRESHOLD = 0x20
    LE_TRANSMIT_POWER_REPORTING = 0x21
    LE_BIGINFO_ADVERTISING_REPORT = 0x22
    LE_SUBRATE_CHANGE = 0x23
    LE_PERIODIC_ADVERTISING_SYNC_ESTABLISHED_V2 = 0x24
    LE_PERIODIC_ADVERTISING_REPORT_V2 = 0x25
    LE_PERIODIC_ADVERTISING_SYNC_TRANSFER_RECEIVED_V2 = 0x26
    LE_PERIODIC_ADVERTISING_SUBEVENT_DATA_REQUEST = 0x27
    LE_PERIODIC_ADVERTISING_RESPONSE_REPORT = 0x28
    LE_ENHANCED_CONNECTION_COMPLETE_V2 = 0x29
    LE_CIS_ESTABLISHED_V2 = 0x2A
    LE_READ_ALL_REMOTE_FEATURES_COMPLETE = 0x2B
    LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE = 0x2C
    LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE = 0x2D
    LE_CS_SECURITY_ENABLE_COMPLETE = 0x2E
    LE_CS_CONFIG_COMPLETE = 0x2F
    LE_CS_PROCEDURE_ENABLE_COMPLETE = 0x30
    LE_CS_SUBEVENT_RESULT = 0x31
    LE_CS_SUBEVENT_RESULT_CONTINUE = 0x32
    LE_CS_TEST_END_COMPLETE = 0x33
    LE_MONITORED_ADVERTISERS_REPORT = 0x34
    LE_FRAME_SPACE_UPDATE_COMPLETE = 0x35
