Version 3.0.270

This commit is contained in:
Oliver Hauff 2022-01-04 18:59:16 +01:00
parent 67999ef4ae
commit e0c75d5b37
81 changed files with 812 additions and 474 deletions

View file

@ -27,7 +27,7 @@ namespace TINK.Model.Bike.BC
WheelType? wheelType = null,
TypeOfBike? typeOfBike = null,
string description = null,
string currentStationId = null,
string stationId = null,
Uri operatorUri = null,
TariffDescription tariffDescription = null)
{
@ -37,7 +37,7 @@ namespace TINK.Model.Bike.BC
IsDemo = isDemo ?? DEFAULTVALUEISDEMO;
Group = group ?? new List<string>();
CurrentStation = currentStationId;
StationId = stationId;
OperatorUri = operatorUri;
TariffDescription = tariffDescription;
}
@ -50,7 +50,7 @@ namespace TINK.Model.Bike.BC
bikeInfo.WheelType,
bikeInfo.TypeOfBike,
bikeInfo.Description,
bikeInfo.CurrentStation,
bikeInfo.StationId,
bikeInfo.OperatorUri,
bikeInfo.TariffDescription) { }
@ -58,13 +58,13 @@ namespace TINK.Model.Bike.BC
/// Constructs a bike info object for a available bike.
/// </summary>
/// <param name="id">Unique id of bike.</param>
/// <param name="currentStationId">Id of station where bike is located.</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>
/// <param name="wheelType"></param>
public BikeInfo(
string id,
string currentStationId,
string stationId,
Uri operatorUri = null,
TariffDescription tariffDescription = null,
bool? isDemo = DEFAULTVALUEISDEMO,
@ -79,7 +79,7 @@ namespace TINK.Model.Bike.BC
wheelType,
typeOfBike,
description,
currentStationId,
stationId,
operatorUri,
tariffDescription)
{
@ -179,7 +179,7 @@ namespace TINK.Model.Bike.BC
/// <summary>
/// Station a which bike is located, null otherwise.
/// </summary>
public string CurrentStation { get; }
public string StationId { get; }
/// <summary> Holds description about the tarif. </summary>
public TariffDescription TariffDescription { get; }
@ -210,7 +210,7 @@ namespace TINK.Model.Bike.BC
/// </summary>
public new string ToString()
{
return $"Id={Bike.Id}{(Bike.WheelType != null ? $", wheel(s)={Bike.WheelType}" : string.Empty)}{(Bike.TypeOfBike != null ? $"type={Bike.TypeOfBike}" : "")}, state={State}, location={(!string.IsNullOrEmpty(CurrentStation)? $"Station {CurrentStation}" : "On the road")}, is demo={IsDemo}.";
return $"Id={Bike.Id}{(Bike.WheelType != null ? $", wheel(s)={Bike.WheelType}" : string.Empty)}{(Bike.TypeOfBike != null ? $"type={Bike.TypeOfBike}" : "")}, state={State}, location={(!string.IsNullOrEmpty(StationId)? $"Station {StationId}" : "On the road")}, is demo={IsDemo}.";
}
}
}

View file

@ -24,7 +24,7 @@ namespace TINK.Model.Bike.BC
/// <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="wheelType"></param>
/// <param name="currentStationId">Name of station where bike is located, null if bike is on the road.</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>
/// <param name="stateInfo">Bike state info.</param>
@ -35,7 +35,8 @@ namespace TINK.Model.Bike.BC
WheelType? wheelType = null,
TypeOfBike? typeOfBike = null,
string description = null,
string currentStationId = null,
string stationId = null,
string stationName = null,
Uri operatorUri = null,
TariffDescription tariffDescription = null,
Func<DateTime> dateTimeProvider = null,
@ -46,32 +47,36 @@ namespace TINK.Model.Bike.BC
m_oBike = new Bike(id, wheelType, typeOfBike, description);
m_oStateInfo = new StateInfoMutable(dateTimeProvider, stateInfo);
m_oStateInfo.PropertyChanged += (sender, eventargs) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(eventargs.PropertyName));
CurrentStation = currentStationId;
StationId = stationId;
StationName = stationName;
OperatorUri = operatorUri;
TariffDescription = tariffDescription;
}
/// <summary> Constructs a bike object from source. </summary>
public BikeInfoMutable(IBikeInfo p_oBike) : this(
p_oBike.Id,
p_oBike.IsDemo,
p_oBike.Group,
p_oBike.WheelType,
p_oBike.TypeOfBike,
p_oBike.Description,
p_oBike.CurrentStation,
p_oBike.OperatorUri,
p_oBike.TariffDescription,
public BikeInfoMutable(IBikeInfo bike, string stationName) : this(
bike.Id,
bike.IsDemo,
bike.Group,
bike.WheelType,
bike.TypeOfBike,
bike.Description,
bike.StationId,
stationName,
bike.OperatorUri,
bike.TariffDescription,
null,
p_oBike.State)
bike.State)
{
}
/// <summary>
/// Station a which bike is located, null otherwise.
/// </summary>
/// <summary> Id of station a which bike is located, null otherwise.</summary>
[DataMember]
public string CurrentStation { get; }
public string StationId { get; }
/// <summary> Name of station a which bike is located, null otherwise. </summary>
[DataMember]
public string StationName { get; }
/// <summary> Holds description about the tarif. </summary>
[DataMember]
@ -118,7 +123,7 @@ namespace TINK.Model.Bike.BC
/// <returns></returns>
public new string ToString()
{
return $"Id={Id}{(WheelType != null ? $", wheel(s)={WheelType}" : string.Empty)}{(TypeOfBike != null ? $", type={TypeOfBike}" : "")}, demo={IsDemo}, state={State.ToString()}, location={(!string.IsNullOrEmpty(CurrentStation) ? $"Station {CurrentStation}" : "On the road")}.";
return $"Id={Id}{(WheelType != null ? $", wheel(s)={WheelType}" : string.Empty)}{(TypeOfBike != null ? $", type={TypeOfBike}" : "")}, demo={IsDemo}, state={State.ToString()}, location={(!string.IsNullOrEmpty(StationId) ? $"Station {StationId}" : "On the road")}.";
}
}
}

View file

@ -37,7 +37,7 @@ namespace TINK.Model.Bike.BC
/// <summary>
/// Station a which bike is located, null otherwise.
/// </summary>
string CurrentStation { get; }
string StationId { get; }
/// <summary>
/// Uri of the operator or null, in case of single operator setup.

View file

@ -35,7 +35,7 @@ namespace TINK.Model.Bikes.Bike.BC
/// <summary>
/// Station a which bike is located, null otherwise.
/// </summary>
string CurrentStation { get; }
string StationId { get; }
/// <summary>
/// Holds the rent state of the bike.

View file

@ -1,5 +1,4 @@
using System;
using TINK.Model.Bikes.Bike;
using TINK.Model.Bikes.Bike.BluetoothLock;
namespace TINK.Model.Bike.BluetoothLock
@ -7,14 +6,15 @@ namespace TINK.Model.Bike.BluetoothLock
public class BikeInfoMutable : BC.BikeInfoMutable, IBikeInfoMutable
{
/// <summary> Constructs a bike object from source. </summary>
public BikeInfoMutable(BikeInfo bike) : base(
public BikeInfoMutable(BikeInfo bike, string stationName) : base(
bike.Id,
bike.IsDemo,
bike.Group,
bike.WheelType,
bike.TypeOfBike,
bike.Description,
bike.CurrentStation,
bike.StationId,
stationName,
bike.OperatorUri,
bike.TariffDescription,
() => DateTime.Now,