atmosdevicenetworksystem for generic device network stuff for atmos devices
This commit is contained in:
@@ -1,14 +0,0 @@
|
|||||||
namespace Content.Server.Atmos.Monitor.Components;
|
|
||||||
|
|
||||||
[RegisterComponent]
|
|
||||||
public sealed class AtmosAlarmingComponent : Component
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// All registered receivers in this alarmer.
|
|
||||||
/// </summary>
|
|
||||||
public HashSet<string> RegisteredReceivers = new();
|
|
||||||
|
|
||||||
// Somebody should do this someday. I'll leave it here as a reminder,
|
|
||||||
// just in case.
|
|
||||||
// public string StationAlarmMonitorFrequencyId
|
|
||||||
}
|
|
||||||
@@ -71,6 +71,12 @@ namespace Content.Server.Atmos.Monitor.Components
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public Dictionary<string, AtmosMonitorAlarmType> NetworkAlarmStates = new();
|
public Dictionary<string, AtmosMonitorAlarmType> NetworkAlarmStates = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registered devices in this atmos monitor. Alerts will be sent directly
|
||||||
|
/// to these devices.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables] public HashSet<string> RegisteredDevices = new();
|
||||||
|
|
||||||
// Calculates the highest alarm in the network, including itself.
|
// Calculates the highest alarm in the network, including itself.
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public AtmosMonitorAlarmType HighestAlarmInNetwork
|
public AtmosMonitorAlarmType HighestAlarmInNetwork
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
public sealed class AirAlarmSystem : EntitySystem
|
public sealed class AirAlarmSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly DeviceNetworkSystem _deviceNet = default!;
|
[Dependency] private readonly DeviceNetworkSystem _deviceNet = default!;
|
||||||
[Dependency] private readonly AtmosMonitorSystem _atmosMonitorSystem = default!;
|
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNetSystem = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||||
[Dependency] private readonly AccessReaderSystem _accessSystem = default!;
|
[Dependency] private readonly AccessReaderSystem _accessSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
@@ -76,54 +76,36 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
/// <param name="data">The data to send to the device.</param>
|
/// <param name="data">The data to send to the device.</param>
|
||||||
public void SetData(EntityUid uid, string address, IAtmosDeviceData data)
|
public void SetData(EntityUid uid, string address, IAtmosDeviceData data)
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
_atmosDevNetSystem.SetDeviceState(uid, address, data);
|
||||||
&& !monitor.NetEnabled)
|
_atmosDevNetSystem.Sync(uid, address);
|
||||||
return;
|
|
||||||
|
|
||||||
var payload = new NetworkPayload
|
|
||||||
{
|
|
||||||
[DeviceNetworkConstants.Command] = AirAlarmSetData,
|
|
||||||
// [AirAlarmTypeData] = type,
|
|
||||||
[AirAlarmSetData] = data
|
|
||||||
};
|
|
||||||
|
|
||||||
_deviceNet.QueuePacket(uid, address, payload);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Broadcast a sync packet to an air alarm's local network.
|
/// Broadcast a sync packet to an air alarm's local network.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SyncAllDevices(EntityUid uid)
|
private void SyncAllDevices(EntityUid uid)
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
_atmosDevNetSystem.Sync(uid, null);
|
||||||
&& !monitor.NetEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var payload = new NetworkPayload
|
|
||||||
{
|
|
||||||
[DeviceNetworkConstants.Command] = AirAlarmSyncCmd
|
|
||||||
};
|
|
||||||
|
|
||||||
_deviceNet.QueuePacket(uid, null, payload);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send a sync packet to a specific device from an air alarm.
|
/// Send a sync packet to a specific device from an air alarm.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="address">The address of the device.</param>
|
/// <param name="address">The address of the device.</param>
|
||||||
public void SyncDevice(EntityUid uid, string address)
|
private void SyncDevice(EntityUid uid, string address)
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
_atmosDevNetSystem.Sync(uid, address);
|
||||||
&& !monitor.NetEnabled)
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
var payload = new NetworkPayload
|
/// Register and synchronize with all devices
|
||||||
{
|
/// on this network.
|
||||||
[DeviceNetworkConstants.Command] = AirAlarmSyncCmd
|
/// </summary>
|
||||||
};
|
/// <param name="uid"></param>
|
||||||
|
public void SyncRegisterAllDevices(EntityUid uid)
|
||||||
_deviceNet.QueuePacket(uid, address, payload);
|
{
|
||||||
|
_atmosDevNetSystem.Register(uid, null);
|
||||||
|
_atmosDevNetSystem.Sync(uid, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -284,7 +266,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
component.ScrubberData.Clear();
|
component.ScrubberData.Clear();
|
||||||
component.SensorData.Clear();
|
component.SensorData.Clear();
|
||||||
|
|
||||||
SyncAllDevices(uid);
|
SyncRegisterAllDevices(uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,7 +407,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case AirAlarmSyncData:
|
case AtmosDeviceNetworkSystem.SyncData:
|
||||||
if (!args.Data.TryGetValue(AirAlarmSyncData, out IAtmosDeviceData? data)
|
if (!args.Data.TryGetValue(AirAlarmSyncData, out IAtmosDeviceData? data)
|
||||||
|| !controller.CanSync)
|
|| !controller.CanSync)
|
||||||
break;
|
break;
|
||||||
@@ -452,16 +434,6 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
|
|
||||||
UpdateUI(uid, controller);
|
UpdateUI(uid, controller);
|
||||||
|
|
||||||
return;
|
|
||||||
case AirAlarmSetDataStatus:
|
|
||||||
if (!args.Data.TryGetValue(AirAlarmSetDataStatus, out bool dataStatus))
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Sync data to interface.
|
|
||||||
// This should say if the result
|
|
||||||
// failed, or succeeded. Don't save it.l
|
|
||||||
SyncDevice(uid, args.SenderAddress);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case AirAlarmSetMode:
|
case AirAlarmSetMode:
|
||||||
if (!args.Data.TryGetValue(AirAlarmSetMode, out AirAlarmMode alarmMode)) break;
|
if (!args.Data.TryGetValue(AirAlarmSetMode, out AirAlarmMode alarmMode)) break;
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
using Content.Server.Atmos.Monitor.Components;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Monitor.Systems;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// System that alarms AtmosAlarmables via DeviceNetwork.
|
|
||||||
/// This is one way, and is usually triggered by an event.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class AtmosAlarmingSystem : EntitySystem
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The alarm command key.
|
|
||||||
/// </summary>
|
|
||||||
public const string AtmosAlarmCmd = "atmos_alarming_alarm_cmd";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Register command. Registers this address so that the alarm can send
|
|
||||||
/// to the given device.
|
|
||||||
/// </summary>
|
|
||||||
public const string AtmosAlarmRegisterCmd = "atmos_alarming_register_cmd";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Alarm data. Contains the alert passed into this alarmer.
|
|
||||||
/// </summary>
|
|
||||||
public const string AtmosAlarmData = "atmos_alarming_alarm_data";
|
|
||||||
|
|
||||||
private void OnAlert(EntityUid uid, AtmosAlarmingComponent component, AtmosMonitorAlarmEvent args)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
65
Content.Server/Atmos/Monitor/Systems/AtmosDeviceNetwork.cs
Normal file
65
Content.Server/Atmos/Monitor/Systems/AtmosDeviceNetwork.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using Content.Server.DeviceNetwork;
|
||||||
|
using Content.Server.DeviceNetwork.Systems;
|
||||||
|
using Content.Shared.Atmos.Monitor.Components;
|
||||||
|
|
||||||
|
namespace Content.Server.Atmos.Monitor.Systems;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generic device network commands useful for atmos devices,
|
||||||
|
/// as well as some helper commands.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class AtmosDeviceNetworkSystem : EntitySystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Any information about atmosphere that a device can scan.
|
||||||
|
/// </summary>
|
||||||
|
public const string AtmosData = "atmos_atmosphere_data";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register a device's address on this device.
|
||||||
|
/// </summary>
|
||||||
|
public const string RegisterDevice = "atmos_register_device";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Synchronize the data this device has with the sender.
|
||||||
|
/// </summary>
|
||||||
|
public const string SyncData = "atmos_sync_data";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the state of this device using the contained data.
|
||||||
|
/// </summary>
|
||||||
|
public const string SetState = "atmos_set_state";
|
||||||
|
|
||||||
|
[Dependency] private readonly DeviceNetworkSystem _deviceNet = default!;
|
||||||
|
|
||||||
|
public void Register(EntityUid uid, string? address)
|
||||||
|
{
|
||||||
|
var registerPayload = new NetworkPayload
|
||||||
|
{
|
||||||
|
[DeviceNetworkConstants.Command] = RegisterDevice
|
||||||
|
};
|
||||||
|
|
||||||
|
_deviceNet.QueuePacket(uid, address, registerPayload);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Sync(EntityUid uid, string? address)
|
||||||
|
{
|
||||||
|
var syncPayload = new NetworkPayload
|
||||||
|
{
|
||||||
|
[DeviceNetworkConstants.Command] = SyncData
|
||||||
|
};
|
||||||
|
|
||||||
|
_deviceNet.QueuePacket(uid, address, syncPayload);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDeviceState(EntityUid uid, string address, IAtmosDeviceData data)
|
||||||
|
{
|
||||||
|
var payload = new NetworkPayload()
|
||||||
|
{
|
||||||
|
[DeviceNetworkConstants.Command] = SetState,
|
||||||
|
[SetState] = data
|
||||||
|
};
|
||||||
|
|
||||||
|
_deviceNet.QueuePacket(uid, address, payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,29 +51,14 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
|
|
||||||
public const string AtmosMonitorSetThresholdCmd = "atmos_monitor_set_threshold";
|
public const string AtmosMonitorSetThresholdCmd = "atmos_monitor_set_threshold";
|
||||||
|
|
||||||
public const string AtmosMonitorGetDataCmd = "atmos_monitor_get_data";
|
|
||||||
|
|
||||||
// Packet data
|
// Packet data
|
||||||
/// <summary>
|
|
||||||
/// Data response that contains the threshold types in an atmos monitor alarm.
|
|
||||||
/// </summary>
|
|
||||||
public const string AtmosMonitorAlarmThresholdTypes = "atmos_monitor_alarm_threshold_types";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Data response that contains the source of an atmos alarm.
|
/// Data response that contains the source of an atmos alarm.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string AtmosMonitorAlarmSrc = "atmos_monitor_alarm_source";
|
public const string AtmosMonitorAlarmSrc = "atmos_monitor_alarm_source";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Data response that contains the maximum alarm in an atmos alarm network.
|
|
||||||
/// </summary>
|
|
||||||
public const string AtmosMonitorAlarmNetMax = "atmos_monitor_alarm_net_max";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Data response that contains the last state recorded by this air monitor.
|
|
||||||
/// </summary>
|
|
||||||
public const string AtmosMonitorAtmosData = "atmos_monitor_atmos_data";
|
|
||||||
|
|
||||||
public const string AtmosMonitorThresholdData = "atmos_monitor_threshold_data";
|
public const string AtmosMonitorThresholdData = "atmos_monitor_threshold_data";
|
||||||
|
|
||||||
public const string AtmosMonitorThresholdDataType = "atmos_monitor_threshold_type";
|
public const string AtmosMonitorThresholdDataType = "atmos_monitor_threshold_type";
|
||||||
@@ -128,43 +113,20 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
// sync the internal 'last alarm state' from
|
// sync the internal 'last alarm state' from
|
||||||
// the other alarms, so that we can calculate
|
// the other alarms, so that we can calculate
|
||||||
// the highest network alarm state at any time
|
// the highest network alarm state at any time
|
||||||
if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd)
|
if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd))
|
||||||
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable)
|
{
|
||||||
|| !EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn))
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// ignore packets from self, ignore from different frequency
|
|
||||||
if (netConn.Address == args.SenderAddress) return;
|
|
||||||
|
|
||||||
var responseKey = string.Empty;
|
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
/*
|
case AtmosDeviceNetworkSystem.RegisterDevice:
|
||||||
// sync on alarm or explicit sync
|
component.RegisteredDevices.Add(args.SenderAddress);
|
||||||
case AtmosMonitorAlarmCmd:
|
|
||||||
case AtmosMonitorAlarmSyncCmd:
|
|
||||||
if (args.Data.TryGetValue(AtmosMonitorAlarmSrc, out string? src)
|
|
||||||
&& alarmable.AlarmedByPrototypes.Contains(src)
|
|
||||||
&& args.Data.TryGetValue(DeviceNetworkConstants.CmdSetState, out AtmosMonitorAlarmType state)
|
|
||||||
&& !component.NetworkAlarmStates.TryAdd(args.SenderAddress, state))
|
|
||||||
component.NetworkAlarmStates[args.SenderAddress] = state;
|
|
||||||
break;
|
break;
|
||||||
*/
|
|
||||||
case AtmosMonitorAlarmResetCmd:
|
case AtmosMonitorAlarmResetCmd:
|
||||||
Reset(uid);
|
Reset(uid);
|
||||||
// Don't clear alarm states here.
|
// Don't clear alarm states here.
|
||||||
break;
|
break;
|
||||||
/*
|
|
||||||
case AtmosMonitorAlarmResetAllCmd:
|
|
||||||
if (args.Data.TryGetValue(AtmosMonitorAlarmSrc, out string? resetSrc)
|
|
||||||
&& alarmable.AlarmedByPrototypes.Contains(resetSrc))
|
|
||||||
{
|
|
||||||
component.LastAlarmState = AtmosMonitorAlarmType.Normal;
|
|
||||||
component.NetworkAlarmStates.Clear();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
case AtmosMonitorSetThresholdCmd:
|
case AtmosMonitorSetThresholdCmd:
|
||||||
if (args.Data.TryGetValue(AtmosMonitorThresholdData, out AtmosAlarmThreshold? thresholdData)
|
if (args.Data.TryGetValue(AtmosMonitorThresholdData, out AtmosAlarmThreshold? thresholdData)
|
||||||
&& args.Data.TryGetValue(AtmosMonitorThresholdDataType, out AtmosMonitorThresholdType? thresholdType))
|
&& args.Data.TryGetValue(AtmosMonitorThresholdDataType, out AtmosMonitorThresholdType? thresholdType))
|
||||||
@@ -174,9 +136,9 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case AtmosMonitorGetDataCmd:
|
case AtmosDeviceNetworkSystem.SyncData:
|
||||||
var payload = new NetworkPayload();
|
var payload = new NetworkPayload();
|
||||||
payload.Add(DeviceNetworkConstants.Command, AtmosMonitorAtmosData);
|
payload.Add(DeviceNetworkConstants.Command, AtmosDeviceNetworkSystem.SyncData);
|
||||||
if (component.TileGas != null)
|
if (component.TileGas != null)
|
||||||
{
|
{
|
||||||
var gases = new Dictionary<Gas, float>();
|
var gases = new Dictionary<Gas, float>();
|
||||||
@@ -185,7 +147,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
gases.Add(gas, component.TileGas.GetMoles(gas));
|
gases.Add(gas, component.TileGas.GetMoles(gas));
|
||||||
}
|
}
|
||||||
|
|
||||||
payload.Add(AtmosMonitorAtmosData, new AtmosSensorData(
|
payload.Add(AtmosDeviceNetworkSystem.SyncData, new AtmosSensorData(
|
||||||
component.TileGas.Pressure,
|
component.TileGas.Pressure,
|
||||||
component.TileGas.Temperature,
|
component.TileGas.Temperature,
|
||||||
component.TileGas.TotalMoles,
|
component.TileGas.TotalMoles,
|
||||||
@@ -418,12 +380,13 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
{
|
{
|
||||||
[DeviceNetworkConstants.Command] = AtmosMonitorAlarmCmd,
|
[DeviceNetworkConstants.Command] = AtmosMonitorAlarmCmd,
|
||||||
[DeviceNetworkConstants.CmdSetState] = monitor.LastAlarmState,
|
[DeviceNetworkConstants.CmdSetState] = monitor.LastAlarmState,
|
||||||
[AtmosMonitorAlarmNetMax] = monitor.HighestAlarmInNetwork,
|
|
||||||
[AtmosMonitorAlarmThresholdTypes] = alarms,
|
|
||||||
[AtmosMonitorAlarmSrc] = source
|
[AtmosMonitorAlarmSrc] = source
|
||||||
};
|
};
|
||||||
|
|
||||||
_deviceNetSystem.QueuePacket(monitor.Owner, null, payload);
|
foreach (var addr in monitor.RegisteredDevices)
|
||||||
|
{
|
||||||
|
_deviceNetSystem.QueuePacket(monitor.Owner, addr, payload);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -188,23 +188,19 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case AirAlarmSystem.AirAlarmSyncCmd:
|
case AtmosDeviceNetworkSystem.SyncData:
|
||||||
payload.Add(DeviceNetworkConstants.Command, AirAlarmSystem.AirAlarmSyncData);
|
payload.Add(DeviceNetworkConstants.Command, AtmosDeviceNetworkSystem.SyncData);
|
||||||
payload.Add(AirAlarmSystem.AirAlarmSyncData, component.ToAirAlarmData());
|
payload.Add(AtmosDeviceNetworkSystem.SyncData, component.ToAirAlarmData());
|
||||||
|
|
||||||
_deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload, device: netConn);
|
_deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload, device: netConn);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case AirAlarmSystem.AirAlarmSetData:
|
case AtmosDeviceNetworkSystem.SetState:
|
||||||
if (!args.Data.TryGetValue(AirAlarmSystem.AirAlarmSetData, out GasVentPumpData? setData))
|
if (!args.Data.TryGetValue(AtmosDeviceNetworkSystem.SetState, out GasVentPumpData? setData))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
component.FromAirAlarmData(setData);
|
component.FromAirAlarmData(setData);
|
||||||
UpdateState(uid, component);
|
UpdateState(uid, component);
|
||||||
payload.Add(DeviceNetworkConstants.Command, AirAlarmSystem.AirAlarmSetDataStatus);
|
|
||||||
payload.Add(AirAlarmSystem.AirAlarmSetDataStatus, true);
|
|
||||||
|
|
||||||
_deviceNetSystem.QueuePacket(uid, null, payload, device: netConn);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,23 +154,19 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case AirAlarmSystem.AirAlarmSyncCmd:
|
case AtmosDeviceNetworkSystem.SyncData:
|
||||||
payload.Add(DeviceNetworkConstants.Command, AirAlarmSystem.AirAlarmSyncData);
|
payload.Add(DeviceNetworkConstants.Command, AtmosDeviceNetworkSystem.SyncData);
|
||||||
payload.Add(AirAlarmSystem.AirAlarmSyncData, component.ToAirAlarmData());
|
payload.Add(AtmosDeviceNetworkSystem.SyncData, component.ToAirAlarmData());
|
||||||
|
|
||||||
_deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload, device: netConn);
|
_deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload, device: netConn);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case AirAlarmSystem.AirAlarmSetData:
|
case AtmosDeviceNetworkSystem.SetState:
|
||||||
if (!args.Data.TryGetValue(AirAlarmSystem.AirAlarmSetData, out GasVentScrubberData? setData))
|
if (!args.Data.TryGetValue(AtmosDeviceNetworkSystem.SetState, out GasVentScrubberData? setData))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
component.FromAirAlarmData(setData);
|
component.FromAirAlarmData(setData);
|
||||||
UpdateState(uid, component);
|
UpdateState(uid, component);
|
||||||
payload.Add(DeviceNetworkConstants.Command, AirAlarmSystem.AirAlarmSetDataStatus);
|
|
||||||
payload.Add(AirAlarmSystem.AirAlarmSetDataStatus, true);
|
|
||||||
|
|
||||||
_deviceNetSystem.QueuePacket(uid, null, payload, device: netConn);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user