using System;
namespace TINK.Services.BluetoothLock.BLE
{
public static class PluginBleHelper
{
///
/// Maps Plugin.BLE device state to LockItShared device state.
///
/// State to convert
///
/// Unexpected state detected.
public static DeviceState GetDeviceState(this Plugin.BLE.Abstractions.DeviceState state)
{
switch (state)
{
case Plugin.BLE.Abstractions.DeviceState.Disconnected:
return DeviceState.Disconnected;
case Plugin.BLE.Abstractions.DeviceState.Connecting:
return DeviceState.Connecting;
case Plugin.BLE.Abstractions.DeviceState.Connected:
return DeviceState.Connected;
case Plugin.BLE.Abstractions.DeviceState.Limited:
return DeviceState.Limited;
default:
throw new ArgumentException($"Can not convert state Plugin.BLE-{state}.");
}
}
}
}