2024-04-08 09:26:24 +05:00
|
|
|
|
namespace AsbCloudApp.Data.DetectedOperation;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Включённые подсистемы
|
|
|
|
|
/// </summary>
|
|
|
|
|
public struct EnabledSubsystems
|
|
|
|
|
{
|
2024-07-04 11:02:45 +05:00
|
|
|
|
private int value;
|
2024-04-08 16:49:15 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
private EnabledSubsystems(int value)
|
|
|
|
|
{
|
|
|
|
|
this.value = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public static implicit operator int(EnabledSubsystems param) =>
|
|
|
|
|
param.value;
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public static implicit operator EnabledSubsystems(int param) =>
|
|
|
|
|
new(param);
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Бурение ротором
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAutoRotor
|
|
|
|
|
{
|
|
|
|
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoRotor);
|
|
|
|
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoRotor);
|
|
|
|
|
}
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Бурение слайдом
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAutoSlide
|
|
|
|
|
{
|
|
|
|
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoSlide);
|
|
|
|
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSlide);
|
|
|
|
|
}
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// ПРОРАБОТКА
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAutoConditionig
|
|
|
|
|
{
|
|
|
|
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoConditionig);
|
|
|
|
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoConditionig);
|
|
|
|
|
}
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// СПУСК СПО
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAutoSinking
|
|
|
|
|
{
|
|
|
|
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoSinking);
|
|
|
|
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoSinking);
|
|
|
|
|
}
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// ПОДЪЕМ СПО
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAutoLifting
|
|
|
|
|
{
|
|
|
|
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoLifting);
|
|
|
|
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLifting);
|
|
|
|
|
}
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// ПОДЪЕМ С ПРОРАБОТКОЙ
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAutoLiftingWithConditionig
|
|
|
|
|
{
|
|
|
|
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoLiftingWithConditionig);
|
|
|
|
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoLiftingWithConditionig);
|
|
|
|
|
}
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Блокировка
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAutoBlocknig
|
|
|
|
|
{
|
|
|
|
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoBlocknig);
|
|
|
|
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoBlocknig);
|
|
|
|
|
}
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Осцилляция
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAutoOscillation
|
|
|
|
|
{
|
|
|
|
|
get => IsEnabledSubsystem(EnabledSubsystemsFlags.AutoOscillation);
|
|
|
|
|
set => UpdateEnabledSubsystems(value, EnabledSubsystemsFlags.AutoOscillation);
|
|
|
|
|
}
|
2024-04-08 09:26:24 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
private bool IsEnabledSubsystem(EnabledSubsystemsFlags flag) =>
|
|
|
|
|
(value & (int)flag) > 0;
|
2024-04-08 16:49:15 +05:00
|
|
|
|
|
2024-07-04 11:02:45 +05:00
|
|
|
|
private void UpdateEnabledSubsystems(bool isEnable, EnabledSubsystemsFlags flag)
|
|
|
|
|
{
|
|
|
|
|
if (isEnable)
|
|
|
|
|
value |= (int)flag;
|
|
|
|
|
else
|
|
|
|
|
value &= ~(int)flag;
|
|
|
|
|
}
|
2024-04-08 09:26:24 +05:00
|
|
|
|
}
|