#ifndef device_uhd_struct_h #define device_uhd_struct_h #include #include #include #define ZDSamSum 200000000 // 8路窄带采样率之和 #define ZDChMax 8 // 每路大通道下窄带通道总数 enum UHD_ParamType : int { CenterFreq = 0, BandWidth = 1, SampleFreq = 2, Gain = 3, PowerRef = 4, KDDCSwitch = 5, KFFTSwitch = 6, ZDDCSwitch = 7, ZDDCParam = 8, KFFTParam = 9, ClockSource = 10, SnapshotSwitch = 11, Snapshot_tm_s = 12, }; enum UHD_FFTWin : unsigned char { jxc = 0, // 矩形窗 = 0, hnc = 1, // 汉宁窗 = 1, hmc = 2, // 海明窗 = 2, blkmc = 3, // 布莱克曼窗 = 3, }; enum UHD_FFTLen : unsigned int { _1024 = 1024, _2048 = 2048, _4096 = 4096, _8192 = 8192, _16384 = 16384, _32768 = 32768, }; #pragma pack(push) #pragma pack(1) struct UHD_ZDParam { unsigned char KCH = 0; // 宽带通道号 unsigned short ZCH = 0; // 窄带通道号 long long CenterFreq = 0; // 中频 int BandWidth = 0; // 带宽 int SampleFreq = 0; // 采样率 int ExtraPer = 1024; // 抽取率 4-4096,2的指数 bool bSwitch_ZDDC = false; }; struct UHD_KDParam { unsigned char KCH = 0; // 宽带通道号 long long CenterFreq = 10000000; int BandWidth = 160000000; int SampleFreq = 200000000; bool bSwitch_6GCH = false; bool bSwitch_KDDC = false; bool bSwitch_KFFT = false; double gain = 0; UHD_ZDParam ZDParam[ZDChMax]; int ExtraPer; bool Snapshot_Switch = false; int Snapshot_tm_s = 0; unsigned long long old_sf; unsigned long long old_cf; unsigned long long old_bw; }; #pragma region 枚举/结构体 /** @brief TODO: 时码类型枚举 * @enum LibWZ57_Enum_TimeType */ enum Enum_TimeType : uint8_t { Enum_TimeType_Invlid = 0, /**< 无效的*/ Enum_TimeType_IRIG_B = 1, /**< IRIG-B*/ Enum_TimeType_RMC = 2, /**< RMC*/ Enum_TimeType_ABSCNTTM = 3, /**< 绝对计数时间*/ Enum_TimeType_REFCNTTM = 4, /**< 相对计数时间*/ }; typedef struct struct_DateTime { Enum_TimeType TimeType; /**< 10 时码类型*/ /** @brief 10个字节的时码信息 * @details * 根据 @ref LibWZ57_Enum_TimeType TimeType,对应不同的 联合体 */ union TimeInfo { ///@brief IRIG-B ///@struct IRIGB_Head struct IRIGB_Head { uint8_t Year; /**< 年 字节1*/ uint16_t Day; /**< 日 字节2*/ uint8_t Hour; /**< 时 字节1*/ uint8_t Minute; /**< 分 字节1*/ uint8_t Second; /**< 秒 字节1*/ uint32_t NanoSec; /**< 纳 字节4*/ } IRIGB_Head; ///@brief RMC ///@struct RMC_Head struct RMC_Head { uint8_t Year; /**< 年 字节1*/ uint8_t Month; /**< 月 字节1*/ uint8_t Day; /**< 日 字节1*/ uint8_t Hour; /**< 时 字节1*/ uint8_t Minute; /**< 分 字节1*/ uint8_t Second; /**< 秒 字节1*/ uint32_t NanoSec; /**< 纳 字节4*/ } RMC_Head; ///@brief 绝对计数时间 ///@struct ABSCNTTM_Head struct ABSCNTTM_Head { ///@brief 秒 字节6; 基准秒计数时间+相对秒计数时间 单位:秒 uint8_t Second[6]; ///@brief 纳秒 字节4; uint32_t NanoSec; } ABSCNTTM_Head; ///@brief 相对计数时间 ///@struct REFCNTTM_Head struct REFCNTTM_Head { ///@brief 秒 字节6; 相对秒计数时间单位:秒 uint8_t Second[6]; ///@brief 纳秒 字节4; uint32_t NanoSec; } REFCNTTM_Head; } TimeInfo; } struct_DataTime; #pragma region 枚举 /***************************** *数据类型 *****************************/ enum UHD_Enum_DataType : unsigned char { zd_ddc = 1, kd_ddc = 2, kd_fft = 3, GPS_Info = 16, // 窄带DDC = 0x01, // 宽带DDC = 0x02, // 宽带FFT = 0x03, }; #pragma endregion #pragma region 结构体 #pragma region UHD_Struct_KFFT UHD_Struct_KDDC UHD_Struct_ZDDC /// /// 宽带FFT头 /// typedef struct { /// /// 帧标识 6 0x2828F628F6F6 固定值 /// unsigned int Head; /// /// /// unsigned short Head2; /// /// 协议版本 1 0x80 /// unsigned char DealVersion; /// /// 帧头长度 1 64 /// unsigned char FrameHeadLen; /// /// 数据长度 2 2048 /// unsigned short DataLen; /// /// 有效数据长度 2 2048 /// unsigned short UsefullLen; /// /// 数据类型 1 /// UHD_Enum_DataType DataType; unsigned char Other1; /// /// 通道号 /// unsigned char Channel; unsigned char Other2; unsigned short ZDChannel; /// /// 帧计数 2 0 ~ 65535 循环递增 /// unsigned short FrameIndex; /// /// 帧起止标识 1 0x0 /// unsigned char FrameBeginFlag; struct_DateTime DateTm; /// /// 采样率 4 单位Hz /// unsigned int SampleFreq_Hz; /// /// 带宽 4 单位Hz /// unsigned int BandWidth_Hz; /// /// 中心频点 4 单位Hz,低位 /// unsigned int CenterFreq_Hz_Low; /// /// 中心频点 2 单位Hz,高位 /// unsigned short CenterFreq_Hz_High; union { unsigned char other5[18]; struct { unsigned char other4[6]; /// /// FFT长度 65536 /// int FFTPoint; unsigned char other5[2]; float other6; /// /// 段内帧号 /// unsigned short SubFrame; } FFT; } Param; // 数据 2048 共1024个数据,1个数据2字节。 } UHD_Struct_KFFT, UHD_Struct_KDDC, UHD_Struct_ZDDC; #pragma endregion #pragma endregion #pragma pack(pop) #pragma endregion #endif