
pub mod master;

pub mod slave;

pub mod data;

pub mod statics;

pub mod utils;

pub mod logging;

pub mod abstractions;

pub mod sugar;

pub use abstractions::{MailboxStatus, MailboxStatistics, MailboxProtocol, MailboxError, MailboxResult};

pub use data::error::{
    CiA402Mode, CiA402State, DarraError, EcState, FoEErrorCode,
    LinkState, RedundancyState, SoEErrorCode, SyncWindowStatus, Result,
    WcContribution,
};
pub use data::structures::{
    constants, PdoStats, PdoMappingEntry, CommunicationStatsLocal,
    SlaveInfo, RealtimeStats, FoEOptionsLocal, EcGroupConfigHelper,
};
pub use data::types::*;

pub use utils::ffi::{
    EmcyRecord, TopologyNode, SlaveIdentity, EsmTimeouts,
    FoEOptions, CommunicationStats, RedundancyStatus,
    WatchdogConfig, WatchdogStatus,
    MasterIdentity, MasterDiagData,
    AOENotificationCallback,
    FsoeState, FsoeError, FsoeConfig, FsoeStatus, SafeMdpConfig,
};
pub use master::core::{EtherCATMaster, IomapGuard, BuildResult, MasterBuilder};
pub use slave::core::Slave;

#[cfg(feature = "async-tokio")]
pub use master::async_isolation::{CancelToken, ProgressFn};

pub use utils::ffi::{
    TIMING_AFTER, TIMING_BEFORE,
    TRANS_IP, TRANS_OS, TRANS_PI, TRANS_PS, TRANS_SO, TRANS_SP,
};

pub use utils::ffi::{
    LogCallback, CrashNotifyCallback, ProcessDataCyclicCallback,
    SlaveStateChangeCallback, EmergencyEventCallback, SlaveDiscoveryCallback,
    RedundancyModeChangedCallback,
    PDOFrameLossCallback, SlavePreOpReconfigCallback,
    FoEProgressCallback, DCSyncLostCallback,
};

pub use master::{
    MasterEvents, SlaveEvents, SlaveIdentityMismatch,
    EmergencyMessage, EmcyRecorder,
    MasterDiagnosticsInfo, MasterPDODiagnostics, BreakPointInfo, PDOFrameLossStats,
    WdkRtCounters, WdkFrameStats, get_wdk_rt_counters, get_wdk_frame_stats,
    get_wdk_jitter_hist_bin, get_wdk_diag_counter,
    MasterConfig, save_master_settings, load_master_settings,
    MasterObjectDictionary,
    MailboxGatewayService, MailboxGateway, MbgNativeStats,
    RedundancyManager, RedundancyInfo,
    HotConnect, HotConnectGroup, HotConnectStatus, HotPlugIdentityMismatch,
    MasterOdEtg1510,

    AlStatusClass, esm_is_legal_transition, esm_legal_transitions, esm_default_timeout_ms,
    esm_is_known_al_status_code, esm_classify_al_status_code, esm_master_class,
};

pub use slave::{
    EcDataType, ObjAccess, ObjectEntry, OdObject, OdList,
    SoEInstance, SoEParameter, SoEAttributes, SoEDataType,
    EoEInstance, EoEPingResult, eoe_ping,
    FoEInstance,
    AoEInstance, AoeTransMode, AoeSubscription, AoeSubscriptionManager,
    VoEInstance, VoEResponse,
    FsoeCrc16, SafetyManager, SafeMdp, FsoeConnectionInfo,
    SlaveDC,
    PdoMonitor,
    SlavePdo,
    CiA401, CiA401ErrorMode,
    CiA402Instance, StateCiA402, ModeCiA402,
    PdoMapEntry, Cia402PdoMap,
    Cia402ReadStatus, Cia402ReadResult, Cia402Readable,
    MdpModule, MdpModuleClass, MdpModuleProfile,
    EsiLoader, EsiStartupParam, extract_startup_parameters,
    StartupParameter, StartupParameterList,
    SlaveTopology,
};

pub use slave::cia402::{
    OD_CONTROLWORD, OD_STATUSWORD, OD_MODES_OF_OPERATION, OD_MODES_OF_OPERATION_DISPLAY,
    OD_TARGET_POSITION, OD_POSITION_ACTUAL, OD_TARGET_VELOCITY, OD_VELOCITY_ACTUAL,
    OD_TARGET_TORQUE, OD_TORQUE_ACTUAL, OD_PROFILE_VELOCITY, OD_PROFILE_ACCELERATION,
    OD_PROFILE_DECELERATION, OD_QUICK_STOP_DECELERATION, OD_HOMING_METHOD, OD_HOMING_SPEEDS,
    OD_HOME_OFFSET, OD_SUPPORTED_DRIVE_MODES, OD_DIGITAL_INPUTS, OD_DIGITAL_OUTPUTS,
    OD_ERROR_CODE, OD_DRIVE_DATA,
    CW_SHUTDOWN, CW_SWITCH_ON, CW_ENABLE_OPERATION, CW_DISABLE_VOLTAGE,
    CW_QUICK_STOP, CW_FAULT_RESET, CW_HALT,
    SW_FAULT, SW_TARGET_REACHED, SW_WARNING, SW_REMOTE,
};

pub use statics::{
    ScannedSlaveInfo, NetworkInfo, get_scanned_slaves, get_network_adapters,
    DllVersion, dll_version,
    LicenseStatus, Authorization,
};

pub use statics::network::{EnumeratedNetworkInfo, enumerate_network_info};

pub use utils::{
    BaseData, EcValue, type_size, convert_from_bytes, convert_to_bytes, default_value,
    ExpectedSlaveConfig, ActualSlaveInfo, SlaveVerifyDetail,
    VerificationResult, verify_configuration,
};

pub use utils::kernel_guard;
pub use utils::kernel_guard::{DarraKernelStatus, DarraKernelNotAvailableError};

pub use utils::esi::{
    EsiPhysicsPortType, EsiRevisionCheckStrategy,
    EsiBootstrapInfo, EsiCoEDetails, EsiDcOpMode, EsiDcConfiguration,
    EsiEepromConfiguration, EsiElectricalInfo, EsiIdentification, EsiMailboxTimeout,
    EsiPdoEntry, EsiPdoInfo, EsiPdoConfiguration, EsiPhysicsPort, EsiPhysicsInfo,
    EsiPortInfo, EsiStartupSdo, EsiStatistics, EsiSyncManagerInfo, EsiDeviceInfo,
    calculate_eeprom_crc, validate_eeprom_crc, match_revision,
};

pub use logging::{LogManager, LogCategory, LogEntry, LogView, LogUpdatedCallback};
