Exemplo n.º 1
0
 /// <summary>
 /// Initialize a new instance of the class and set the function delegates, properties and member variables to those values associated with the
 /// specified communication interface.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be
 /// used to initialize the class.</param>
 public CommunicationWatch(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initialize a new instance of the class
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be
 /// used to initialize the class.</param>
 public CommunicationSelfTest(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
     m_SelfTestMarshal = new SelfTestMarshal(communicationInterface.CommDevice);
 }
 /// <summary>
 /// Initialize a new instance of the class and set the properties and member variables to those values associated with the specified
 /// communication interface.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be
 /// used to initialize the class.</param>
 public CommunicationSelfTestOffline(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
 }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes an new instance of the form. Defines the communication interface and then downloads the current default data stream parameters and displays these
        /// on the form.
        /// </summary>
        /// <param name="communicationInterface">Reference to the communication interface that is to be used to communicate with the VCU.</param>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        /// <param name="log">The selected event log.</param>
        public FormConfigureFaultLogParameters(ICommunicationParent communicationInterface, WorksetCollection worksetCollection, Log log)
            : base(worksetCollection)
        {
            InitializeComponent();

            // Move the position of the Cancel buttons.
            m_ButtonCancel.Location = m_ButtonApply.Location;

            // Initialize the communication interface.
            if (communicationInterface is CommunicationParent)
            {
                CommunicationInterface = new CommunicationEvent(communicationInterface);
            }
            else
            {
                CommunicationInterface = new CommunicationEventOffline(communicationInterface);
            }
            Debug.Assert(CommunicationInterface != null);

            // Don't allow the user to edit the workset until the security level of the workset has been established.
            ModifyEnabled = false;
            m_NumericUpDownSampleMultiple.Enabled = ModifyEnabled;

            // ----------------------------------------------------
            // Get the current data stream parameters from the VCU.
            // ----------------------------------------------------
            short variableCount, pointCount, sampleMultiple;

            short[] watchIdentifiers, dataTypes;
            try
            {
                CommunicationInterface.GetDefaultStreamInformation(out variableCount, out pointCount, out sampleMultiple, out watchIdentifiers, out dataTypes);
            }
            catch (Exception)
            {
                MessageBox.Show(Resources.MBTGetDefaultStreamParametersFailed, Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Convert the parameters to a workset.
            Workset_t workset = CommunicationInterface.ConvertToWorkset("GetDefaultStreamInformation()", watchIdentifiers, sampleMultiple);

            // Search the list of worksets for a match.
            m_WorksetFromVCU   = workset;
            m_WorksetToCompare = workset;
            Workset_t matchedWorkset = Workset.FaultLog.Worksets.Find(CompareWorkset);

            // Check whether a match was found.
            if (matchedWorkset.WatchItems == null)
            {
                // No - Create a new workset.
                workset.Name = DefaultNewWorksetName;

                // Set the flag to indicate that the workset does not exist and that any changes will be saved as a new workset.
                m_CreateMode = true;
                m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDown;

                // Ensure that the TextChanged event is not triggered as a result of specifying the Text property of the TextBox control.
                m_TextBoxName.TextChanged -= new EventHandler(m_TextBoxName_TextChanged);
                m_TextBoxName.Text         = workset.Name;
                m_TextBoxName.TextChanged += new EventHandler(m_TextBoxName_TextChanged);

                m_TextBoxName.Enabled = true;
            }
            else
            {
                // Yes - Update the name and security level of the workset.
                workset = matchedWorkset;

                // Set the flag to indicate that the form already exists and any changes will result in the existing workset being modified.
                m_CreateMode = false;
                m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDownList;

                // Ensure that the TextChanged event is not triggered as a result of specifying the Text property of the TextBox control.
                m_TextBoxName.TextChanged -= new EventHandler(m_TextBoxName_TextChanged);
                m_TextBoxName.Text         = workset.Name;
                m_TextBoxName.TextChanged += new EventHandler(m_TextBoxName_TextChanged);

                m_TextBoxName.Enabled = false;
            }

            // Keep a record of the selected workset. This must be set up before the call to SetEnabledEditNewCopyRename().
            m_SelectedWorkset = workset;

            SetEnabledEditNewCopyRename(true);

            // Display the name of the default workset on the ComboBox control.
            // Ensure that the SelectionChanged event is not triggered as a result of specifying the Text property of the ComboBox control.
            m_ComboBoxWorkset.SelectedIndexChanged -= new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged);
            m_ComboBoxWorkset.Text = workset.Name;
            m_ComboBoxWorkset.SelectedIndexChanged += new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged);

            LoadWorkset(workset);

            // Update the EntryCountMax property to reflect the actual number of watch variables associated with the current event log.
            m_EntryCountMax = log.DataStreamTypeParameters.WatchVariablesMax;
            UpdateCount();

            // Check whether the 'Row Header' ListBox can be used to display the channel numbers. This is only possible if
            // the project doesn't support multiple data stream types and the number of parameters supported by the data
            // stream can be displayed on the TabPage without the need for scroll bars i.e. <= WatchSizeFaultLogMax.
            if ((Parameter.SupportsMultipleDataStreamTypes == false) && (Parameter.WatchSizeFaultLog <= WatchSizeFaultLogMax))
            {
                AddRowHeader();
            }
            else
            {
                NoRowHeader();
            }

            // Disable all options other than save if the downloaded workset doesn't exist.
            if (m_CreateMode == true)
            {
                SetEnabledEditNewCopyRename(false);
            }

            // Allow the user to save the workset if it doesn't already exist.
            m_TSBSave.Enabled = (m_CreateMode == true) ? true : false;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initialize a new instance of the class and set the function delegates, properties and member variables.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to
 /// be used to initialize the class.</param>
 public CommunicationParent(ICommunicationParent communicationInterface)
     : this()
 {
     m_CommunicationSetting = communicationInterface.CommunicationSetting;
     m_CommDevice = communicationInterface.CommDevice;
     m_WatchClockMarshal = communicationInterface.WatchClockMarshall;
 }
 /// <summary>
 /// Initialize a new instance of the class and set the properties and member variables to those values associated with the specified
 /// communication interface.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be
 /// used to initialize the class.</param>
 public CommunicationSelfTestOffline(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initialize a new instance of the class and set the function delegates, properties and member variables to those values associated with the
 /// specified communication interface.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to
 /// be used to initialize the class.</param>
 public CommunicationEvent(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
     #region - [Initialize VcuCommunication.event.cpp Function Delegates] -
     // ----------------------------------------------------------------------
     // Initialize the function delegates to either the VcuCommunication32.dll
     // or VcuCommunication64.dll functions depending upon whether the
     // Windows operating system is 64 bit or 32 bit.
     // ----------------------------------------------------------------------
     if (m_Is64BitOperatingSystem == true)
     {
         m_LoadFaultlog = VcuCommunication64Event.LoadFaultlog;
         m_CheckFaultlogger = VcuCommunication64Event.CheckFaultlogger;
         m_GetFaultHdr = VcuCommunication64Event.GetFaultHdr;
         m_GetFaultVar = VcuCommunication64Event.GetFaultVar;
         m_GetFltFlagInfo = VcuCommunication64Event.GetFltFlagInfo;
         m_GetFltHistInfo = VcuCommunication64Event.GetFltHistInfo;
         m_FreeEventLogMemory = VcuCommunication64Event.FreeEventLogMemory;
         m_SetFaultFlags = VcuCommunication64Event.SetFaultFlags;
         m_ClearEvent = VcuCommunication64Event.ClearEvent;
         m_InitializeEventLog = VcuCommunication64Event.InitializeEventLog;
         m_GetStream = VcuCommunication64Event.GetStream;
         m_GetStreamInformation = VcuCommunication64Event.GetStreamInformation;
         m_GetDefaultStreamInformation = VcuCommunication64Event.GetDefaultStreamInformation;
         m_SetDefaultStreamInformation = VcuCommunication64Event.SetDefaultStreamInformation;
         m_GetEventLog = VcuCommunication64Event.GetEventLog;
         m_ChangeEventLog = VcuCommunication64Event.ChangeEventLog;
         m_ExitEventLog = VcuCommunication64Event.ExitEventLog;
     }
     else
     {
         m_LoadFaultlog = VcuCommunication32Event.LoadFaultlog;
         m_CheckFaultlogger = VcuCommunication32Event.CheckFaultlogger;
         m_GetFaultHdr = VcuCommunication32Event.GetFaultHdr;
         m_GetFaultVar = VcuCommunication32Event.GetFaultVar;
         m_GetFltFlagInfo = VcuCommunication32Event.GetFltFlagInfo;
         m_GetFltHistInfo = VcuCommunication32Event.GetFltHistInfo;
         m_FreeEventLogMemory = VcuCommunication32Event.FreeEventLogMemory;
         m_SetFaultFlags = VcuCommunication32Event.SetFaultFlags;
         m_ClearEvent = VcuCommunication32Event.ClearEvent;
         m_InitializeEventLog = VcuCommunication32Event.InitializeEventLog;
         m_GetStream = VcuCommunication32Event.GetStream;
         m_GetStreamInformation = VcuCommunication32Event.GetStreamInformation;
         m_GetDefaultStreamInformation = VcuCommunication32Event.GetDefaultStreamInformation;
         m_SetDefaultStreamInformation = VcuCommunication32Event.SetDefaultStreamInformation;
         m_GetEventLog = VcuCommunication32Event.GetEventLog;
         m_ChangeEventLog = VcuCommunication32Event.ChangeEventLog;
         m_ExitEventLog = VcuCommunication32Event.ExitEventLog;
     }
     #endregion - [Initialize VcuCommunication.event.cpp Function Delegates] -
 }
        /// <summary>
        /// Initialize a new instance of the class and set the properties and member variables to those values associated with the specified
        /// communication interface.
        /// </summary>
        /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be
        /// used to initialize the class.</param>
        public CommunicationParentOffline(ICommunicationParent communicationInterface)
        {
            // Initialize the watch element array.
            m_WatchElements = new WatchElement_t[Parameter.WatchSize];

            m_CommunicationSetting = communicationInterface.CommunicationSetting;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes an new instance of the form. Defines the communication interface and then downloads the current default data stream parameters and displays these
        /// on the form.
        /// </summary>
        /// <param name="communicationInterface">Reference to the communication interface that is to be used to communicate with the VCU.</param>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        /// <param name="log">The selected event log.</param>
        public FormConfigureFaultLogParameters(ICommunicationParent communicationInterface, WorksetCollection worksetCollection, Log log)
            : base(worksetCollection)
        {
            InitializeComponent();

            // Only one column is required for this workset so delete the tab pages associated with columns 2 and 3.
            m_TabControlColumn.TabPages.Remove(m_TabPageColumn2);
            m_TabControlColumn.TabPages.Remove(m_TabPageColumn3);

            // Move the position of the Cancel buttons.
            m_ButtonCancel.Location = m_ButtonApply.Location;

            // Check the mode of the PTU.
            if (communicationInterface == null)
            {
                CommunicationInterface = null;
            }
            else if (communicationInterface is CommunicationParent)
            {
                // The PTU is in online mode.
                CommunicationInterface = new CommunicationEvent(communicationInterface);
            }
            else
            {
                // The PTU is in simulation mode (originally referred to as offline mode).
                CommunicationInterface = new CommunicationEventOffline(communicationInterface);
            }

            // Don't allow the user to edit the workset until the security level of the workset has been established.
            ModifyEnabled = false;
            m_NumericUpDownSampleMultiple.Enabled = ModifyEnabled;

            #region - [ToolTipText] -
            m_ToolStrip.Items[CommonConstants.KeyToolStripButtonUpload].ToolTipText           = Resources.FunctionKeyToolTipDataStreamUpload;
            m_ToolStrip.Items[CommonConstants.KeyToolStripButtonSave].ToolTipText             = Resources.FunctionKeyToolTipDataStreamSave;
            m_ToolStrip.Items[CommonConstants.KeyToolStripButtonEdit].ToolTipText             = Resources.FunctionKeyToolTipDataStreamConfigure;
            m_ToolStrip.Items[CommonConstants.KeyToolStripButtonNew].ToolTipText              = Resources.FunctionKeyToolTipDataStreamCreate;
            m_ToolStrip.Items[CommonConstants.KeyToolStripButtonCopy].ToolTipText             = Resources.FunctionKeyToolTipDataStreamCopy;
            m_ToolStrip.Items[CommonConstants.KeyToolStripButtonRename].ToolTipText           = Resources.FunctionKeyToolTipDataStreamRename;
            m_ToolStrip.Items[CommonConstants.KeyToolStripButtonDelete].ToolTipText           = Resources.FunctionKeyToolTipDataStreamDelete;
            m_ToolStrip.Items[CommonConstants.KeyToolStripButtonSetAsDefault].ToolTipText     = Resources.FunctionKeyToolTipDataStreamSetAsDefault;
            m_ToolStrip.Items[CommonConstants.KeyToolStripButtonOverrideSecurity].ToolTipText = Resources.FunctionKeyToolTipDataStreamOverrideSecurity;
            #endregion - [ToolTipText] -

            #region - [Get the Current Data Stream from the VCU] -
            // This only applies if the PTU is online.
            Workset_t workset;
            if (CommunicationInterface != null)
            {
                short   variableCount, pointCount, sampleMultiple;
                short[] watchIdentifiers, dataTypes;
                try
                {
                    CommunicationInterface.GetDefaultStreamInformation(out variableCount, out pointCount, out sampleMultiple, out watchIdentifiers, out dataTypes);
                }
                catch (Exception)
                {
                    MessageBox.Show(Resources.MBTGetDefaultStreamParametersFailed, Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Convert the parameters to a workset.
                workset = CommunicationInterface.ConvertToWorkset("GetDefaultStreamInformation()", watchIdentifiers, sampleMultiple);

                // Search the list of worksets for a match.
                m_WorksetFromVCU   = workset;
                m_WorksetToCompare = workset;
                Workset_t matchedWorkset = Workset.FaultLog.Worksets.Find(CompareWorkset);

                // Check whether a match was found.
                if (matchedWorkset.WatchItems == null)
                {
                    // No - Create a new workset.
                    workset.Name = DefaultNewWorksetName;

                    // Set the flag to indicate that the workset does not exist and that any changes will be saved as a new workset.
                    m_CreateMode = true;
                    m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDown;

                    // Ensure that the TextChanged event is not triggered as a result of specifying the Text property of the TextBox control.
                    m_TextBoxName.TextChanged -= new EventHandler(m_TextBoxName_TextChanged);
                    m_TextBoxName.Text         = workset.Name;
                    m_TextBoxName.TextChanged += new EventHandler(m_TextBoxName_TextChanged);

                    m_TextBoxName.Enabled = true;
                }
                else
                {
                    // Yes - Update the name and security level of the workset.
                    workset = matchedWorkset;

                    // Set the flag to indicate that the form already exists and any changes will result in the existing workset being modified.
                    m_CreateMode = false;
                    m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDownList;

                    // Ensure that the TextChanged event is not triggered as a result of specifying the Text property of the TextBox control.
                    m_TextBoxName.TextChanged -= new EventHandler(m_TextBoxName_TextChanged);
                    m_TextBoxName.Text         = workset.Name;
                    m_TextBoxName.TextChanged += new EventHandler(m_TextBoxName_TextChanged);

                    m_TextBoxName.Enabled = false;
                }
            }
            else
            {
                // Load the default workset.
                workset = worksetCollection.Worksets[worksetCollection.DefaultIndex];

                // Set the flag to indicate that the form already exists and any changes will result in the existing workset being modified.
                m_CreateMode = false;
                m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDownList;

                // Ensure that the TextChanged event is not triggered as a result of specifying the Text property of the TextBox control.
                m_TextBoxName.TextChanged -= new EventHandler(m_TextBoxName_TextChanged);
                m_TextBoxName.Text         = workset.Name;
                m_TextBoxName.TextChanged += new EventHandler(m_TextBoxName_TextChanged);

                m_TextBoxName.Enabled = false;
            }
            #endregion - [Get the Current Data Stream from the VCU] -

            // Keep a record of the selected workset. This must be set up before the call to SetEnabledToolStripButtons().
            m_SelectedWorkset = workset;

            SetEnabledToolStripButtons(true);

            // Update the 'Default' Image that identifies whether the selected workset is the default workset or not.
            m_PictureBoxDefault.Visible = (m_SelectedWorkset.Name.Equals(m_WorksetCollection.DefaultName)) ? true : false;

            // Display the name of the workset on the ComboBox control.
            // Ensure that the SelectionChanged event is not triggered as a result of specifying the Text property of the ComboBox control.
            m_ComboBoxWorkset.SelectedIndexChanged -= new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged);
            m_ComboBoxWorkset.Text = workset.Name;
            m_ComboBoxWorkset.SelectedIndexChanged += new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged);

            LoadWorkset(m_SelectedWorkset);

            // If an event log was specified, update the EntryCountMax property to reflect the actual number of watch variables associated with the current event log.
            if (log != null)
            {
                m_EntryCountMax = log.DataStreamTypeParameters.WatchVariablesMax;
            }
            UpdateCount();

            // Check whether the 'Row Header' ListBox can be used to display the channel numbers. This is only possible if
            // the project doesn't support multiple data stream types and the number of parameters supported by the data
            // stream can be displayed on the TabPage without the need for scroll bars i.e. <= WatchSizeFaultLogMax.
            if ((Parameter.SupportsMultipleDataStreamTypes == false) && (Parameter.WatchSizeFaultLog <= WatchSizeFaultLogMax))
            {
                AddRowHeader();
            }
            else
            {
                NoRowHeader();
            }

            // Disable all options other than save if the downloaded workset doesn't exist.
            if (m_CreateMode == true)
            {
                SetEnabledToolStripButtons(false);
            }

            // Allow the user to save the workset if it doesn't already exist.
            m_TSBSave.Enabled = (m_CreateMode == true) ? true : false;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the class. 
        /// </summary>
        /// <param name="communicationInterface">The communication interface that is to be used to communicate with the VCU.</param>
        /// <param name="log">The current event log.</param>
        public FormShowEventHistory(ICommunicationParent communicationInterface, Log log)
        {
            InitializeComponent();

            // Initialize the communication interface.
            if (communicationInterface is CommunicationParent)
            {
                CommunicationInterface = new CommunicationEvent(communicationInterface);
            }
            else
            {
                CommunicationInterface = new CommunicationEventOffline(communicationInterface);
            }
            Debug.Assert(CommunicationInterface != null);

            #region - [Size] -
            m_DataGridViewTextColumnEnableEvent.Visible = false;
            m_DataGridViewTextColumnStreamTriggered.Visible = false;
            m_DataGridViewTextColumnCumulativeHistory.Visible = true;
            m_DataGridViewTextColumnRecentHistory.Visible = true;

            // Get the combined width of all visible DataGridView columns.
            int dataGridViewWidth = 0;
            DataGridViewColumn dataGridViewColumn;
            for (int columnIndex = 0; columnIndex < m_DataGridViewEventStatus.Columns.Count; columnIndex++)
            {
                dataGridViewColumn = m_DataGridViewEventStatus.Columns[columnIndex];
                if (dataGridViewColumn.Visible == true)
                {
                    dataGridViewWidth += dataGridViewColumn.Width;
                }
            }

            m_PanelDataGridViewEventStatus.Width = dataGridViewWidth + MarginRightDataGridViewControl;

            Width = m_PanelDataGridViewEventStatus.Width + MarginRightPanelControl;
            #endregion - [Size] -

            #region - [Buttons] -
            // Only the OK button is required for this form, move the position of the OK button so that it hides the cancel button.
            m_ButtonCancel.Visible = false;
            m_ButtonOK.Location = m_ButtonCancel.Location;
            #endregion - [Buttons] -

            #region - [Context Menu] -
            // Disable those context menu options that are not applicable to this form.
            m_ContextMenuStripFlags.Items[ContextMenuItemIndexEnabled].Visible = false;
            m_ContextMenuStripFlags.Items[ContextMenuItemIndexStreamTriggered].Visible = false;
            #endregion - [Context Menu] -

            // ------------------------------------------------------------------
            // Get the list of events associated with the current event log.
            // ------------------------------------------------------------------
            List<EventRecord> foundEventRecordList = Lookup.EventTable.RecordList.FindAll(delegate(EventRecord eventRecord)
            {
                // Include a try/catch block in case an event record has not been defined.
                try
                {
                    // The LOGID field of the EVENTS table actually uses the log index value which is equal to the log identifier - 1.
                    return (eventRecord.LogIdentifier == log.Identifier - 1);
                }
                catch (Exception)
                {
                    return false;
                }
            });

            foundEventRecordList.Sort(CompareByTaskIDByEventIDAscending);

            try
            {
                FormGetFltHistInfo formGetFltHistInfo = new FormGetFltHistInfo(CommunicationInterface, foundEventRecordList, log);
                formGetFltHistInfo.CalledFrom = this;
                formGetFltHistInfo.ShowDialog();
            }
            catch (Exception)
            {
                throw new CommunicationException(Resources.EMGetFltHistInfoFailed);
            }

            AddList(EventStatusList);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="communicationInterface">The communication interface that is to be used to communicate with the VCU.</param>
        /// <param name="log">The current event log.</param>
        public FormShowEventHistory(ICommunicationParent communicationInterface, Log log)
        {
            InitializeComponent();

            // Initialize the communication interface.
            if (communicationInterface is CommunicationParent)
            {
                CommunicationInterface = new CommunicationEvent(communicationInterface);
            }
            else
            {
                CommunicationInterface = new CommunicationEventOffline(communicationInterface);
            }
            Debug.Assert(CommunicationInterface != null);

            #region - [Size] -
            m_DataGridViewTextColumnEnableEvent.Visible       = false;
            m_DataGridViewTextColumnStreamTriggered.Visible   = false;
            m_DataGridViewTextColumnCumulativeHistory.Visible = true;
            m_DataGridViewTextColumnRecentHistory.Visible     = true;

            // Get the combined width of all visible DataGridView columns.
            int dataGridViewWidth = 0;
            DataGridViewColumn dataGridViewColumn;
            for (int columnIndex = 0; columnIndex < m_DataGridViewEventStatus.Columns.Count; columnIndex++)
            {
                dataGridViewColumn = m_DataGridViewEventStatus.Columns[columnIndex];
                if (dataGridViewColumn.Visible == true)
                {
                    dataGridViewWidth += dataGridViewColumn.Width;
                }
            }

            m_PanelDataGridViewEventStatus.Width = dataGridViewWidth + MarginRightDataGridViewControl;

            Width = m_PanelDataGridViewEventStatus.Width + MarginRightPanelControl;
            #endregion - [Size] -

            #region - [Buttons] -
            // Only the OK button is required for this form, move the position of the OK button so that it hides the cancel button.
            m_ButtonCancel.Visible = false;
            m_ButtonOK.Location    = m_ButtonCancel.Location;
            #endregion - [Buttons] -

            #region - [Context Menu] -
            // Disable those context menu options that are not applicable to this form.
            m_ContextMenuStripFlags.Items[ContextMenuItemIndexEnabled].Visible         = false;
            m_ContextMenuStripFlags.Items[ContextMenuItemIndexStreamTriggered].Visible = false;
            #endregion - [Context Menu] -

            // ------------------------------------------------------------------
            // Get the list of events associated with the current event log.
            // ------------------------------------------------------------------
            List <EventRecord> foundEventRecordList = Lookup.EventTable.RecordList.FindAll(delegate(EventRecord eventRecord)
            {
                // Include a try/catch block in case an event record has not been defined.
                try
                {
                    // The LOGID field of the EVENTS table actually uses the log index value which is equal to the log identifier - 1.
                    return(eventRecord.LogIdentifier == log.Identifier - 1);
                }
                catch (Exception)
                {
                    return(false);
                }
            });

            foundEventRecordList.Sort(CompareByTaskIDByEventIDAscending);

            try
            {
                FormGetFltHistInfo formGetFltHistInfo = new FormGetFltHistInfo(CommunicationInterface, foundEventRecordList, log);
                formGetFltHistInfo.CalledFrom = this;
                formGetFltHistInfo.ShowDialog();
            }
            catch (Exception)
            {
                throw new CommunicationException(Resources.EMGetFltHistInfoFailed);
            }

            AddList(EventStatusList);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Initialize a new instance of the class and set the function delegates, properties and member variables to those values associated with the
 /// specified communication interface.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be
 /// used to initialize the class.</param>
 public CommunicationSelfTest(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
     #region - [Initialize VcuCommunication.selftest.cpp Function Delegates] -
     // ----------------------------------------------------------------------
     // Initialize the function delegates to either the VcuCommunication32.dll
     // or VcuCommunication64.dll functions depending upon whether the
     // Windows operating system is 64 bit or 32 bit.
     // ----------------------------------------------------------------------
     if (m_Is64BitOperatingSystem == true)
     {
         m_GetSelfTestSpecialMessage = VcuCommunication64SelfTest.GetSelfTestSpecialMessage;
         m_StartSelfTestTask = VcuCommunication64SelfTest.StartSelfTestTask;
         m_ExitSelfTestTask = VcuCommunication64SelfTest.ExitSelfTestTask;
         m_AbortSTSequence = VcuCommunication64SelfTest.AbortSTSequence;
         m_SendOperatorAcknowledge = VcuCommunication64SelfTest.SendOperatorAcknowledge;
         m_UpdateSTTestList = VcuCommunication64SelfTest.UpdateSTTestList;
         m_RunPredefinedSTTests = VcuCommunication64SelfTest.RunPredefinedSTTests;
         m_UpdateSTLoopCount = VcuCommunication64SelfTest.UpdateSTLoopCount;
         m_ExecuteSTTestList = VcuCommunication64SelfTest.ExecuteSTTestList;
         unsafe
         {
             m_GetSelfTestResult = VcuCommunication64SelfTest.GetSelfTestResult;
         }
         m_UpdateSTMode = VcuCommunication64SelfTest.UpdateSTMode;
     }
     else
     {
         m_GetSelfTestSpecialMessage = VcuCommunication32SelfTest.GetSelfTestSpecialMessage;
         m_StartSelfTestTask = VcuCommunication32SelfTest.StartSelfTestTask;
         m_ExitSelfTestTask = VcuCommunication32SelfTest.ExitSelfTestTask;
         m_AbortSTSequence = VcuCommunication32SelfTest.AbortSTSequence;
         m_SendOperatorAcknowledge = VcuCommunication32SelfTest.SendOperatorAcknowledge;
         m_UpdateSTTestList = VcuCommunication32SelfTest.UpdateSTTestList;
         m_RunPredefinedSTTests = VcuCommunication32SelfTest.RunPredefinedSTTests;
         m_UpdateSTLoopCount = VcuCommunication32SelfTest.UpdateSTLoopCount;
         m_ExecuteSTTestList = VcuCommunication32SelfTest.ExecuteSTTestList;
         unsafe
         {
             m_GetSelfTestResult = VcuCommunication32SelfTest.GetSelfTestResult;
         }
         m_UpdateSTMode = VcuCommunication32SelfTest.UpdateSTMode;
     }
     #endregion - [Initialize VcuCommunication.selftest.cpp Function Delegates] -
 }
Exemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="communicationInterface">The communication interface that is to be used to communicate with the VCU.</param>
        /// <param name="log">The current event log.</param>
        public FormConfigureEventFlags(ICommunicationParent communicationInterface, Log log)
        {
            InitializeComponent();

            // Initialize the communication interface.
            if (communicationInterface is CommunicationParent)
            {
                CommunicationInterface = new CommunicationEvent(communicationInterface);
            }
            else
            {
                CommunicationInterface = new CommunicationEventOffline(communicationInterface);
            }
            Debug.Assert(CommunicationInterface != null);

            #region - [Size] -
            // Get the combined width of all visible DataGridView columns.
            int dataGridViewWidth = 0;
            DataGridViewColumn dataGridViewColumn;
            for (int columnIndex = 0; columnIndex < m_DataGridViewEventStatus.Columns.Count; columnIndex++)
            {
                dataGridViewColumn = m_DataGridViewEventStatus.Columns[columnIndex];
                if (dataGridViewColumn.Visible == true)
                {
                    dataGridViewWidth += dataGridViewColumn.Width;
                }
            }

            m_PanelDataGridViewEventStatus.Width = dataGridViewWidth + MarginRightDataGridViewControl;

            Width = m_PanelDataGridViewEventStatus.Width + MarginRightPanelControl;
            #endregion - [Size] -

            // ------------------------------------------------------------------
            // Get the list of events associated with the current event log.
            // ------------------------------------------------------------------
            List <EventRecord> foundEventRecordList;
            foundEventRecordList = Lookup.EventTable.RecordList.FindAll(delegate(EventRecord eventRecord)
            {
                // Include a try/catch block in case an event record has not been defined.
                try
                {
                    // The LOGID field of the EVENTS table actually uses the log index value which is equal to the log identifier - 1.
                    return(eventRecord.LogIdentifier == log.Identifier - 1);
                }
                catch (Exception)
                {
                    return(false);
                }
            });

            foundEventRecordList.Sort(CompareByTaskIDByEventIDAscending);

            // ---------------------------------------------------------------
            // Get the event flag information associated with the current log.
            // ---------------------------------------------------------------
            int eventCount    = (short)foundEventRecordList.Count;
            int maxEventCount = log.MaxEventsPerTask * log.MaxTasks;

            // Initialize the validFlags array to define which of the events are used in the current log.
            short[] validFlags = new short[maxEventCount];
            int     eventIndex;
            for (int index = 0; index < foundEventRecordList.Count; index++)
            {
                eventIndex             = foundEventRecordList[index].TaskIdentifier * log.MaxEventsPerTask + foundEventRecordList[index].EventIdentifier;
                validFlags[eventIndex] = CommonConstants.True;
            }

            short[] enabledFlags         = new short[eventCount];
            short[] streamTriggeredFlags = new short[eventCount];
            try
            {
                CommunicationInterface.GetFltFlagInfo(validFlags, ref enabledFlags, ref streamTriggeredFlags, (short)maxEventCount);
            }
            catch (Exception)
            {
                throw new CommunicationException(Resources.EMGetFltFlagInfoFailed);
            }

            // ---------------------------------
            // Initialise the event status list.
            // ---------------------------------
            m_EventStatusList = new List <EventStatus_t>(eventCount);
            EventStatus_t eventStatus;
            for (int eventStatusIndex = 0; eventStatusIndex < eventCount; eventStatusIndex++)
            {
                eventStatus            = new EventStatus_t();
                eventStatus.Index      = eventStatusIndex;
                eventStatus.Identifier = foundEventRecordList[eventStatusIndex].Identifier;

                if (enabledFlags[eventStatusIndex] == CommonConstants.True)
                {
                    eventStatus.Enabled = true;
                }

                if (streamTriggeredFlags[eventStatusIndex] == CommonConstants.True)
                {
                    eventStatus.StreamTriggered = true;
                }

                m_EventStatusList.Add(eventStatus);
            }

            AddList(m_EventStatusList);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Initialize a new instance of the class and set the properties and member variables to those values associated with the specified communication interface.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be used to
 /// initialize the class.</param>
 public CommunicationApplicationOffline(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
 }
Exemplo n.º 15
0
 /// <summary>
 /// Initialize a new instance of the class and set the function delegates, properties and member variables.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to
 /// be used to initialize the class.</param>
 public CommunicationParent(ICommunicationParent communicationInterface)
     : this()
 {
     m_CommunicationSetting = communicationInterface.CommunicationSetting;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initialize a new instance of the class and set the properties and member variables to those values associated with the specified
 /// communication interface.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be
 /// used to initialize the class.</param>
 public CommunicationApplication(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
 }
Exemplo n.º 17
0
 /// <summary>
 /// Initialize a new instance of the class and set the function delegates, properties and member variables to those values associated with the
 /// specified communication interface.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be
 /// used to initialize the class.</param>
 public CommunicationWatch(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
 }
Exemplo n.º 18
0
        /// <summary>
        /// Clean up the resources used by the form.
        /// </summary>
        /// <param name="disposing">True to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        protected virtual void Cleanup(bool disposing)
        {
            this.Cursor = Cursors.WaitCursor;
            try
            {
                // Provided that the form isn't minimized, update the WindowState setting.
                if (this.WindowState != FormWindowState.Minimized)
                {
                    Settings.Default.WindowState = this.WindowState;
                    Settings.Default.Save();
                }

                // If the WindowState property is normal, update the: Location and Size settings.
                if (this.WindowState == FormWindowState.Normal)
                {
                    Settings.Default.FormLocation = this.Location;
                    Settings.Default.FormSize = this.Size;
                    Settings.Default.Save();
                }

                CloseChildForms();
                DebugMode.Close();
                WinHlp32.Close(this.Handle.ToInt32());

                // Ensure that the communication port is closed.
                if (m_CommunicationInterface != null)
                {
                    CommunicationInterface.CloseCommunication(CommunicationInterface.CommunicationSetting.Protocol);
                }

                if (disposing)
                {
                    // Method called by consumer code. Call the Dispose method of any managed data members that implement the dispose method.
                    // Cleanup managed objects by calling their Dispose() methods.
                    if (components != null)
                    {
                        components.Dispose();
                    }

                    if (m_DataDictionary != null)
                    {
                        m_DataDictionary.Dispose();
                    }

                    if (m_ControlPanel != null)
                    {
                        m_ControlPanel.Dispose();
                    }

                    if (m_TimerWibuBox != null)
                    {
                        m_TimerWibuBox.Stop();
                        m_TimerWibuBox.Enabled = false;
                        m_TimerWibuBox.Tick -= new EventHandler(WibuBoxCheck);
                        m_TimerWibuBox.Dispose();
                    }
                }

                // Whether called by consumer code or the garbage collector free all unmanaged resources and set the value of managed data 
                // members to null.
                m_DataDictionary = null;
                m_TimerWibuBox = null;
                m_ControlPanel = null;
                m_CommunicationInterface = null;
                m_MenuInterfaceApplication = null;
                m_MenuInterfaceEvent = null;
                m_MenuInterfaceSelfTest = null;
                m_MenuInterfaceWatch = null;
                m_MenuInterfaceWibuKey = null;
                m_Security = null;
            }
            catch (Exception)
            {
                // Don't do anything, just ensure that an exception is not thrown.
            }
            this.Cursor = Cursors.Default;
        }
Exemplo n.º 19
0
 /// <summary>
 /// Initialize a new instance of the class
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be
 /// used to initialize the class.</param>
 public CommunicationSelfTest(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
     m_SelfTestMarshal = new SelfTestMarshal(communicationInterface.CommDevice);
 }
        /// <summary>
        /// Initialize a new instance of the class and set the properties and member variables to those values associated with the specified communication interface.
        /// </summary>
        /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to be used to
        /// initialize the class.</param>
        public CommunicationEventOffline(ICommunicationParent communicationInterface)
            : base(communicationInterface)
        {
            // --------------------------------------------------------------------------------------------
            // Get the workset that is to be used to simulate the fault log parameters and the data stream.
            // --------------------------------------------------------------------------------------------

            // If it has been configured, get the first valid workset other than the baseline workset; otherwise, use the baseline workset.
            int worksetIndex = (Workset.FaultLog.Worksets.Count > 0) ? 1 : 0;
            Workset_t workset = Workset.FaultLog.Worksets[worksetIndex];
            m_Workset = workset;
        }
Exemplo n.º 21
0
 /// <summary>
 /// Initialize a new instance of the class and set the function delegates, properties and member variables to those values associated with the
 /// specified communication interface.
 /// </summary>
 /// <param name="communicationInterface">Reference to the communication interface containing the properties and member variables that are to
 /// be used to initialize the class.</param>
 public CommunicationEvent(ICommunicationParent communicationInterface)
     : base(communicationInterface)
 {
     m_EventStreamMarshal = new EventStreamMarshal(communicationInterface.CommDevice);
 }