mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 03:27:29 +02:00
Version 3.0.337
This commit is contained in:
parent
fd0e63cf10
commit
573fe77e12
2336 changed files with 33688 additions and 86082 deletions
|
@ -58,7 +58,7 @@ namespace TINK.Services.BluetoothLock.Crypto
|
|||
}
|
||||
|
||||
accessKey[accessKey.Length - 1] += 1;
|
||||
|
||||
|
||||
var keyCopri = KeyCopri;
|
||||
byte[] acccessKeyEncrypted;
|
||||
try
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
{
|
||||
public class AlreadyConnectedException : System.Exception
|
||||
{
|
||||
public AlreadyConnectedException() : base("Invalid reconnect call detected. Device is already connected.") {}
|
||||
public AlreadyConnectedException() : base("Invalid reconnect call detected. Device is already connected.") { }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Exception
|
||||
{
|
||||
|
|
|
@ -4,6 +4,6 @@ namespace TINK.Services.BluetoothLock.Exception
|
|||
{
|
||||
public class ConnectLocationPermissionMissingException : System.Exception
|
||||
{
|
||||
public ConnectLocationPermissionMissingException() : base(Resources.ErrorConnectLockLocationPermissingMissingException) { }
|
||||
public ConnectLocationPermissionMissingException() : base(Resources.ErrorConnectLockLocationPermissingMissingException) { }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Exception
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.MultilingualResources;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Exception
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Exception
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Exception
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace TINK.Services.BluetoothLock.Exception
|
|||
public class CouldntOpenBoldIsBlockedException : StateAwareException
|
||||
{
|
||||
public CouldntOpenBoldIsBlockedException() : base(
|
||||
LockingState.UnknownFromHardwareError,
|
||||
LockingState.UnknownFromHardwareError,
|
||||
MultilingualResources.Resources.ErrorOpenLockBoldBlocked)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Exception
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.MultilingualResources;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Exception
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
namespace TINK.Services.BluetoothLock.Exception
|
||||
{
|
||||
/// <summary> Thrown whenever lock is out of reach.</summary>
|
||||
/// <remarks> If fired when scan for devices does not result in lock beeing found.</remarks>
|
||||
public class OutOfReachException : System.Exception
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Exception
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace TINK.Services.BluetoothLock
|
|||
Task ReconnectAsync(
|
||||
LockInfoAuthTdo authInfo,
|
||||
TimeSpan connectTimeout);
|
||||
|
||||
|
||||
/// <summary> Opens lock. </summary>
|
||||
/// <returns> State of lock after performing open operation. </returns>
|
||||
Task<LockitLockingState?> OpenAsync();
|
||||
|
@ -42,7 +42,7 @@ namespace TINK.Services.BluetoothLock
|
|||
/// <param name="doWaitRetry">True if to wait and retry in case of failures. </param>
|
||||
/// <returns></returns>
|
||||
Task<LockInfoTdo> GetLockStateAsync(bool doWaitRetry = false);
|
||||
|
||||
|
||||
Task<bool> SetSoundAsync(SoundSettings settings);
|
||||
|
||||
Task<bool> SetAlarmSettingsAsync(AlarmSettings settings);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
||||
namespace TINK.Services.BluetoothLock
|
||||
|
@ -12,22 +12,22 @@ namespace TINK.Services.BluetoothLock
|
|||
ITimeOutProvider TimeOut { get; set; }
|
||||
|
||||
/// <summary> Gets lock info for all lock in reach./// </summary>
|
||||
/// <param name="connectTimeout">Timeout for connect operation of a single lock.</param>
|
||||
/// <param name="connectTimeout">Timeout for connect operation of a single lock.</param>
|
||||
Task<IEnumerable<LockInfoTdo>> GetLocksStateAsync(
|
||||
IEnumerable<LockInfoAuthTdo> locksInfo,
|
||||
IEnumerable<LockInfoAuthTdo> locksInfo,
|
||||
TimeSpan connectTimeout);
|
||||
|
||||
/// <summary> Connects to lock.</summary>
|
||||
/// <param name="authInfo"> Info required to connect to lock.</param>
|
||||
/// <param name="connectTimeout">Timeout for connect operation.</param>
|
||||
Task<LockInfoTdo> ConnectAsync(
|
||||
LockInfoAuthTdo authInfo,
|
||||
LockInfoAuthTdo authInfo,
|
||||
TimeSpan connectTimeout);
|
||||
|
||||
/// <summary>Gets a lock by bike Id.</summary>
|
||||
/// <param name="bikeId"></param>
|
||||
/// <returns>Lock object</returns>
|
||||
ILockService this[int bikeId] { get; }
|
||||
ILockService this[int bikeId] { get; }
|
||||
|
||||
/// <summary> Disconnects lock.</summary>
|
||||
/// <param name="bikeId"> Id of lock to disconnect.</param>
|
||||
|
@ -41,7 +41,7 @@ namespace TINK.Services.BluetoothLock
|
|||
public enum AlarmSettings
|
||||
{
|
||||
SmallSensivity = 2,
|
||||
SmallSensivitySilent = 3,
|
||||
SmallSensivitySilent = 3,
|
||||
SmallSensitivityPrealarm = 22,
|
||||
MediumSensivity = 4,
|
||||
MediumSensivitySilent = 0x05,
|
||||
|
@ -60,7 +60,7 @@ namespace TINK.Services.BluetoothLock
|
|||
LockingStarted = 0x02,
|
||||
AllOff = 0x03, // Mute
|
||||
OpenedSuccessfully = 0x04,
|
||||
LockingStartedOpenedSuccessfully = 0x05,
|
||||
LockingStartedOpenedSuccessfully = 0x05,
|
||||
AllOn = 0x06, // All sounds on
|
||||
OpenedSuccessfullyWarn = 0x07,
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
||||
namespace TINK.Model.Bike.BluetoothLock
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
||||
{
|
||||
public static class LockInfoHelper
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace TINK.Model.Bike.BluetoothLock
|
|||
/// <param name="locksInfoTdo">Tdos holding data to updat from</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<LockInfo> UpdateById(
|
||||
this IEnumerable<LockInfo> locksInfo,
|
||||
this IEnumerable<LockInfo> locksInfo,
|
||||
IEnumerable<LockInfoTdo> locksInfoTdo)
|
||||
{
|
||||
var locksInfoUpdated = new List<LockInfo>();
|
||||
|
@ -30,7 +30,7 @@ namespace TINK.Model.Bike.BluetoothLock
|
|||
var state = lockInfoTdo.State.HasValue ? lockInfoTdo.State.Value.GetLockingState() : LockingState.UnknownDisconnected;
|
||||
|
||||
locksInfoUpdated.Add(state != lockInfo.State || lockInfoTdo.Guid != lockInfo.Guid
|
||||
? new LockInfo.Builder(lockInfo) { Guid = lockInfoTdo.Guid, State = state}.Build() // State has changed, update required.
|
||||
? new LockInfo.Builder(lockInfo) { Guid = lockInfoTdo.Guid, State = state }.Build() // State has changed, update required.
|
||||
: lockInfo);
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,6 @@ namespace TINK.Model.Bike.BluetoothLock
|
|||
return new LockInfoAuthTdo.Builder() { Id = lockInfo.Id, Guid = lockInfo.Guid, K_u = lockInfo.UserKey, K_a = lockInfo.AdminKey, K_seed = lockInfo.Seed }.Build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace LockItShared.Services.BluetoothLock
|
||||
{
|
||||
|
@ -9,7 +8,7 @@ namespace LockItShared.Services.BluetoothLock
|
|||
/// <summary>
|
||||
/// Holds guids of developent locks to ensure that no wrong guid are provided by COPRI
|
||||
/// </summary>
|
||||
public static Dictionary<int, Guid> DevelGuids = new Dictionary<int, Guid>
|
||||
public static Dictionary<int, Guid> DevelGuids = new Dictionary<int, Guid>
|
||||
{
|
||||
{ 2200537, new Guid("00000000-0000-0000-0000-d589a8023487") },
|
||||
{ 2200543, new Guid("00000000-0000-0000-0000-cc141a6f68bb") },
|
||||
|
|
|
@ -19,44 +19,44 @@ namespace TINK.Services.BluetoothLock
|
|||
public Task ReconnectAsync(LockInfoAuthTdo authInfo, TimeSpan connectTimeout) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
public string Name =>
|
||||
public string Name =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
public Guid Guid =>
|
||||
public Guid Guid =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
public int Id =>
|
||||
public int Id =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
public async Task<LockitLockingState?> OpenAsync() =>
|
||||
await Task.FromResult((LockitLockingState?)null);
|
||||
|
||||
public async Task<LockitLockingState?> CloseAsync() =>
|
||||
public async Task<LockitLockingState?> CloseAsync() =>
|
||||
await Task.FromResult((LockitLockingState?)null);
|
||||
|
||||
public Task<double> GetBatteryPercentageAsync() =>
|
||||
public Task<double> GetBatteryPercentageAsync() =>
|
||||
throw new System.Exception($"Can not get battery percentage. Lock {BikeId} not found.");
|
||||
|
||||
public DeviceState? GetDeviceState() =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
public Task<bool> GetIsAlarmOffAsync() =>
|
||||
public Task<bool> GetIsAlarmOffAsync() =>
|
||||
throw new System.Exception($"Can not get whether alarm is on or off. Lock {BikeId} not found.");
|
||||
|
||||
public Task<LockInfoTdo> GetLockStateAsync(bool doWaitRetry = false) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
public Task SetIsAlarmOffAsync(bool isActivated) =>
|
||||
public Task SetIsAlarmOffAsync(bool isActivated) =>
|
||||
throw new System.Exception($"Can not set alarm {isActivated}. Lock {BikeId} not found.");
|
||||
|
||||
public async Task<bool> SetSoundAsync(SoundSettings settings) =>
|
||||
public async Task<bool> SetSoundAsync(SoundSettings settings) =>
|
||||
await Task.FromResult(false);
|
||||
|
||||
public async Task<bool> SetAlarmSettingsAsync(AlarmSettings settings) =>
|
||||
await Task.FromResult(false);
|
||||
|
||||
/// <summary> Disconnect from bluetooth lock. </summary>
|
||||
public Task Disconnect() =>
|
||||
public Task Disconnect() =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using TINK.Model.Connector;
|
||||
using System;
|
||||
using System;
|
||||
using TINK.Model.Connector;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Tdo
|
||||
{
|
||||
|
|
|
@ -6,15 +6,15 @@ namespace TINK.Services.BluetoothLock.Tdo
|
|||
public enum LockitLockingState
|
||||
{
|
||||
Open = 0x00,
|
||||
|
||||
|
||||
Closed = 0x01,
|
||||
|
||||
|
||||
Unknown = 0x02,
|
||||
|
||||
CouldntCloseMoving = 0x03,
|
||||
|
||||
|
||||
CouldntOpenBoldBlocked = 0x04,
|
||||
|
||||
|
||||
CouldntCloseBoldBlocked = 0x05
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace TINK.Services.BluetoothLock
|
|||
|
||||
public TimeSpan MultiConnect => TimeOuts.ToArray()[0];
|
||||
|
||||
public TimeSpan GetSingleConnect(int countOfTry) => countOfTry < TimeOuts.Count
|
||||
? TimeOuts.ToArray()[countOfTry]
|
||||
: new TimeSpan(TimeOuts.ToArray()[0].Ticks * Math.Min(countOfTry, MAXIMUMFACTORTIMEOUT)) ;
|
||||
public TimeSpan GetSingleConnect(int countOfTry) => countOfTry < TimeOuts.Count
|
||||
? TimeOuts.ToArray()[countOfTry]
|
||||
: new TimeSpan(TimeOuts.ToArray()[0].Ticks * Math.Min(countOfTry, MAXIMUMFACTORTIMEOUT));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue