sharee.bike-App/TestFramework/Services/BluetoothLock/LocksServiceMock.cs
Anja Müller-Meißner 0468955d49 Version 3.0.338
2022-09-08 09:55:14 +02:00

86 lines
3.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.Tdo;
namespace TestFramework.Services.BluetoothLock
{
public class LocksServiceMock : ILocksService
{
/// <param name="connectTimeout">Timeout for connect operation of a single lock.</param>
public async Task<IEnumerable<LockInfoTdo>> GetLocksStateAsync(IEnumerable<LockInfoAuthTdo> locksInfo, TimeSpan connectTimeout)
{
return await Task.FromResult(new List<LockInfoTdo>());
}
/// <summary> Holds timeout values for series of connecting attemps to a lock or multiple locks. </summary>
public ITimeOutProvider TimeOut { get; set; }
public void UpdateSimulation(BikeCollection bikes) { }
/// <summary> Opens lock.</summary>
/// <param name="bike">Bike object to update.</param>
public async Task<LockitLockingState?> OpenAsync(int lockId, byte[] copriKey) => await Task.FromResult(LockitLockingState.Open);
/// <summary> Closes lock.</summary>
/// <param name="bike">Bike object to update.</param>
public async Task<LockitLockingState?> CloseAsync(int lockId, byte[] copriKey) => await Task.FromResult(LockitLockingState.Closed);
/// <summary> Gets the state of a bike. </summary>
/// <param name="lockId">Id of lockId to get state for.</param>
/// <returns></returns>
public async Task<LockitLockingState?> GetState(string lockId) => await Task.FromResult((LockitLockingState?)null);
/// <summary> Connects to lock.</summary>
/// <param name="authInfo"> Info required to connect to lock.</param>
/// <param name="connectTimeout">Timeout for connect operation.</param>
public async Task<LockInfoTdo> ConnectAsync(LockInfoAuthTdo authInfo, TimeSpan connectTimeout)
{
return await Task.FromResult(new LockInfoTdo.Builder { Id = 12, Guid = new System.Guid("00000000-0000-0000-0000-000000000042"), State = null }.Build());
}
/// <summary> Set sound settings.</summary>
/// <param name="lockId">Id of lock to set sound settings.</param>
public async Task<bool> SetSoundAsync(int lockId, SoundSettings settings)
{
return await Task.FromResult(true);
}
/// <summary> Gets battery percentage.</summary>
/// <param name="lockId">Id of lock to get info for.</param>
public Task<double> GetBatteryPercentageAsync(int lockId)
{
throw new NotSupportedException();
}
/// <summary> Sets whether alarm is on or off.</summary>
/// <param name="lockId">Id of lock to get info from.</param>
public async Task SetIsAlarmOffAsync(int lockId, bool activated)
{
await Task.FromResult(true);
}
/// <summary> Gets whether alarm is on or off.</summary>
/// <param name="lockId">Id of lock to get info for.</param>
public async Task<bool> GetIsAlarmOffAsync(int lockId)
{
return await Task.FromResult(true);
}
/// <summary>Gets a lock by bike Id.</summary>
/// <param name="bikeId"></param>
/// <returns>Lock object</returns>
public ILockService this[int bikeId]
{
get
{
return null;
}
}
public Task<LockingState> DisconnectAsync(int bikeId, Guid bikeGuid) => throw new NotSupportedException();
}
}