/// <summary> /// Returns an InstrumentBlocksType runtime object containing the CFX system status of all connected instruments, /// along with any associated service or instrument error reports. /// </summary> /// <returns>List of InstrumentStatus objects containing the statuses of all connected CFX systems.</returns> public List <InstrumentStatus> GetInstrumentStatus() { try { m_MasterMessage.Item = m_InstrumentStatus_Item; return(BlocksType2StatusList(XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage))))); } catch (Exception ex) { OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name))); } return(null); }
/// <summary> /// Unregister the underlying client with CFX Manager API service. Called by the consumer facing CloseClient() /// method. It is important that the client unregister with the service before closing since the service uses /// the registration to enforce its single client policy. /// /// Wraps CFXManagerClient:SendServiceRequest() in the local exception handling framework /// </summary> /// <returns>true IFF no exceptions occurred during the operation</returns> private InstrumentBlocksType Unregister() { try { m_MasterMessage.Item = m_Unregister_Item; return(XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage)))); } catch (Exception ex) { OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name))); } return(null); }
/// <summary> /// Shutdown the CFX Manager application hosting the service. This should be used by consumer applications to /// shut-down server mode (no UI) instances of the CFX Manager application which they have explcitly started. /// If this command is not used to shut down such instances (the application is shut-down by simply killing /// the process, for example) then there is a high likelyhood that certain associated independent processes /// will remain running and prevent any further normal operation of CFX Manager until host system reboot. /// </summary> public void ShutDown() { try { //We know we will probably get a time-out here because the service will be closed during the shut-down, //so set the time-out to 1 second be sure we don't have to wait any longer than that at the send command. CFXManagerClient.SetResponseTimeOut(1); m_MasterMessage.Item = m_ShutDown_Item; CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage)); } catch { ; //an expected time-out will often occur here because the shut-down sequence closes the service //pretty quicky, usually before a response can be generated. } }
/// <summary> /// Generate PDF report from the specified data file /// </summary> /// <param name="dataFile">The data file from which to generate the report</param> /// <param name="templateFile">The report template file to be use to generate the report</param> /// <param name="outputFile"> /// Fully qualified file name of the report file will be written. /// If empty or null then the name of the data file will be used with the filename extention replaced according to the report file type. /// </param> /// <list type=""> /// <item>Portable data format ("PDF").</item> /// <item>Mime-type HTML ("mHTML").</item> /// <item>Plain Text ("text").</item> /// </list> /// <returns>List of InstrumentStatus objects containing the status of all connected instruments</returns> public List <InstrumentStatus> GenerateReport( string dataFile, string templateFile, string outputFile ) { try { m_GenerateReport_Item.DataFile = dataFile; m_GenerateReport_Item.OutputFile = outputFile; m_GenerateReport_Item.TemplateFile = templateFile; m_GenerateReport_Item.Type = ReportTypes.pdf; m_MasterMessage.Item = m_GenerateReport_Item; return(BlocksType2StatusList(XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage))))); } catch (Exception ex) { OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name))); } return(null); }
/// <summary> /// Start a protocol run using the given parameters on the specified CFX system. /// </summary> /// <param name="serialNumber"> /// Serial number of CFX system base /// </param> /// <param name="protocolFile"> /// Fully qualified protocol, LIMS, or PrimePCR file name /// </param> /// <param name="plateFile"> /// Full path to plate file if protocolFile is a real-time protocol(.pcrd) file. /// Null if protocolFile is a conventional protocol, a LIMS(.csv) file, or PrimePCR(.plrn) file. /// </param> /// <param name="runNote"> /// Text to appear as Notes in the report file /// </param> /// <param name="runID"> /// Text to appear as Run ID, (typically a plate barcode), in the report file /// </param> /// <param name="DataFileName"> /// Fully qualified file name of the data file to be created, or empty to use CFX manager default settings /// </param> /// <param name="LockInstrumentPanel"> /// Locking the instrument front panel during the run? True to lock /// </param> /// <param name="GenerateReport"> /// Generate report after the run? True to generate report /// </param> /// <param name="ReportTemplate"> /// Full path to report template file to be used to create reports or empty to use default template /// </param> /// <param name="ReportFileName"> /// Fully qualified file name of the data file to be created, or empty to use CFX manager default settings /// </param> /// <param name="EmailAddresses"> /// Comma seperated Email addresses to send data files and reports to at run completion. /// </param> /// <returns> /// InstrumentBlocksType runtime object containing the status of the target instrument and any errors that occurred during the operation /// </returns> public List <InstrumentStatus> RunProtocol( string serialNumber, string protocolFile, string plateFile, string runNote, string runID, string DataFileName, bool LockInstrumentPanel, bool GenerateReport, string ReportTemplate, string ReportFileName, string EmailAddresses) { try { m_RunProtocol_Item.SerialNumber = serialNumber; m_RunProtocol_Item.ProtocolFile = protocolFile; m_RunProtocol_Item.PlateFile = plateFile; m_RunProtocol_Item.Note = runNote == null ? string.Empty : runNote; m_RunProtocol_Item.RunId = runID == null ? string.Empty : runID; m_RunProtocol_Item.DataFile = DataFileName; m_RunProtocol_Item.LockInstrumentPanel = LockInstrumentPanel; m_RunProtocol_Item.GenerateReportEndOfRun = GenerateReport; m_RunProtocol_Item.GenerateReportTemplateFile = ReportTemplate; m_RunProtocol_Item.GenerateReportOutputFile = ReportFileName; m_RunProtocol_Item.EmailAddresses = EmailAddresses; m_RunProtocol_Item.GenerateReportType = ReportTypes.pdf; m_MasterMessage.Item = m_RunProtocol_Item; return(BlocksType2StatusList(XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage))))); } catch (Exception ex) { OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name))); } return(null); }
/// <summary> /// Register the underlying client with the CFX Manager API service. Called by the consumer facing OpenClient() /// method to register the underlying client with the service once the connection is established. /// /// The registration ID aquired by this request is required by all other service requests. This class hides the /// registration ID and its associated role in service transactions from consuming applications. /// /// Wraps CFXManagerClient:SendServiceRequest() in the local exception handling framework /// </summary> /// <returns>true IFF no exceptions occurred during the operation</returns> private bool Register() { m_registrationID = string.Empty; try { m_MasterMessage.Item = m_Register_Item; m_MasterMessage.RegistrationID = string.Empty; InstrumentBlocksType response = XML2BlocksType(CFXManagerClient.SendServiceRequest(Message2XML(m_MasterMessage))); m_registrationID = response.RegistrationID; m_MasterMessage.RegistrationID = m_registrationID; } catch (Exception ex) { OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name))); } if (string.IsNullOrEmpty(m_registrationID)) { OnClientError(new ClientErrorEventArgs( new ErrorRecord(ErrorRecord.c_NoCode, "Registration with the CFX Manager API service failed. A previously connected client may have exited without unregistering. Try re-starting CFX Manager", System.Reflection.MethodBase.GetCurrentMethod().Name))); } return(!string.IsNullOrEmpty(m_registrationID)); }