mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 03:27:29 +02:00
Initial version.
This commit is contained in:
commit
6bab491a21
40 changed files with 1812 additions and 0 deletions
61
LockItShared/Services/BluetoothLock/Tdo/LockInfoAuthTdo.cs
Normal file
61
LockItShared/Services/BluetoothLock/Tdo/LockInfoAuthTdo.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
using TINK.Model.Connector;
|
||||
using System;
|
||||
|
||||
namespace TINK.Services.BluetoothLock.Tdo
|
||||
{
|
||||
/// <summary> Data required to connect to a blutooth lock.</summary>
|
||||
public class LockInfoAuthTdo
|
||||
{
|
||||
/// <summary> Identification number of bluetooth lock, 6-digits, second part of advertisement name.</summary>
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary> GUID to the device. </summary>
|
||||
public Guid Guid { get; private set; }
|
||||
|
||||
/// <summary> Seed used to generate key for connecting to bluetooth lock.</summary>
|
||||
public byte[] K_seed { get; private set; }
|
||||
|
||||
/// <summary> Key for connect to bluetooth lock as user.</summary>
|
||||
public byte[] K_u { get; private set; }
|
||||
|
||||
/// <summary> Key for connect to bluetooth lock as admin.</summary>
|
||||
public byte[] K_a { get; private set; }
|
||||
|
||||
public bool IsIdValid => Id != TextToLockItTypeHelper.INVALIDLOCKID;
|
||||
|
||||
public bool IsGuidValid => Guid != TextToLockItTypeHelper.INVALIDLOCKGUID;
|
||||
|
||||
public class Builder
|
||||
{
|
||||
private LockInfoAuthTdo lockInfoTdo = new LockInfoAuthTdo();
|
||||
|
||||
public Builder() { }
|
||||
|
||||
/// <summary> Identification number of bluetooth lock, 6-digits, second part of advertisement name.</summary>
|
||||
public int Id { get => lockInfoTdo.Id; set { lockInfoTdo.Id = value; } }
|
||||
|
||||
/// <summary> GUID to the device. </summary>
|
||||
public Guid Guid { get => lockInfoTdo.Guid; set { lockInfoTdo.Guid = value; } }
|
||||
|
||||
/// <summary> Seed used to generate key for connecting to bluetooth lock.</summary>
|
||||
public byte[] K_seed { get => lockInfoTdo.K_seed; set { lockInfoTdo.K_seed = value; } }
|
||||
|
||||
/// <summary> Key for connect to bluetooth lock as user.</summary>
|
||||
public byte[] K_u { get => lockInfoTdo.K_u; set { lockInfoTdo.K_u = value; } }
|
||||
|
||||
/// <summary> Key for connect to bluetooth lock as admin.</summary>
|
||||
public byte[] K_a { get => lockInfoTdo.K_a; set { lockInfoTdo.K_a = value; } }
|
||||
|
||||
public LockInfoAuthTdo Build()
|
||||
{
|
||||
if (K_seed == null) K_seed = new byte[0];
|
||||
|
||||
if (K_u == null) K_u = new byte[0];
|
||||
|
||||
if (K_a == null) K_a = new byte[0];
|
||||
|
||||
return lockInfoTdo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue