Commit 050dae32 authored by Yann Garcia's avatar Yann Garcia
Browse files

Update ProvChgUuUniSubscription & V2xMsgSubscription subscription/Notification, predictedQosPost

parent a627bcbc
Loading
Loading
Loading
Loading
+35 −4
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ type SbiCfg struct {
	PostgisPort    string
	Locality       []string
	ScenarioNameCb func(string)
	V2xNotify      func(v2xMessage []byte, v2xType int32, longitude *float32, latitude *float32)
	V2xNotify      func(v2xMessage []byte, v2xType int32, msgProtocolVersion int32, stdOrganization string, longitude *float32, latitude *float32)
	CleanUpCb      func()
}

@@ -72,7 +72,7 @@ type VisSbi struct {
	activeModel              *mod.Model
	trafficMgr               *tm.TrafficMgr
	updateScenarioNameCB     func(string)
	v2xNotify                func(v2xMessage []byte, v2xType int32, longitude *float32, latitude *float32)
	v2xNotify                func(v2xMessage []byte, v2xType int32, msgProtocolVersion int32, stdOrganization string, longitude *float32, latitude *float32)
	cleanUpCB                func()
	mutex                    sync.Mutex
	predictionModelSupported bool
@@ -361,10 +361,12 @@ func processActiveScenarioUpdate() {

func initializeV2xMessageDistribution() (err error) {
	poaNameList := sbi.activeModel.GetNodeNames(mod.NodeTypePoa4G, mod.NodeTypePoa5G)
	log.Info("+++ poaNameList: ", poaNameList)
	var validPoaNameList []string
	var ecgi_s []string
	for _, poaName := range poaNameList {
		node := sbi.activeModel.GetNode(poaName)
		log.Info("+++ Processing node: ", node)
		if node != nil {
			nl := node.(*dataModel.NetworkLocation)
			if nl.GeoData != nil {
@@ -374,11 +376,15 @@ func initializeV2xMessageDistribution() (err error) {
				mcc := ""
				cellId := ""
				ecgi := ""
				zone := ""
				switch nl.Type_ {
				case mod.NodeTypePoa4G, mod.NodeTypePoa5G:
					poaParent := sbi.activeModel.GetNodeParent(poaName)
					log.Info("+++ poaParent: ", poaParent)
					if zone, ok := poaParent.(*dataModel.Zone); ok {
						log.Info("+++ zone: ", zone)
						zoneParent := sbi.activeModel.GetNodeParent(zone.Name)
						log.Info("+++ zoneParent: ", zoneParent)
						if domain, ok := zoneParent.(*dataModel.Domain); ok {
							if domain.CellularDomainConfig != nil {
								mnc = domain.CellularDomainConfig.Mnc
@@ -398,6 +404,7 @@ func initializeV2xMessageDistribution() (err error) {
					log.Info("=================> cellId: ", cellId)
					log.Info("=================> mnc: ", mnc)
					log.Info("=================> mcc: ", mcc)
					log.Info("=================> mcc: ", zone)
					// Calculate Ecgi
					cellId_num, err := strconv.Atoi(cellId)
					if err != nil {
@@ -442,7 +449,7 @@ func initializeV2xMessageDistribution() (err error) {
		}
	} // End of 'for' statement
	log.Info("initializeV2xMessageDistribution: ecgi_s= ", ecgi_s)
	err = sbi.trafficMgr.InitializeV2xMessageDistribution(validPoaNameList, ecgi_s)
	err = sbi.trafficMgr.InitializeV2xMessageDistribution(sbi.poaList, validPoaNameList, ecgi_s)
	if err != nil {
		log.Error(err.Error())
		return err
@@ -482,9 +489,9 @@ func GetPredictedPowerValues(hour int32, inRsrp int32, inRsrq int32, poaName str
}

func GetInfoUuUnicast(params []string, num_item int) (proInfoUuUnicast UuUnicastProvisioningInfoProInfoUuUnicast_list, err error) {
	proInfoUuUnicast = nil
	resp, err := sbi.trafficMgr.GetInfoUuUnicast(params, num_item)
	log.Info("GetInfoUuUnicast: resp= ", resp)
	proInfoUuUnicast = nil
	if err != nil {
		log.Error(err.Error())
	} else {
@@ -542,6 +549,30 @@ func GetInfoUuUnicast(params []string, num_item int) (proInfoUuUnicast UuUnicast
			}
		} // End of 'for' statement
	}
	// } else if params[0] == "latitude" {
	// 	// var geocoordinatesList gisClient.GeoCoordinateList
	// 	// geocoordinatesList.GeoCoordinates = geocoordinates
	// 	// powerResp, _, err := gisAppClient.GeospatialDataApi.GetGeoDataPowerValues(context.TODO(), geocoordinatesList)
	// 	// log.Info("GetInfoUuUnicast: powerResp= ", powerResp)
	// 	// if err != nil {
	// 	// 	err = errors.New("GetInfoUuUnicast: GetGeoDataPowerValues failed")
	// 	// 	log.Error(err.Error())
	// 	// 	return proInfoUuUnicast, err
	// 	// }
	// 	proInfoUuUnicast = make([]UuUnicastProvisioningInfoProInfoUuUnicast, len(resp))
	// 	proInfoUuUnicast[0].LocationInfo = new(LocationInfo)
	// 	proInfoUuUnicast[0].LocationInfo.Ecgi = nil
	// 	proInfoUuUnicast[0].LocationInfo.GeoArea = nil
	// 	proInfoUuUnicast[0].NeighbourCellInfo = nil
	// 	err = errors.New("GetInfoUuUnicast: Location not supported yet")
	// 	log.Error(err.Error())
	// 	return proInfoUuUnicast, err
	// } else {
	// 	err = errors.New("GetInfoUuUnicast: Invalid parameter: " + params[0])
	// 	log.Error(err.Error())
	// 	return proInfoUuUnicast, err
	// }

	log.Info("GetInfoUuUnicast: proInfoUuUnicast= ", proInfoUuUnicast)
	return proInfoUuUnicast, err
}