Version 3.0.340

This commit is contained in:
Anja 2022-09-20 13:51:55 +02:00
parent 52c9f6f1d9
commit bad07e1ec9
62 changed files with 1401 additions and 1000 deletions

View file

@ -1,4 +1,4 @@

using System;
using System.Collections.Generic;
using System.IO;
@ -6,6 +6,7 @@ using System.Net;
using System.Text;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Model.Logging;
using TINK.Repository.Exception;
@ -172,10 +173,11 @@ namespace TINK.Repository
lock_state state,
Uri operatorUri,
LocationDto location,
double batteryLevel) =>
double batteryLevel,
IVersionInfo versionInfo) =>
await DoUpdateLockingStateAsync(
operatorUri?.AbsoluteUri ?? m_oCopriHost.AbsoluteUri,
requestBuilder.UpateLockingState(bikeId, state, location, batteryLevel),
requestBuilder.UpateLockingState(bikeId, state, location, batteryLevel, versionInfo),
UserAgent);
/// <summary> Gets booking request request. </summary>

View file

@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository.Request;
using TINK.Repository.Response;
@ -1636,7 +1637,8 @@ namespace TINK.Repository
lock_state state,
Uri operatorUri,
LocationDto geolocation,
double batteryLevel) => null;
double batteryLevel,
IVersionInfo versionInfo) => null;
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
=> null;

View file

@ -1,7 +1,8 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MonkeyCache.FileStore;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Model.Services.CopriApi;
using TINK.Repository.Request;
@ -171,7 +172,8 @@ namespace TINK.Repository
lock_state state,
Uri operatorUri,
LocationDto geolocation,
double batteryLevel)
double batteryLevel,
IVersionInfo versionInfo)
=> throw new System.Exception("Aktualisierung des Schlossstatuses im Offlinemodus nicht möglich!");
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)

View file

@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository.Request;
using TINK.Repository.Response;
@ -69,7 +70,8 @@ namespace TINK.Repository
lock_state state,
Uri operatorUri,
LocationDto location = null,
double batteryPercentage = double.NaN);
double batteryPercentage = double.NaN,
IVersionInfo versionInfo = null);
/// <summary> Books a bluetooth bike. </summary>
/// <param name="bikeId">Id of the bike to book.</param>

View file

@ -1,5 +1,6 @@
using System;
using System;
using System.Collections.Generic;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
namespace TINK.Repository.Request
@ -63,14 +64,16 @@ namespace TINK.Repository.Request
/// <summary> Gets the request for updating lock state for a booked bike. </summary>
/// <param name="bikeId">Id of the bike to update locking state for.</param>
/// <param name="location">Geolocation of lock when state change occurred.</param>
/// <param name="state">New locking state.</param>
/// <param name="location">Geolocation of lock when state change occurred.</param>
/// <param name="versionInfo">Information about lock (firmware version, hardware version, ...).</param>
/// <returns>Request to update locking state.</returns>
string UpateLockingState(
string bikeId,
lock_state state,
LocationDto location = null,
double batteryPercentage = double.NaN);
double batteryPercentage = double.NaN,
IVersionInfo versionInfo = null);
/// <summary> Gets the booking request (synonym: booking == renting == mieten). </summary>
/// <param name="bikeId">Id of the bike to book.</param>

View file

@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Net;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository.Exception;
@ -101,7 +102,11 @@ namespace TINK.Repository.Request
public string StartReturningBike(string bikeId)
=> throw new NotSupportedException();
public string UpateLockingState(string bikeId, lock_state state, LocationDto geolocation, double batteryPercentage)
/// <summary>
/// Not supported if user is not logged in. Lock state is only updated after open/ close which is only possible if user is logged in.
/// </summary>
/// <exception cref="NotSupportedException"></exception>
public string UpateLockingState(string bikeId, lock_state state, LocationDto geolocation, double batteryPercentage, IVersionInfo versionInfo)
=> throw new NotSupportedException();
public string DoBook(string bikeId, Guid guid, double batteryPercentage)

View file

@ -1,8 +1,9 @@
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository.Exception;
using TINK.Services.Logging;
@ -129,17 +130,20 @@ namespace TINK.Repository.Request
/// <remarks> Operator specific call.</remarks>
/// <param name="bikeId">Id of the bike to update locking state for.</param>
/// <param name="state">New locking state.</param>
/// <param name="versionInfo">Information about lock (firmware version, hardware version, ...).</param>
/// <returns>Request to update locking state.</returns>
public string UpateLockingState(
string bikeId,
lock_state state,
LocationDto geolocation,
double batteryPercentage)
double batteryPercentage,
IVersionInfo versionInfo)
=> "request=booking_update" +
GetBikeIdParameter(bikeId) +
GetLocationParameters(geolocation) +
GetLockStateParameter(state) +
GetBatteryPercentageParameters(batteryPercentage) +
GetVersionInfoParameter(versionInfo) +
AuthCookieParameter +
UiIsoLanguageNameParameter;
@ -272,6 +276,10 @@ namespace TINK.Repository.Request
? $"&voltage={batteryPercentage.ToString(CultureInfo.InvariantCulture)}"
: string.Empty;
private static string GetVersionInfoParameter(IVersionInfo versionInfo) => versionInfo?.FirmwareVersion > 0 || versionInfo?.HardwareVersion > 0 || versionInfo?.LockVersion > 0
? $"&firmware=HW%20{versionInfo.HardwareVersion};FW%20{versionInfo.FirmwareVersion};Lock%20{versionInfo.LockVersion}"
: string.Empty;
/// <summary> Gets the geolocation parameter. </summary>
/// <param name="geolocation">Geolocation or null.</param>
private static string GetLocationParameters(LocationDto geolocation)