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

package oam

import (
	"fmt"
	"ipsomc/module/ps/psmodel"
	"ipsomc/public"
)

type OamReport struct {
}

const (
	ORDER_REPORT_UDP_HEART = 0x0201 //udp心跳
)

// 设备上报参数
// dataModel:基站基本参数模型
// wCommand:监控命令
// dataList:数据队列
// wLen:队列长度
func (obj *OamReport) OamReportCmd(stHeadModel *psmodel.PS_HEAD_T, wCommand uint16, dataList []byte, wLen uint16) error {
	switch wCommand {
	case ORDER_REPORT_UDP_HEART:
		var modeHeart public.HeartMapValue
		heartIdStr := fmt.Sprintf("%08X", stHeadModel.StVpHead.ProjectID) + "-" + fmt.Sprintf("%08X", stHeadModel.StVpHead.DeviceID)
		_, exist := public.Gpub_mapHeart[heartIdStr]
		if !exist {
			modeHeart.ProjectID = stHeadModel.StVpHead.ProjectID
			modeHeart.BtsID = stHeadModel.StVpHead.DeviceID

			public.Gpub_mutex.Lock()
			public.Gpub_mapHeart[heartIdStr] = modeHeart //在线
			public.Gpub_mutex.Unlock()
		}
	default:
		break
	}

	return nil
}
