173 lines
10 KiB
C++
173 lines
10 KiB
C++
#include <pybind11/pybind11.h>
|
|
#include <pybind11/stl.h>
|
|
#include <pybind11/functional.h>
|
|
|
|
#include "icsneo/api/event.h"
|
|
|
|
namespace icsneo {
|
|
|
|
void init_event(pybind11::module_& m) {
|
|
pybind11::class_<APIEvent, std::shared_ptr<APIEvent>> apiEvent(m, "APIEvent");
|
|
pybind11::enum_<APIEvent::Type>(apiEvent, "Type")
|
|
.value("Any", APIEvent::Type::Any)
|
|
.value("InvalidNeoDevice", APIEvent::Type::InvalidNeoDevice)
|
|
.value("RequiredParameterNull", APIEvent::Type::RequiredParameterNull)
|
|
.value("BufferInsufficient", APIEvent::Type::BufferInsufficient)
|
|
.value("OutputTruncated", APIEvent::Type::OutputTruncated)
|
|
.value("ParameterOutOfRange", APIEvent::Type::ParameterOutOfRange)
|
|
.value("DeviceCurrentlyOpen", APIEvent::Type::DeviceCurrentlyOpen)
|
|
.value("DeviceCurrentlyClosed", APIEvent::Type::DeviceCurrentlyClosed)
|
|
.value("DeviceCurrentlyOnline", APIEvent::Type::DeviceCurrentlyOnline)
|
|
.value("DeviceCurrentlyOffline", APIEvent::Type::DeviceCurrentlyOffline)
|
|
.value("DeviceCurrentlyPolling", APIEvent::Type::DeviceCurrentlyPolling)
|
|
.value("DeviceNotCurrentlyPolling", APIEvent::Type::DeviceNotCurrentlyPolling)
|
|
.value("UnsupportedTXNetwork", APIEvent::Type::UnsupportedTXNetwork)
|
|
.value("MessageMaxLengthExceeded", APIEvent::Type::MessageMaxLengthExceeded)
|
|
.value("ValueNotYetPresent", APIEvent::Type::ValueNotYetPresent)
|
|
.value("Timeout", APIEvent::Type::Timeout)
|
|
.value("WiVINotSupported", APIEvent::Type::WiVINotSupported)
|
|
.value("RestrictedEntryFlag", APIEvent::Type::RestrictedEntryFlag)
|
|
.value("NotSupported", APIEvent::Type::NotSupported)
|
|
.value("PollingMessageOverflow", APIEvent::Type::PollingMessageOverflow)
|
|
.value("NoSerialNumber", APIEvent::Type::NoSerialNumber)
|
|
.value("IncorrectSerialNumber", APIEvent::Type::IncorrectSerialNumber)
|
|
.value("SettingsReadError", APIEvent::Type::SettingsReadError)
|
|
.value("SettingsVersionError", APIEvent::Type::SettingsVersionError)
|
|
.value("SettingsLengthError", APIEvent::Type::SettingsLengthError)
|
|
.value("SettingsChecksumError", APIEvent::Type::SettingsChecksumError)
|
|
.value("SettingsNotAvailable", APIEvent::Type::SettingsNotAvailable)
|
|
.value("SettingsReadOnly", APIEvent::Type::SettingsReadOnly)
|
|
.value("CANSettingsNotAvailable", APIEvent::Type::CANSettingsNotAvailable)
|
|
.value("CANFDSettingsNotAvailable", APIEvent::Type::CANFDSettingsNotAvailable)
|
|
.value("LSFTCANSettingsNotAvailable", APIEvent::Type::LSFTCANSettingsNotAvailable)
|
|
.value("SWCANSettingsNotAvailable", APIEvent::Type::SWCANSettingsNotAvailable)
|
|
.value("BaudrateNotFound", APIEvent::Type::BaudrateNotFound)
|
|
.value("UnexpectedNetworkType", APIEvent::Type::UnexpectedNetworkType)
|
|
.value("DeviceFirmwareOutOfDate", APIEvent::Type::DeviceFirmwareOutOfDate)
|
|
.value("SettingsStructureMismatch", APIEvent::Type::SettingsStructureMismatch)
|
|
.value("SettingsStructureTruncated", APIEvent::Type::SettingsStructureTruncated)
|
|
.value("NoDeviceResponse", APIEvent::Type::NoDeviceResponse)
|
|
.value("MessageFormattingError", APIEvent::Type::MessageFormattingError)
|
|
.value("CANFDNotSupported", APIEvent::Type::CANFDNotSupported)
|
|
.value("RTRNotSupported", APIEvent::Type::RTRNotSupported)
|
|
.value("DeviceDisconnected", APIEvent::Type::DeviceDisconnected)
|
|
.value("OnlineNotSupported", APIEvent::Type::OnlineNotSupported)
|
|
.value("TerminationNotSupportedDevice", APIEvent::Type::TerminationNotSupportedDevice)
|
|
.value("TerminationNotSupportedNetwork", APIEvent::Type::TerminationNotSupportedNetwork)
|
|
.value("AnotherInTerminationGroupEnabled", APIEvent::Type::AnotherInTerminationGroupEnabled)
|
|
.value("NoSerialNumberFW", APIEvent::Type::NoSerialNumberFW)
|
|
.value("NoSerialNumber12V", APIEvent::Type::NoSerialNumber12V)
|
|
.value("NoSerialNumberFW12V", APIEvent::Type::NoSerialNumberFW12V)
|
|
.value("EthPhyRegisterControlNotAvailable", APIEvent::Type::EthPhyRegisterControlNotAvailable)
|
|
.value("DiskNotSupported", APIEvent::Type::DiskNotSupported)
|
|
.value("EOFReached", APIEvent::Type::EOFReached)
|
|
.value("SettingsDefaultsUsed", APIEvent::Type::SettingsDefaultsUsed)
|
|
.value("AtomicOperationRetried", APIEvent::Type::AtomicOperationRetried)
|
|
.value("AtomicOperationCompletedNonatomically", APIEvent::Type::AtomicOperationCompletedNonatomically)
|
|
.value("WiVIStackRefreshFailed", APIEvent::Type::WiVIStackRefreshFailed)
|
|
.value("WiVIUploadStackOverflow", APIEvent::Type::WiVIUploadStackOverflow)
|
|
.value("I2CMessageExceedsMaxLength", APIEvent::Type::I2CMessageExceedsMaxLength)
|
|
.value("A2BMessageIncompleteFrame", APIEvent::Type::A2BMessageIncompleteFrame)
|
|
.value("CoreminiUploadVersionMismatch", APIEvent::Type::CoreminiUploadVersionMismatch)
|
|
.value("DiskNotConnected", APIEvent::Type::DiskNotConnected)
|
|
.value("UnexpectedResponse", APIEvent::Type::UnexpectedResponse)
|
|
.value("LiveDataInvalidHandle", APIEvent::Type::LiveDataInvalidHandle)
|
|
.value("LiveDataInvalidCommand", APIEvent::Type::LiveDataInvalidCommand)
|
|
.value("LiveDataInvalidArgument", APIEvent::Type::LiveDataInvalidArgument)
|
|
.value("LiveDataVersionMismatch", APIEvent::Type::LiveDataVersionMismatch)
|
|
.value("LiveDataNoDeviceResponse", APIEvent::Type::LiveDataNoDeviceResponse)
|
|
.value("LiveDataMaxSignalsReached", APIEvent::Type::LiveDataMaxSignalsReached)
|
|
.value("LiveDataCommandFailed", APIEvent::Type::LiveDataCommandFailed)
|
|
.value("LiveDataEncoderError", APIEvent::Type::LiveDataEncoderError)
|
|
.value("LiveDataDecoderError", APIEvent::Type::LiveDataDecoderError)
|
|
.value("LiveDataNotSupported", APIEvent::Type::LiveDataNotSupported)
|
|
.value("LINSettingsNotAvailable", APIEvent::Type::LINSettingsNotAvailable)
|
|
.value("ModeNotFound", APIEvent::Type::ModeNotFound)
|
|
.value("AppErrorParsingFailed", APIEvent::Type::AppErrorParsingFailed)
|
|
.value("FailedToRead", APIEvent::Type::FailedToRead)
|
|
.value("FailedToWrite", APIEvent::Type::FailedToWrite)
|
|
.value("DriverFailedToOpen", APIEvent::Type::DriverFailedToOpen)
|
|
.value("DriverFailedToClose", APIEvent::Type::DriverFailedToClose)
|
|
.value("PacketChecksumError", APIEvent::Type::PacketChecksumError)
|
|
.value("TransmitBufferFull", APIEvent::Type::TransmitBufferFull)
|
|
.value("DeviceInUse", APIEvent::Type::DeviceInUse)
|
|
.value("PCAPCouldNotStart", APIEvent::Type::PCAPCouldNotStart)
|
|
.value("PCAPCouldNotFindDevices", APIEvent::Type::PCAPCouldNotFindDevices)
|
|
.value("PacketDecodingError", APIEvent::Type::PacketDecodingError)
|
|
.value("SocketFailedToOpen", APIEvent::Type::SocketFailedToOpen)
|
|
.value("FailedToBind", APIEvent::Type::FailedToBind)
|
|
.value("ErrorSettingSocketOption", APIEvent::Type::ErrorSettingSocketOption)
|
|
.value("GetIfAddrsError", APIEvent::Type::GetIfAddrsError)
|
|
.value("SendToError", APIEvent::Type::SendToError)
|
|
.value("MDIOMessageExceedsMaxLength", APIEvent::Type::MDIOMessageExceedsMaxLength)
|
|
.value("FTOK", APIEvent::Type::FTOK)
|
|
.value("FTInvalidHandle", APIEvent::Type::FTInvalidHandle)
|
|
.value("FTDeviceNotFound", APIEvent::Type::FTDeviceNotFound)
|
|
.value("FTDeviceNotOpened", APIEvent::Type::FTDeviceNotOpened)
|
|
.value("FTIOError", APIEvent::Type::FTIOError)
|
|
.value("FTInsufficientResources", APIEvent::Type::FTInsufficientResources)
|
|
.value("FTInvalidParameter", APIEvent::Type::FTInvalidParameter)
|
|
.value("FTInvalidBaudRate", APIEvent::Type::FTInvalidBaudRate)
|
|
.value("FTDeviceNotOpenedForErase", APIEvent::Type::FTDeviceNotOpenedForErase)
|
|
.value("FTDeviceNotOpenedForWrite", APIEvent::Type::FTDeviceNotOpenedForWrite)
|
|
.value("FTFailedToWriteDevice", APIEvent::Type::FTFailedToWriteDevice)
|
|
.value("FTEEPROMReadFailed", APIEvent::Type::FTEEPROMReadFailed)
|
|
.value("FTEEPROMWriteFailed", APIEvent::Type::FTEEPROMWriteFailed)
|
|
.value("FTEEPROMEraseFailed", APIEvent::Type::FTEEPROMEraseFailed)
|
|
.value("FTEEPROMNotPresent", APIEvent::Type::FTEEPROMNotPresent)
|
|
.value("FTEEPROMNotProgrammed", APIEvent::Type::FTEEPROMNotProgrammed)
|
|
.value("FTInvalidArgs", APIEvent::Type::FTInvalidArgs)
|
|
.value("FTNotSupported", APIEvent::Type::FTNotSupported)
|
|
.value("FTNoMoreItems", APIEvent::Type::FTNoMoreItems)
|
|
.value("FTTimeout", APIEvent::Type::FTTimeout)
|
|
.value("FTOperationAborted", APIEvent::Type::FTOperationAborted)
|
|
.value("FTReservedPipe", APIEvent::Type::FTReservedPipe)
|
|
.value("FTInvalidControlRequestDirection", APIEvent::Type::FTInvalidControlRequestDirection)
|
|
.value("FTInvalidControlRequestType", APIEvent::Type::FTInvalidControlRequestType)
|
|
.value("FTIOPending", APIEvent::Type::FTIOPending)
|
|
.value("FTIOIncomplete", APIEvent::Type::FTIOIncomplete)
|
|
.value("FTHandleEOF", APIEvent::Type::FTHandleEOF)
|
|
.value("FTBusy", APIEvent::Type::FTBusy)
|
|
.value("FTNoSystemResources", APIEvent::Type::FTNoSystemResources)
|
|
.value("FTDeviceListNotReady", APIEvent::Type::FTDeviceListNotReady)
|
|
.value("FTDeviceNotConnected", APIEvent::Type::FTDeviceNotConnected)
|
|
.value("FTIncorrectDevicePath", APIEvent::Type::FTIncorrectDevicePath)
|
|
.value("FTOtherError", APIEvent::Type::FTOtherError)
|
|
.value("VSABufferCorrupted", APIEvent::Type::VSABufferCorrupted)
|
|
.value("VSATimestampNotFound", APIEvent::Type::VSATimestampNotFound)
|
|
.value("VSABufferFormatError", APIEvent::Type::VSABufferFormatError)
|
|
.value("VSAMaxReadAttemptsReached", APIEvent::Type::VSAMaxReadAttemptsReached)
|
|
.value("VSAByteParseFailure", APIEvent::Type::VSAByteParseFailure)
|
|
.value("VSAExtendedMessageError", APIEvent::Type::VSAExtendedMessageError)
|
|
.value("VSAOtherError", APIEvent::Type::VSAOtherError)
|
|
.value("NoErrorFound", APIEvent::Type::NoErrorFound)
|
|
.value("TooManyEvents", APIEvent::Type::TooManyEvents)
|
|
.value("Unknown", APIEvent::Type::Unknown)
|
|
.value("FixedPointOverflow", APIEvent::Type::FixedPointOverflow)
|
|
.value("FixedPointPrecision", APIEvent::Type::FixedPointPrecision);
|
|
|
|
pybind11::enum_<APIEvent::Severity>(apiEvent, "Severity")
|
|
.value("Any", APIEvent::Severity::Any)
|
|
.value("EventInfo", APIEvent::Severity::EventInfo)
|
|
.value("EventWarning", APIEvent::Severity::EventWarning)
|
|
.value("Error", APIEvent::Severity::Error);
|
|
|
|
apiEvent
|
|
.def("get_type", &APIEvent::getType)
|
|
.def("get_severity", &APIEvent::getSeverity)
|
|
.def("get_description", &APIEvent::getDescription)
|
|
.def("describe", &APIEvent::describe)
|
|
.def("__repr__", &APIEvent::describe);
|
|
|
|
pybind11::class_<EventFilter, std::shared_ptr<EventFilter>>(m, "EventFilter")
|
|
.def(pybind11::init())
|
|
.def(pybind11::init<APIEvent::Type>())
|
|
.def(pybind11::init<APIEvent::Severity>())
|
|
.def_readwrite("type", &EventFilter::type)
|
|
.def_readwrite("severity", &EventFilter::severity)
|
|
.def_readwrite("serial", &EventFilter::serial);
|
|
}
|
|
|
|
} // namespace icsneo
|
|
|