set gnss timestamp in location
This commit is contained in:
parent
452589d11d
commit
59dc57a618
@ -51,6 +51,14 @@ router.post(
|
||||
)?.measurementValue,
|
||||
};
|
||||
|
||||
const gnssTimestamp = {
|
||||
timestamp: message.uplink_message.decoded_payload?.messages[0].find(
|
||||
(e) => e.type === "Latitude"
|
||||
)?.timestamp
|
||||
};
|
||||
|
||||
|
||||
|
||||
const wifiScans =
|
||||
message.uplink_message.decoded_payload?.messages[0]
|
||||
.find((e) => e.type === "Wi-Fi Scan")
|
||||
@ -96,8 +104,11 @@ router.post(
|
||||
? {
|
||||
latitude: gnnsLocation.latitude,
|
||||
longitude: gnnsLocation.longitude,
|
||||
|
||||
}
|
||||
: undefined,
|
||||
|
||||
gnss_timestamp: new Date(gnssTimestamp.timestamp),
|
||||
});
|
||||
};
|
||||
createDatabaseEntries().then();
|
||||
|
@ -10,6 +10,7 @@ export class Location extends Model {
|
||||
public gnss_longitude!: number;
|
||||
public ttn_gw_latitude!: number;
|
||||
public ttn_gw_longitude!: number;
|
||||
public gnss_timestamp!: Date;
|
||||
public created_at_utc!: Date;
|
||||
public updated_at_utc!: Date;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ interface CreateLocationParams {
|
||||
wifi?: Coordinates;
|
||||
gnss?: Coordinates;
|
||||
ttn_gw?: Coordinates;
|
||||
gnss_timestamp?: Date;
|
||||
}
|
||||
|
||||
interface CreateLocationTriangulationParams {
|
||||
@ -18,6 +19,7 @@ interface CreateLocationTriangulationParams {
|
||||
}[];
|
||||
ttn_gw: LocationSignal[];
|
||||
gnss?: Coordinates;
|
||||
gnss_timestamp: Date;
|
||||
}
|
||||
|
||||
interface LocationSignal extends Coordinates {
|
||||
@ -65,6 +67,7 @@ export class LocationService {
|
||||
ttn_gw_longitude: data.ttn_gw?.longitude,
|
||||
gnss_latitude: data.gnss?.latitude,
|
||||
gnss_longitude: data.gnss?.longitude,
|
||||
gnss_timestamp: data.gnss_timestamp,
|
||||
});
|
||||
}
|
||||
|
||||
@ -81,6 +84,7 @@ export class LocationService {
|
||||
wifi: wifi_location,
|
||||
ttn_gw: gateway_location,
|
||||
gnss: data.gnss,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user