SmartOS/Config.h

37 lines
808 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __Config_H__
#define __Config_H__
#include "Sys.h"
#include "Stream.h"
// 必须设定为1字节对齐否则offsetof会得到错误的位置
#pragma pack(push) // 保存对齐状态
// 强制结构体紧凑分配空间
#pragma pack(1)
// 配置信息
class TConfig
{
public:
ushort Length; // 数据长度
byte HardVer; // 硬件版本
byte SoftVer; // 软件版本
ushort Type; // 类型
byte Address; // 分配得到的设备地址
byte Server; // 网关ID
byte Channel; // 通道
byte Speed; // 传输速度
ByteArray ServerKey; // 服务端组网密码退网时使用。一般6字节
// 初始化各字段为0
void Init();
void LoadDefault();
};
#pragma pack(pop) // 恢复对齐状态
extern TConfig Config;
#endif