81 lines
2.2 KiB
C#
81 lines
2.2 KiB
C#
using Manager.Interfaces.DTO;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace Manager.Interfaces.Models
|
|
{
|
|
/// <summary>
|
|
/// Device Information (Tablet)
|
|
/// </summary>
|
|
public class Device
|
|
{
|
|
[BsonId]
|
|
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
|
public string Id { get; set; }
|
|
|
|
[BsonElement("Name")]
|
|
public string Name { get; set; }
|
|
|
|
[BsonElement("IpAddress")]
|
|
[BsonRequired]
|
|
public string IpAddress { get; set; }
|
|
|
|
[BsonElement("ConfigurationId")]
|
|
[BsonRequired]
|
|
public string ConfigurationId { get; set; }
|
|
|
|
[BsonElement("Connected")]
|
|
[BsonRequired]
|
|
public bool Connected { get; set; }
|
|
|
|
[BsonElement("DateCreation")]
|
|
public DateTime DateCreation { get; set; }
|
|
|
|
// BatteryLevel in case of powered devices
|
|
[BsonElement("BatteryLevel")]
|
|
public string BatteryLevel { get; set; }
|
|
|
|
[BsonElement("LastBatteryLevel")]
|
|
public DateTime LastBatteryLevel { get; set; }
|
|
|
|
// ConnectionLevel wifi strength level
|
|
[BsonElement("ConnectionLevel")]
|
|
public string ConnectionLevel { get; set; }
|
|
|
|
[BsonElement("LastConnectionLevel")]
|
|
public DateTime LastConnectionLevel { get; set; }
|
|
|
|
|
|
public DeviceDTO ToDTO()
|
|
{
|
|
return new DeviceDTO()
|
|
{
|
|
Id = Id,
|
|
Name = Name,
|
|
IpAddress = IpAddress,
|
|
Connected = Connected,
|
|
ConfigurationId = ConfigurationId,
|
|
DateCreation = DateCreation
|
|
};
|
|
}
|
|
|
|
public DeviceDetailDTO ToDetailDTO()
|
|
{
|
|
return new DeviceDetailDTO()
|
|
{
|
|
Id = Id,
|
|
Name = Name,
|
|
IpAddress = IpAddress,
|
|
Connected = Connected,
|
|
ConfigurationId = ConfigurationId,
|
|
ConnectionLevel = ConnectionLevel,
|
|
LastConnectionLevel = LastConnectionLevel,
|
|
BatteryLevel = BatteryLevel,
|
|
LastBatteryLevel = LastBatteryLevel,
|
|
DateCreation = DateCreation
|
|
};
|
|
}
|
|
}
|
|
} |