Пример #1
0
        public InstrumentDataReportCTD(InstrumentDataManager _manager,
                                       byte _deviceId,
                                       OutPutFormat _outFormat
                                       ) :
            base(_manager, _deviceId)
        {
            sipperFile = _manager.SipperFile();
            SipperConfigRec configRec = _manager.ConmfigRec();

            if (sipperFile != null)
            {
                ext0Code = sipperFile.CtdExt0;
                ext1Code = sipperFile.CtdExt1;
                ext2Code = sipperFile.CtdExt2;
                ext3Code = sipperFile.CtdExt3;
            }

            else if (configRec != null)
            {
                ext0Code = configRec.HeaderRec().CtdExt0Code();
                ext1Code = configRec.HeaderRec().CtdExt1Code();
                ext2Code = configRec.HeaderRec().CtdExt2Code();
                ext3Code = configRec.HeaderRec().CtdExt3Code();
            }

            String siperFileName = "";

            if (sipperFile != null)
            {
                siperFileName = OSservices.GetRootName(sipperFile.SipperFileName);
            }

            //if  (!String.IsNullOrEmpty (siperFileName))
            //  ctdStream = new StreamWriter ("C:\\Temp\\" + siperFileName + ".txt");
        }
Пример #2
0
        } /* AllMessages */

        public InstrumentDataReportText(InstrumentDataManager _manager,
                                        byte _deviceId
                                        ) :
            base(_manager, _deviceId)
        {
            messages = new List <string> ();
        }
Пример #3
0
 public InstrumentDataReport(InstrumentDataManager _manager,
                             byte _deviceId
                             )
 {
     manager  = _manager;
     deviceId = _deviceId;
 }
        virtual public InstrumentDataReport  CreateInstrumentDataReport(InstrumentDataManager manager,
                                                                        byte deviceId
                                                                        )
        {
            InstrumentDataReport dr = null;

            switch (deviceId)
            {
            case  6: dr = new InstrumentDataReportText(manager, deviceId);
                break;

            case  7: dr = new InstrumentDataReportIllumination(manager, deviceId);
                break;

            case  8: dr = new InstrumentDataReportCTD(manager, deviceId, InstrumentDataReportCTD.OutPutFormat.EngineeringUnitsInDec);
                break;

            case  9: dr = new InstrumentDataReportGPS(manager, deviceId);
                break;

            case 10: dr = new InstrumentDataReportFlowMeter(manager, deviceId);
                break;


            default: dr = new InstrumentDataReport(manager, deviceId);
                break;
            }

            return(dr);
        } /* CreateInstrumentDataReport */
 public InstrumentDataReportIllumination(InstrumentDataManager _manager,
                                         byte _deviceId
                                         )
     :
     base(_manager, _deviceId)
 {
 }
Пример #6
0
 public InstrumentDataReportBatteryMeter(InstrumentDataManager _manager,
                                         byte _deviceId
                                         )
     :
     base(_manager, _deviceId)
 {
     batteryLevels = new float[numOfBatteries + 1]; // Will be '1' based, bats 1-4
 }
Пример #7
0
 public SipperBuff4Bit(Stream _stream,
                       InstrumentDataManager _instrumentDataManager
                       ) :
     base(_stream, _instrumentDataManager)
 {
     BuildConversionTables();
     BuildDecodeRecs();
     ReadHeader();
 }
Пример #8
0
 public SipperBuff4Bit(string _fileName,
                       InstrumentDataManager _instrumentDataManager
                       ) :
     base(_fileName, _instrumentDataManager)
 {
     BuildConversionTables();
     BuildDecodeRecs();
     ReadHeader();
 }
Пример #9
0
 public Sipper3File(Stream _stream,
                    InstrumentDataManager _instrumentDataManager
                    ) :
     base(_stream, _instrumentDataManager)
 {
     if (decodeRecs == null)
     {
         BuildDecodeRecs();
     }
 }
Пример #10
0
 public Sipper3File(string _fileName,
                    InstrumentDataManager _instrumentDataManager
                    ) :
     base(_fileName, _instrumentDataManager)
 {
     if (decodeRecs == null)
     {
         BuildDecodeRecs();
     }
 }
Пример #11
0
        public SipperFileBuffered(Stream _stream,
                                  InstrumentDataManager _dataManger
                                  )
        {
            // We will first make sure that '_fileName' exists.
            sipperFile = OpenAppropriateFormat(_stream, _dataManger);
            if (sipperFile == null)
            {
                throw new Exception("SipperFileBuffered:   Could not determine format of stream.");
            }

            weOwnSipperFile = true;
            Initialization();
        }
Пример #12
0
        public SipperBaseFile(Stream _stream,
                              InstrumentDataManager _instrumentDataManager
                              )
        {
            stream = _stream;
            instrumentDataManager = _instrumentDataManager;
            fileStream            = null;

            try
            {
                OpenStream();
            }
            catch (Exception e)
            {
                throw new Exception("'SipperBaseFile',  Could not OpenFile file.", e);
            }
        }
        int[] flowMeterTurnScanLines = null; // A circular buffer that will keep track of scan lines.



        public InstrumentDataReportFlowMeter(InstrumentDataManager _manager,
                                             byte _deviceId
                                             )
            :
            base(_manager, _deviceId)
        {
            int x;

            flowMeterTurnScanLines = new int[NumTurnSignalsToTrack];
            for (x = 0; x < NumTurnSignalsToTrack; x++)
            {
                flowMeterTurnScanLines[x] = 0;
            }

            flowMeterTrailingSlot = flowMeterCurSlot - NumTurnSignalsToTrack + 1;
            if (flowMeterTrailingSlot < 0)
            {
                flowMeterTrailingSlot += NumTurnSignalsToTrack;
            }
        }
Пример #14
0
        public SipperFileBuffered(string _fileName,
                                  InstrumentDataManager _dataManger
                                  )
        {
            try
            {
                sipperFile = OpenAppropriateFormat(_fileName, _dataManger);
            }
            catch (IOException ioException)
            {
                throw ioException;
            }

            if (sipperFile == null)
            {
                throw new Exception("SipperFileBuffered:   Could not determine format of file[" + _fileName + "]");
            }

            weOwnSipperFile = true;
            Initialization();
        }
Пример #15
0
        public SipperBaseFile(string _fileName,
                              InstrumentDataManager _instrumentDataManager
                              )
        {
            fileName = _fileName;
            instrumentDataManager = _instrumentDataManager;


            try
            {
                OpenFile();
            }
            catch (IOException e)
            {
                throw e;
            }
            catch (Exception e2)
            {
                throw  e2;
            }
        }
Пример #16
0
 public InstrumentDataReportGPS(InstrumentDataManager _manager,
                                byte _deviceId
                                ) :
     base(_manager, _deviceId)
 {
 }
Пример #17
0
        } /* OpenAppropriateFormat  */

        private SipperBaseFile  OpenAppropriateFormat(Stream _stream,
                                                      InstrumentDataManager _dataManger
                                                      )
        {
            //*******************************************************
            // First Lets try Sipper3 format

            bool validSipper2      = false;
            bool validSipper3      = false;
            bool validSipperSimple = false;
            bool validLarcos4Bit   = false;

            long startPos = _stream.Position;


            // We will first try to see if a Sipper3 file.
            try
            {
                sipperFile   = new Sipper3File(_stream, _dataManger);
                validSipper3 = sipperFile.ValidateFormat();
            }
            catch (Exception)
            {
                validSipper3 = false;
                sipperFile   = null;
            }
            if ((sipperFile != null) && (validSipper3))
            {
                return(sipperFile);
            }
            if (sipperFile != null)
            {
                //sipperFile.Dispose ();
                //sipperFile = null;
            }



            //*******************************************************
            // Try 4Bit Larcos Format
            try
            {
                _stream.Seek(0, SeekOrigin.Begin);
                sipperFile      = new SipperBuff4Bit(_stream, _dataManger);
                validLarcos4Bit = sipperFile.ValidateFormat();
            }
            catch (IOException ioException)
            {
                throw  new IOException("OpenAppropriateFormat  Could not open file", ioException);
            }
            catch (Exception)
            {
                validLarcos4Bit = false;
                sipperFile      = null;
            }

            if ((sipperFile != null) && (validLarcos4Bit))
            {
                return(sipperFile);
            }



            //*******************************************************
            // Try SipperSimple format.
            _stream.Position = startPos;
            try
            {
                sipperFile        = new SipperFileSimple(_stream, _dataManger);
                validSipperSimple = sipperFile.ValidateFormat();
            }
            catch (Exception)
            {
                validSipperSimple = false;
                sipperFile        = null;
            }
            if ((sipperFile != null) && (validSipperSimple))
            {
                return(sipperFile);
            }


            // Now we will try to see if valid  Sipper2 format
            try
            {
                sipperFile   = new Sipper2File(_stream, _dataManger);
                validSipper2 = sipperFile.ValidateFormat();
            }
            catch (Exception)
            {
                validSipper2 = false;
                sipperFile   = null;
            }

            if ((sipperFile != null) && (validSipper2))
            {
                return(sipperFile);
            }


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

            sipperFile = null;

            return(null);
        } /* OpenAppropriateFormat  */
Пример #18
0
        } /* CalculateTargetCols */

        private SipperBaseFile  OpenAppropriateFormat(string _fileName,
                                                      InstrumentDataManager _dataManger
                                                      )
        {
            // First Lets try Sipper3 format

            bool validSipper2      = false;
            bool validSipper3      = false;
            bool validSipperSimple = false;
            bool validLarcos4Bit   = false;


            // We will first try to see if a Sipper3 file.
            try
            {
                sipperFile   = new Sipper3File(_fileName, _dataManger);
                validSipper3 = sipperFile.ValidateFormat();
            }
            catch (IOException ioException)
            {
                throw  new IOException("OpenAppropriateFormat  Could not open file", ioException);
            }
            catch (Exception)
            {
                validSipper3 = false;
                sipperFile   = null;
            }

            if ((sipperFile != null) && (validSipper3))
            {
                return(sipperFile);
            }

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


            // Try 4Bit Larcos Format
            try
            {
                sipperFile      = new SipperBuff4Bit(_fileName, _dataManger);
                validLarcos4Bit = sipperFile.ValidateFormat();
            }
            catch (IOException ioException)
            {
                throw  new IOException("OpenAppropriateFormat  Could not open file", ioException);
            }
            catch (Exception)
            {
                validLarcos4Bit = false;
                sipperFile      = null;
            }

            if ((sipperFile != null) && (validLarcos4Bit))
            {
                return(sipperFile);
            }

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


            // Now try the Simple Sipper Format.
            try
            {
                sipperFile        = new SipperFileSimple(_fileName, _dataManger);
                validSipperSimple = sipperFile.ValidateFormat();
            }
            catch (Exception)
            {
                validSipperSimple = false;
                sipperFile        = null;
            }

            if ((sipperFile != null) && (validSipperSimple))
            {
                return(sipperFile);
            }

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

            sipperFile = null;



            // Now we will try to see if valid  Sipper2 format
            try
            {
                sipperFile   = new Sipper2File(_fileName, _dataManger);
                validSipper2 = sipperFile.ValidateFormat();
            }
            catch (Exception)
            {
                validSipper2 = false;
                sipperFile   = null;
            }

            if ((sipperFile != null) && (validSipper2))
            {
                return(sipperFile);
            }


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

            sipperFile = null;

            return(null);
        } /* OpenAppropriateFormat  */
Пример #19
0
 public SipperFileSimple(Stream _stream,
                         InstrumentDataManager _instrumentDataManager
                         ) :
     base(_stream, _instrumentDataManager)
 {
 }
Пример #20
0
 public SipperFileSimple(string _fileName,
                         InstrumentDataManager _instrumentDataManager
                         ) :
     base(_fileName, _instrumentDataManager)
 {
 }
 public override InstrumentDataReport  CreateInstrumentDataReport(InstrumentDataManager manager,
                                                                  byte deviceId
                                                                  )
 {
     return(new InstrumentDataReportCTD(manager, deviceId, InstrumentDataReportCTD.OutPutFormat.EngineeringUnitsInDec));
 }
        }                                            // Only the InstrumentOther can return true.

        public override InstrumentDataReport  CreateInstrumentDataReport(InstrumentDataManager manager,
                                                                         byte deviceId
                                                                         )
        {
            return(new InstrumentDataReport(manager, deviceId));
        }