Commit 759f0d82 authored by Yann Garcia's avatar Yann Garcia
Browse files

Update PredictedQos; Add UuMbmsProvisioningInfo

parent 050dae32
Loading
Loading
Loading
Loading
+148 −5
Original line number Diff line number Diff line
@@ -86,21 +86,40 @@ type UuUnicastProvisioningInfoProInfoUuUnicast struct {
	V2xApplicationServer *V2xApplicationServer
}
type UuUnicastProvisioningInfoProInfoUuUnicast_list []UuUnicastProvisioningInfoProInfoUuUnicast
type UuMbmsProvisioningInfoProInfoUuMbms struct {
	LocationInfo      *LocationInfo
	NeighbourCellInfo []UuMbmsNeighbourCellInfo
	V2xServerUsd      *V2xServerUsd
}
type UuMbmsProvisioningInfoProInfoUuMbms_list []UuMbmsProvisioningInfoProInfoUuMbms
type LocationInfo struct {
	Ecgi    *Ecgi
	GeoArea *LocationInfoGeoArea
}
type UuUniNeighbourCellInfo struct {
	Ecgi    *Ecgi
	//FddInfo *FddInfo
	FddInfo *FddInfo
	Pci     int32
	Plmn    *Plmn
	TddInfo *TddInfo
}
type UuMbmsNeighbourCellInfo struct {
	Ecgi                    *Ecgi
	FddInfo                 *FddInfo
	MbmsServiceAreaIdentity []string `json:"mbmsServiceAreaIdentity"`
	Pci                     int32
	Plmn                    *Plmn
	//TddInfo *TddInfo
	TddInfo                 *TddInfo
}
type V2xApplicationServer struct {
	IpAddress string
	UdpPort   string
}
type V2xServerUsd struct {
	SdpInfo               *V2xServerUsdSdpInfo
	ServiceAreaIdentifier []string
	Tmgi                  *V2xServerUsdTmgi
}
type Ecgi struct {
	CellId *CellId
	Plmn   *Plmn
@@ -112,10 +131,30 @@ type Plmn struct {
	Mcc string
	Mnc string
}
type FddInfo struct {
	DlEarfcn                *int32
	DlTransmissionBandwidth *int32
	UlEarfcn                *int32
	UlTransmissionBandwidth *int32
}
type TddInfo struct {
	Earfcn                *int32
	SubframeAssignment    string
	TransmissionBandwidth *int32
}
type LocationInfoGeoArea struct {
	Latitude  float32
	Longitude float32
}
type V2xServerUsdSdpInfo struct {
	IpMulticastAddress string
	PortNumber         string
}
type V2xServerUsdTmgi struct {
	MbmsServiceId string
	Mcc           string
	Mnc           string
}

// Init - V2XI Service SBI initialization
func Init(cfg SbiCfg) (predictionModelSupported bool, err error) {
@@ -534,12 +573,14 @@ func GetInfoUuUnicast(params []string, num_item int) (proInfoUuUnicast UuUnicast
							proInfoUuUnicast[i].NeighbourCellInfo[j].Ecgi.Plmn.Mnc = resp[i].NeighbourCellInfo[j].Ecgi.Plmn.Mnc
						}
					}
					// FIXME FSCOM FddInfo
					proInfoUuUnicast[i].NeighbourCellInfo[j].Pci = resp[i].NeighbourCellInfo[j].Pci
					if resp[i].NeighbourCellInfo[j].Plmn != nil {
						proInfoUuUnicast[i].NeighbourCellInfo[j].Plmn = new(Plmn)
						proInfoUuUnicast[i].NeighbourCellInfo[j].Plmn.Mcc = resp[i].NeighbourCellInfo[j].Plmn.Mcc
						proInfoUuUnicast[i].NeighbourCellInfo[j].Plmn.Mnc = resp[i].NeighbourCellInfo[j].Plmn.Mnc
					}
					// FIXME FSCOM TddInfo
				} // End of 'for' statement
			}
			if resp[i].V2xApplicationServer != nil {
@@ -577,6 +618,108 @@ func GetInfoUuUnicast(params []string, num_item int) (proInfoUuUnicast UuUnicast
	return proInfoUuUnicast, err
}

func GetInfoUuMbmscast(params []string, num_item int) (proInfoUuMbmscast UuMbmsProvisioningInfoProInfoUuMbms_list, err error) {
	proInfoUuMbmscast = nil
	resp, err := sbi.trafficMgr.GetInfoUuMbmscast(params, num_item)
	log.Info("GetInfoUuMbmscast: resp= ", resp)
	if err != nil {
		log.Error(err.Error())
	} else {
		proInfoUuMbmscast = make([]UuMbmsProvisioningInfoProInfoUuMbms, len(resp))
		for i := range resp {
			if resp[i].LocationInfo != nil {
				proInfoUuMbmscast[i].LocationInfo = new(LocationInfo)
				if resp[i].LocationInfo.Ecgi != nil {
					proInfoUuMbmscast[i].LocationInfo.Ecgi = new(Ecgi)
					if resp[i].LocationInfo.Ecgi.CellId != nil {
						proInfoUuMbmscast[i].LocationInfo.Ecgi.CellId = new(CellId)
						proInfoUuMbmscast[i].LocationInfo.Ecgi.CellId.CellId = resp[i].LocationInfo.Ecgi.CellId.CellId
					}
					if resp[i].LocationInfo.Ecgi.Plmn != nil {
						proInfoUuMbmscast[i].LocationInfo.Ecgi.Plmn = new(Plmn)
						proInfoUuMbmscast[i].LocationInfo.Ecgi.Plmn.Mcc = resp[i].LocationInfo.Ecgi.Plmn.Mcc
						proInfoUuMbmscast[i].LocationInfo.Ecgi.Plmn.Mnc = resp[i].LocationInfo.Ecgi.Plmn.Mnc
					}
				}
				if resp[i].LocationInfo.GeoArea != nil {
					proInfoUuMbmscast[i].LocationInfo.GeoArea = new(LocationInfoGeoArea)
					proInfoUuMbmscast[i].LocationInfo.GeoArea.Latitude = resp[i].LocationInfo.GeoArea.Latitude
					proInfoUuMbmscast[i].LocationInfo.GeoArea.Longitude = resp[i].LocationInfo.GeoArea.Longitude
				}
			}

			if resp[i].NeighbourCellInfo != nil {
				proInfoUuMbmscast[i].NeighbourCellInfo = make([]UuMbmsNeighbourCellInfo, len(resp[i].NeighbourCellInfo))
				for j := range resp[i].NeighbourCellInfo {

					if resp[i].NeighbourCellInfo[j].Ecgi != nil {
						proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi = new(Ecgi)
						if resp[i].NeighbourCellInfo[j].Ecgi.CellId != nil {
							proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.CellId = new(CellId)
							proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.CellId.CellId = resp[i].NeighbourCellInfo[j].Ecgi.CellId.CellId
						}
						if resp[i].NeighbourCellInfo[j].Ecgi.Plmn != nil {
							proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.Plmn = new(Plmn)
							proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.Plmn.Mcc = resp[i].NeighbourCellInfo[j].Ecgi.Plmn.Mcc
							proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.Plmn.Mnc = resp[i].NeighbourCellInfo[j].Ecgi.Plmn.Mnc
						}
					}
					// FIXME FSCOM FddInfo
					proInfoUuMbmscast[i].NeighbourCellInfo[j].Pci = resp[i].NeighbourCellInfo[j].Pci
					proInfoUuMbmscast[i].NeighbourCellInfo[j].MbmsServiceAreaIdentity = resp[i].NeighbourCellInfo[j].MbmsServiceAreaIdentity
					if resp[i].NeighbourCellInfo[j].Plmn != nil {
						proInfoUuMbmscast[i].NeighbourCellInfo[j].Plmn = new(Plmn)
						proInfoUuMbmscast[i].NeighbourCellInfo[j].Plmn.Mcc = resp[i].NeighbourCellInfo[j].Plmn.Mcc
						proInfoUuMbmscast[i].NeighbourCellInfo[j].Plmn.Mnc = resp[i].NeighbourCellInfo[j].Plmn.Mnc
					}
					// FIXME FSCOM TddInfo
				} // End of 'for' statement
			}
			if resp[i].V2xServerUsd != nil {
				proInfoUuMbmscast[i].V2xServerUsd = new(V2xServerUsd)
				if proInfoUuMbmscast[i].V2xServerUsd.SdpInfo != nil {
					proInfoUuMbmscast[i].V2xServerUsd.SdpInfo = new(V2xServerUsdSdpInfo)
					proInfoUuMbmscast[i].V2xServerUsd.SdpInfo.IpMulticastAddress = resp[i].V2xServerUsd.SdpInfo.IpMulticastAddress
					proInfoUuMbmscast[i].V2xServerUsd.SdpInfo.PortNumber = resp[i].V2xServerUsd.SdpInfo.PortNumber
				}
				proInfoUuMbmscast[i].V2xServerUsd.ServiceAreaIdentifier = resp[i].V2xServerUsd.ServiceAreaIdentifier
				if proInfoUuMbmscast[i].V2xServerUsd.Tmgi != nil {
					proInfoUuMbmscast[i].V2xServerUsd.Tmgi = new(V2xServerUsdTmgi)
					proInfoUuMbmscast[i].V2xServerUsd.Tmgi.MbmsServiceId = resp[i].V2xServerUsd.Tmgi.MbmsServiceId
					proInfoUuMbmscast[i].V2xServerUsd.Tmgi.Mcc = resp[i].V2xServerUsd.Tmgi.Mcc
					proInfoUuMbmscast[i].V2xServerUsd.Tmgi.Mnc = resp[i].V2xServerUsd.Tmgi.Mnc
				}
			}
		} // 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("GetInfoUuMbmscast: powerResp= ", powerResp)
	// 	// if err != nil {
	// 	// 	err = errors.New("GetInfoUuMbmscast: GetGeoDataPowerValues failed")
	// 	// 	log.Error(err.Error())
	// 	// 	return proInfoUuMbmscast, err
	// 	// }
	// 	proInfoUuMbmscast = make([]UuMbmsProvisioningInfoProInfoUuMbms, len(resp))
	// 	proInfoUuMbmscast[0].LocationInfo = new(LocationInfo)
	// 	proInfoUuMbmscast[0].LocationInfo.Ecgi = nil
	// 	proInfoUuMbmscast[0].LocationInfo.GeoArea = nil
	// 	proInfoUuMbmscast[0].NeighbourCellInfo = nil
	// 	err = errors.New("GetInfoUuMbmscast: Location not supported yet")
	// 	log.Error(err.Error())
	// 	return proInfoUuMbmscast, err
	// } else {
	// 	err = errors.New("GetInfoUuMbmscast: Invalid parameter: " + params[0])
	// 	log.Error(err.Error())
	// 	return proInfoUuMbmscast, err
	// }

	log.Info("GetInfoUuMbmscast: proInfoUuMbmscast= ", proInfoUuMbmscast)
	return proInfoUuMbmscast, err
}

func PublishMessageOnMessageBroker(msgContent string, msgEncodeFormat string, stdOrganization string, msgType *int32) (err error) {
	return sbi.trafficMgr.PublishMessageOnMessageBroker(msgContent, msgEncodeFormat, stdOrganization, msgType)
}
+2 −6
Original line number Diff line number Diff line
@@ -22,15 +22,11 @@ func PredictedQosPOST(w http.ResponseWriter, r *http.Request) {
}

func ProvInfoGET(w http.ResponseWriter, r *http.Request) {
	// TODO
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	w.WriteHeader(http.StatusOK)
	provInfoPc5GET(w, r)
}

func ProvInfoUuMbmsGET(w http.ResponseWriter, r *http.Request) {
	// TODO
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	w.WriteHeader(http.StatusOK)
	provInfoUuMbmsGET(w, r)
}

func ProvInfoUuUnicastGET(w http.ResponseWriter, r *http.Request) {
+203 −20
Original line number Diff line number Diff line
@@ -694,7 +694,7 @@ func predictedQosPost(w http.ResponseWriter, r *http.Request) {
		return
	}

	if requestData.Routes == nil || len(requestData.Routes) == 0 {
	if len(requestData.Routes) == 0 {
		log.Error("Mandatory routes parameter is either empty or not present")
		errHandlerProblemDetails(w, "Mandatory attribute routes is either empty or not present in the request.", http.StatusBadRequest)
		return
@@ -808,16 +808,15 @@ func errHandlerProblemDetails(w http.ResponseWriter, error string, code int) {
	fmt.Fprint(w, jsonResponse)
}

// V2xMsgPublicationPOST is to create at V2xMsgPublication /publish_v2x_message endpoint
func v2xMsgPublicationPOST(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> V2xMsgPublicationPOST: ", r)

	log.Info("V2xMsgPublicationPOST: ", r)
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")

	var v2xMsgPubReq V2xMsgPublication
	// Read JSON input stream provided in the Request, and stores it in the bodyBytes as bytes
	bodyBytes, _ := ioutil.ReadAll(r.Body)
	// Unmarshal function to converts a JSON-formatted string into a V2xMsgPublication struct and store it in v2xMsgPubReq
	var v2xMsgPubReq V2xMsgPublication
	err := json.Unmarshal(bodyBytes, &v2xMsgPubReq)
	if err != nil {
		log.Error(err.Error())
@@ -859,10 +858,7 @@ func v2xMsgPublicationPOST(w http.ResponseWriter, r *http.Request) {

	if len(v2xMsgSubscriptionMap) != 0 { // There are some subscription ongoing, we can publish it
		// Publish message on message broker
		//var msgType *int32 = new(int32)
		//*msgType = int32(msgPropertiesValues.MsgType)

		err = sbi.PublishMessageOnMessageBroker(v2xMsgPubReq.MsgContent, "base64", msgPropertiesValues.StdOrganization, &msgType)
		err = sbi.PublishMessageOnMessageBroker(v2xMsgPubReq.MsgContent, v2xMsgPubReq.MsgRepresentationFormat, msgPropertiesValues.StdOrganization, &msgType)
		if err != nil {
			w.WriteHeader(http.StatusInternalServerError)
		}
@@ -875,9 +871,8 @@ func v2xMsgPublicationPOST(w http.ResponseWriter, r *http.Request) {
}

func v2xMsgDistributionServerPost(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> v2xMsgDistributionServerPost: ", r)

	log.Info("v2xMsgDistributionServerPost: ", r)
	// TODO
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	w.WriteHeader(http.StatusOK)
}
@@ -1307,12 +1302,10 @@ func registerV2xMsgSubscription(v2xMsgSubscription *V2xMsgSubscription, subId st
	log.Info("registerV2xMsgSubscription: After subscriptionExpiryMap: ", subscriptionExpiryMap)
	log.Info("New registration: ", subsId, " type: ", V2X_MSG)

	if len(subscriptionExpiryMap) == 1 { // Start V2X message broker server
	log.Info("deregisterV2xMsgSubscription: len(v2xMsgSubscriptionMap): ", len(v2xMsgSubscriptionMap))
	if len(v2xMsgSubscriptionMap) == 1 { // Start V2X message broker server
		log.Info("registerV2xMsgSubscription: StartV2xMessageBrokerServer")
		_ = sbi.StartV2xMessageBrokerServer()
	} else if len(subscriptionExpiryMap) == 0 { // Stop V2X message broker server
		log.Info("registerV2xMsgSubscription: StopV2xMessageBrokerServer")
		sbi.StopV2xMessageBrokerServer()
	}
}

@@ -1920,12 +1913,7 @@ func deregisterV2xMsgSubscription(subsIdStr string, mutexTaken bool) {
	log.Info("deregisterV2xMsgSubscription: ", subsId, " type: ", V2X_MSG)

	log.Info("deregisterV2xMsgSubscription: len(v2xMsgSubscriptionMap): ", len(v2xMsgSubscriptionMap))
	if len(v2xMsgSubscriptionMap) == 0 {
		sbi.StopV2xMessageBrokerServer()
	}

	if len(subscriptionExpiryMap) == 0 { // Stop V2X message broker server
		log.Info("deregisterV2xMsgSubscription: StopV2xMessageBrokerServer")
	if len(v2xMsgSubscriptionMap) == 0 { // Stop V2X message broker server
		sbi.StopV2xMessageBrokerServer()
	}
}
@@ -2216,6 +2204,201 @@ func provInfoUuUnicastGET(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, string(jsonResponse))
}

func provInfoUuMbmsGET(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> provInfoUuMbmsGET", r)

	w.Header().Set("Content-Type", "application/json; charset=UTF-8")

	// Retrieve query parameters
	u, _ := url.Parse(r.URL.String())
	log.Info("url: ", u.RequestURI())
	q := u.Query()
	log.Info("infoUuMbmscastGET: q= ", q)
	validQueryParams := []string{"location_info"}
	if !validateQueryParams(q, validQueryParams) {
		w.WriteHeader(http.StatusBadRequest)
		return
	}

	// Get & validate query param values
	location_info := q.Get("location_info")
	log.Info("infoUuMbmscastGET: location_info= ", location_info)
	// Extract parameters
	params := strings.Split(location_info, ",")
	log.Info("infoUuMbmscastGET: args= ", params)

	if !validateQueryParamValue(params[0], []string{"ecgi", "latitude"}) {
		w.WriteHeader(http.StatusBadRequest)
		return
	}
	// Extract list of items
	var i int
	for i = 1; i < len(params); i += 1 {
		if validateQueryParamValue(params[i], []string{"longitude"}) {
			break
		}
	} // End of 'for' statement
	i -= 1
	log.Info("infoUuMbmscastGET: i= ", i)
	log.Info("infoUuMbmscastGET: (len(params)-2)/2= ", (len(params)-2)/2)
	if i < 1 || ((params[0] == "latitude") && (i != (len(params)-2)/2)) {
		w.WriteHeader(http.StatusBadRequest)
		return
	}

	// Process the request
	log.Info("infoUuMbmscastGET: Process the request")
	resp, err := sbi.GetInfoUuMbmscast(params, i)
	if err != nil {
		log.Error(err.Error())
		errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError)
		return
	}

	proInfoUuMbmscast := make([]UuMbmsProvisioningInfoProInfoUuMbms, len(resp))
	for i := range resp {
		if resp[i].LocationInfo != nil {
			proInfoUuMbmscast[i].LocationInfo = new(LocationInfo)
			if resp[i].LocationInfo.Ecgi != nil {
				proInfoUuMbmscast[i].LocationInfo.Ecgi = new(Ecgi)
				if resp[i].LocationInfo.Ecgi.CellId != nil {
					proInfoUuMbmscast[i].LocationInfo.Ecgi.CellId = new(CellId)
					proInfoUuMbmscast[i].LocationInfo.Ecgi.CellId.CellId = resp[i].LocationInfo.Ecgi.CellId.CellId
				}
				if resp[i].LocationInfo.Ecgi.Plmn != nil {
					proInfoUuMbmscast[i].LocationInfo.Ecgi.Plmn = new(Plmn)
					proInfoUuMbmscast[i].LocationInfo.Ecgi.Plmn.Mcc = resp[i].LocationInfo.Ecgi.Plmn.Mcc
					proInfoUuMbmscast[i].LocationInfo.Ecgi.Plmn.Mnc = resp[i].LocationInfo.Ecgi.Plmn.Mnc
				}
			}
			if resp[i].LocationInfo.GeoArea != nil {
				proInfoUuMbmscast[i].LocationInfo.GeoArea = new(LocationInfoGeoArea)
				proInfoUuMbmscast[i].LocationInfo.GeoArea.Latitude = resp[i].LocationInfo.GeoArea.Latitude
				proInfoUuMbmscast[i].LocationInfo.GeoArea.Longitude = resp[i].LocationInfo.GeoArea.Longitude
			}
		}

		if resp[i].NeighbourCellInfo != nil {
			proInfoUuMbmscast[i].NeighbourCellInfo = make([]UuMbmsNeighbourCellInfo, len(resp[i].NeighbourCellInfo))
			for j := range resp[i].NeighbourCellInfo {

				if resp[i].NeighbourCellInfo[j].Ecgi != nil {
					proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi = new(Ecgi)
					if resp[i].NeighbourCellInfo[j].Ecgi.CellId != nil {
						proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.CellId = new(CellId)
						proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.CellId.CellId = resp[i].NeighbourCellInfo[j].Ecgi.CellId.CellId
					}
					if resp[i].NeighbourCellInfo[j].Ecgi.Plmn != nil {
						proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.Plmn = new(Plmn)
						proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.Plmn.Mcc = resp[i].NeighbourCellInfo[j].Ecgi.Plmn.Mcc
						proInfoUuMbmscast[i].NeighbourCellInfo[j].Ecgi.Plmn.Mnc = resp[i].NeighbourCellInfo[j].Ecgi.Plmn.Mnc
					}
				}
				proInfoUuMbmscast[i].NeighbourCellInfo[j].FddInfo = nil // FIXME Not supported yet
				proInfoUuMbmscast[i].NeighbourCellInfo[j].Pci = resp[i].NeighbourCellInfo[j].Pci
				if resp[i].NeighbourCellInfo[j].Plmn != nil {
					proInfoUuMbmscast[i].NeighbourCellInfo[j].Plmn = new(Plmn)
					proInfoUuMbmscast[i].NeighbourCellInfo[j].Plmn.Mcc = resp[i].NeighbourCellInfo[j].Plmn.Mcc
					proInfoUuMbmscast[i].NeighbourCellInfo[j].Plmn.Mnc = resp[i].NeighbourCellInfo[j].Plmn.Mnc
				}
				proInfoUuMbmscast[i].NeighbourCellInfo[j].TddInfo = nil // FIXME Not supported yet
			} // End of 'for' statement
		}
		if resp[i].V2xServerUsd != nil {
			proInfoUuMbmscast[i].V2xServerUsd = new(V2xServerUsd)
			if proInfoUuMbmscast[i].V2xServerUsd.SdpInfo != nil {
				proInfoUuMbmscast[i].V2xServerUsd.SdpInfo = new(V2xServerUsdSdpInfo)
				proInfoUuMbmscast[i].V2xServerUsd.SdpInfo.IpMulticastAddress = resp[i].V2xServerUsd.SdpInfo.IpMulticastAddress
				proInfoUuMbmscast[i].V2xServerUsd.SdpInfo.PortNumber = resp[i].V2xServerUsd.SdpInfo.PortNumber
			}
			proInfoUuMbmscast[i].V2xServerUsd.ServiceAreaIdentifier = resp[i].V2xServerUsd.ServiceAreaIdentifier
			if proInfoUuMbmscast[i].V2xServerUsd.Tmgi != nil {
				proInfoUuMbmscast[i].V2xServerUsd.Tmgi = new(V2xServerUsdTmgi)
				proInfoUuMbmscast[i].V2xServerUsd.Tmgi.MbmsServiceId = resp[i].V2xServerUsd.Tmgi.MbmsServiceId
				proInfoUuMbmscast[i].V2xServerUsd.Tmgi.Mcc = resp[i].V2xServerUsd.Tmgi.Mcc
				proInfoUuMbmscast[i].V2xServerUsd.Tmgi.Mnc = resp[i].V2xServerUsd.Tmgi.Mnc
			}
		}
	} // End of 'for' statement
	uuMbmsProvisioningInfo := UuMbmsProvisioningInfo{
		ProInfoUuMbms: proInfoUuMbmscast,
		TimeStamp: &TimeStamp{
			Seconds: int32(time.Now().Unix()),
		},
	}
	log.Info("infoUuMbmscastGET: uuUnicastProvisioningInfo: ", uuMbmsProvisioningInfo)

	// Send response
	jsonResponse, err := json.Marshal(uuMbmsProvisioningInfo)
	if err != nil {
		log.Error(err.Error())
		errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError)
		return
	}
	log.Info("infoUuMbmscastGET: Response: ", string(jsonResponse))
	w.WriteHeader(http.StatusOK)
	fmt.Fprint(w, string(jsonResponse))
}

func provInfoPc5GET(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> provInfoPc5GET", r)

	w.Header().Set("Content-Type", "application/json; charset=UTF-8")

	// Retrieve query parameters
	u, _ := url.Parse(r.URL.String())
	log.Info("url: ", u.RequestURI())
	q := u.Query()
	log.Info("infoUuMbmscastGET: q= ", q)
	validQueryParams := []string{"location_info"}
	if !validateQueryParams(q, validQueryParams) {
		w.WriteHeader(http.StatusBadRequest)
		return
	}

	// Get & validate query param values
	location_info := q.Get("location_info")
	log.Info("provInfoPc5GET: location_info= ", location_info)
	// Extract parameters
	params := strings.Split(location_info, ",")
	log.Info("provInfoPc5GET: args= ", params)

	if !validateQueryParamValue(params[0], []string{"ecgi", "latitude"}) {
		w.WriteHeader(http.StatusBadRequest)
		return
	}
	// Extract list of items
	var i int
	for i = 1; i < len(params); i += 1 {
		if validateQueryParamValue(params[i], []string{"longitude"}) {
			break
		}
	} // End of 'for' statement
	i -= 1
	log.Info("provInfoPc5GET: i= ", i)
	log.Info("provInfoPc5GET: (len(params)-2)/2= ", (len(params)-2)/2)
	if i < 1 || ((params[0] == "latitude") && (i != (len(params)-2)/2)) {
		w.WriteHeader(http.StatusBadRequest)
		return
	}

	// Process the request
	log.Info("provInfoPc5GET: Process the request")

	// Send response
	jsonResponse := ""
	// jsonResponse, err := json.Marshal(Pc5ProvisioningInfo)
	// if err != nil {
	// 	log.Error(err.Error())
	// 	errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError)
	// 	return
	// }

	log.Info("infoUuMbmscastGET: Response: ", string(jsonResponse))
	w.WriteHeader(http.StatusOK)
	fmt.Fprint(w, string(jsonResponse))
}

func v2xNotify(v2xMessage []byte, v2xType int32, msgProtocolVersion int32, stdOrganization string, longitude *float32, latitude *float32) {
	log.Info(">>> v2xNotify: ", v2xMessage)

+179 −156

File changed.

Preview size limit exceeded, changes collapsed.

+132 −6

File changed.

Preview size limit exceeded, changes collapsed.

Loading