//! 工具模块
//!
//! 包含 FFI 绑定、数据类型处理、启动验证、代码保护和辅助工具。

/// 原始 C FFI 绑定 (内部实现, 不进入公开文档)
#[doc(hidden)]
pub mod ffi;

/// EtherCAT 数据类型处理 (类型安全读写)
pub mod base_data;

/// 启动配置验证器
pub mod startup_verifier;

/// VMProtect SDK 集成 (代码保护, 不进入公开文档)
#[doc(hidden)]
pub mod protection;

/// ESI 工具函数 (端口类型、版本检查策略、十六进制解析)
pub mod esi;

/// 辅助工具函数 (字节数组转字符串)
pub mod help;

/// DLL 版本信息工具 (缓存、校验码)
pub mod version_info;

/// XML 配置文件解析工具
pub mod xml;

/// 内核驱动可用性门控 (对齐 C# `KernelGuard`, ordinals D_1629/D_1630/D_1631)
pub mod kernel_guard;

// 重新导出核心类型
pub use ffi::{
    EmcyRecord, TopologyNode, SlaveIdentity, EsmTimeouts,
    FoEOptions, CommunicationStats, RedundancyStatus,
    WatchdogConfig, WatchdogStatus,
    MasterIdentity, MasterDiagData,
    AOENotificationCallback,
    FsoeState, FsoeError, FsoeConfig, FsoeStatus, SafeMdpConfig,
    TIMING_AFTER, TIMING_BEFORE,
    TRANS_IP, TRANS_OS, TRANS_PI, TRANS_PS, TRANS_SO, TRANS_SP,
    LogCallback, CrashNotifyCallback, ProcessDataCyclicCallback,
    SlaveStateChangeCallback, EmergencyEventCallback, SlaveDiscoveryCallback,
    InputDataChangedCallback, RedundancyModeChangedCallback,
    PDOFrameLossCallback, SlavePreOpReconfigCallback,
    SlaveIdentityMismatchCallback, SlavePortLinkChangedCallback,
    FoEProgressCallback, DCSyncLostCallback,
};
pub use base_data::{BaseData, EcValue, type_size, convert_from_bytes, convert_to_bytes, default_value};
pub use startup_verifier::{
    ExpectedSlaveConfig, ActualSlaveInfo, SlaveVerifyDetail,
    VerificationResult, verify_configuration,
};
pub use 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 help::{convert_byte_array_to_string, convert_fixed_name_to_string, decode_ethercat_string, bytes_to_hex_display, ip_to_string};
pub use version_info::{DllVersionInfoCached, get_dll_version_info, version_number, build_date};
pub use xml::{
    parse_uint_hex_or_dec, parse_u16_hex_or_dec, parse_u8_hex_or_dec, parse_i32_hex_or_dec,
    bytes_to_hex_string, hex_string_to_bytes,
    QosConfiguration, StartupSdoConfig, MasterXmlConfiguration,
    GroupConfigData, SlaveDcConfig, XmlConfigurationResult,
    SyncManagerConfig, PdoEntryConfig, SlaveXmlConfiguration,
    // save_xml_configuration 已删除 (DENI 导出是 Darra 内部功能, 不对外暴露)
    load_xml_configuration, apply_xml_configuration,
};
pub use kernel_guard::{DarraKernelStatus, DarraKernelNotAvailableError};
