sharee.bike-App/LockItShared/Services/BluetoothLock/ILocksService.cs
2021-05-13 17:07:16 +02:00

58 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bike.BluetoothLock;
using TINK.Services.BluetoothLock.Tdo;
namespace TINK.Services.BluetoothLock
{
public interface ILocksService
{
/// <summary> Holds timeout values for series of connecting attemps to a lock or multiple locks. </summary>
ITimeOutProvider TimeOut { get; set; }
/// <summary> Gets lock info for all lock in reach./// </summary>
/// <param name="connectTimeout">Timeout for connect operation of a single lock.</param>
Task<IEnumerable<LockInfoTdo>> GetLocksStateAsync(
IEnumerable<LockInfoAuthTdo> locksInfo,
TimeSpan connectTimeout);
/// <summary> Connects to lock.</summary>
/// <param name="authInfo"> Info required to connect to lock.</param>
/// <param name="connectTimeout">Timeout for connect operation.</param>
Task<LockInfoTdo> ConnectAsync(
LockInfoAuthTdo authInfo,
TimeSpan connectTimeout);
/// <summary>Gets a lock by bike Id.</summary>
/// <param name="bikeId"></param>
/// <returns>Lock object</returns>
ILockService this[int bikeId] { get; }
/// <summary> Disconnects lock.</summary>
/// <param name="bikeId"> Id of lock to disconnect.</param>
/// <param name="bikeGuid"> Guid of lock to disconnect.</param>
/// <returns> State disconnected it lock is already disconneced or after successfully disconnecting.</returns>
Task<LockingState> DisconnectAsync(int bikeId, Guid bikeGuid);
}
/// <summary> Sound types. </summary>
/// <remarks>
/// 1. Locking process started: One long beep.
/// 2. Unlocking successful: One short beep.
/// 3. Bike moved while trying to lock: Three short beeps.
/// 4. Locking bolt blocked while locking: Three short beeps.
/// 5. Unable to unlock because locking bolt is blocked: Three short beeps.
/// </remarks>
public enum SoundSettings
{
AllButOpenedSuccessfully, // Sounds: 1, 3, 4, 5
MovingBlocked = 1, // Sounds: 3, 4, 5
LockingStarted = 2, // Sounds: 1
AllOff = 3, // Mute
OpenedSuccessfully = 4, // Sounds: 2
LockingStartedOpenedSuccessfully = 5, // Sounds: 1, 2
AllOn = 6, // All sounds on
AllButLockingStarted = 7, // Sounds: 2, 3, 4, 5
}
}