53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Threading.Tasks;
|
||
|
using MongoDB.Bson.Serialization.Attributes;
|
||
|
using MongoDB.Bson;
|
||
|
using MongoDB.Driver;
|
||
|
|
||
|
namespace EFB.Models
|
||
|
{
|
||
|
public class SimPositionModel
|
||
|
{
|
||
|
[BsonId]
|
||
|
public ObjectId Id { get; set; }
|
||
|
public string EMail { get; set; } = "";
|
||
|
public DateTime LatestPacketUpdate { get; set; }
|
||
|
public SimPosition LatestPosition { get; set; } = null;
|
||
|
|
||
|
public SimPositionModel(string email, SimPosition position){
|
||
|
EMail = email;
|
||
|
LatestPacketUpdate = DateTime.Now;
|
||
|
LatestPosition = position;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
public class SimPosition
|
||
|
{
|
||
|
public float Latitude { get; set; }
|
||
|
public float Longitude { get; set; }
|
||
|
public int Altitude { get; set; }
|
||
|
|
||
|
public SimPosition(float latitude, float longitude, int altitude){
|
||
|
Latitude = latitude;
|
||
|
Longitude = longitude;
|
||
|
Altitude = altitude;
|
||
|
}
|
||
|
|
||
|
//**Packet Processing not required**//
|
||
|
|
||
|
// public SimPosition(Packet[] data){
|
||
|
// if (data[0].Data != null)
|
||
|
// {
|
||
|
// //Use Linq to search through the packets for a given id and use that data
|
||
|
// Latitude = (data.Where(x => x.Id == 22).Select(x => x.Data[0]).ToArray())[0];
|
||
|
// Longitude = (data.Where(x => x.Id == 23).Select(x => x.Data[0]).ToArray())[0];
|
||
|
// Altitude = Convert.ToInt32((data.Where(x => x.Id == 24).Select(x => x.Data[0]).ToArray())[0]);
|
||
|
|
||
|
// }
|
||
|
// }
|
||
|
}
|
||
|
}
|