176 lines
3.8 KiB
C
176 lines
3.8 KiB
C
#ifndef DATA_CONFIG_H
|
||
#define DATA_CONFIG_H
|
||
#include <QString>
|
||
#include <QPushButton>
|
||
#include <QLabel>
|
||
#include <QList>
|
||
|
||
typedef unsigned char uint8_t;
|
||
typedef unsigned short uint16_t;
|
||
|
||
extern QString g_strServerIp; // 服务端IP
|
||
|
||
#define CHANNLE_COUNT 4
|
||
typedef struct {
|
||
int slot;
|
||
QString slot_type;
|
||
QString chan_display;
|
||
QString rack_type;
|
||
QPushButton *slot_btn;
|
||
QLabel *slot_label;
|
||
} SlotConfig;
|
||
|
||
enum CMTCommand {
|
||
kEigenvalueCmd = 1,
|
||
kExceptionInfo = 2,
|
||
kUpgradeCard = 3,
|
||
kGetVersionInfo = 4,
|
||
kRelaySetting = 5,
|
||
kRelayStatus = 6,
|
||
kUpgradeProgress = 7
|
||
};
|
||
|
||
// 振动板通道类型
|
||
typedef enum {
|
||
kVibRadial = 0, // 径向位移
|
||
kVibAcc = 1, // 加速度
|
||
kVibVelocity = 2 // 速度
|
||
} VibChannelType;
|
||
|
||
// 振动板采样率
|
||
typedef enum {
|
||
kVibSR16K = 0, // 16k
|
||
kVibSR32K = 1, // 32k
|
||
kVibSR64k = 2, // 64k
|
||
kVibSR128K = 3, // 128k
|
||
} VibSamplingRate;
|
||
|
||
// 振动板机架类型
|
||
typedef enum {
|
||
kVibRackSingle = 0, // 单一
|
||
kVibRackTMR = 1 // 三冗余
|
||
} VibRackType;
|
||
|
||
typedef struct {
|
||
int id;
|
||
QString channel_name;
|
||
bool standby;
|
||
bool active;
|
||
int rack_type; // VibRackType
|
||
QString tmr_group;
|
||
int channel_type; // VibChannelType
|
||
QString transducer_name;
|
||
QString scale_factor;
|
||
int sampling_rate; // VibSamplingRate
|
||
float normal_voltage_low;
|
||
float normal_voltage_high;
|
||
} SeismicMonitor;
|
||
|
||
typedef struct {
|
||
QString type;
|
||
int low;
|
||
int high;
|
||
bool checked;
|
||
} Filter;
|
||
|
||
typedef struct {
|
||
QString type;
|
||
int full_sacle_range;
|
||
int bias_voltage;
|
||
float clamp_value;
|
||
int phase_lag;
|
||
bool checked;
|
||
float custom;
|
||
} Variables;
|
||
|
||
typedef struct {
|
||
int alert;
|
||
float danger;
|
||
bool active_100ms;
|
||
} Dealy;
|
||
typedef struct {
|
||
bool rms_active;
|
||
bool integrate_active;
|
||
bool alert_latching;
|
||
bool danger_latching;
|
||
bool timed_ok;
|
||
int recorder_output;
|
||
bool two_ma_clamp;
|
||
float trip_multiply;
|
||
QString comparision;
|
||
int comparision_percentage;
|
||
} Alert_Variables;
|
||
|
||
typedef struct {
|
||
int id;
|
||
bool active;
|
||
float normal_voltage_low;
|
||
float normal_voltage_high;
|
||
bool automatic_threshold;
|
||
float threshold;
|
||
float hysteresis;
|
||
int events_per_revolution;
|
||
QString record_output;
|
||
bool two_ma_clamp;
|
||
bool alert_latching;
|
||
bool overspeed_latching;
|
||
bool normal_latching;
|
||
int alert_response_time;
|
||
int danger_response_time;
|
||
} Tachometer_Variables;
|
||
|
||
typedef struct {
|
||
QString transducer_name;
|
||
double scale_factor;
|
||
} Transducer;
|
||
|
||
#pragma pack(1)
|
||
typedef struct {
|
||
uint8_t head[3]; // 固定值:0xAA55AA
|
||
uint8_t cmd; // 命令
|
||
int len; // 数据长度
|
||
uint8_t crc; // 数据 CRC 校验和
|
||
char data[0]; // 文件内容
|
||
} PackageHead;
|
||
|
||
typedef struct {
|
||
uint8_t card_id; // 0xff是本机,其它子卡是1~15
|
||
char data[0];
|
||
} UpgradeCardReq;
|
||
|
||
typedef struct {
|
||
uint8_t code; // 0: 上传成功
|
||
} UpgradeRsp;
|
||
|
||
typedef struct {
|
||
uint8_t card_id; // 0xff是本机,其它子卡是1~15
|
||
} GetVersionReq;
|
||
|
||
typedef struct {
|
||
uint8_t fpga; // fpga版本号
|
||
uint8_t sw; // 软件版本号
|
||
char fpga_data[9]; // fpga版本日期
|
||
} VersionRsp;
|
||
|
||
typedef struct {
|
||
uint8_t card_id; // 0xff是本机,其它子卡是1~15
|
||
uint8_t led_id; // ok 灯 0xff,rx/tx 灯 0xf1,板卡测试模式 0xee,板卡状态 0xe1,其他 1 ~ 16
|
||
uint8_t led_operate; // 0 OFF,1 ON,2 红色,3 绿色,4 红色1Hz闪烁,5 红色2Hz闪烁,6 绿色闪烁,7 测试状态,8 手动状态,9 工作状态
|
||
} RelaySettingReq;
|
||
|
||
typedef struct {
|
||
uint8_t code;
|
||
} RelaySettingRsp;
|
||
|
||
typedef struct {
|
||
uint8_t card_id; // 0xff是本机,其它子卡是1~15
|
||
} RelayStatusReq;
|
||
|
||
typedef struct {
|
||
uint8_t status; // 7 测试状态,8 手动状态,9 工作状态
|
||
} RelayStatusRsp;
|
||
|
||
#pragma pack()
|
||
|
||
#endif // DATA_CONFIG_H
|