sharee.bike-App/LockItShared/Services/BluetoothLock/NullLock.cs

71 lines
2.1 KiB
C#
Raw Normal View History

2022-09-20 13:51:55 +02:00
using System;
2021-05-13 17:07:16 +02:00
using System.Threading.Tasks;
using TINK.Services.BluetoothLock.Tdo;
namespace TINK.Services.BluetoothLock
{
2022-09-06 16:08:19 +02:00
/// <summary>
/// Represents a not exisitng lock.
/// </summary>
public class NullLock : ILockService
{
private int BikeId { get; }
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public NullLock(int bikeId)
{
BikeId = bikeId;
}
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public Task ReconnectAsync(LockInfoAuthTdo authInfo, TimeSpan connectTimeout) =>
throw new NotImplementedException();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public string Name =>
throw new NotImplementedException();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public Guid Guid =>
throw new NotImplementedException();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public int Id =>
throw new NotImplementedException();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public async Task<LockitLockingState?> OpenAsync() =>
await Task.FromResult((LockitLockingState?)null);
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public async Task<LockitLockingState?> CloseAsync() =>
await Task.FromResult((LockitLockingState?)null);
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public Task<double> GetBatteryPercentageAsync() =>
throw new System.Exception($"Can not get battery percentage. Lock {BikeId} not found.");
2021-05-13 17:07:16 +02:00
2022-09-20 13:51:55 +02:00
public Task<VersionInfoTdo> GetVersionInfoAsync() =>
throw new System.Exception($"Can not get versions. Lock {BikeId} not found.");
public VersionInfoTdo VersionInfo
{
get => throw new System.Exception($"Can not get versions. Lock {BikeId} not found.");
}
2022-09-06 16:08:19 +02:00
public DeviceState? GetDeviceState() =>
throw new NotImplementedException();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public Task<bool> GetIsAlarmOffAsync() =>
throw new System.Exception($"Can not get whether alarm is on or off. Lock {BikeId} not found.");
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public Task<LockInfoTdo> GetLockStateAsync(bool doWaitRetry = false) =>
throw new NotImplementedException();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public Task SetIsAlarmOffAsync(bool isActivated) =>
throw new System.Exception($"Can not set alarm {isActivated}. Lock {BikeId} not found.");
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public async Task<bool> SetSoundAsync(SoundSettings settings) =>
await Task.FromResult(false);
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public async Task<bool> SetAlarmSettingsAsync(AlarmSettings settings) =>
await Task.FromResult(false);
2022-01-22 18:28:01 +01:00
2022-09-06 16:08:19 +02:00
/// <summary> Disconnect from bluetooth lock. </summary>
public Task Disconnect() =>
throw new NotImplementedException();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
}
2021-05-13 17:07:16 +02:00
}