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

package oam

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

type OamNetwork struct {
}

const (
	ORDER_NETWORK_WIFI_NAME    = 0x0101 //wifi名称
	ORDER_NETWORK_WIFI_PWD     = 0x0102 //wifi密码
	ORDER_NETWORK_SERVICE_IP   = 0x0103 //服务器IP
	ORDER_NETWORK_SERVICE_PORT = 0x0104 //服务器端口
	ORDER_NETWORK_SWITCH       = 0x0105 //管理中心使能
)

// 设备参数查询响应
// dataModel:基站基本参数模型
// wCommand:监控命令
// dataList:数据队列
// wLen:队列长度
func (obj *OamNetwork) OamNetrowkQueryResp(dataModel *bparammodel.BtsBaseParam, wCommand uint16, dataList []byte, wLen uint16) error {
	strTmp := ""
	switch wCommand {
	case ORDER_NETWORK_WIFI_NAME:
		strTmp = string(dataList)
		strTmp = util.RemoveNullChars(strTmp)
		dataModel.WifiName = strTmp
	case ORDER_NETWORK_WIFI_PWD:
		strTmp = string(dataList)
		strTmp = util.RemoveNullChars(strTmp)
		dataModel.WifiPwd = strTmp
	case ORDER_NETWORK_SERVICE_IP:
		strTmp = string(dataList)
		strTmp = util.RemoveNullChars(strTmp)
		dataModel.ServiceIP = strTmp
	case ORDER_NETWORK_SERVICE_PORT:
		dataModel.ServicePort = int(binary.LittleEndian.Uint16(dataList[0:wLen]))
	case ORDER_NETWORK_SWITCH:
		dataModel.NetworkSwitch = dataList[0]
	default:
		break
	}

	return nil
}
