diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-08-21 15:08:34 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-08-21 15:08:34 +0300 |
| commit | cc556a1c4a0813a548bf95d693c4e2748f895e13 (patch) | |
| tree | d1d3e21e2fa8b3de348c1f8cbb55a15ddaa06d77 /Software/Visual_Studio/Tango.Integration | |
| parent | 9f440be9a409955d06b5fc8738aac806e46ef85b (diff) | |
| download | Tango-cc556a1c4a0813a548bf95d693c4e2748f895e13.tar.gz Tango-cc556a1c4a0813a548bf95d693c4e2748f895e13.zip | |
Telemetry Wire + Machine Status Pumps.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs | 10 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs | 54 |
2 files changed, 64 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index c99e83558..0f9f3b008 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -268,6 +268,11 @@ namespace Tango.Integration.Operation event EventHandler<InkFillingStatusChangedEventArgs> InkFillingStatusChanged; /// <summary> + /// Occurs when a new telemetry wire is available. + /// </summary> + event EventHandler<StartTelemetryWireResponse> TelemetryWireAvailable; + + /// <summary> /// Occurs when waste replacement is required. /// </summary> event EventHandler WasteReplacementRequired; @@ -313,6 +318,11 @@ namespace Tango.Integration.Operation bool EnableInkFillingStatus { get; set; } /// <summary> + /// Gets or set a value indicating whether to enable telemetry flow from the firmware to the cloud. + /// </summary> + bool EnableTelemetryWire { get; set; } + + /// <summary> /// Gets the last process parameters table sent to the embedded device. /// </summary> ProcessParametersTable CurrentProcessParameters { get; } 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 /// </summary> public event EventHandler WasteReplacementRequired; + public event EventHandler<StartTelemetryWireResponse> 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); + } + } + } + + /// <summary> /// Gets or sets the machine events state provider used to get notifications about current machine events and errors. /// </summary> @@ -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<StartTelemetryWireRequest, StartTelemetryWireResponse>(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); + }); + } + } + /// <summary> /// Called when the enable events property has been changed. /// </summary> @@ -1028,6 +1074,11 @@ namespace Tango.Integration.Operation DiagnosticsDataAvailable?.Invoke(this, data); } + private void OnTelemetryWireAvailable(StartTelemetryWireResponse response) + { + TelemetryWireAvailable?.Invoke(this, response); + } + /// <summary> /// Called when events notification message has been received. /// </summary> @@ -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) { |
