//! 从站模块
//!
//! 包含从站核心操作和各种协议支持。

/// 从站核心 (SDO/SoE/FoE/EoE/AoE/VoE 操作)
pub mod core;

/// CoE 对象字典树遍历
pub mod coe;

/// CoE EMCY 紧急消息历史
pub mod coe_emcy;

/// SoE 完整实现 (类型化读写、命令执行、IDN映射、通知)
pub mod soe;

/// EoE 完整实现 (IP/MAC/DNS配置、帧收发、Ping)
pub mod eoe;

/// FoE 文件传输实例 (上传/下载、进度回调)
pub mod foe;

/// AoE 完整实现 (ADS 读写/通知/订阅管理器)
pub mod aoe;

/// VoE 实例 (厂商特定帧收发/构建/解析)
pub mod voe;

/// FSoE 高级功能 (CRC16, 多连接管理器, MDP 封装)
pub mod fsoe;

/// DC 同步配置
pub mod dc;

/// PDO 变化检测监控器
pub mod pdo;

/// 从站 PDO 实例封装 (类型化读写)
pub mod slave_pdo;

/// CiA 401 I/O 模块协议
pub mod cia401;

/// CiA 402 驱动器协议 (状态机/使能/模式切换)
pub mod cia402;

/// MDP 模块发现
pub mod mdp;

/// ESI 文件加载器
pub mod esi;

/// 启动参数管理
pub mod startup;

/// 网络拓扑管理
pub mod topology;

/// 从站诊断 (ESC端口错误, DC诊断)
pub mod slave_stats;

// 重新导出核心类型
pub use self::core::{Slave, SlaveDetailedInfo};
pub use coe::{
    EcDataType, ObjAccess, ObjectEntry, OdObject, OdList, CaObjectEntry,
    parse_complete_access_data,
    CoEInstance, CoeError, DiagMeta,
};
pub use coe_emcy::{emcy_get_history, emcy_clear_history, emcy_get_count};
pub use soe::{
    SoEInstance, SoEParameter, SoEAttributes, SoEDataType,
    ServoMappingEntry, ServoMappingInfo, SoENotificationEventArgs,
    SoENotificationEvent, SoEEmergencyEvent,
    SoENotificationCallback, SoEEmergencyCallback,
};
pub use eoe::{
    EoEInstance, EoEPingResult,
    eoe_ping, internet_checksum,
    foe_estimate_packet_count,
};
pub use foe::{FoEInstance, FoEBusyEvent, FoEBusyCallback};
pub use aoe::{AoEInstance, AoeTransMode, AoeSubscription, AoeSubscriptionManager};
pub use voe::{VoEInstance, VoEResponse};
pub use fsoe::{
    FsoeCrc16, SafetyManager, SafeMdp, FsoeConnectionInfo,
    validate_conn_id, is_connection_id_available,
};
pub use dc::{SlaveDC, MasterDC};
pub use pdo::{
    WatchPoint, PdoChange, PdoMonitor, PdoManager,
    read_le_u16, read_le_u32, read_le_i16, read_le_i32,
    PdoDataItem, PdoArrayInstance,
    get_input_data_pointer, get_output_data_pointer,
    read_input_data_direct, write_output_data_direct,
};
pub use slave_pdo::SlavePdo;
pub use cia401::{CiA401, CiA401ErrorMode};
pub use cia402::{
    PdoMapEntry, Cia402PdoMap, CiA402Instance, StateCiA402, ModeCiA402,
    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,
    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 mdp::{
    MdpModule, MdpModuleClass, MdpModuleProfile, MdpModulePdoInfo,
    mdp_discover, mdp_discover_safety, mdp_is_mdp_device,
    read_configured_address_list, read_detected_address_list,
    read_module_profile_list, is_module_config_consistent,
    auto_configure_from_detected_modules, get_module_pdo_layout,
};
pub use esi::{EsiLoader, EsiStartupParam, extract_startup_parameters, load_esi_file, load_and_apply_startup};
pub use startup::{StartupParameter, StartupParameterList};
pub use topology::SlaveTopology;
pub use slave_stats::{EscPortErrors, SlaveDCDiagnostics, SlaveDiagnostics};
