mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +02:00
Version 3.0.340
This commit is contained in:
parent
52c9f6f1d9
commit
bad07e1ec9
62 changed files with 1401 additions and 1000 deletions
|
@ -20,7 +20,6 @@
|
|||
<ItemGroup>
|
||||
<Folder Include="Model\Device\" />
|
||||
<Folder Include="Services\BluetoothLock\Crypto\" />
|
||||
<Folder Include="Services\BluetoothLock\Tdo\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using TINK.Model.Connector;
|
||||
|
@ -53,39 +53,32 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
|
||||
public bool IsGuidValid => Guid != TextToLockItTypeHelper.INVALIDLOCKGUID;
|
||||
|
||||
public override bool Equals(object obj) => this.Equals(obj as LockInfo);
|
||||
public override bool Equals(object obj)
|
||||
=> Equals(obj as LockInfo);
|
||||
|
||||
public bool Equals(LockInfo other)
|
||||
{
|
||||
if (Object.ReferenceEquals(other, null)) return false;
|
||||
if (Object.ReferenceEquals(this, other)) return true;
|
||||
if (this.GetType() != other.GetType()) return false;
|
||||
if (ReferenceEquals(other, null)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
if (GetType() != other.GetType()) return false;
|
||||
|
||||
return ToString() == other.ToString();
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return ToString().GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => ToString().GetHashCode();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
public override string ToString() => JsonConvert.SerializeObject(this);
|
||||
|
||||
public static bool operator ==(LockInfo lhs, LockInfo rhs)
|
||||
{
|
||||
if (Object.ReferenceEquals(lhs, null))
|
||||
return Object.ReferenceEquals(rhs, null) ? true /*null == null = true*/: false;
|
||||
if (ReferenceEquals(lhs, null))
|
||||
return ReferenceEquals(rhs, null) ? true /*null == null = true*/: false;
|
||||
|
||||
return lhs.Equals(rhs);
|
||||
}
|
||||
|
||||
public static bool operator !=(LockInfo lhs, LockInfo rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
=> !(lhs == rhs);
|
||||
|
||||
public class Builder
|
||||
{
|
||||
|
@ -127,6 +120,5 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
return LockInfo;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
||||
|
@ -49,6 +49,17 @@ namespace TINK.Services.BluetoothLock
|
|||
|
||||
Task<bool> GetIsAlarmOffAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get info about lock firmware- hardware- and lock-version.
|
||||
/// </summary>
|
||||
/// <returns>Lock versions info.</returns>
|
||||
Task<VersionInfoTdo> GetVersionInfoAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Holds info about lock firmware- hardware- and lock-version, null if info has not yet been read.
|
||||
/// </summary>
|
||||
VersionInfoTdo VersionInfo { get; }
|
||||
|
||||
Task SetIsAlarmOffAsync(bool isActivated);
|
||||
|
||||
/// <summary>Gets the battery percentage.</summary>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
||||
|
@ -37,6 +37,13 @@ namespace TINK.Services.BluetoothLock
|
|||
public Task<double> GetBatteryPercentageAsync() =>
|
||||
throw new System.Exception($"Can not get battery percentage. Lock {BikeId} not found.");
|
||||
|
||||
public Task<VersionInfoTdo> GetVersionInfoAsync() =>
|
||||
throw new System.Exception($"Can not get versions. Lock {BikeId} not found.");
|
||||
|
||||
public VersionInfoTdo VersionInfo
|
||||
{
|
||||
get => throw new System.Exception($"Can not get versions. Lock {BikeId} not found.");
|
||||
}
|
||||
public DeviceState? GetDeviceState() =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
|
|
41
LockItShared/Services/BluetoothLock/Tdo/VersionInfoTdo.cs
Normal file
41
LockItShared/Services/BluetoothLock/Tdo/VersionInfoTdo.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
namespace TINK.Services.BluetoothLock.Tdo
|
||||
{
|
||||
public class VersionInfoTdo
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about firmware- and hardware version of a lock and the type of lock (lock version).
|
||||
/// </summary>
|
||||
private VersionInfoTdo() { }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the firmware version of the lock.
|
||||
/// </summary>
|
||||
public int FirmwareVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the hardware version (revision) of the lock.
|
||||
/// </summary>
|
||||
public int HardwareVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds lock version (2 – classic, 3 – plus, 4 – GPS).
|
||||
/// </summary>
|
||||
public int LockVersion { get; private set; }
|
||||
|
||||
public class Builder
|
||||
{
|
||||
private VersionInfoTdo lockVersionTdo = new VersionInfoTdo();
|
||||
|
||||
public int FirmwareVersion { get => lockVersionTdo.FirmwareVersion; set => lockVersionTdo.FirmwareVersion = value; }
|
||||
|
||||
public int HardwareVersion { get => lockVersionTdo.HardwareVersion; set => lockVersionTdo.HardwareVersion = value; }
|
||||
|
||||
public int LockVersion { get => lockVersionTdo.LockVersion; set => lockVersionTdo.LockVersion = value; }
|
||||
|
||||
public VersionInfoTdo Build()
|
||||
{
|
||||
return lockVersionTdo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue