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

This module contains the definition of the L2CAP signaling
codes used by HCI ACL packets.

"""
from enum import Enum


class AclChannelIds(Enum):
    """
    ACL packet channel IDs.
    """

    ACL_CHANNEL_ID_ACL = 0x01
    ACL_CHANNEL_ID_ATT = 0x04
    ACL_CHANNEL_ID_LE = 0x05


class L2CAPSignalingCodes(Enum):
    """
    ACL packet L2CAP signaling codes.
    """

    L2CAP_COMMAND_REJECT_RSP = 0x01
    L2CAP_CONNECTION_REQ = 0x02
    L2CAP_CONNECTION_RSP = 0x03
    L2CAP_CONFIGURATION_REQ = 0x04
    L2CAP_CONFIGURATION_RSP = 0x05
    L2CAP_DISCONNECTION_REQ = 0x06
    L2CAP_DISCONNECTION_RSP = 0x07
    L2CAP_ECHO_REQ = 0x08
    L2CAP_ECHO_RSP = 0x09
    L2CAP_INFORMATION_REQ = 0x0A
    L2CAP_INFORMATION_RSP = 0x0B
    L2CAP_CONNECTION_PARAMETER_UPDATE_REQ = 0x12
    L2CAP_CONNECTION_PARAMETER_UPDATE_RSP = 0x13
    L2CAP_LE_CREDIT_BASED_CONNECTION_REQ = 0x14
    L2CAP_LE_CREDIT_BASED_CONNECTION_RSP = 0x15
    L2CAP_FLOW_CONTROL_CREDIT_IND = 0x16
    L2CAP_CREDIT_BASED_CONNECTION_REQ = 0x17
    L2CAP_CREDIT_BASED_CONNECTION_RSP = 0x18
    L2CAP_CREDIT_BASED_RECONFIGURE_REQ = 0x19
    L2CAP_CREDIT_BASED_RECONFIGURE_RSP = 0x1A


class ATTProtocolCodes(Enum):
    """
    ACL packet ATT protocol codes.
    """

    ATT_ERROR_RSP = 0x01
    ATT_EXCHANGE_MTU_REQ = 0x02
    ATT_EXCHANGE_MTU_RSP = 0x03
    ATT_FIND_INFORMATION_REQ = 0x04
    ATT_FIND_INFORMATION_RSP = 0x05
    ATT_FIND_BY_TYPE_VALUE_REQ = 0x06
    ATT_FIND_BY_TYPE_VALUE_RSP = 0x07
    ATT_READ_BY_TYPE_REQ = 0x08
    ATT_READ_BY_TYPE_RSP = 0x09
    ATT_READ_REQ = 0x0A
    ATT_READ_RSP = 0x0B
    ATT_READ_BLOB_REQ = 0x0C
    ATT_READ_BLOB_RSP = 0x0D
    ATT_READ_MULTIPLE_REQ = 0x0E
    ATT_READ_MULTIPLE_RSP = 0x0F
    ATT_READ_BY_GROUP_TYPE_REQ = 0x10
    ATT_READ_BY_GROUP_TYPE_RSP = 0x11
    ATT_READ_MULTIPLE_VARIABLE_REQ = 0x20
    ATT_READ_MULTIPLE_VARIABLE_RSP = 0x21
    ATT_WRITE_REQ = 0x12
    ATT_WRITE_RSP = 0x13
    ATT_WRITE_CMD = 0x52
    ATT_SIGNED_WRITE_CMD = 0xD2
    ATT_PREPARE_WRITE_REQ = 0x16
    ATT_PREPARE_WRITE_RSP = 0x17
    ATT_EXECUTE_WRITE_REQ = 0x18
    ATT_EXECUTE_WRITE_RSP = 0x19
    ATT_HANDLE_VALUE_NTF = 0x1B
    ATT_HANDLE_VALUE_IND = 0x1D
    ATT_HANDLE_VALUE_CFM = 0x1E
    ATT_MULTIPLE_HANDLE_VALUE_NTF = 0x23
