// 监控对象
// 秒寻科技
// zt 2024-09-17

package oam

import (
	"encoding/binary"
	"ipsomc/module/bparam/bparammodel"
	"ipsomc/util"
)

type OamInstall struct {
}

const (
	ORDER_INSTALL_BUILD_ID            = 0x0400
	ORDER_INSTALL_LAYER_ID            = 0x0401
	ORDER_INSTALL_LAYER_BLOCK_ID      = 0x0402
	ORDER_INSTALL_LAYER_BLOCK_DESC    = 0x0403
	ORDER_INSTALL_LAYER_LOCATION_TYPE = 0x0404 //定位类型
	ORDER_INSTALL_LAYER_POSITION      = 0x0405
	ORDER_INSTALL_LAYER_COORD_X       = 0x0406
	ORDER_INSTALL_LAYER_COORD_Y       = 0x0407
	ORDER_INSTALL_LAYER_COORD_Z       = 0x0408
)

// 安装参数查询响应
// dataModel:基站基本参数模型
// wCommand:监控命令
// dataList:数据队列
// wLen:队列长度
func (obj *OamInstall) OamInstallQueryResp(dataModel *bparammodel.BtsBaseParam, wCommand uint16, dataList []byte, wLen uint16) error {
	strTmp := ""
	switch wCommand {
	case ORDER_INSTALL_BUILD_ID:
		dataModel.BuildID = uint16(dataList[0])
	case ORDER_INSTALL_LAYER_ID:
		dataModel.LayerID = int16(binary.LittleEndian.Uint16(dataList[0:wLen]))
	case ORDER_INSTALL_LAYER_BLOCK_ID:
		dataModel.BlockID = uint16(dataList[0])
	case ORDER_INSTALL_LAYER_BLOCK_DESC:
		utf8Str, _ := util.CharTransGbToUtf8(dataList)
		strTmp = string(utf8Str)
		strTmp = util.RemoveNullChars(strTmp)
		dataModel.BlockDesc = strTmp
	case ORDER_INSTALL_LAYER_LOCATION_TYPE:
		dataModel.LocationType = uint8(dataList[0])
	case ORDER_INSTALL_LAYER_POSITION:
		utf8Str, _ := util.CharTransGbToUtf8(dataList)
		strTmp = string(utf8Str)
		strTmp = util.RemoveNullChars(strTmp)
		dataModel.Position = strTmp
	case ORDER_INSTALL_LAYER_COORD_X:
		dataModel.CoordX = int32(binary.LittleEndian.Uint32(dataList[0:wLen]))
	case ORDER_INSTALL_LAYER_COORD_Y:
		dataModel.CoordY = int32(binary.LittleEndian.Uint32(dataList[0:wLen]))
	case ORDER_INSTALL_LAYER_COORD_Z:
		dataModel.CoordZ = int32(binary.LittleEndian.Uint32(dataList[0:wLen]))
	default:
		break
	}

	return nil
}
