Exemplo n.º 1
0
        public void  Dispose()
        {
            if (reporters != null)
            {
                for (int x = 0; x < reporters.Length; x++)
                {
                    if (reporters[x] != null)
                    {
                        reporters[x].Dispose();
                        reporters[x] = null;
                    }
                }
            }

            currentDataRow = null;
            reporters      = null;

            if (dataLogger != null)
            {
                dataLogger.Dispose();
                dataLogger = null;
            }
        } /* Dispose */
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InstrumentDataManager"/> class.
        /// </summary>
        /// <param name="_dataLogger">The _data logger.</param>
        /// <param name="_sipperFile">The _sipper file.</param>
        /// <param name="_configRec">The _config rec.</param>
        /// <param name="_currentDataRow">The _current data row.</param>
        public InstrumentDataManager(InstrumentDataLogger _dataLogger,             // Will take ownership of '_dataLogger'
                                     PicesSipperFile _sipperFile,
                                     SipperConfigRec _configRec,
                                     InstrumentData _currentDataRow
                                     )
        {
            dataLogger = _dataLogger;
            configRec  = _configRec;
            sipperFile = _sipperFile;

            portAssignments = null;

            if (sipperFile != null)
            {
                portAssignments = new PortAssignment[4];

                if (String.IsNullOrEmpty(sipperFile.Sp0))
                {
                    portAssignments[0] = null;
                }
                else
                {
                    portAssignments[0] = new PortAssignment(sipperFile.Sp0, "");
                }

                if (String.IsNullOrEmpty(sipperFile.Sp1))
                {
                    portAssignments[1] = null;
                }
                else
                {
                    portAssignments[1] = new PortAssignment(sipperFile.Sp1, "");
                }

                if (String.IsNullOrEmpty(sipperFile.Sp2))
                {
                    portAssignments[2] = null;
                }
                else
                {
                    portAssignments[2] = new PortAssignment(sipperFile.Sp2, "");
                }

                if (String.IsNullOrEmpty(sipperFile.Sp3))
                {
                    portAssignments[3] = null;
                }
                else
                {
                    portAssignments[3] = new PortAssignment(sipperFile.Sp3, "");
                }
            }
            else
            {
                portAssignments = configRec.HeaderRec().PortAssignments();
            }

            reporters = new InstrumentDataReport[MaxNumOfDevices];

            currentDataRow = _currentDataRow;

            byte deviceId = 0;

            for (deviceId = 0; deviceId < MaxNumOfDevices; deviceId++)
            {
                reporters[deviceId] = null;

                if (deviceId >= SerialPort0DeviceID)
                {
                    byte serialPort = (byte)(deviceId - SerialPort0DeviceID);
                    if (serialPort < portAssignments.Length)
                    {
                        if (portAssignments[serialPort] != null)
                        {
                            reporters[deviceId] = portAssignments[serialPort].Instrument().CreateInstrumentDataReport(this, deviceId);
                        }
                    }
                }
            }

            InitializeLatitude();
        }