//同步参数查询响应
// 秒寻科技
// zt 2024-10-02

package oam

import (
	"ipsomc/module/bparam/bparammodel"
)

type OamSync struct {
}

const (
	ORDER_SYNC_FREQ_OFFSET  = 0x0502
	ORDER_SYNC_CENTER_FREQ  = 0x0501
	ORDER_SYNC_RX_SYNC_WORD = 0x0505
	ORDER_SYNC_RSSI         = 0x0504

	ORDER_SYNC_TX_FLAG        = 0x0506
	ORDER_SYNC_TX_CENTER_FREQ = 0x0507
	ORDER_SYNC_TX_SYNC_WORD   = 0x0508
	ORDER_SYNC_TX_POWER       = 0x0503
)

// 同步参数查询响应
// dataModel:基站基本参数模型
// wCommand:监控命令
// datalist:数据队列
// wLen:队列长度
func (obj *OamSync) OamSyncQueryResp(dataModel *bparammodel.BtsBaseParam, wCommand uint16, datalist []byte, wLen uint16) error {
	switch wCommand {
	case ORDER_SYNC_CENTER_FREQ: //接收中心频率
		dataModel.CenterFreq = uint8(datalist[0])
	case ORDER_SYNC_RX_SYNC_WORD: //接收同步字
		dataModel.RxSyncWordId = uint8(datalist[0])
	case ORDER_SYNC_RSSI: //接收电平
		dataModel.Rssi = int8(datalist[0])
	case ORDER_SYNC_TX_FLAG: //发射标识符
		dataModel.TxSwitch = uint8(datalist[0])
	case ORDER_SYNC_TX_CENTER_FREQ: //发射中心频率
		dataModel.TxCenterFreq = uint8(datalist[0])
	case ORDER_SYNC_TX_SYNC_WORD: //发射同步字
		dataModel.TxSyncWordId = uint8(datalist[0])
	case ORDER_SYNC_TX_POWER: //发送功率
		dataModel.TxPower = int8(datalist[0])
	default:
		break
	}

	return nil
}
