Initial version.

This commit is contained in:
Oliver Hauff 2021-05-13 17:07:16 +02:00
commit 6bab491a21
40 changed files with 1812 additions and 0 deletions

View file

@ -0,0 +1,7 @@
namespace TINK.Services.BluetoothLock.Exception
{
public class AlreadyConnectedException : System.Exception
{
public AlreadyConnectedException() : base("Invalid reconnect call detected. Device is already connected.") {}
}
}

View file

@ -0,0 +1,8 @@
namespace TINK.Services.BluetoothLock.Exception
{
public class AuthKeyException : System.Exception
{
public AuthKeyException(string message) : base(message)
{ }
}
}

View file

@ -0,0 +1,11 @@
using TINK.Model.Bike.BluetoothLock;
namespace TINK.Services.BluetoothLock.Exception
{
public class BluetoothDisconnectedException : StateAwareException
{
public BluetoothDisconnectedException() : base(LockingState.Disconnected, MultilingualResources.Resources.ErrorBluetoothDisconnectedException)
{
}
}
}

View file

@ -0,0 +1,13 @@
using TINK.Model.Bike.BluetoothLock;
namespace TINK.Services.BluetoothLock.Exception
{
public class CouldntCloseBoldBlockedException : StateAwareException
{
public CouldntCloseBoldBlockedException() : base(
LockingState.Unknown, // Lock is closed in most cases, but this is not guarnteed according to haveltec.
MultilingualResources.Resources.ErrorCloseLockBoldBlocked)
{
}
}
}

View file

@ -0,0 +1,18 @@

using TINK.Model.Bike.BluetoothLock;
using TINK.MultilingualResources;
namespace TINK.Services.BluetoothLock.Exception
{
public class CouldntCloseInconsistentStateExecption : StateAwareException
{
public CouldntCloseInconsistentStateExecption(LockingState state) :
base(
state,
state != LockingState.Unknown
? string.Format(Resources.ErrorCloseLockUnexpectedState, state)
: Resources.ErrorCloseLockUnknownPosition)
{
}
}
}

View file

@ -0,0 +1,13 @@
using TINK.Model.Bike.BluetoothLock;
namespace TINK.Services.BluetoothLock.Exception
{
public class CouldntOpenBoldBlockedException : StateAwareException
{
public CouldntOpenBoldBlockedException() : base(
LockingState.Unknown, //
MultilingualResources.Resources.ErrorOpenLockBoldBlocked)
{
}
}
}

View file

@ -0,0 +1,18 @@

using TINK.Model.Bike.BluetoothLock;
using TINK.MultilingualResources;
namespace TINK.Services.BluetoothLock.Exception
{
public class CouldntOpenInconsistentStateExecption : StateAwareException
{
public CouldntOpenInconsistentStateExecption(LockingState state) :
base(
state,
state != LockingState.Unknown
? string.Format(Resources.ErrorOpenLockUnexpectedState, state)
: Resources.ErrorOpenLockUnknownPosition)
{
}
}
}

View file

@ -0,0 +1,8 @@
namespace TINK.Services.BluetoothLock.Exception
{
public class CoundntGetCharacteristicException : System.Exception
{
public CoundntGetCharacteristicException(string message) : base(message)
{ }
}
}

View file

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

View file

@ -0,0 +1,9 @@
namespace TINK.Services.BluetoothLock.Exception
{
public class GuidUnknownException : System.Exception
{
public GuidUnknownException() : base("Can not connect to lock. No Guid available.")
{
}
}
}

View file

@ -0,0 +1,7 @@
namespace TINK.Services.BluetoothLock.Exception
{
/// <summary> Thrown whenever lock is out of reach.</summary>
public class OutOfReachException : System.Exception
{
}
}

View file

@ -0,0 +1,15 @@
using TINK.Model.Bike.BluetoothLock;
namespace TINK.Services.BluetoothLock.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; }
}
}