LAPTOP-SNT8I5JK\Boounion
2025-02-15 f8971cfc3abcc23fd2a5541a7bf698389d5e9300
SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.h
@@ -4,14 +4,14 @@
#include "PerformanceMelsec.h"
enum class CCLinkIEControlMode : short {
    UNKNOWN = 0x0194,               // 未知
    ONLINE = 0x0000,                // 在线
    OFFLINE = 0x0002,               // 离线
    INTER_STATION_TEST = 0x0005,    // 站间测试
    LINE_TEST = 0x0006,             // 线路测试
    LOOPBACK_TEST = 0x0007,         // 自回送测试
    HW_TEST = 0x0009,               // H/W测试
    BUS_IF_TEST = 0x000E            // 总线I/F测试
    UNKNOWN = 0x0194,               // δ֪
    ONLINE = 0x0000,                // 在线
    OFFLINE = 0x0002,               // 离线
    INTER_STATION_TEST = 0x0005,    // 站间测试
    LINE_TEST = 0x0006,             // 线路测试
    LOOPBACK_TEST = 0x0007,         // 自回送测试
    HW_TEST = 0x0009,               // H/W测试
    BUS_IF_TEST = 0x000E            // 总线I/F测试
};
class CCCLinkIEControl final : public CPerformanceMelsec {
@@ -20,16 +20,16 @@
    ~CCCLinkIEControl() override;
    struct LedStatus {
        bool bExtPw; // 外部电源状态 (b15)
        bool bRd;    // 数据接收状态 (b6)
        bool bDLnk;  // 数据链接状态 (b5)
        bool bPrm;   // 管理功能状态 (b4)
        bool bErr;   // 错误状态 (b3)
        bool bSd;    // 数据发送状态 (b2)
        bool bMode;  // 动作模式 (b1)
        bool bRun;   // 运行状态 (b0)
        bool bExtPw; // 外部电源状态 (b15)
        bool bRd;    // 数据接收状态 (b6)
        bool bDLnk;  // 数据链接状态 (b5)
        bool bPrm;   // 管理功能状态 (b4)
        bool bErr;   // 错误状态 (b3)
        bool bSd;    // 数据发送状态 (b2)
        bool bMode;  // 动作模式 (b1)
        bool bRun;   // 运行状态 (b0)
        // 转换为字符串,用于调试
        // 转换为字符串,用于调试
        std::string ToString() const {
            std::ostringstream oss;
            oss << "CC-Link IE Control Network LED Status: {"
@@ -46,19 +46,21 @@
        }
    };
    // 读取目标站点CPU类型
    // 读取目标站点CPU类型
    // short ReadCPUCodeEx(const StationIdentifier& station, short& nCPUCode);
    // 板模式获取/设置
    // 板模式获取/设置
    int SetBoardModeEx(CCLinkIEControlMode mode);
    CCLinkIEControlMode GetBoardModeEx();
    // 获取板状态
    // 获取板状态
    int GetBoardStatusEx(BoardStatus& status);
    // 读取LED状态
    // 读取LED状态
    int ReadLedStatus(LedStatus& outLedStatus);
    int ReadData2(const StationIdentifier& station, short devType, short devNo, short size, void* pData);
private:
    static CCLinkIEControlMode ConvertToCCLinkIEControlMode(short nMode);
    static int ValidateBoardStatus(const BoardStatus& status);