"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
"""

import builtins
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import sys
import typing

if sys.version_info >= (3, 10):
    import typing as typing_extensions
else:
    import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

@typing.final
class SerialHalCommand(google.protobuf.message.Message):
    """SerialHalCommand messages are sent from host to device over the SerialHal
    framing stream. Responses normally come back as SerialHalResponse with the
    same transaction_id.

    Interrupt notifications are the one asynchronous exception: the device emits
    an unsolicited SerialHalResponse with transaction_id == 0 and value == pin.
    Host implementations should treat those frames as interrupt events rather
    than replies to an outstanding request.
    """

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    class _Type:
        ValueType = typing.NewType("ValueType", builtins.int)
        V: typing_extensions.TypeAlias = ValueType

    class _TypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[SerialHalCommand._Type.ValueType], builtins.type):
        DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
        UNSET: SerialHalCommand._Type.ValueType  # 0
        PIN_MODE: SerialHalCommand._Type.ValueType  # 1
        DIGITAL_WRITE: SerialHalCommand._Type.ValueType  # 2
        DIGITAL_READ: SerialHalCommand._Type.ValueType  # 3
        ATTACH_INTERRUPT: SerialHalCommand._Type.ValueType  # 4
        DETACH_INTERRUPT: SerialHalCommand._Type.ValueType  # 5
        SPI_TRANSFER: SerialHalCommand._Type.ValueType  # 6
        NOOP: SerialHalCommand._Type.ValueType  # 7

    class Type(_Type, metaclass=_TypeEnumTypeWrapper): ...
    UNSET: SerialHalCommand.Type.ValueType  # 0
    PIN_MODE: SerialHalCommand.Type.ValueType  # 1
    DIGITAL_WRITE: SerialHalCommand.Type.ValueType  # 2
    DIGITAL_READ: SerialHalCommand.Type.ValueType  # 3
    ATTACH_INTERRUPT: SerialHalCommand.Type.ValueType  # 4
    DETACH_INTERRUPT: SerialHalCommand.Type.ValueType  # 5
    SPI_TRANSFER: SerialHalCommand.Type.ValueType  # 6
    NOOP: SerialHalCommand.Type.ValueType  # 7

    TRANSACTION_ID_FIELD_NUMBER: builtins.int
    TYPE_FIELD_NUMBER: builtins.int
    PIN_FIELD_NUMBER: builtins.int
    VALUE_FIELD_NUMBER: builtins.int
    MODE_FIELD_NUMBER: builtins.int
    DATA_FIELD_NUMBER: builtins.int
    transaction_id: builtins.int
    """Host-assigned request id. Replies echo this id back in
    SerialHalResponse.transaction_id.
    """
    type: global___SerialHalCommand.Type.ValueType
    pin: builtins.int
    value: builtins.int
    mode: builtins.int
    data: builtins.bytes
    def __init__(
        self,
        *,
        transaction_id: builtins.int = ...,
        type: global___SerialHalCommand.Type.ValueType = ...,
        pin: builtins.int = ...,
        value: builtins.int = ...,
        mode: builtins.int = ...,
        data: builtins.bytes = ...,
    ) -> None: ...
    def ClearField(self, field_name: typing.Literal["data", b"data", "mode", b"mode", "pin", b"pin", "transaction_id", b"transaction_id", "type", b"type", "value", b"value"]) -> None: ...

global___SerialHalCommand = SerialHalCommand

@typing.final
class SerialHalResponse(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    class _Result:
        ValueType = typing.NewType("ValueType", builtins.int)
        V: typing_extensions.TypeAlias = ValueType

    class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[SerialHalResponse._Result.ValueType], builtins.type):
        DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
        OK: SerialHalResponse._Result.ValueType  # 0
        ERROR: SerialHalResponse._Result.ValueType  # 1
        BAD_REQUEST: SerialHalResponse._Result.ValueType  # 2
        UNSUPPORTED: SerialHalResponse._Result.ValueType  # 3

    class Result(_Result, metaclass=_ResultEnumTypeWrapper): ...
    OK: SerialHalResponse.Result.ValueType  # 0
    ERROR: SerialHalResponse.Result.ValueType  # 1
    BAD_REQUEST: SerialHalResponse.Result.ValueType  # 2
    UNSUPPORTED: SerialHalResponse.Result.ValueType  # 3

    TRANSACTION_ID_FIELD_NUMBER: builtins.int
    RESULT_FIELD_NUMBER: builtins.int
    VALUE_FIELD_NUMBER: builtins.int
    DATA_FIELD_NUMBER: builtins.int
    ERROR_FIELD_NUMBER: builtins.int
    transaction_id: builtins.int
    """Matches the originating SerialHalCommand.transaction_id for normal
    request/response traffic.

    A value of 0 indicates an unsolicited interrupt notification generated by
    the device. In that case, the host should interpret value as the GPIO pin
    that triggered.
    """
    result: global___SerialHalResponse.Result.ValueType
    value: builtins.int
    """Used by DIGITAL_READ replies and interrupt notifications. For interrupt
    notifications (transaction_id == 0), this carries the pin number.
    """
    data: builtins.bytes
    error: builtins.str
    def __init__(
        self,
        *,
        transaction_id: builtins.int = ...,
        result: global___SerialHalResponse.Result.ValueType = ...,
        value: builtins.int = ...,
        data: builtins.bytes = ...,
        error: builtins.str = ...,
    ) -> None: ...
    def ClearField(self, field_name: typing.Literal["data", b"data", "error", b"error", "result", b"result", "transaction_id", b"transaction_id", "value", b"value"]) -> None: ...

global___SerialHalResponse = SerialHalResponse
