73 lines
4.4 KiB
Python
73 lines
4.4 KiB
Python
|
|
import struct
|
|||
|
|
from datetime import datetime
|
|||
|
|
|
|||
|
|
class LocalInspectionMonitor:
|
|||
|
|
def __init__(self):
|
|||
|
|
self.hello = "地检状态监控报文解析工具类"
|
|||
|
|
|
|||
|
|
|
|||
|
|
def get_local_inspection_status_data(self, demod_data):
|
|||
|
|
"""解析地检状态监控数据"""
|
|||
|
|
# 格式字符串:>表示大端序,B表示Uint8,H表示Uint16,I表示Uint32
|
|||
|
|
format_str = '>B B I I B B B I I I B I I B B B B B B B B I B B I B H B B B I B B B B B I B B B I B B B I B B B I B I B I' # 总共82字节
|
|||
|
|
|
|||
|
|
# 解包数据
|
|||
|
|
fields = struct.unpack(format_str, demod_data[:102])
|
|||
|
|
|
|||
|
|
# 创建结果字典
|
|||
|
|
res = {}
|
|||
|
|
res['cpu0_usage'] = fields[0] # CPU0占用率
|
|||
|
|
res['cpu1_usage'] = fields[1] # CPU1占用率
|
|||
|
|
res['program_version'] = fields[2] # 地检/终端程序版本号
|
|||
|
|
res['uptime'] = fields[3] # 开机后运行时间
|
|||
|
|
res['gps_status'] = fields[4] # GPS状态
|
|||
|
|
res['pps_lock_status'] = fields[5] # 内部PPS锁定状态
|
|||
|
|
res['ad9361_status'] = fields[6] # AD9361状态
|
|||
|
|
res['ad9361_calibration_factor'] = fields[7] # AD9361频率校准因子
|
|||
|
|
res['ad9361_tx_lo_freq'] = fields[8] # AD9361发射本振频率
|
|||
|
|
res['ad9361_tx_sample_rate'] = fields[9] # AD9361发射采样率
|
|||
|
|
res['ad9361_tx_attenuation'] = fields[10] # AD9361发射衰减
|
|||
|
|
res['ad9361_rx_lo_freq'] = fields[11] # AD9361接收本振频率
|
|||
|
|
res['ad9361_rx_sample_rate'] = fields[12] # AD9361接收采样率
|
|||
|
|
res['ad9361_rx_gain'] = fields[13] # AD9361接收增益
|
|||
|
|
res['vdes_protocol_enable'] = fields[14] # VDES协议工作使能
|
|||
|
|
res['vdes_filter_enable'] = fields[15] # VDES报文过滤使能
|
|||
|
|
res['rac_limit_enable'] = fields[16] # 随机信道消息接入限制使能
|
|||
|
|
res['vdes_agc_enable'] = fields[17] # VDES接收AGC使能
|
|||
|
|
res['delay_compensation_enable'] = fields[18] # 星地延时补偿使能
|
|||
|
|
res['upper_satellite_id'] = fields[19] # 上半频段卫星ID
|
|||
|
|
res['upper_satellite_cqi'] = fields[20] # 上半频段卫星CQI
|
|||
|
|
res['upper_satellite_amplitude'] = fields[21] # 上半频段卫星信号平均幅度
|
|||
|
|
res['lower_satellite_id'] = fields[22] # 下半频段卫星ID
|
|||
|
|
res['lower_satellite_cqi'] = fields[23] # 下半频段卫星CQI
|
|||
|
|
res['lower_satellite_amplitude'] = fields[24] # 下半频段卫星信号平均幅度
|
|||
|
|
res['current_satellite_id'] = fields[25] # 当前选用的卫星ID
|
|||
|
|
res['current_vdes_slot'] = fields[26] # 当前VDES时隙号
|
|||
|
|
res['current_vdes_subframe'] = fields[27] # 当前VDES子帧编号
|
|||
|
|
res['vdes_tx_linkid'] = fields[28] # VDES发射LinKID
|
|||
|
|
res['vdes_tx_channel'] = fields[29] # VDES发射通道
|
|||
|
|
res['vdes_tx_frequency'] = fields[30] # VDES发射频点
|
|||
|
|
res['vdes_buffer1_status'] = fields[31] # VDES上行数据缓存区1状态
|
|||
|
|
res['vdes_buffer2_status'] = fields[32] # VDES上行数据缓存区2状态
|
|||
|
|
res['demod1_enable'] = fields[33] # VDES解调器1使能
|
|||
|
|
res['demod1_linkid'] = fields[34] # VDES解调器1接收LINKID
|
|||
|
|
res['demod1_channel'] = fields[35] # VDES解调器1接收信道
|
|||
|
|
res['demod1_frequency'] = fields[36] # VDES解调器1接收频点
|
|||
|
|
res['demod2_enable'] = fields[37] # VDES解调器2使能
|
|||
|
|
res['demod2_linkid'] = fields[38] # VDES解调器2接收LINKID
|
|||
|
|
res['demod2_channel'] = fields[39] # VDES解调器2接收信道
|
|||
|
|
res['demod2_frequency'] = fields[40] # VDES解调器2接收频点
|
|||
|
|
res['demod3_enable'] = fields[41] # VDES解调器3使能
|
|||
|
|
res['demod3_linkid'] = fields[42] # VDES解调器3接收LINKID
|
|||
|
|
res['demod3_channel'] = fields[43] # VDES解调器3接收信道
|
|||
|
|
res['demod3_frequency'] = fields[44] # VDES解调器3接收频点
|
|||
|
|
res['demod4_enable'] = fields[45] # VDES解调器4使能
|
|||
|
|
res['demod4_linkid'] = fields[46] # VDES解调器4接收LINKID
|
|||
|
|
res['demod4_channel'] = fields[47] # VDES解调器4接收信道
|
|||
|
|
res['demod4_frequency'] = fields[48] # VDES解调器4接收频点
|
|||
|
|
res['ais_demod1_enable'] = fields[49] # AIS解调器1使能
|
|||
|
|
res['ais_demod1_frequency'] = fields[50] # AIS解调器1频点
|
|||
|
|
res['ais_demod2_enable'] = fields[51] # AIS解调器2使能
|
|||
|
|
res['ais_demod2_frequency'] = fields[52] # AIS解调器2频点
|
|||
|
|
|
|||
|
|
return res
|