save GNSS location in location element
This commit is contained in:
		| @ -15,8 +15,8 @@ domainEventEmitter.on( | ||||
|  | ||||
|     var wifi_based_latitude: number; | ||||
|     var wifi_based_longitude: number; | ||||
|     var gnss_based_latitude: number; | ||||
|     var gnss_based_longitude: number; | ||||
|     var gnss_based_latitude: number | undefined = undefined; | ||||
|     var gnss_based_longitude: number | undefined = undefined; | ||||
|     var ttn_gw_based_latitude: number | undefined = undefined; | ||||
|     var ttn_gw_based_longitude: number | undefined = undefined; | ||||
|  | ||||
| @ -50,14 +50,21 @@ domainEventEmitter.on( | ||||
|       // TODO: parse Wifi location here | ||||
|     } | ||||
|  | ||||
|     if ((event.gnssLocation.latitude) && (event.gnssLocation.longitude)) { | ||||
|       gnss_based_latitude = event.gnssLocation.latitude; | ||||
|       gnss_based_longitude = event.gnssLocation.longitude; | ||||
|     } else { | ||||
|       console.log("No GNSS location received!") | ||||
|     } | ||||
|  | ||||
|     const newLocation = await locationService.createLocation({ | ||||
|       lp_ttn_end_device_uplinks_id: event.lp_ttn_end_device_uplinks_id, | ||||
|       ttn_gw_latitude: ttn_gw_based_latitude, | ||||
|       ttn_gw_longitude: ttn_gw_based_longitude, | ||||
|       //TODO: Add gnss location | ||||
|       gnss_latitude: gnss_based_latitude, | ||||
|       gnss_longitude: gnss_based_longitude, | ||||
|     }); | ||||
|  | ||||
|  | ||||
|     console.log(newLocation) | ||||
|   } | ||||
| ); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user