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.

51 lines
1.0 KiB
C++

#pragma once
#include <string>
#include <vector>
#include <map>
#include <list>
#include "data/Data.h"
/*
* 结构类型数据
*SensorMode
*
*/
typedef struct
{
unsigned short angle; // 角度
unsigned int ampere; // 电流
unsigned int ampere2;
}FallbackParam_t;
class FallbackStructData : public Data
{
public:
FallbackStructData();
FallbackStructData(FallbackParam_t *data);
virtual ~FallbackStructData() {};
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;
FallbackParam_t& getData() { return m_data; }
void setData(FallbackParam_t& data);
private:
FallbackParam_t m_data;
};