using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.PMR.Diagnostics;
using Tango.PMR.Printing;
using Tango.Transport;
using System.Reactive;
using Tango.PMR;
using System.Reactive.Linq;
using Tango.PMR.Debugging;
using Tango.PMR.Hardware;
using Tango.BL.Entities;
using Google.Protobuf;
using Tango.PMR.Connection;
using Tango.PMR.Stubs;
using Tango.Integration.Storage;
using System.IO;
using Tango.Integration.Upgrade;
using Tango.PMR.IO;
using Tango.PMR.FirmwareUpgrade;
using Tango.Integration.JobRuns;
using Tango.Integration.Emergency;
using Tango.PMR.MachineStatus;
using Tango.PMR.ThreadLoading;
using Tango.PMR.Power;
using Tango.PMR.IFS;
using Tango.BL.Enumerations;
namespace Tango.Integration.Operation
{
///
/// Represents a Tango machine operator.
///
///
public interface IMachineOperator : ITransporter
{
///
/// Gets or sets the job handling mode.
///
JobHandlerModes JobHandlingMode { get; set; }
///
/// Gets or sets the job upload strategy.
///
JobUploadStrategy JobUploadStrategy { get; set; }
///
/// Gets or sets the job number of units duplication method.
///
JobUnitsMethods JobUnitsMethod { get; set; }
///
/// Gets or sets the way of calculating how much liquid was spent during the job.
///
JobLiquidQuantityCalculationMode JobLiquidQuantityCalculationMode { get; set; }
///
/// Gets the current machine status.
///
MachineStatuses Status { get; }
///
/// Gets or sets the type of the machine.
///
MachineTypes MachineType { get; set; }
///
/// Gets a value indicating whether the machine is connected and status is not disconnected.
///
bool IsConnected { get; }
///
/// Gets or sets a value indicating whether to enable liquid quantity validation before starting the job.
/// The validation is done using the reported .
///
bool EnableJobLiquidQuantityValidation { get; set; }
///
/// Gets the machine embedded device status.
///
MachineStatus MachineStatus { get; }
///
/// Gets the current thread loading status.
///
StartThreadLoadingResponse ThreadLoadingStatus { get; }
///
/// Gets the ink filling status.
///
InkFillingStatus InkFillingStatus { get; }
///
/// Gets or sets the firmware upgrade mode.
///
FirmwareUpgradeModes FirmwareUpgradeMode { get; set; }
///
/// Gets the running job.
///
Job RunningJob { get; }
///
/// Gets the running job status.
///
RunningJobStatus RunningJobStatus { get; }
///
/// Gets or sets the gradients generation configuration.
///
IGradientGenerationConfiguration GradientGenerationConfiguration { get; set; }
///
/// Gets or sets the emergency notification provider.
///
IEmergencyNotificationProvider EmergencyNotificationProvider { get; set; }
///
/// Gets a value indicating whether this instance is printing.
///
bool IsPrinting { get; }
///
/// Gets a value indicating whether this instance can print.
///
bool CanPrint { get; }
///
/// Gets or sets the general continuous request timeout.
///
TimeSpan ContinuousRequestTimeout { get; set; }
///
/// Gets a value indicating whether the spool was replaced after the last job.
///
bool IsSpoolReplaced { get; }
///
/// Occurs when the machine has changed.
///
event EventHandler StatusChanged;
///
/// Reports about the job printing preparation progress.
///
event EventHandler PreparingJobProgress;
///
/// Occurs when a printing process has started.
///
event EventHandler PrintingStarted;
///
/// Occurs when a printing process has failed.
///
event EventHandler PrintingFailed;
///
/// Occurs when a printing process has been aborted.
///
event EventHandler PrintingAborted;
///
/// Occurs when a printing process has completed.
///
event EventHandler PrintingCompleted;
///
/// Occurs when a printing process has ended.
///
event EventHandler PrintingEnded;
///
/// Occurs when the machine operator has detected that a job is in progress after connecting to the machine.
///
event EventHandler ResumingJob;
///
/// Occurs when there is new diagnostics data available.
///
event EventHandler DiagnosticsDataAvailable;
///
/// Occurs when an events notification has been received from the embedded device.
///
event EventHandler EventsNotification;
///
/// Occurs when a new debug log is available.
///
event EventHandler DebugLogAvailable;
///
/// Occurs when machine embedded device status has changed.
///
event EventHandler MachineStatusChanged;
///
/// Occurs when a new cartridge validation request has been received.
///
event EventHandler CartridgeValidationRequestReceived;
///
/// Occurs when the machine was connected and device has reported IsAfterReset.
///
event EventHandler FirmwareStarted;
///
/// Occurs when the power up sequence has started.
///
event EventHandler PowerUpStarted;
///
/// Occurs when the power up sequence progress has changed.
///
event EventHandler PowerUpProgress;
///
/// Occurs when power up sequence has completed successfully.
///
event EventHandler PowerUpCompleted;
///
/// Occurs when power up sequence has failed.
///
event EventHandler PowerUpFailed;
///
/// Occurs when power up sequence has ended. Could be due to no response to the request!
///
event EventHandler PowerUpEnded;
///
/// Occurs when power down has started.
///
event EventHandler PowerDownStarted;
///
/// Occurs when the thread loading status has changed.
///
event EventHandler ThreadLoadingStatusChanged;
///
/// Occurs when a thread loading confirmation is required.
///
event EventHandler ThreadLoadingConfirmationRequired;
///
/// Occurs when thread loading has completed.
///
event EventHandler ThreadLoadingCompleted;
///
/// Occurs when thread loading has failed.
///
event EventHandler ThreadLoadingFailed;
///
/// Occurs when a head cleaning job has ended.
///
event EventHandler HeadCleaningEnded;
///
/// Occurs when the ink filling status has changed.
///
event EventHandler InkFillingStatusChanged;
///
/// Occurs when a new telemetry wire is available.
///
event EventHandler TelemetryWireAvailable;
///
/// Occurs when waste replacement is required.
///
event EventHandler WasteReplacementRequired;
///
/// Gets or sets a value indicating whether direct the embedded device to send diagnostics messages.
///
bool EnableDiagnostics { get; set; }
///
/// Gets or sets a value indicating whether direct the embedded device to send events notification messages.
///
bool EnableEventsNotification { get; set; }
///
/// Gets or sets a value indicating whether to allow incoming debugging messages.
///
bool EnableEmbeddedDebugging { get; set; }
///
/// Gets or sets a value indicating whether to check whether a job is in progress after connection was successful.
///
bool EnableJobResume { get; set; }
///
/// Gets or sets a value indicating whether to direct the embedded device to update about status changes.
///
bool EnableMachineStatusUpdates { get; set; }
///
/// Gets or sets a value indicating whether to enable automatic thread loading support.
///
bool EnableAutomaticThreadLoading { get; set; }
///
/// Gets or sets a value indicating whether to enable the power sequence tracking.
///
bool EnablePowerUpSequence { get; set; }
///
/// Gets or sets a value indicating whether to enable the ink/waste filling status channel.
///
bool EnableInkFillingStatus { get; set; }
///
/// Gets or set a value indicating whether to enable telemetry flow from the firmware to the cloud.
///
bool EnableTelemetryWire { get; set; }
///
/// Gets the last process parameters table sent to the embedded device.
///
ProcessParametersTable CurrentProcessParameters { get; }
///
/// Gets the last hardware configuration sent to the embedded device.
///
HardwareConfiguration CurrentHardwareConfiguration { get; }
///
/// Gets or sets the embedded device information.
///
DeviceInformation DeviceInformation { get; }
///
/// Gets or sets the machine events state provider used to get notifications about current machine events and errors.
///
IMachineEventsStateProvider MachineEventsStateProvider { get; set; }
///
/// Gets or sets the job runs logger.
///
IJobRunsLogger JobRunsLogger { get; set; }
///
/// Prints the specified job.
/// The process parameters table will be calculated using color conversion gamut region.
/// This method cannot accept brush stops with 'Volume' as color space.
///
/// The job.
/// Optional job configuration.
///
Task Print(Job job, AdditionalJobConfiguration config = null);
///
/// Prints the specified job using the specified job parameters.
///
/// The job.
/// Process parameters table
///
Task Print(Job job, ProcessParametersTable processParameters, AdditionalJobConfiguration config = null);
///
/// Uploads the specified process parameters to the embedded device.
///
/// The process parameters.
///
Task UploadProcessParameters(ProcessParametersTable processParameters);
///
/// Uploads the specified hardware configuration to the embedded device.
///
/// Machine version.
/// Machine configuration.
///
Task UploadHardwareConfiguration(HardwareVersion hardwareVersion, Configuration configuration);
///
/// Starts jogging the specified motor.
///
/// The request.
///
Task StartMotorJogging(MotorJoggingRequest request);
///
/// Stops jogging the specified motor.
///
/// The request.
///
Task StopMotorJogging(MotorAbortJoggingRequest request);
///
/// Starts homing the specified motor.
///
/// The request.
///
IObservable StartMotorHoming(MotorHomingRequest request);
///
/// Stops homing the specified motor.
///
/// The request.
///
Task StopMotorHoming(MotorAbortHomingRequest request);
///
/// Starts jogging the specified dispenser.
///
/// The request.
///
Task StartDispenserJogging(DispenserJoggingRequest request);
///
/// Stops jogging the specified dispenser.
///
/// The request.
///
Task StopDispenserJogging(DispenserAbortJoggingRequest request);
///
/// Starts homing the specified dispenser.
///
/// The request.
///
IObservable StartDispenserHoming(DispenserHomingRequest request);
///
/// Stops homing the specified dispenser.
///
/// The request.
///
Task StopDispenserHoming(DispenserAbortHomingRequest request);
///
/// Turn on/off the specified digital output pin.
///
/// The request.
///
Task SetDigitalOut(SetDigitalOutRequest request);
///
/// Starts jogging the thread motion system.
///
/// The request.
///
Task StartThreadJogging(ThreadJoggingRequest request);
///
/// Stops jogging the thread motion system.
///
/// The request.
///
Task StopThreadJogging(ThreadAbortJoggingRequest request);
///
/// Sets the specified component value.
///
/// The request.
///
Task SetComponentValue(SetComponentValueRequest request);
///
/// Sets the state of the specified heater type.
///
/// The heater.
/// Set point temperature.
///
Task SetHeaterState(HeaterType heater, double setPoint);
///
/// Sets the state of the specified blower.
///
/// The blower.
/// Blower on/off.
/// The voltage in millivolts.
///
Task SetBlowerState(PMR.Hardware.HardwareBlowerType blower, bool isActive, double voltage);
///
/// Sets the state of the specified valve type.
///
/// The valve.
/// Valve state.
///
Task SetValveState(ValveType valve, ValveStateCode state);
///
/// Resolves the specified event type.
///
/// Type of the event.
///
Task ResolveEvent(PMR.Diagnostics.EventType eventType);
///
/// Resets the embedded device.
///
///
Task Reset();
///
/// Directs the embedded device to switch to stand-by mode.
///
///
Task StandBy();
///
/// Resets the device through the DFU channel.
///
///
Task ResetDFU();
///
/// Upgrades the firmware.
///
/// The TFP stream (Tango Firmware Package File).
/// Specify whether the connected machine is emulated and to skip the actual DFU interface.
///
Task UpgradeFirmware(Stream tfpStream, bool isEmulated = false);
///
/// Directs the embedded device to validate the last uploaded firmware package.
///
///
Task ValidateFirmwareVersion(String path);
///
/// Directs the embedded device to validate the last uploaded firmware package.
///
///
Task ActivateFirmwareVersion(String path);
///
/// Gets the firmware update package info.
///
/// The TFP (Tango Firmware Package File) stream.
///
Task GetFirmwarePackageInfo(Stream tfpStream);
///
/// Creates a storage manager for managing the machine file system.
///
///
StorageManager CreateStorageManager();
///
/// Turns off the machine.
///
///
Task PowerDown();
///
/// Starts a manual head cleaning process.
///
///
Task PerformHeadCleaning(bool longCleaning);
///
/// Starts the automatic thread loading process.
///
///
Task StartThreadLoading();
///
/// Continues the current thread loading.
///
/// The process parameters.
///
Task ContinueThreadLoading(ProcessParametersTable processParameters);
///
/// Aborts the current thread loading process.
///
///
Task AbortThreadLoading();
///
/// Attempts to jog the thread in order to check whether there are no thread breaking issues.
///
///
Task AttemptThreadJogging();
///
/// Emulates a hardware event that will last for the specified timeout.
///
/// Type of the event.
/// The timeout.
void PushEmulatedEvent(Event ev, TimeSpan timeout);
///
/// Gets the last machine built-in test results.
///
///
Task> GetBitResults(List bitTypes);
///
/// Notifies the remote machine about spool type change.
/// If the machine is not connected the spool type will be added to the connection request.
///
/// Type of the spool.
Task SetSpoolType(JobSpoolType spoolType);
///
/// Completes the waste replacement sequence.
///
/// Approve or decline the sequence.
Task CompleteWasteReplacement(bool approved);
///
/// Gets the list of firmware version descriptors.
///
///
Task> GetFirmwareVersionDescriptors();
///
/// Resets the firmware card by the specified card id.
///
/// The card identifier.
///
Task ResetCard(int cardID);
///
/// Sets the machine power saving mode.
///
/// The time to idle in minutes.
/// The time to power down in minutes.
///
Task SetPowerSavingMode(int timeToIdleMinutes,int timeToPowerDownMinutes);
///
/// Sets the jerrican inserted liters.
///
/// IDS pack index.
/// The inserted liters.
///
Task SetJerricanInsertedLiters(int idsPackIndex, double insertedLiters);
///
/// Sets the machine buzzer settings.
///
Task SetBuzzerSettings(bool enable, int duration);
///
/// Sets the machine white thread skip settings.
///
Task SetWhiteThreadSkip(bool enable);
}
}