Commit edd74ca6 authored by Ikram Haq's avatar Ikram Haq
Browse files

Update server stubs for Resource: Distance

parent dadb5f76
Loading
Loading
Loading
Loading
+24 −53
Original line number Diff line number Diff line
@@ -683,7 +683,6 @@ func registerZoneStatus(zoneId string, upNbOfUsersZoneThreshold int32, upNbOfUse
		StatusSub.Reporting_amount = zoneStatusSub.ReportingCtrl.MaximumCount
		StatusSub.Reporting_interval = zoneStatusSub.ReportingCtrl.MinimumInterval
		// StatusSub.NextTts = zoneStatusSub.ReportingCtrl.MaximumFrequency
		StatusSub.NextTts = int32(time.Now().Unix() + int64(zoneStatusSub.ReportingCtrl.MinimumInterval))
	}
	zoneStatusSubscriptionMap[subsId] = &zoneStatus
	zoneStatusSubscriptionMapLink[subsId] = &StatusSub
@@ -1009,11 +1008,10 @@ func checkNotificationDistancePeriodicTrigger1() {
			userList.User = userInfoList
			distanceNotif.MonitoredUsers = &userList
			distanceNotif.NotificationType = "UserDistanceNotification"
			distanceNotif.CallbackData = distanceCheck.Subscription.CallbackReference.CallbackData
			var inlineDistanceSubscriptionNotification InlineUserDistanceNotification
			inlineDistanceSubscriptionNotification.UserDistanceNotification = &distanceNotif
			distanceCheck.NbNotificationsSent++
			sendSubscriptionNotification3(distanceCheck.Subscription.CallbackReference.NotifyURL, inlineDistanceSubscriptionNotification)
			sendSubscriptionNotification3(distanceCheck.Subscription.CallbackReference, inlineDistanceSubscriptionNotification)
			log.Info("Distance Notification"+"("+subsIdStr+") For ", returnAddr)
			// distanceSubscriptionMap[subsId].NextTts = distanceCheck.Subscription.Frequency
			// distanceSubscriptionMap[subsId].NotificationCheckReady = false
@@ -1626,40 +1624,10 @@ func registerPeriodic(periodicSub *PeriodicNotificationSubscription, subsIdStr s
	periodicSubscriptionMap[subsId] = &periodicCheck
}

// func checkNotificationRegisteredZoneStatus1(zoneId string, apId string, nbUsersInAP int32, nbUsersInZone int32, previousNbUsersInAP int32, previousNbUsersInZone int32) {
// 	// Your existing code here

// 	for subsId, zoneStatus := range zoneStatusSubscriptionMap {
// 		// Your existing code here

// 		// Check if reporting amount and interval are set
// 		if zoneStatusSubscriptionMapLink[subsId].Reporting_amount > 0 && zoneStatusSubscriptionMapLink[subsId].Reporting_interval > 0 {
// 			// reportingControl := zoneStatusSubscriptionMapLink[subsId].ReportingControl

// 			// If NextTts has passed, send notification
// 			if time.Now().Unix() >= int64(zoneStatusSubscriptionMapLink[subsId].NextTts) {
// 				// Update NextTts for the next notification
// 				zoneStatusSubscriptionMapLink[subsId].NextTts = int32(time.Now().Unix() + int64(zoneStatusSubscriptionMapLink[subsId].Reporting_interval))
// 				// Check if reporting amount is reached
// 				if zoneStatusSubscriptionMapLink[subsId].Reporting_amount <= 0 {
// 					// If reporting amount is zero, no more notifications should be sent
// 					continue
// 				}
// 				// Decrement reporting amount
// 				zoneStatusSubscriptionMapLink[subsId].Reporting_interval--
// 				sendNotificationForZoneStatus(zoneId, apId, nbUsersInAP, nbUsersInZone, subsId, previousNbUsersInZone, previousNbUsersInAP, zoneStatus)
// 			}
// 		} else {
// 			// If no reporting control parameters, send notification without conditions
// 			sendNotificationForZoneStatus(zoneId, apId, nbUsersInAP, nbUsersInZone, subsId, previousNbUsersInZone, previousNbUsersInAP, zoneStatus)
// 		}
// 	}
// }

// func checkNotificationRegisteredZoneStatus1(zoneId string, apId string, nbUsersInAP int32, nbUsersInZone int32, previousNbUsersInAP int32, previousNbUsersInZone int32) {
// 	mutex.Lock()
// 	defer mutex.Unlock()

// 	currentTime := time.Now().Unix()
// 	// Check all subscriptions
// 	for subsId, zoneStatus := range zoneStatusSubscriptionMap {
// 		if zoneStatus == nil {
@@ -1678,12 +1646,13 @@ func registerPeriodic(periodicSub *PeriodicNotificationSubscription, subsIdStr s
// 			continue
// 		}

// 		// If NextTts has passed and reporting control is provided, send notification
// 		if time.Now().Unix() >= int64(zoneStatusSubscriptionMapLink[subsId].NextTts) && zoneStatusSubscriptionMapLink[subsId].Subscription.ReportingCtrl != nil {
// 		if zoneStatusSubscriptionMapLink[subsId].Subscription.ReportingCtrl != nil {
// 			// If NextTts has passed, send notification
// 			if currentTime >= int64(zoneStatusSubscriptionMapLink[subsId].NextTts) {
// 				// Update NextTts for the next notification
// 			zoneStatusSubscriptionMapLink[subsId].NextTts = int32(time.Now().Unix() + int64(zoneStatusSubscriptionMapLink[subsId].Subscription.ReportingCtrl.MinimumInterval))
// 				zoneStatusSubscriptionMapLink[subsId].NextTts = int32(currentTime + int64(zoneStatusSubscriptionMapLink[subsId].Reporting_interval))
// 				// Check if reporting amount is reached
// 			if zoneStatusSubscriptionMapLink[subsId].Reporting_amount == 0 {
// 				if zoneStatusSubscriptionMapLink[subsId].Reporting_amount <= 0 {
// 					// If reporting amount is zero, no more notifications should be sent
// 					continue
// 				}
@@ -1691,6 +1660,10 @@ func registerPeriodic(periodicSub *PeriodicNotificationSubscription, subsIdStr s
// 				zoneStatusSubscriptionMapLink[subsId].Reporting_amount--
// 				sendNotificationForZoneStatus(zoneId, apId, nbUsersInAP, nbUsersInZone, subsId, previousNbUsersInZone, previousNbUsersInAP, zoneStatus)
// 			}
// 		} else {
// 			// If no reporting control parameters, send notification without conditions
// 			sendNotificationForZoneStatus(zoneId, apId, nbUsersInAP, nbUsersInZone, subsId, previousNbUsersInZone, previousNbUsersInAP, zoneStatus)
// 		}
// 	}
// }

@@ -2246,8 +2219,10 @@ func checkNotificationRegisteredZones1(oldZoneId string, newZoneId string, oldAp
				// Check if entering event subscription exists
				if zonalSubscriptionEnteringMap[subsId] != "" {
					// Check if reporting control parameters are provided
					if zonalSubscriptionMapLink[subsId].Reporting_amount > 0 && zonalSubscriptionMapLink[subsId].Reporting_interval > 0 {
					// if zonalSubscriptionMapLink[subsId].Reporting_amount > 0 && zonalSubscriptionMapLink[subsId].Reporting_interval > 0 {
					if zonalSubscriptionMapLink[subsId].Subscription.ReportingCtrl != nil {
						// If NextTts has passed, send notification

						if currentTime >= int64(zonalSubscriptionMapLink[subsId].NextTts) {
							// Update NextTts for the next notification
							zonalSubscriptionMapLink[subsId].NextTts = int32(currentTime + int64(zonalSubscriptionMapLink[subsId].Reporting_interval))
@@ -2271,7 +2246,8 @@ func checkNotificationRegisteredZones1(oldZoneId string, newZoneId string, oldAp
			if value == oldZoneId {
				if zonalSubscriptionLeavingMap[subsId] != "" {

					if zonalSubscriptionMapLink[subsId].Reporting_amount > 0 && zonalSubscriptionMapLink[subsId].Reporting_interval > 0 {
					// if zonalSubscriptionMapLink[subsId].Reporting_amount > 0 && zonalSubscriptionMapLink[subsId].Reporting_interval > 0 {
					if zonalSubscriptionMapLink[subsId].Subscription.ReportingCtrl != nil {
						// If NextTts has passed, send notification
						if currentTime >= int64(zonalSubscriptionMapLink[subsId].NextTts) {
							// Update NextTts for the next notification
@@ -2991,7 +2967,7 @@ func distanceSubPost(w http.ResponseWriter, r *http.Request) {
		return
	}
	//checking for mandatory properties
	if distanceSub.CallbackReference == nil || distanceSub.CallbackReference.NotifyURL == "" {
	if distanceSub.CallbackReference == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
@@ -3055,7 +3031,7 @@ func distanceSubPut(w http.ResponseWriter, r *http.Request) {
	}

	//checking for mandatory properties
	if distanceSub.CallbackReference == nil || distanceSub.CallbackReference.NotifyURL == "" {
	if distanceSub.CallbackReference == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
@@ -3077,11 +3053,6 @@ func distanceSubPut(w http.ResponseWriter, r *http.Request) {
				   return
		   }
	*/
	if distanceSub.Links.Self.Href == "" {
		log.Error("Mandatory ResourceURL parameter not present")
		errHandlerProblemDetails(w, "Mandatory ResourceURL parameter not present", http.StatusBadRequest)
		return
	}

	subsIdParamStr := vars["subscriptionId"]

+2 −16
Original line number Diff line number Diff line
/*
 * Copyright (c) 2022  The AdvantEDGE Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * AdvantEDGE Location API
 *
 * Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/02.02.01_60/gs_mec013v020201p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 * Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/03.01.01_60/gs_mec013v030101p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 *
 * API version: 2.2.1
 * API version: 3.1.1
 * Contact: AdvantEDGE@InterDigital.com
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
+2 −16
Original line number Diff line number Diff line
/*
 * Copyright (c) 2022  The AdvantEDGE Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * AdvantEDGE Location API
 *
 * Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/02.02.01_60/gs_mec013v020201p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 * Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/03.01.01_60/gs_mec013v030101p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 *
 * API version: 2.2.1
 * API version: 3.1.1
 * Contact: AdvantEDGE@InterDigital.com
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
+2 −2
Original line number Diff line number Diff line
/*
 * AdvantEDGE Location API
 *
 * Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/02.02.01_60/gs_mec013v020201p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 * Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/03.01.01_60/gs_mec013v030101p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 *
 * API version: 2.2.1
 * API version: 3.1.1
 * Contact: AdvantEDGE@InterDigital.com
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
+7 −7
Original line number Diff line number Diff line
/*
 * AdvantEDGE Location API
 *
* Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/02.02.01_60/gs_mec013v020201p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 * Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/03.01.01_60/gs_mec013v030101p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 *
* API version: 2.2.1
 * API version: 3.1.1
 * Contact: AdvantEDGE@InterDigital.com
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
Loading