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

72 lines
1.8 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
public enum DeviceState
{
Disconnected = 0,
Connecting = 1,
Connected = 2,
Limited = 3 /* Mactches Connecting? */
}
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
public interface ILockService
{
/// <summary> Reconnect to lock. </summary>
Task ReconnectAsync(
LockInfoAuthTdo authInfo,
TimeSpan connectTimeout);
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Opens lock. </summary>
/// <returns> State of lock after performing open operation. </returns>
Task<LockitLockingState?> OpenAsync();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Closes lock. </summary>
/// <returns>State of lock after performing close operation.</returns>
Task<LockitLockingState?> CloseAsync();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
string Name { get; }
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
Guid Guid { get; }
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
int Id { get; }
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Gets the device state.</summary>
DeviceState? GetDeviceState();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
/// <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);
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
Task<bool> SetSoundAsync(SoundSettings settings);
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
Task<bool> SetAlarmSettingsAsync(AlarmSettings settings);
2022-01-22 18:28:01 +01:00
2022-09-06 16:08:19 +02:00
Task<bool> GetIsAlarmOffAsync();
2021-05-13 17:07:16 +02:00
2022-09-20 13:51:55 +02:00
/// <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; }
2022-09-06 16:08:19 +02:00
Task SetIsAlarmOffAsync(bool isActivated);
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>Gets the battery percentage.</summary>
Task<double> GetBatteryPercentageAsync();
2021-05-13 17:07:16 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Disconnect from lock.</summary>
Task Disconnect();
}
2021-05-13 17:07:16 +02:00
}