forked from ddrilling/AsbCloudServer
102 lines
2.5 KiB
C#
102 lines
2.5 KiB
C#
|
namespace AsbCloudApp.Data.DetectedOperation;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Включённые подсистемы
|
|||
|
/// </summary>
|
|||
|
public struct EnabledSubsystems
|
|||
|
{
|
|||
|
private int value;
|
|||
|
|
|||
|
private EnabledSubsystems(int value)
|
|||
|
{
|
|||
|
this.value = value;
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc/>
|
|||
|
public static implicit operator int(EnabledSubsystems param) =>
|
|||
|
param.value;
|
|||
|
|
|||
|
/// <inheritdoc/>
|
|||
|
public static implicit operator EnabledSubsystems(int param) =>
|
|||
|
new(param);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Бурение ротором
|
|||
|
/// </summary>
|
|||
|
public bool IsAutoRotor
|
|||
|
{
|
|||
|
get => (value & (int)EnabledSubsystemsFlags.AutoRotor) > 0;
|
|||
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoRotor);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Бурение слайдом
|
|||
|
/// </summary>
|
|||
|
public bool IsAutoSlide
|
|||
|
{
|
|||
|
get => (value & (int)EnabledSubsystemsFlags.AutoSlide) > 0;
|
|||
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSlide);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// ПРОРАБОТКА
|
|||
|
/// </summary>
|
|||
|
public bool IsAutoConditionig
|
|||
|
{
|
|||
|
get => (value & (int)EnabledSubsystemsFlags.AutoConditionig) > 0;
|
|||
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoConditionig);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// СПУСК СПО
|
|||
|
/// </summary>
|
|||
|
public bool IsAutoSinking
|
|||
|
{
|
|||
|
get => (value & (int)EnabledSubsystemsFlags.AutoSinking) > 0;
|
|||
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSinking);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// ПОДЪЕМ СПО
|
|||
|
/// </summary>
|
|||
|
public bool IsAutoLifting
|
|||
|
{
|
|||
|
get => (value & (int)EnabledSubsystemsFlags.AutoLifting) > 0;
|
|||
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLifting);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// ПОДЪЕМ С ПРОРАБОТКОЙ
|
|||
|
/// </summary>
|
|||
|
public bool IsAutoLiftingWithConditionig
|
|||
|
{
|
|||
|
get => (value & (int)EnabledSubsystemsFlags.AutoLiftingWithConditionig) > 0;
|
|||
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLiftingWithConditionig);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Блокировка
|
|||
|
/// </summary>
|
|||
|
public bool IsAutoBlocknig
|
|||
|
{
|
|||
|
get => (value & (int)EnabledSubsystemsFlags.AutoBlocknig) > 0;
|
|||
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoBlocknig);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Осцилляция
|
|||
|
/// </summary>
|
|||
|
public bool IsAutoOscillation
|
|||
|
{
|
|||
|
get => (value & (int)EnabledSubsystemsFlags.AutoOscillation) > 0;
|
|||
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoOscillation);
|
|||
|
}
|
|||
|
|
|||
|
private void UpdateEnabledSubsystems(bool isEnable, EnabledSubsystemsFlags flag)
|
|||
|
{
|
|||
|
if (isEnable)
|
|||
|
value |= (int)flag;
|
|||
|
else
|
|||
|
value &= ~(int)flag;
|
|||
|
}
|
|||
|
}
|