mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 03:27:29 +02:00
Version 3.0.363
This commit is contained in:
parent
4ff3307997
commit
91d42552c7
212 changed files with 1799 additions and 1318 deletions
|
@ -23,6 +23,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
|
|||
public class BikeViewModel : BikeViewModelBase, INotifyPropertyChanged
|
||||
{
|
||||
public Xamarin.Forms.Command ShowTrackingInfoCommand { get; private set; }
|
||||
public Xamarin.Forms.Command ShowRideTypeInfoCommand { get; private set; }
|
||||
|
||||
/// <summary> Notifies GUI about changes. </summary>
|
||||
public override event PropertyChangedEventHandler PropertyChanged;
|
||||
|
@ -112,6 +113,15 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
|
|||
|
||||
});
|
||||
|
||||
ShowRideTypeInfoCommand = new Xamarin.Forms.Command(async () => {
|
||||
|
||||
await ViewService.DisplayAlert(
|
||||
AppResources.MessageAaRideTypeInfoTitle,
|
||||
TariffDescription.RideTypeText,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
});
|
||||
|
||||
RequestHandler = user.IsLoggedIn
|
||||
? RequestHandlerFactory.Create(
|
||||
selectedBike,
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
|
||||
}
|
||||
|
||||
// Check if quering geolocation is required.
|
||||
// Check if querying geolocation is required.
|
||||
if (currentLocation == null)
|
||||
{
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextQueryLocationStart;
|
||||
|
@ -216,7 +216,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
SelectedBike,
|
||||
currentLocationDto);
|
||||
|
||||
// If canceling bike succedes remove bike because it is not ready to be booked again
|
||||
// If canceling bike succeeds remove bike because it is not ready to be booked again
|
||||
IsRemoveBikeRequired = true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
@ -238,7 +238,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
// COPRI returned an error.
|
||||
Log.ForContext<BookedClosed>().Information(
|
||||
"User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Postion send to COPRI {@position}.",
|
||||
"User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Position send to COPRI {@position}.",
|
||||
SelectedBike,
|
||||
currentLocationDto);
|
||||
|
||||
|
@ -427,7 +427,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
"OK");
|
||||
}
|
||||
|
||||
// When bold is blocked lock is still closed even if exception occurres.
|
||||
// When bold is blocked lock is still closed even if exception occurs.
|
||||
// In all other cases state is supposed to be unknown. Example: Lock is out of reach and no more bluetooth connected.
|
||||
SelectedBike.LockInfo.State = exception is StateAwareException stateAwareException
|
||||
? stateAwareException.State
|
||||
|
@ -449,13 +449,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
if (exception is OutOfReachException)
|
||||
{
|
||||
Log.ForContext<BookedClosed>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
|
||||
Log.ForContext<BookedClosed>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<BookedClosed>().Error("Akkustate can not be read. {Exception}", exception);
|
||||
Log.ForContext<BookedClosed>().Error("Battery state can not be read. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
/// <returns></returns>
|
||||
public async Task<IRequestHandler> HandleRequestOption2() => await ConnectLock();
|
||||
|
||||
/// <summary> Requst is not supported, button should be disabled. </summary>
|
||||
/// <summary> Request is not supported, button should be disabled. </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IRequestHandler> UnsupportedRequest()
|
||||
{
|
||||
|
|
|
@ -119,11 +119,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
return this;
|
||||
}
|
||||
|
||||
// Start of closing lock and returing bike sequence.
|
||||
// Start of closing lock and returning bike sequence.
|
||||
Log.ForContext<BookedOpen>().Information("Request to return bike {bike} detected.", SelectedBike);
|
||||
|
||||
// Clear logging memory sink to avoid passing log data not related to returning of bike to backend.
|
||||
// Log data is passed to backend when calling CopriCallsHttps.DoReturn().
|
||||
// Clear logging memory sink to avoid passing log data not related to returning of bike to back-end.
|
||||
// Log data is passed to back end when calling CopriCallsHttps.DoReturn().
|
||||
MemoryStackSink.ClearMessages();
|
||||
|
||||
// Stop polling before returning bike.
|
||||
|
@ -260,7 +260,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
// Check locking state.
|
||||
if (SelectedBike.LockInfo.State != LockingState.Closed)
|
||||
{
|
||||
Log.ForContext<BookedOpen>().Error($"Lock can not be closed. Invalid locking state state {SelectedBike.LockInfo.State} detected.");
|
||||
Log.ForContext<BookedOpen>().Error($"Lock can not be closed. Invalid locking state {SelectedBike.LockInfo.State} detected.");
|
||||
|
||||
BikesViewModel.ActionText = string.Empty;
|
||||
|
||||
|
@ -298,7 +298,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
catch (Exception innerExWhenAll)
|
||||
{
|
||||
// No location information available.
|
||||
Log.ForContext<BookedOpen>().Information("Canceling query location/ updating lock state failed failed on unexpected lock state failed. {Exception}", SelectedBike, innerExWhenAll);
|
||||
Log.ForContext<BookedOpen>().Information("Canceling query location/ updating lock state failed on unexpected lock state failed. {Exception}", SelectedBike, innerExWhenAll);
|
||||
}
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdater;
|
||||
|
@ -360,7 +360,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
SelectedBike,
|
||||
currentLocationDto,
|
||||
SmartDevice);
|
||||
// If canceling bike succedes remove bike because it is not ready to be booked again
|
||||
// If canceling bike succeeds remove bike because it is not ready to be booked again
|
||||
IsRemoveBikeRequired = true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
@ -382,7 +382,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
// COPRI returned an error.
|
||||
Log.ForContext<BookedOpen>().Information(
|
||||
"User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Postion send to COPRI {@position}.",
|
||||
"User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Position send to COPRI {@position}.",
|
||||
SelectedBike,
|
||||
currentLocationDto);
|
||||
|
||||
|
@ -510,8 +510,8 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
BikesViewModel.IsIdle = false;
|
||||
Log.ForContext<BookedOpen>().Information("User request to lock bike {bike} in order to pause ride.", SelectedBike);
|
||||
|
||||
// Clear logging memory sink to avoid passing log data not related to returning of bike to backend.
|
||||
// Log data is passed to backend when calling CopriCallsHttps.DoReturn().
|
||||
// Clear logging memory sink to avoid passing log data not related to returning of bike to back end.
|
||||
// Log data is passed to back end when calling CopriCallsHttps.DoReturn().
|
||||
MemoryStackSink.ClearMessages();
|
||||
|
||||
// Start getting geolocation.
|
||||
|
@ -608,7 +608,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
|
||||
}
|
||||
|
||||
// Get geoposition.
|
||||
// Get geolocation.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextQueryLocation;
|
||||
IGeolocation currentLocation = null;
|
||||
try
|
||||
|
|
|
@ -14,7 +14,6 @@ using TINK.Services.BluetoothLock;
|
|||
using TINK.Services.BluetoothLock.Exception;
|
||||
using TINK.Services.Geolocation;
|
||||
using TINK.View;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
||||
{
|
||||
|
@ -126,7 +125,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
AppResources.MessageAnswerOk);
|
||||
}
|
||||
|
||||
// When bold is blocked lock is still closed even if exception occurres.
|
||||
// When bold is blocked lock is still closed even if exception occurs.
|
||||
// In all other cases state is supposed to be unknown. Example: Lock is out of reach and no more bluetooth connected.
|
||||
SelectedBike.LockInfo.State = exception is StateAwareException stateAwareException
|
||||
? stateAwareException.State
|
||||
|
@ -148,13 +147,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
if (exception is OutOfReachException)
|
||||
{
|
||||
Log.ForContext<BookedUnknown>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
|
||||
Log.ForContext<BookedUnknown>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<BookedUnknown>().Error("Akkustate can not be read. {Exception}", exception);
|
||||
Log.ForContext<BookedUnknown>().Error("Battery state can not be read. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
if (alertResult == false)
|
||||
{
|
||||
// User aborted booking process
|
||||
Log.ForContext<DisposableDisconnected>().Information("User selected availalbe bike {bike} in order to reserve but action was canceled.", SelectedBike);
|
||||
Log.ForContext<DisposableDisconnected>().Information("User selected centered bike {bike} in order to reserve but action was canceled.", SelectedBike);
|
||||
BikesViewModel.IsIdle = true;
|
||||
return this;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|| exception is RequestNotCachableException)
|
||||
{
|
||||
// Copri server is not reachable.
|
||||
Log.ForContext<DisposableDisconnected>().Information("User selected availalbe bike {bike} but reserving failed (Copri server not reachable).", SelectedBike);
|
||||
Log.ForContext<DisposableDisconnected>().Information("User selected centered bike {bike} but reserving failed (Copri server not reachable).", SelectedBike);
|
||||
|
||||
await ViewService.DisplayAlert(
|
||||
AppResources.MessageReservingBikeErrorConnectionTitle,
|
||||
|
@ -115,7 +115,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<DisposableDisconnected>().Error("User selected availalbe bike {bike} but reserving failed. {@l_oException}", SelectedBike, exception);
|
||||
Log.ForContext<DisposableDisconnected>().Error("User selected centered bike {bike} but reserving failed. {@l_oException}", SelectedBike, exception);
|
||||
|
||||
await ViewService.DisplayAlert(
|
||||
AppResources.MessageReservingBikeErrorGeneralTitle,
|
||||
|
@ -346,13 +346,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
if (exception is OutOfReachException)
|
||||
{
|
||||
Log.ForContext<DisposableDisconnected>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
|
||||
Log.ForContext<DisposableDisconnected>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<DisposableDisconnected>().Error("Akkustate can not be read. {Exception}", exception);
|
||||
Log.ForContext<DisposableDisconnected>().Error("Battery state can not be read. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
|
||||
}
|
||||
|
||||
/// <summary> Requst is not supported, button should be disabled. </summary>
|
||||
/// <summary> Request is not supported, button should be disabled. </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IRequestHandler> UnsupportedRequest()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
@ -26,7 +26,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
/// <summary> Bike is disposable, lock is open and can be reached via bluetooth. </summary>
|
||||
/// <remarks>
|
||||
/// This state should never occure because as long as a ILOCKIT is connected it
|
||||
/// This state should never occur because as long as a ILOCKIT is connected it
|
||||
/// - cannot be closed manually
|
||||
/// - no other device can access lock
|
||||
/// - app itself should never event attempt to open a lock which is not rented.
|
||||
|
@ -177,19 +177,19 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
if (exception is OutOfReachException)
|
||||
{
|
||||
Log.ForContext<DisposableOpen>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
|
||||
Log.ForContext<DisposableOpen>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<DisposableOpen>().Error("Akkustate can not be read. {Exception}", exception);
|
||||
Log.ForContext<DisposableOpen>().Error("Battery state can not be read. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
|
||||
}
|
||||
}
|
||||
|
||||
// Notify corpi about unlock action in order to start booking.
|
||||
// Notify copri about unlock action in order to start booking.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextRentingBike;
|
||||
IsConnected = IsConnectedDelegate();
|
||||
try
|
||||
|
@ -270,7 +270,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
|
||||
}
|
||||
|
||||
/// <summary> Requst is not supported, button should be disabled. </summary>
|
||||
/// <summary> Request is not supported, button should be disabled. </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IRequestHandler> UnsupportedRequest()
|
||||
{
|
||||
|
|
|
@ -16,11 +16,11 @@ using IBikeInfoMutable = TINK.Model.Bikes.BikeInfoNS.BluetoothLock.IBikeInfoMuta
|
|||
|
||||
namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
||||
{
|
||||
/// <summary> Bike is reserved, lock is closed and and connected to app. </summary>
|
||||
/// <summary> Bike is reserved, lock is closed and connected to app. </summary>
|
||||
/// <remarks>
|
||||
/// Occures when
|
||||
/// - biks was reserved out of reach and is in reach now
|
||||
/// - bike is is reserved while in reach
|
||||
/// Occurs when
|
||||
/// - bike was reserved out of reach and is in reach now
|
||||
/// - bike is reserved while in reach
|
||||
/// </remarks>
|
||||
public class ReservedClosed : Base, IRequestHandler
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
await ConnectorFactory(IsConnected).Command.DoCancelReservation(SelectedBike);
|
||||
|
||||
// If canceling bike succedes remove bike because it is not ready to be booked again
|
||||
// If canceling bike succeeds remove bike because it is not ready to be booked again
|
||||
IsRemoveBikeRequired = true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
@ -311,13 +311,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
if (exception is OutOfReachException)
|
||||
{
|
||||
Log.ForContext<ReservedClosed>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
|
||||
Log.ForContext<ReservedClosed>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<ReservedClosed>().Error("Akkustate can not be read. {Exception}", exception);
|
||||
Log.ForContext<ReservedClosed>().Error("Battery state can not be read. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
/// <summary> Cancel reservation. </summary>
|
||||
public async Task<IRequestHandler> HandleRequestOption1() => await CancelReservation();
|
||||
|
||||
/// <summary> Connect to reserved bike ask whether to book bike bike or not and if yes open lock. </summary>
|
||||
/// <summary> Connect to reserved bike ask whether to book bike or not and if yes open lock. </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IRequestHandler> HandleRequestOption2() => await ConnectLockAndBook();
|
||||
|
||||
|
@ -86,7 +86,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
await ConnectorFactory(IsConnected).Command.DoCancelReservation(SelectedBike);
|
||||
|
||||
// If canceling bike succedes remove bike because it is not ready to be booked again
|
||||
// If canceling bike succeeds remove bike because it is not ready to be booked again
|
||||
IsRemoveBikeRequired = true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
@ -136,7 +136,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
|
||||
}
|
||||
|
||||
/// <summary> Connect to reserved bike ask whether to book bike bike or not and if yes open lock. </summary>
|
||||
/// <summary> Connect to reserved bike ask whether to book bike or not and if yes open lock. </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IRequestHandler> ConnectLockAndBook()
|
||||
{
|
||||
|
@ -474,13 +474,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
if (exception is OutOfReachException)
|
||||
{
|
||||
Log.ForContext<ReservedDisconnected>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
|
||||
Log.ForContext<ReservedDisconnected>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<ReservedDisconnected>().Error("Akkustate can not be read. {Exception}", exception);
|
||||
Log.ForContext<ReservedDisconnected>().Error("Battery state can not be read. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
/// <summary> Bike is reserved, lock is open and connected to app. </summary>
|
||||
/// <remarks>
|
||||
/// This state might occure when a ILOCKIT was manually opened (color code) and app connects afterwards.
|
||||
/// This state might occur when a ILOCKIT was manually opened (color code) and app connects afterwards.
|
||||
/// This should never during ILOCKIT is connected to app because
|
||||
/// - manually opening lock is not possible when lock is connected
|
||||
/// - two devices can not simultaneously conect to same lock.
|
||||
/// - two devices can not simultaneously connect to same lock.
|
||||
public class ReservedOpen : Base, IRequestHandler
|
||||
{
|
||||
/// <param name="smartDevice">Provides info about the smart device (phone, tablet, ...)</param>
|
||||
|
@ -89,13 +89,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
if (exception is OutOfReachException)
|
||||
{
|
||||
Log.ForContext<ReservedOpen>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
|
||||
Log.ForContext<ReservedOpen>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<ReservedOpen>().Error("Akkustate can not be read. {Exception}", exception);
|
||||
Log.ForContext<ReservedOpen>().Error("Battery state can not be read. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
await ConnectorFactory(IsConnected).Command.DoCancelReservation(SelectedBike);
|
||||
|
||||
// If canceling bike succedes remove bike because it is not ready to be booked again
|
||||
// If canceling bike succeeds remove bike because it is not ready to be booked again
|
||||
IsRemoveBikeRequired = true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
AppResources.MessageAnswerOk);
|
||||
}
|
||||
|
||||
// When bold is blocked lock is still closed even if exception occurres.
|
||||
// When bold is blocked lock is still closed even if exception occurs.
|
||||
// In all other cases state is supposed to be unknown. Example: Lock is out of reach and no more bluetooth connected.
|
||||
SelectedBike.LockInfo.State = exception is StateAwareException stateAwareException
|
||||
? stateAwareException.State
|
||||
|
@ -144,13 +144,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
if (exception is OutOfReachException)
|
||||
{
|
||||
Log.ForContext<ReservedUnknown>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
|
||||
Log.ForContext<ReservedUnknown>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<ReservedUnknown>().Error("Akkustate can not be read. {Exception}", exception);
|
||||
Log.ForContext<ReservedUnknown>().Error("Battery state can not be read. {Exception}", exception);
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
|
||||
}
|
||||
|
||||
// Get geoposition.
|
||||
// Get geolocation.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextQueryLocation;
|
||||
IGeolocation currentLocation = null;
|
||||
try
|
||||
|
|
|
@ -43,11 +43,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
|
|||
{
|
||||
case Model.State.InUseStateEnum.Disposable:
|
||||
|
||||
// Bike is reserved, selecte action depending on lock state.
|
||||
// Bike is reserved, select action depending on lock state.
|
||||
switch (selectedBluetoothLockBike.LockInfo.State)
|
||||
{
|
||||
case LockingState.Closed:
|
||||
// Unexepected state detected.
|
||||
// Unexpected state detected.
|
||||
// This state is unexpected because connection is closed
|
||||
// - when reservation is canceled or
|
||||
// - when bike is returned.
|
||||
|
@ -60,13 +60,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
|
|||
|
||||
case LockingState.Open:
|
||||
case LockingState.UnknownFromHardwareError:
|
||||
// Unexepected state detected.
|
||||
// Unexpected state detected.
|
||||
/// This state is unexpected because
|
||||
/// - app does not allow to return bike/ cancel reservation when lock is closed
|
||||
/// - as long as app is connected to lock
|
||||
/// - lock can not be opened manually
|
||||
/// - no other device can access lock
|
||||
/// Nevetheless this state is not expected let user either
|
||||
/// Nevertheless this state is not expected let user either
|
||||
/// - close lock or
|
||||
/// - rent bike
|
||||
/// </remarks>
|
||||
|
@ -100,7 +100,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
|
|||
|
||||
case Model.State.InUseStateEnum.Reserved:
|
||||
|
||||
// Bike is reserved, selecte action depending on lock state.
|
||||
// Bike is reserved, select action depending on lock state.
|
||||
switch (selectedBluetoothLockBike.LockInfo.State)
|
||||
{
|
||||
case LockingState.Closed:
|
||||
|
@ -132,7 +132,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
|
|||
|
||||
case LockingState.Open:
|
||||
// Unwanted state detected.
|
||||
/// This state might occure when a ILOCKIT was manually opened (color code) and app connects afterwards.
|
||||
/// This state might occur when a ILOCKIT was manually opened (color code) and app connects afterwards.
|
||||
Log.Error("Unwanted state {BookingState}/ {LockingState} detected.", selectedBluetoothLockBike.State.Value, selectedBluetoothLockBike.LockInfo.State);
|
||||
return new ReservedOpen(
|
||||
selectedBluetoothLockBike,
|
||||
|
@ -167,7 +167,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
|
|||
|
||||
case Model.State.InUseStateEnum.Booked:
|
||||
|
||||
// Bike is booked, selecte action depending on lock state.
|
||||
// Bike is booked, select action depending on lock state.
|
||||
switch (selectedBluetoothLockBike.LockInfo.State)
|
||||
{
|
||||
case LockingState.Closed:
|
||||
|
@ -214,7 +214,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
|
|||
|
||||
default:
|
||||
// Invalid state detected.
|
||||
// If bike is booked lock state must be querried before creating view model.
|
||||
// If bike is booked lock state must be queried before creating view model.
|
||||
return new BookedDisconnected(
|
||||
selectedBluetoothLockBike,
|
||||
isConnectedDelegate,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue