#pragma once #include #include #include #include #include "data/Data.h" /* * 结构类型数据 *SensorMode * */ // 扭矩参数 class SensorModeParam { public: SensorModeParam(std::string name, int value) : m_name(name), m_value(value) {}; virtual ~SensorModeParam() {}; std::string getName() { return m_name; } int getValue() { return m_value; } private: const std::string m_name; const int m_value; }; typedef struct { std::list datas; }SensorModeParam_t; class SensorModeStructData : public Data { public: SensorModeStructData(); SensorModeStructData(SensorModeParam_t *data); virtual ~SensorModeStructData() {}; Data* clone() override; void copy(Data* data) override; void copy(Data& data) override; int length() override; // 转换为字符串格式 virtual std::string toStr() override; // 转换为Byte字符串 virtual std::string toByteStr() override; // 转换为十六进制字符串 virtual std::string toHexStr() override; // 根据Byte字符串解析数据 virtual bool fromByteStr(std::string str = "") override; SensorModeParam_t& getData() { return m_data; } void setData(SensorModeParam_t& data); // void setType(int type) { m_type = type; } // int getType() { return m_type; } private: const int m_prefixLength; SensorModeParam_t m_data; };