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.
|
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <QByteArray>
|
|
|
|
|
|
|
|
|
|
#define DATA_TYPE_NULL 0 // 无实体数据
|
|
|
|
|
#define DATA_TYPE_DATETIME 1 // 日期时间
|
|
|
|
|
#define DATA_TYPE_INTEGER 2 // 整形数字
|
|
|
|
|
#define DATA_TYPE_STRING 3 // 字符串
|
|
|
|
|
#define DATA_TYPE_STRUCT 4 // 结构类型
|
|
|
|
|
#define DATA_TYPE_STRUCT_OF_TORQUE 5 // 结构类型 - 扭矩模式
|
|
|
|
|
#define DATA_TYPE_STRUCT_OF_BOLT 6 // 结构类型 - 螺栓模式
|
|
|
|
|
#define DATA_TYPE_STRUCT_OF_ANGLE 7 // 结构类型 - 角度模式
|
|
|
|
|
#define DATA_TYPE_STRUCT_OF_GEAR 8 // 结构类型 - 挡位预设
|
|
|
|
|
#define DATA_TYPE_STRUCT_OF_SENSOR 9 // 结构类型 - 传感器模式
|
|
|
|
|
#define DATA_TYPE_STRUCT_OF_FALLBACK 10 // 结构类型 - 回退参数
|
|
|
|
|
|
|
|
|
|
class Data
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual ~Data() = default;
|
|
|
|
|
|
|
|
|
|
virtual Data* clone() = 0;
|
|
|
|
|
virtual void copy(Data* data) = 0;
|
|
|
|
|
virtual void copy(Data& data) = 0;
|
|
|
|
|
virtual int length() = 0;
|
|
|
|
|
// 转换为字符串格式
|
|
|
|
|
virtual std::string toStr() = 0;
|
|
|
|
|
// 转换为Byte字符串
|
|
|
|
|
virtual std::string toByteStr() = 0;
|
|
|
|
|
// 转换为QByteArray
|
|
|
|
|
//virtual QByteArray toByteArray() = 0;
|
|
|
|
|
// 转换为十六进制字符串
|
|
|
|
|
virtual std::string toHexStr() = 0;
|
|
|
|
|
// 根据Byte字符串解析数据
|
|
|
|
|
virtual bool fromByteStr(std::string str = "") = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|