# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
"""
This file contains the exact signatures for all functions in module
PySide6.QtSerialBus, except for defaults which are replaced by "...".
"""

# mypy: disable-error-code="override, overload-overlap"
# Module `PySide6.QtSerialBus`

import PySide6.QtSerialBus
import PySide6.QtCore

import enum
import typing
from PySide6.QtCore import Signal
from shiboken6 import Shiboken


class QCanBus(PySide6.QtCore.QObject): ...


class QCanBusDevice(PySide6.QtCore.QObject):

    errorOccurred            : typing.ClassVar[Signal] = ... # errorOccurred(QCanBusDevice::CanBusError)
    framesReceived           : typing.ClassVar[Signal] = ... # framesReceived()
    framesWritten            : typing.ClassVar[Signal] = ... # framesWritten(qlonglong)
    stateChanged             : typing.ClassVar[Signal] = ... # stateChanged(QCanBusDevice::CanBusDeviceState)

    class CanBusDeviceState(enum.Enum):

        UnconnectedState          = 0x0
        ConnectingState           = 0x1
        ConnectedState            = 0x2
        ClosingState              = 0x3

    class CanBusError(enum.Enum):

        NoError                   = 0x0
        ReadError                 = 0x1
        WriteError                = 0x2
        ConnectionError           = 0x3
        ConfigurationError        = 0x4
        UnknownError              = 0x5
        OperationError            = 0x6
        TimeoutError              = 0x7

    class CanBusStatus(enum.Enum):

        Unknown                   = 0x0
        Good                      = 0x1
        Warning                   = 0x2
        Error                     = 0x3
        BusOff                    = 0x4

    class ConfigurationKey(enum.Enum):

        RawFilterKey              = 0x0
        ErrorFilterKey            = 0x1
        LoopbackKey               = 0x2
        ReceiveOwnKey             = 0x3
        BitRateKey                = 0x4
        CanFdKey                  = 0x5
        DataBitRateKey            = 0x6
        ProtocolKey               = 0x7
        UserKey                   = 0x1e

    class Direction(enum.Flag):

        Input                     = 0x1
        Output                    = 0x2
        AllDirections             = 0x3

    class Filter(Shiboken.Object):

        class FormatFilter(enum.Flag):

            MatchBaseFormat           = 0x1
            MatchExtendedFormat       = 0x2
            MatchBaseAndExtendedFormat = 0x3


class QCanBusDeviceInfo(Shiboken.Object): ...


class QCanBusFactory(Shiboken.Object): ...


class QCanBusFrame(Shiboken.Object):

    class FrameError(enum.Flag):

        NoError                   = 0x0
        TransmissionTimeoutError  = 0x1
        LostArbitrationError      = 0x2
        ControllerError           = 0x4
        ProtocolViolationError    = 0x8
        TransceiverError          = 0x10
        MissingAcknowledgmentError = 0x20
        BusOffError               = 0x40
        BusError                  = 0x80
        ControllerRestartError    = 0x100
        UnknownError              = 0x200
        AnyError                  = 0x1fffffff

    class FrameType(enum.Enum):

        UnknownFrame              = 0x0
        DataFrame                 = 0x1
        ErrorFrame                = 0x2
        RemoteRequestFrame        = 0x3
        InvalidFrame              = 0x4

    class TimeStamp(Shiboken.Object): ...


class QCanDbcFileParser(Shiboken.Object):

    class Error(enum.Enum):

        None_                     = 0x0
        FileReading               = 0x1
        Parsing                   = 0x2


class QCanFrameProcessor(Shiboken.Object):

    class Error(enum.Enum):

        None_                     = 0x0
        InvalidFrame              = 0x1
        UnsupportedFrameFormat    = 0x2
        Decoding                  = 0x3
        Encoding                  = 0x4

    class ParseResult(Shiboken.Object): ...


class QCanMessageDescription(Shiboken.Object): ...
    def __repr__(self, /) -> str: ...


class QCanSignalDescription(Shiboken.Object):

    class MultiplexValueRange(Shiboken.Object): ...
        def __repr__(self, /) -> str: ...


    def __repr__(self, /) -> str: ...


class QCanUniqueIdDescription(Shiboken.Object): ...


class QIntList: ...


class QModbusClient(PySide6.QtSerialBus.QModbusDevice):

    timeoutChanged           : typing.ClassVar[Signal] = ... # timeoutChanged(int)


class QModbusDataUnit(Shiboken.Object):

    class RegisterType(enum.Enum):

        Invalid                   = 0x0
        DiscreteInputs            = 0x1
        Coils                     = 0x2
        InputRegisters            = 0x3
        HoldingRegisters          = 0x4


class QModbusDevice(PySide6.QtCore.QObject):

    errorOccurred            : typing.ClassVar[Signal] = ... # errorOccurred(QModbusDevice::Error)
    stateChanged             : typing.ClassVar[Signal] = ... # stateChanged(QModbusDevice::State)

    class ConnectionParameter(enum.Enum):

        SerialPortNameParameter   = 0x0
        SerialParityParameter     = 0x1
        SerialBaudRateParameter   = 0x2
        SerialDataBitsParameter   = 0x3
        SerialStopBitsParameter   = 0x4
        NetworkPortParameter      = 0x5
        NetworkAddressParameter   = 0x6

    class Error(enum.Enum):

        NoError                   = 0x0
        ReadError                 = 0x1
        WriteError                = 0x2
        ConnectionError           = 0x3
        ConfigurationError        = 0x4
        TimeoutError              = 0x5
        ProtocolError             = 0x6
        ReplyAbortedError         = 0x7
        UnknownError              = 0x8
        InvalidResponseError      = 0x9

    class IntermediateError(enum.Enum):

        ResponseCrcError          = 0x0
        ResponseRequestMismatch   = 0x1

    class State(enum.Enum):

        UnconnectedState          = 0x0
        ConnectingState           = 0x1
        ConnectedState            = 0x2
        ClosingState              = 0x3


class QModbusDeviceIdentification(Shiboken.Object):

    class ConformityLevel(enum.Enum):

        BasicConformityLevel      = 0x1
        RegularConformityLevel    = 0x2
        ExtendedConformityLevel   = 0x3
        BasicIndividualConformityLevel = 0x81
        RegularIndividualConformityLevel = 0x82
        ExtendedIndividualConformityLevel = 0x83

    class ObjectId(enum.Enum):

        VendorNameObjectId        = 0x0
        ProductCodeObjectId       = 0x1
        MajorMinorRevisionObjectId = 0x2
        VendorUrlObjectId         = 0x3
        ProductNameObjectId       = 0x4
        ModelNameObjectId         = 0x5
        UserApplicationNameObjectId = 0x6
        ReservedObjectId          = 0x7
        ProductDependentObjectId  = 0x80
        UndefinedObjectId         = 0x100

    class ReadDeviceIdCode(enum.Enum):

        BasicReadDeviceIdCode     = 0x1
        RegularReadDeviceIdCode   = 0x2
        ExtendedReadDeviceIdCode  = 0x3
        IndividualReadDeviceIdCode = 0x4


class QModbusExceptionResponse(PySide6.QtSerialBus.QModbusResponse): ...


class QModbusPdu(Shiboken.Object):

    class ExceptionCode(enum.Enum):

        IllegalFunction           = 0x1
        IllegalDataAddress        = 0x2
        IllegalDataValue          = 0x3
        ServerDeviceFailure       = 0x4
        Acknowledge               = 0x5
        ServerDeviceBusy          = 0x6
        NegativeAcknowledge       = 0x7
        MemoryParityError         = 0x8
        GatewayPathUnavailable    = 0xa
        GatewayTargetDeviceFailedToRespond = 0xb
        ExtendedException         = 0xff

    class FunctionCode(enum.Enum):

        Invalid                   = 0x0
        ReadCoils                 = 0x1
        ReadDiscreteInputs        = 0x2
        ReadHoldingRegisters      = 0x3
        ReadInputRegisters        = 0x4
        WriteSingleCoil           = 0x5
        WriteSingleRegister       = 0x6
        ReadExceptionStatus       = 0x7
        Diagnostics               = 0x8
        GetCommEventCounter       = 0xb
        GetCommEventLog           = 0xc
        WriteMultipleCoils        = 0xf
        WriteMultipleRegisters    = 0x10
        ReportServerId            = 0x11
        ReadFileRecord            = 0x14
        WriteFileRecord           = 0x15
        MaskWriteRegister         = 0x16
        ReadWriteMultipleRegisters = 0x17
        ReadFifoQueue             = 0x18
        EncapsulatedInterfaceTransport = 0x2b
        UndefinedFunctionCode     = 0x100


    def __repr__(self, /) -> str: ...


class QModbusReply(PySide6.QtCore.QObject):

    errorOccurred            : typing.ClassVar[Signal] = ... # errorOccurred(QModbusDevice::Error)
    finished                 : typing.ClassVar[Signal] = ... # finished()
    intermediateErrorOccurred: typing.ClassVar[Signal] = ... # intermediateErrorOccurred(QModbusDevice::IntermediateError)

    class ReplyType(enum.Enum):

        Raw                       = 0x0
        Common                    = 0x1
        Broadcast                 = 0x2


class QModbusRequest(PySide6.QtSerialBus.QModbusPdu): ...


class QModbusResponse(PySide6.QtSerialBus.QModbusPdu): ...


class QModbusRtuSerialClient(PySide6.QtSerialBus.QModbusClient): ...


class QModbusRtuSerialServer(PySide6.QtSerialBus.QModbusServer): ...


class QModbusServer(PySide6.QtSerialBus.QModbusDevice):

    dataWritten              : typing.ClassVar[Signal] = ... # dataWritten(QModbusDataUnit::RegisterType,int,int)

    class Option(enum.Enum):

        DiagnosticRegister        = 0x0
        ExceptionStatusOffset     = 0x1
        DeviceBusy                = 0x2
        AsciiInputDelimiter       = 0x3
        ListenOnlyMode            = 0x4
        ServerIdentifier          = 0x5
        RunIndicatorStatus        = 0x6
        AdditionalData            = 0x7
        DeviceIdentification      = 0x8
        UserOption                = 0x100


class QModbusTcpClient(PySide6.QtSerialBus.QModbusClient): ...


class QModbusTcpConnectionObserver(Shiboken.Object): ...


class QModbusTcpServer(PySide6.QtSerialBus.QModbusServer):

    modbusClientDisconnected : typing.ClassVar[Signal] = ... # modbusClientDisconnected(QTcpSocket*)


class QtCanBus(Shiboken.Object):

    class DataFormat(enum.Enum):

        SignedInteger             = 0x0
        UnsignedInteger           = 0x1
        Float                     = 0x2
        Double                    = 0x3
        AsciiString               = 0x4

    class DataSource(enum.Enum):

        Payload                   = 0x0
        FrameId                   = 0x1

    class MultiplexState(enum.Enum):

        None_                     = 0x0
        MultiplexorSwitch         = 0x1
        MultiplexedSignal         = 0x2
        SwitchAndSignal           = 0x3

    class UniqueId(enum.Enum): ...  # type: ignore[misc]


# eof
