Version 3.0.363

This commit is contained in:
Anja 2023-04-19 12:14:14 +02:00
parent 4ff3307997
commit 91d42552c7
212 changed files with 1799 additions and 1318 deletions

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -10,13 +10,13 @@ using TINK.Services.BluetoothLock.Tdo;
namespace TINK.Services.BluetoothLock
{
/// <summary>
/// Facke locks service implementation which simulates locks which are in reach.
/// Fake locks service implementation which simulates locks which are in reach.
/// </summary>
public class LocksServiceInReach : ILocksServiceFake
{
private IEnumerable<LockInfoTdo> LocksInfo { get; set; } = new List<LockInfoTdo>();
/// <summary> Holds timeout values for series of connecting attemps to a lock or multiple locks. </summary>
/// <summary> Holds timeout values for series of connecting attempts to a lock or multiple locks. </summary>
public ITimeOutProvider TimeOut { get; set; }
/// <summary> Connects to lock.</summary>
@ -45,7 +45,7 @@ namespace TINK.Services.BluetoothLock
switch (bikeInfo.State.Value)
{
case InUseStateEnum.Disposable:
case InUseStateEnum.FeedbackPending: // State feedback pending does not exist for bluetooth locks but maches from bluetooth perspective state disposable.
case InUseStateEnum.FeedbackPending: // State feedback pending does not exist for bluetooth locks but matches from bluetooth perspective state disposable.
switch (lockInfo.State)
{
case LockingState.Open:

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -9,13 +9,13 @@ using TINK.Services.BluetoothLock.Tdo;
namespace TINK.Services.BluetoothLock
{
/// <summary>
/// Facke locks service implementation which simulates locks which are out of reach.
/// Fake locks service implementation which simulates locks which are out of reach.
/// </summary>
public class LocksServiceOutOfReach : ILocksServiceFake
{
private IEnumerable<LockInfoTdo> LocksInfo { get; set; } = new List<LockInfoTdo>();
/// <summary> Holds timeout values for series of connecting attemps to a lock or multiple locks. </summary>
/// <summary> Holds timeout values for series of connecting attempts to a lock or multiple locks. </summary>
public ITimeOutProvider TimeOut { get; set; }
/// <summary> Connects to lock.</summary>
@ -26,7 +26,7 @@ namespace TINK.Services.BluetoothLock
return await Task.FromResult(new LockInfoTdo.Builder { Id = authInfo.Id, Guid = authInfo.Guid, State = null }.Build());
}
/// <summary> No info availalbe because no lock is in reach.</summary>
/// <summary> No info centered because no lock is in reach.</summary>
/// <param name="connectTimeout">Timeout for connect operation of a single lock.</param>
/// <returns>Empty collection.</returns>
public async Task<IEnumerable<LockInfoTdo>> GetLocksStateAsync(IEnumerable<LockInfoAuthTdo> locksInfo, TimeSpan connectTimeout) => await Task.FromResult(LocksInfo);

View file

@ -9,6 +9,7 @@ using TINK.Model.Device;
using TINK.Repository;
using TINK.Repository.Request;
using TINK.Repository.Response;
using TINK.Repository.Response.Stations;
namespace TINK.Model.Services.CopriApi
{
@ -18,7 +19,7 @@ namespace TINK.Model.Services.CopriApi
/// <summary> Object which manages stored copri answers. </summary>
private ICopriCache CacheServer { get; }
/// <summary> Communicates whith copri server. </summary>
/// <summary> Communicates with copri server. </summary>
private ICopriServer HttpsServer { get; }
/// <summary> True if connector has access to copri server, false if cached values are used. </summary>
@ -30,9 +31,9 @@ namespace TINK.Model.Services.CopriApi
/// <summary> Gets the merchant id.</summary>
public string MerchantId => HttpsServer.MerchantId;
/// <summary> Constructs copri provider object to connet to https using a cache objet. </summary>
/// <summary> Constructs copri provider object to connect to https using a cache object. </summary>
/// <param name="copriHost"></param>
/// <param name="appContextInfo">Provides app related info (app name and version, merchantid) to pass to COPRI.</param>
/// <param name="appContextInfo">Provides app related info (app name and version, merchant id) to pass to COPRI.</param>
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
/// <param name="smartDevice">Holds info about smart device.</param>
/// <param name="sessionCookie">Cookie of user if a user is logged in, false otherwise.</param>
@ -68,7 +69,7 @@ namespace TINK.Model.Services.CopriApi
try
{
Log.ForContext<CopriProviderHttps>().Debug($"Querrying bikes available from copri.");
Log.ForContext<CopriProviderHttps>().Debug($"Querying bikes available from copri.");
var bikesAvailableResponse = await HttpsServer.GetBikesAvailableAsync();
return new Result<BikesAvailableResponse>(
typeof(CopriCallsHttps),
@ -78,13 +79,13 @@ namespace TINK.Model.Services.CopriApi
catch (Exception exception)
{
// Return response from cache.
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querrying bikes available. {Exception}.", exception);
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querying bikes available. {Exception}.", exception);
var bikesAvailableResponse = await CacheServer.GetBikesAvailableAsync();
return new Result<BikesAvailableResponse>(typeof(CopriCallsMonkeyStore), bikesAvailableResponse, bikesAvailableResponse.GetGeneralData(), exception);
}
}
/// <summary> Gets a list of bikes reserved/ booked by acctive user. </summary>
/// <summary> Gets a list of bikes reserved/ booked by active user. </summary>
/// <param name="sessionCookie">Cookie to authenticate user.</param>
/// <returns>Response holding list of bikes.</returns>
public async Task<Result<BikesReservedOccupiedResponse>> GetBikesOccupied(bool fromCache = false)
@ -101,7 +102,7 @@ namespace TINK.Model.Services.CopriApi
try
{
Log.ForContext<CopriProviderHttps>().Debug($"Querrying bikes occupied from copri.");
Log.ForContext<CopriProviderHttps>().Debug($"Querying bikes occupied from copri.");
var bikesOccupiedResponse = await HttpsServer.GetBikesOccupiedAsync();
return new Result<BikesReservedOccupiedResponse>(
typeof(CopriCallsHttps),
@ -112,7 +113,7 @@ namespace TINK.Model.Services.CopriApi
catch (Exception exception)
{
// Return response from cache.
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querrying bikes occupied. {Exception}.", exception);
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querying bikes occupied. {Exception}.", exception);
var bikesOccupiedResponse = await CacheServer.GetBikesOccupiedAsync();
return new Result<BikesReservedOccupiedResponse>(typeof(CopriCallsMonkeyStore), bikesOccupiedResponse, bikesOccupiedResponse.GetGeneralData(), exception);
}
@ -134,7 +135,7 @@ namespace TINK.Model.Services.CopriApi
try
{
Log.ForContext<CopriProviderHttps>().Debug($"Querrying stations from copri.");
Log.ForContext<CopriProviderHttps>().Debug($"Querying stations from copri.");
var stations = await HttpsServer.GetStationsAsync();
@ -146,7 +147,7 @@ namespace TINK.Model.Services.CopriApi
catch (Exception exception)
{
// Return response from cache.
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querrying stations. {Exception}.", exception);
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querying stations. {Exception}.", exception);
var stationsResponse = await CacheServer.GetStationsAsync();
return new Result<StationsAvailableResponse>(typeof(CopriCallsMonkeyStore), stationsResponse, stationsResponse.GetGeneralData(), exception);
}

View file

@ -7,6 +7,7 @@ using TINK.Model.Device;
using TINK.Repository;
using TINK.Repository.Request;
using TINK.Repository.Response;
using TINK.Repository.Response.Stations;
using TINK.Services.CopriApi.Exception;
namespace TINK.Model.Services.CopriApi

View file

@ -1,7 +1,8 @@

using System.Threading.Tasks;
using TINK.Repository;
using TINK.Repository.Response;
using TINK.Repository.Response.Stations;
namespace TINK.Model.Services.CopriApi
{
@ -16,7 +17,7 @@ namespace TINK.Model.Services.CopriApi
/// <returns>Response holding list of bikes.</returns>
Task<Result<BikesAvailableResponse>> GetBikesAvailable(bool fromCache = false);
/// <summary> Gets a list of bikes reserved/ booked by acctive user from Copri.</summary>
/// <summary> Gets a list of bikes reserved/ booked by active user from Copri.</summary>
/// <returns>Response holding list of bikes.</returns>
Task<Result<BikesReservedOccupiedResponse>> GetBikesOccupied(bool fromCache = false);

View file

@ -1,5 +1,6 @@
using TINK.Repository;
using TINK.Repository.Response;
using TINK.Repository.Response.Stations;
namespace TINK.Model.Services.CopriApi
{

View file

@ -112,7 +112,7 @@ namespace TINK.Services.CopriApi
if (lockingState == null)
{
// User did not take bike out of the station
throw new BikeStillInStationException("Booking was cancelled because bike is still in station.");
throw new BikeStillInStationException("Booking was canceled because bike is still in station.");
}
// Upate booking state.

View file

@ -1,4 +1,4 @@
using System;
using System;
using TINK.Services.CopriApi;
namespace TINK.Model.Services.CopriApi
@ -10,7 +10,7 @@ namespace TINK.Model.Services.CopriApi
/// </summary>
/// <param name="source">Type of source (data provider).</param>
/// <param name="response">Requested data (bikes, station).</param>
/// <param name="generalData">General data (common to all respones).</param>
/// <param name="generalData">General data (common to all responses).</param>
public Result(
Type source,
T response,

View file

@ -1,5 +1,5 @@
using TINK.Model.Bikes;
using TINK.Model.Station;
using TINK.Model.Bikes;
using TINK.Model.Stations;
namespace TINK.Model.Services.CopriApi
{

View file

@ -30,7 +30,7 @@ namespace TINK.Services.Geolocation
/// <summary> Gets the current location.</summary>
/// <param name="cancellationToken">Token to cancel request for geolocation.</param>
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geoloation can be used or not.</param>
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geolocation can be used or not.</param>
public async Task<IGeolocation> GetAsync(CancellationToken? cancellationToken = null, DateTime? timeStamp = null)
{
try

View file

@ -2,7 +2,6 @@ using System;
using System.Threading;
using System.Threading.Tasks;
using TINK.Model.Device;
using Xamarin.Essentials;
namespace TINK.Services.Geolocation
{
@ -11,7 +10,7 @@ namespace TINK.Services.Geolocation
{
/// <summary> Gets the current location.</summary>
/// <param name="cancellationToken">Token to cancel request for geolocation. If null request can not be cancels and times out after GeolocationService.GEOLOCATIONREQUEST_TIMEOUT_MS if geolocation is not available.</param>
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine for some implementations whether cached geoloation can be used or not.</param>
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine for some implementations whether cached geolocation can be used or not.</param>
/// <returns></returns>
Task<IGeolocation> GetAsync(CancellationToken? cancellationToken = null, DateTime? timeStamp = null);

View file

@ -18,7 +18,7 @@ namespace TINK.Services.Geolocation
/// <summary> Gets the current location.</summary>
/// <param name="cancelationToken">Token to cancel request for geolocation.</param>
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geoloation can be used or not.</param>
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geolocation can be used or not.</param>
public async Task<IGeolocation> GetAsync(CancellationToken? cancelationToken = null, DateTime? timeStamp = null)
{
IGeolocation location;

View file

@ -17,7 +17,7 @@ namespace TINK.Services.Geolocation
/// <summary> Gets the current location.</summary>
/// <param name="cancelToken">Token to cancel request for geolocation.</param>
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geoloation can be used or not.</param>
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geolocation can be used or not.</param>
public async Task<IGeolocation> GetAsync(CancellationToken? cancelToken = null, DateTime? timeStamp = null)
{
return await Task.FromResult(new Geolocation.Builder {