sharee.bike-App/LockIt.BusinessLogic/Services/BluetoothLock/ILockService.cs
2024-04-09 12:53:23 +02:00

71 lines
1.8 KiB
C#

using System;
using System.Threading.Tasks;
using ShareeBike.Services.BluetoothLock.Tdo;
namespace ShareeBike.Services.BluetoothLock
{
public enum DeviceState
{
Disconnected = 0,
Connecting = 1,
Connected = 2,
Limited = 3 /* Mactches Connecting? */
}
public interface ILockService
{
/// <summary> Reconnect to lock. </summary>
Task ReconnectAsync(
LockInfoAuthTdo authInfo,
TimeSpan connectTimeout);
/// <summary> Opens lock. </summary>
/// <returns> State of lock after performing open operation. </returns>
Task<LockitLockingState?> OpenAsync();
/// <summary> Closes lock. </summary>
/// <returns>State of lock after performing close operation.</returns>
Task<LockitLockingState?> CloseAsync();
string Name { get; }
Guid Guid { get; }
int Id { get; }
/// <summary> Gets the device state.</summary>
DeviceState? GetDeviceState();
/// <summary>
/// Gets the locking state.
/// </summary>
/// <param name="doWaitRetry">True if to wait and retry in case of failures. </param>
/// <returns></returns>
Task<LockInfoTdo> GetLockStateAsync(bool doWaitRetry = false);
Task<bool> SetSoundAsync(SoundSettings settings);
Task<bool> SetAlarmSettingsAsync(AlarmSettings settings);
Task<bool> GetIsAlarmOffAsync();
/// <summary>
/// Get info about lock firmware- hardware- and lock-version.
/// </summary>
/// <returns>Lock versions info.</returns>
Task<VersionInfoTdo> GetVersionInfoAsync();
/// <summary>
/// Holds info about lock firmware- hardware- and lock-version, null if info has not yet been read.
/// </summary>
VersionInfoTdo VersionInfo { get; }
Task SetIsAlarmOffAsync(bool isActivated);
/// <summary>Gets the battery percentage.</summary>
Task<double> GetBatteryPercentageAsync();
/// <summary> Disconnect from lock.</summary>
Task Disconnect();
}
}