mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-21 20:46:28 +02:00
Version 3.0.363
This commit is contained in:
parent
4ff3307997
commit
91d42552c7
212 changed files with 1799 additions and 1318 deletions
|
@ -6,7 +6,7 @@ using TINK.Model.State;
|
|||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.BC
|
||||
{
|
||||
public class BikeInfo : IBikeInfo
|
||||
public abstract class BikeInfo : IBikeInfo
|
||||
{
|
||||
/// <summary> Default value of demo property. </summary>
|
||||
public const bool DEFAULTVALUEISDEMO = false;
|
||||
|
@ -64,72 +64,6 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
bikeInfo.TariffDescription)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a bike info object for a available bike.
|
||||
/// </summary>
|
||||
/// <param name="dataSource">Specified the source of the data.</param>
|
||||
/// <param name="stationId">Id of station where bike is located.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
public BikeInfo(
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
DataSource dataSource,
|
||||
string stationId,
|
||||
Uri operatorUri = null,
|
||||
RentalDescription tariffDescription = null,
|
||||
bool? isDemo = DEFAULTVALUEISDEMO,
|
||||
IEnumerable<string> group = null) : this(
|
||||
new StateInfo(),
|
||||
bike,
|
||||
drive,
|
||||
dataSource,
|
||||
isDemo,
|
||||
group,
|
||||
stationId,
|
||||
operatorUri,
|
||||
tariffDescription)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a bike info object for a booked bike.
|
||||
/// </summary>
|
||||
/// <param name="dataSource">Specified the source of the data.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remainig time on demand for state of type reserved.</param>
|
||||
/// <param name="currentStationId">Name of station where bike is located, null if bike is on the road.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="bookedAt">Date time when bike was booked</param>
|
||||
/// <param name="mailAddress">Mail address of user which booked bike.</param>
|
||||
/// <param name="code">Booking code.</param>
|
||||
public BikeInfo(
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
DataSource dataSource,
|
||||
bool? isDemo,
|
||||
IEnumerable<string> group,
|
||||
string currentStationId,
|
||||
Uri operatorUri,
|
||||
RentalDescription tariffDescription,
|
||||
DateTime bookedAt,
|
||||
string mailAddress,
|
||||
string code) : this(
|
||||
new StateInfo(
|
||||
bookedAt,
|
||||
mailAddress,
|
||||
code),
|
||||
bike,
|
||||
drive,
|
||||
dataSource,
|
||||
isDemo,
|
||||
group,
|
||||
currentStationId,
|
||||
operatorUri,
|
||||
tariffDescription)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary> True if device is demo device, false otherwise. </summary>
|
||||
public bool IsDemo { get; }
|
||||
|
||||
|
@ -141,7 +75,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
/// </summary>
|
||||
public string StationId { get; }
|
||||
|
||||
/// <summary> Holds description about the tarif. </summary>
|
||||
/// <summary> Holds description about the tariff. </summary>
|
||||
public RentalDescription TariffDescription { get; }
|
||||
|
||||
/// Holds the rent state of the bike.
|
||||
|
|
|
@ -9,7 +9,7 @@ using TINK.Model.State;
|
|||
namespace TINK.Model.Bikes.BikeInfoNS.BC
|
||||
{
|
||||
[DataContract]
|
||||
public class BikeInfoMutable : IBikeInfoMutable, INotifyPropertyChanged
|
||||
public abstract class BikeInfoMutable : IBikeInfoMutable, INotifyPropertyChanged
|
||||
{
|
||||
/// <summary> Holds the bike. </summary>
|
||||
private readonly Bike _Bike;
|
||||
|
@ -24,7 +24,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
/// Constructs a bike.
|
||||
/// </summary>
|
||||
/// <param name="isDemo">True if device is demo device, false otherwise.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remainig time on demand for state of type reserved.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remaining time on demand for state of type reserved.</param>
|
||||
/// <param name="stationId">Name of station where bike is located, null if bike is on the road.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
|
@ -55,24 +55,6 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
TariffDescription = tariffDescription;
|
||||
}
|
||||
|
||||
/// <summary> Constructs a bike object from source. </summary>
|
||||
public BikeInfoMutable(IBikeInfo bike, string stationName) : this(
|
||||
bike != null
|
||||
? bike.Bike
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
bike.Drive,
|
||||
bike.DataSource,
|
||||
bike.IsDemo,
|
||||
bike.Group,
|
||||
bike.StationId,
|
||||
stationName,
|
||||
bike.OperatorUri,
|
||||
bike.TariffDescription,
|
||||
null /* date time provider */,
|
||||
bike.State)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary> Id of station a which bike is located, null otherwise.</summary>
|
||||
[DataMember]
|
||||
public string StationId { get; }
|
||||
|
@ -81,7 +63,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
[DataMember]
|
||||
public string StationName { get; }
|
||||
|
||||
/// <summary> Holds description about the tarif. </summary>
|
||||
/// <summary> Holds description about the tariff. </summary>
|
||||
[DataMember]
|
||||
public RentalDescription TariffDescription { get; private set; }
|
||||
|
||||
|
@ -113,6 +95,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
|
||||
public TypeOfBike? TypeOfBike => _Bike.TypeOfBike;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether bike is a AA bike (bike must be always returned a the same station) or AB bike (start and end stations can be different stations).
|
||||
/// </summary>
|
||||
public AaRideType? AaRideType => _Bike.AaRideType;
|
||||
|
||||
|
||||
public LockModel LockModel => _Bike.LockModel;
|
||||
|
||||
public string Description => _Bike.Description;
|
||||
|
|
|
@ -30,6 +30,11 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
/// </summary>
|
||||
TypeOfBike? TypeOfBike { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether bike is a AA bike (bike must be always returned a the same station) or AB bike (start and end stations can be different stations).
|
||||
/// </summary>
|
||||
AaRideType? AaRideType { get; }
|
||||
|
||||
/// <summary> Gets the model of the lock. </summary>
|
||||
LockModel LockModel { get; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.BikeNS
|
||||
|
@ -21,12 +21,19 @@ namespace TINK.Model.Bikes.BikeInfoNS.BikeNS
|
|||
City = 2,
|
||||
}
|
||||
|
||||
/// <summary> Holds whether bike is a AA bike (bike must be always returned a the same station) or AB bike (start and end stations can be different stations).</summary>
|
||||
public enum AaRideType
|
||||
{
|
||||
NoAaRide = 0,
|
||||
AaRide = 1,
|
||||
}
|
||||
|
||||
/// <summary> Holds the model of lock. </summary>
|
||||
public enum LockModel
|
||||
{
|
||||
ILockIt, // haveltec GbmH Brandenburg, Germany bluetooth lock
|
||||
BordComputer, // Teilrad BC
|
||||
Sigo, // Sigo Gmbh Darmstadt, Germany bike lock
|
||||
BordComputer, // TeilRad BC
|
||||
Sigo, // Sigo GmbH Darmstadt, Germany bike lock
|
||||
}
|
||||
|
||||
/// <summary> Holds the type of lock. </summary>
|
||||
|
@ -47,10 +54,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.BikeNS
|
|||
LockModel lockModel,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
AaRideType? aaRideType = null,
|
||||
string description = null)
|
||||
{
|
||||
WheelType = wheelType;
|
||||
TypeOfBike = typeOfBike;
|
||||
AaRideType = aaRideType;
|
||||
LockModel = lockModel;
|
||||
Id = id;
|
||||
Description = description;
|
||||
|
@ -71,6 +80,11 @@ namespace TINK.Model.Bikes.BikeInfoNS.BikeNS
|
|||
/// </summary>
|
||||
public TypeOfBike? TypeOfBike { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether bike is a AA bike (bike must be always returned a the same station) or AB bike (start and end stations can be different stations).
|
||||
/// </summary>
|
||||
public AaRideType? AaRideType { get; }
|
||||
|
||||
/// <summary> Gets the model of the lock. </summary>
|
||||
public LockModel LockModel { get; private set; }
|
||||
|
||||
|
|
|
@ -33,9 +33,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.ILockIt /* Ensure consistend lock model value */,
|
||||
LockModel.ILockIt /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
@ -53,7 +54,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
/// Constructs a bike info object for a requested bike.
|
||||
/// </summary>
|
||||
/// <param name="dataSource">Specified the source of the data.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remainig time on demand for state of type reserved.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remaining time on demand for state of type reserved.</param>
|
||||
/// <param name="lockId">Id of the lock.</param>
|
||||
/// <param name="lockGuid">GUID specifying the lock.</param>
|
||||
/// <param name="requestedAt">Date time when bike was requested</param>
|
||||
|
@ -61,7 +62,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
/// <param name="currentStationId">Name of station where bike is located, null if bike is on the road.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="dateTimeProvider">Date time provider to calculate reaining time.</param>
|
||||
/// <param name="dateTimeProvider">Date time provider to calculate remaining time.</param>
|
||||
public BikeInfo(
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
|
@ -87,9 +88,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.ILockIt /* Ensure consistend lock model value */,
|
||||
LockModel.ILockIt /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
@ -139,9 +141,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.ILockIt /* Ensure consistend lock model value */,
|
||||
LockModel.ILockIt /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(),
|
||||
drive,
|
||||
|
@ -155,7 +158,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
LockInfo = new LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
|
||||
}
|
||||
|
||||
public BikeInfo(Model.Bikes.BikeInfoNS.BC.BikeInfo bikeInfo, LockInfo lockInfo) : base(
|
||||
public BikeInfo(BC.BikeInfo bikeInfo, LockInfo lockInfo) : base(
|
||||
bikeInfo ?? throw new ArgumentException($"Can not copy-construct {typeof(BikeInfo).Name}-object. Source bike info must not be null."))
|
||||
{
|
||||
LockInfo = lockInfo
|
||||
|
|
|
@ -38,8 +38,9 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.Sigo,
|
||||
bike.WheelType /* Ensure consistend lock model value */,
|
||||
bike.WheelType /* Ensure consistent lock model value */,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
@ -66,7 +67,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
/// <param name="lockInfo">Lock info.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remainig time on demand for state of type reserved.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remaining time on demand for state of type reserved.</param>
|
||||
public BikeInfo(
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
|
@ -88,9 +89,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.Sigo /* Ensure consistend lock model value */,
|
||||
LockModel.Sigo /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
@ -136,9 +138,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.Sigo /* Ensure consistend lock model value */,
|
||||
LockModel.Sigo /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
return;
|
||||
}
|
||||
|
||||
// Add a dummy querry. Querries are not yet read from COPRI but compiled into the app.
|
||||
// Add a dummy query. Querries are not yet read from COPRI but compiled into the app.
|
||||
BookingFinishedModel.MiniSurvey.Questions.Add("q1", new MiniSurvey.QuestionModel());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Serilog;
|
||||
using Serilog;
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
||||
{
|
||||
|
@ -12,12 +12,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
public double CurrentChargePercent { get; private set; } = double.NaN;
|
||||
|
||||
/// <summary>
|
||||
/// Holds the current chargeing level of the battery in bars, null if unkonwn.
|
||||
/// Holds the current charging level of the battery in bars, null if unknown.
|
||||
/// </summary>
|
||||
public int? CurrentChargeBars { get; private set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Holds the maximum chargeing level of the battery in bars, null if unkonwn.
|
||||
/// Holds the maximum charging level of the battery in bars, null if unknown.
|
||||
/// </summary>
|
||||
public int? MaxChargeBars { get; private set; } = null;
|
||||
|
||||
|
@ -34,12 +34,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
public class Builder
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the current chargeing level of the battery in bars.
|
||||
/// Holds the current charging level of the battery in bars.
|
||||
/// </summary>
|
||||
public int? CurrentChargeBars { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Holds the maximum chargeing level of the battery in bars.
|
||||
/// Holds the maximum charging level of the battery in bars.
|
||||
/// </summary>
|
||||
public int? MaxChargeBars { get; set; } = null;
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
&& MaxChargeBars == null)
|
||||
{
|
||||
// If current charge bars is set, max charge must be set as well.
|
||||
Log.ForContext<Battery>().Error($"Current bars value can not be set to {CurrentChargeBars} if max bars is not se.");
|
||||
Log.ForContext<Battery>().Error($"Current bars value can not be set to {CurrentChargeBars} if max bars is not set.");
|
||||
CurrentChargeBars = null;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
&& CurrentChargeBars > MaxChargeBars)
|
||||
{
|
||||
// If current charge bars must never be larger than max charge bars.
|
||||
Log.ForContext<Battery>().Error($"Invalid current bars value {CurrentChargeBars} detected. Value must never be largen than max value bars {MaxChargeBars}.");
|
||||
Log.ForContext<Battery>().Error($"Invalid current bars value {CurrentChargeBars} detected. Value must never be larger than max value bars {MaxChargeBars}.");
|
||||
CurrentChargeBars = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
||||
{
|
||||
public interface IBattery
|
||||
|
@ -9,12 +9,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
double CurrentChargePercent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the current chargeing level of the battery in bars. Must not be arger than MaxChargeBars, null if unkonwn.
|
||||
/// Holds the current charging level of the battery in bars. Must not be larger than MaxChargeBars, null if unknown.
|
||||
/// </summary>
|
||||
int? CurrentChargeBars { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the maximum chargeing level of the battery in bars, null if unkonwn.
|
||||
/// Holds the maximum charging level of the battery in bars, null if unknown.
|
||||
/// </summary>
|
||||
int? MaxChargeBars { get; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue