Version 3.0.360

This commit is contained in:
Anja 2023-02-22 14:03:35 +01:00
parent 5c0b2e70c9
commit faf68061f4
160 changed files with 2114 additions and 1932 deletions

View file

@ -11,7 +11,7 @@
<PackageReference Include="Plugin.BLE" Version="2.1.3" />
<PackageReference Include="Polly" Version="7.2.3" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.4" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
</ItemGroup>
<ItemGroup>

View file

@ -154,8 +154,8 @@ namespace TINK.Services.BluetoothLock.BLE
case LockitLockingState.Unknown:
// Expected error. ILockIt count not be opened (Spoke has blocked/ blocks lock, ....)
Log.ForContext<LockItEventBased>().Debug($"Opening lock failed. Bold was blocked.");
throw new CouldntOpenBoldWasBlockedException();
Log.ForContext<LockItEventBased>().Debug($"Opening lock failed. Bold status is unknown");
throw new CouldntOpenBoldStatusIsUnknownException();
default:
// Comprises values
@ -270,6 +270,11 @@ namespace TINK.Services.BluetoothLock.BLE
Log.ForContext<LockItEventBased>().Information($"Lock was closed successfully.");
return lockingState;
case LockitLockingState.Open:
// Expected error. ILockIt could not be closed. Bolt was blocked but was opened again.
Log.ForContext<LockItPolling>().Debug($"Closing lock failed. Bold is blocked but was reopened again.");
throw new CouldntCloseBoldBlockedException(LockingState.Open);
default:
// Comprises values
// - LockitLockingState.Open

View file

@ -120,8 +120,8 @@ namespace TINK.Services.BluetoothLock.BLE
case LockitLockingState.Unknown:
// Expected error. ILockIt count not be opened (Spoke has blocked/ blocks lock, ....)
Log.ForContext<LockItPolling>().Debug($"Opening lock failed. Bold was blocked.");
throw new CouldntOpenBoldWasBlockedException();
Log.ForContext<LockItPolling>().Debug($"Opening lock failed. Bold status is unknown.");
throw new CouldntOpenBoldStatusIsUnknownException();
default:
// Comprises values
@ -181,13 +181,29 @@ namespace TINK.Services.BluetoothLock.BLE
var watch = new Stopwatch();
watch.Start();
var hasBeenLocked = false;
while (info.State != null
&& info.State.Value != LockitLockingState.CouldntCloseBoldBlocked
&& info.State.Value != LockitLockingState.CouldntCloseMoving
&& info.State.Value != LockitLockingState.Closed
&& watch.Elapsed < TimeSpan.FromMilliseconds(OPEN_CLOSE_TIMEOUT_MS))
{
info = await GetLockStateAsync(true); ; // While closing lock seems not always respond to reading operations.
if (info.State.Value == LockitLockingState.CouldntCloseBoldBlocked)
{
// Lock reported a blocked bold.
hasBeenLocked = true;
Log.ForContext<LockItPolling>().Debug($"Waiting for lock to close. Bold is blocked.");
continue;
}
if (hasBeenLocked && info.State.Value == LockitLockingState.Open)
{
// ILockIt could not be closed. Bolt was blocked but was opened again.
Log.ForContext<LockItPolling>().Debug($"Closing lock failed. Bold was blocked and lock was reopened.");
throw new CouldntCloseBoldBlockedException(LockingState.Open);
}
Log.ForContext<LockItPolling>().Debug($"Waiting for lock to close. Current lock state is {info?.State.Value}.");
}