From cc556a1c4a0813a548bf95d693c4e2748f895e13 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 21 Aug 2025 15:08:34 +0300 Subject: Telemetry Wire + Machine Status Pumps. --- .../Tango.Integration/Operation/MachineOperator.cs | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs') diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index f77ea978c..eb994afc6 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -75,6 +75,7 @@ namespace Tango.Integration.Operation private bool _debugSent; private bool _machineStatusSent; private bool _inkFillingStatusSent; + private bool _telemetryWireSent; private bool _threadLoadingSent; private bool _isPowerDownRequestInProgress; private bool _isHeadCleaningInProgress; @@ -355,6 +356,8 @@ namespace Tango.Integration.Operation /// public event EventHandler WasteReplacementRequired; + public event EventHandler TelemetryWireAvailable; + #endregion #region Properties @@ -655,6 +658,22 @@ namespace Tango.Integration.Operation set { _enablePowerUpSequence = value; RaisePropertyChangedAuto(); } } + private bool _enableTelemetryWire; + public bool EnableTelemetryWire + { + get { return _enableTelemetryWire; } + set + { + if (_enableTelemetryWire != value) + { + _enableTelemetryWire = value; + RaisePropertyChangedAuto(); + OnEnableTelemetryWireChanged(value); + } + } + } + + /// /// Gets or sets the machine events state provider used to get notifications about current machine events and errors. /// @@ -778,6 +797,33 @@ namespace Tango.Integration.Operation } } + private void OnEnableTelemetryWireChanged(bool value) + { + if (value && State == TransportComponentState.Connected && !_telemetryWireSent) + { + var request = new StartTelemetryWireRequest(); + + _telemetryWireSent = true; + + LogManager.Log($"Sending '{nameof(StartTelemetryWireRequest)}'..."); + + SendContinuousRequest(request, new TransportContinuousRequestConfig() { ShouldLog = false }).ObserveOn(new NewThreadScheduler()).Subscribe( + (response) => + { + OnTelemetryWireAvailable(response); + }, + (ex) => + { + _telemetryWireSent = false; + }, + () => + { + _telemetryWireSent = false; + LogManager.Log("Telemetry Wire response completed!?", LogCategory.Warning); + }); + } + } + /// /// Called when the enable events property has been changed. /// @@ -1028,6 +1074,11 @@ namespace Tango.Integration.Operation DiagnosticsDataAvailable?.Invoke(this, data); } + private void OnTelemetryWireAvailable(StartTelemetryWireResponse response) + { + TelemetryWireAvailable?.Invoke(this, response); + } + /// /// Called when events notification message has been received. /// @@ -1491,6 +1542,7 @@ namespace Tango.Integration.Operation _debugSent = false; _eventsSent = false; _machineStatusSent = false; + _telemetryWireSent = false; //MachineStatus = null; @@ -1593,6 +1645,7 @@ namespace Tango.Integration.Operation _eventsSent = false; _debugSent = false; _machineStatusSent = false; + _telemetryWireSent = false; _bitResults = null; @@ -1602,6 +1655,7 @@ namespace Tango.Integration.Operation OnEnableMachineStatusUpdatesChanged(EnableMachineStatusUpdates); OnEnableAutomaticThreadLoadingChanged(EnableAutomaticThreadLoading); OnEnableInkFillingStatus(EnableInkFillingStatus); + OnEnableTelemetryWireChanged(EnableTelemetryWire); if (EnablePowerUpSequence) { -- cgit v1.3.1