You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.4 KiB
C++
67 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
#include <list>
|
|
#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<SensorModeParam> 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;
|
|
|
|
};
|
|
|