sharee.bike-App/SharedBusinessLogic/Model/Bikes/BikeInfoNS/CopriLock/LockInfoMutable.cs

31 lines
913 B
C#
Raw Permalink Normal View History

2024-04-09 12:53:23 +02:00
namespace ShareeBike.Model.Bikes.BikeInfoNS.CopriLock
2022-04-25 22:15:15 +02:00
{
2022-09-06 16:08:19 +02:00
public class LockInfoMutable : ILockInfoMutable
{
/// <summary> Lock info object. </summary>
private LockInfo LockInfo { get; set; }
2022-04-25 22:15:15 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Constructs a bluetooth lock info object. </summary>
/// <param name="id">Id of lock must always been known when constructing an lock info object.</param>
public LockInfoMutable(LockingState state)
{
LockInfo = new LockInfo.Builder() { State = state }.Build();
}
2022-04-25 22:15:15 +02:00
2022-09-06 16:08:19 +02:00
public LockingState State
{
get => LockInfo.State;
set => LockInfo = new LockInfo.Builder(LockInfo) { State = value }.Build();
}
2022-04-25 22:15:15 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Holds the percentage of lock battery.</summary>
public double BatteryPercentage { get; set; } = double.NaN;
2022-04-25 22:15:15 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Loads lock info object from values. </summary>
public void Load()
{
LockInfo = new LockInfo.Builder(LockInfo) { }.Build();
}
}
2022-04-25 22:15:15 +02:00
}