Version 3.0.294

This commit is contained in:
Oliver Hauff 2022-04-25 22:15:15 +02:00
parent d92fb4a40f
commit 8f40f2c208
133 changed files with 17890 additions and 14246 deletions

View file

@ -17,8 +17,6 @@
<Warning Text="$(MSBuildProjectFile) is Multilingual build enabled, but the Multilingual App Toolkit is unavailable during the build. If building with Visual Studio, please check to ensure that toolkit is properly installed." />
</Target>
<ItemGroup>
<Folder Include="Model\Bikes\Bike\BluetoothLock\" />
<Folder Include="Model\Bikes\Bike\" />
<Folder Include="Model\Device\" />
<Folder Include="Services\BluetoothLock\Crypto\" />
<Folder Include="Services\BluetoothLock\Tdo\" />

View file

@ -0,0 +1,8 @@
namespace TINK.Model.Bikes.Bike.CopriLock
{
public interface ILockInfo
{
/// <summary> Locking state of backend lock. </summary>
LockingState State { get; }
}
}

View file

@ -0,0 +1,88 @@
using Newtonsoft.Json;
using System;
using System.Runtime.Serialization;
namespace TINK.Model.Bikes.Bike.CopriLock
{
/// <summary> Locking states. </summary>
public enum LockingState
{
/// <summary> App is not connected to lock.</summary>
UnknownDisconnected,
/// <summary> Lock is closed. </summary>
Closed,
/// <summary> Lock is closing. </summary>
Closing,
/// <summary> Lock is open. </summary>
Open,
/// <summary> Lock is opening. </summary>
Opening
}
[DataContract]
public class LockInfo : ILockInfo
{
/// <summary> Locking state of bluetooth lock. </summary>
[DataMember]
public LockingState State { get; private set; } = LockingState.UnknownDisconnected;
public override bool Equals(object obj) => this.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;
return ToString() == other.ToString();
}
public override int GetHashCode()
{
return ToString().GetHashCode();
}
public override string ToString()
{
return 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;
return lhs.Equals(rhs);
}
public static bool operator !=(LockInfo lhs, LockInfo rhs)
{
return !(lhs == rhs);
}
public class Builder
{
public Builder(LockInfo lockInfo = null)
{
if (lockInfo == null)
{
return;
}
LockInfo = JsonConvert.DeserializeObject<LockInfo>(JsonConvert.SerializeObject(lockInfo));
}
private readonly LockInfo LockInfo = new LockInfo();
public LockingState State { get => LockInfo.State; set => LockInfo.State = value; }
public LockInfo Build() => LockInfo;
}
}
}

View file

@ -1,11 +1,10 @@
using TINK.Model.Bike.BluetoothLock;
using TINK.Services.BluetoothLock.Tdo;
namespace TINK.Services.BluetoothLock.Exception
{
public class CounldntCloseMovingException : StateAwareException
public class CouldntCloseMovingException : StateAwareException
{
public CounldntCloseMovingException() : base(
public CouldntCloseMovingException() : base(
LockingState.Open, // Locking bold is probable (according to haveltec) still open.
MultilingualResources.Resources.ErrorCloseLockBikeMoving)
{

View file

@ -0,0 +1,7 @@

namespace TINK.Services.CopriLock.Exception
{
public class CouldntCloseBoldBlockedException : System.Exception
{
}
}

View file

@ -0,0 +1,7 @@

namespace TINK.Services.CopriLock.Exception
{
public class CouldntOpenBoldIsBlockedException : System.Exception
{
}
}

View file

@ -0,0 +1,7 @@

namespace TINK.Services.CopriLock.Exception
{
public class CouldntOpenBoldWasBlockedException : System.Exception
{
}
}

View file

@ -0,0 +1,7 @@

namespace TINK.Services.CopriLock.Exception
{
public class CounldntCloseMovingException : System.Exception
{
}
}

View file

@ -0,0 +1,7 @@

namespace TINK.Services.CopriLock.Exception
{
public class OutOfReachException : System.Exception
{
}
}

View file

@ -0,0 +1,15 @@
using TINK.Model.Bikes.Bike.CopriLock;
namespace TINK.Services.CopriLock.Exception
{
public abstract class StateAwareException : System.Exception
{
public StateAwareException(LockingState state, string description) : base(description)
{
State = state;
}
/// <summary> Holds the state reported by lock.</summary>
public LockingState State { get; }
}
}