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.

68 lines
1.5 KiB
C++

#pragma once
#include <string>
#include <vector>
#include <map>
#include <list>
#include "data/Data.h"
/*
* 结构类型数据
*GearMode
*
*/
// 扭矩参数
class GearModeParam
{
public:
GearModeParam(unsigned char level, unsigned int value) : m_level(level), m_value(value) {};
virtual ~GearModeParam() {};
unsigned char getLevel() { return m_level; }
unsigned int getValue() { return m_value; }
private:
const unsigned char m_level;
const unsigned int m_value;
};
typedef struct
{
std::list<GearModeParam> datas;
}GearModeParam_t;
class GearModeStructData : public Data
{
public:
GearModeStructData();
GearModeStructData(GearModeParam_t *data);
virtual ~GearModeStructData();
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;
GearModeParam_t* getData() { return m_data; }
void setData(GearModeParam_t* data);
void copyData(GearModeParam_t* data);
// void setType(int type) { m_type = type; }
// int getType() { return m_type; }
private:
const int m_prefixLength;
GearModeParam_t* m_data;
};