コード例 #1
0
ファイル: SipperHeaderRec.cs プロジェクト: PalakDave/Pices
        public void  SerialPort(int serialPortNum, string shortName, string description)
        {
            if ((serialPortNum < 0) || (serialPortNum >= 6))
            {
                MessageBox.Show("Invalid Serial Port Number[" + serialPortNum.ToString() + "].");
                return;
            }

            if (shortName.ToLower() == "none")
            {
                portAssignments[serialPortNum] = null;
            }
            else
            {
                portAssignments[serialPortNum] = new PortAssignment(shortName, description);
            }
        }
コード例 #2
0
ファイル: SipperHeaderRec.cs プロジェクト: PalakDave/Pices
        } /* ParseDataFileLine */

        public void  Save(StreamWriter w)
        {
            w.WriteLine("AirTemp              = " + airTemp);
            w.WriteLine("CruiseDates          = " + cruiseDateStart.ToString("yyyy/mm/dd") + "," + cruiseDateEnd.ToString("yyyy/mm/dd"));
            w.WriteLine("CruiseLocation       = " + cruiseLocation);
            w.WriteLine("deploymentVehicle    = " + deploymentVehicle);
            w.WriteLine("SipperFilename       = " + sipperFileName);
            w.WriteLine("Latitude             = " + latitude.ToString());
            w.WriteLine("Longitude            = " + longitude.ToString());
            w.WriteLine("Objective            = " + objective);
            w.WriteLine("Principal            = " + principal);
            w.WriteLine("ResearchOrganization = " + researchOrg);
            w.WriteLine("SeaConditions        = " + seaConditions);
            w.WriteLine("ScanRate             = " + scanRate.ToString());
            w.WriteLine("CtdExt0Code          = " + ctdExt0Code);
            w.WriteLine("CtdExt1Code          = " + ctdExt1Code);
            w.WriteLine("CtdExt2Code          = " + ctdExt2Code);
            w.WriteLine("CtdExt3Code          = " + ctdExt3Code);

            if (portAssignments != null)
            {
                for (int x = 0; x < 6; x++)
                {
                    PortAssignment portAssignment = portAssignments[x];

                    if (portAssignment != null)
                    {
                        w.WriteLine
                            ("SerialPort           = " + x.ToString() + "," + portAssignment.HeaderStr());
                    }
                }
            }

            w.WriteLine("WeatherConditions    = " + weatherConditions);
            w.WriteLine("WaveHeight           = " + waveHeight);
        } /* Save */
コード例 #3
0
ファイル: SipperHeaderRec.cs プロジェクト: PalakDave/Pices
        } /* ParseDataFileLine */

        public void  ProcessNameAndDataStrings(string fieldName,
                                               string fieldValue,
                                               ref bool found
                                               )
        {
            found     = true;
            fieldName = fieldName.ToLower();

            if ((fieldName == "at") || (fieldName == "airtemp"))
            {
                airTemp = fieldValue;
            }

            else if ((fieldName == "cd") || (fieldName == "cruisedates"))
            {
                string[]        subFields = fieldValue.Split(',');
                IFormatProvider format    = new System.Globalization.CultureInfo("", true);
                cruiseDateStart = DateTime.ParseExact(subFields[0], "yyyy/mm/dd", format);
                if (subFields.Length < 2)
                {
                    cruiseDateEnd = cruiseDateStart;
                }
                else
                {
                    cruiseDateEnd = DateTime.ParseExact(subFields[1], "yyyy/mm/dd", format);
                }
            }

            else if ((fieldName == "cl") || (fieldName == "cruiselocation"))
            {
                cruiseLocation = fieldValue;
            }

            else if ((fieldName == "dv") || (fieldName == "deploymentvehicle"))
            {
                deploymentVehicle = fieldValue;
            }

            else if ((fieldName == "ext0") || (fieldName == "ctdext0code"))
            {
                ctdExt0Code = fieldValue;
            }

            else if ((fieldName == "ext1") || (fieldName == "ctdext1code"))
            {
                ctdExt1Code = fieldValue;
            }

            else if ((fieldName == "ext2") || (fieldName == "ctdext2code"))
            {
                ctdExt2Code = fieldValue;
            }

            else if ((fieldName == "ext3") || (fieldName == "ctdext3code"))
            {
                ctdExt3Code = fieldValue;
            }

            else if ((fieldName == "fn") || (fieldName == "sipperfilename"))
            {
                sipperFileName = fieldValue;
            }

            else if ((fieldName == "lat") || (fieldName == "latitude"))
            {
                latitude = double.Parse(fieldValue);
            }

            else if ((fieldName == "log") || (fieldName == "longitude"))
            {
                longitude = double.Parse(fieldValue);
            }

            else if ((fieldName == "ob") || (fieldName == "objective"))
            {
                objective = fieldValue;
            }

            else if ((fieldName == "pr") || (fieldName == "principal"))
            {
                principal = fieldValue;
            }

            else if ((fieldName == "ro") || (fieldName == "researchorganization"))
            {
                researchOrg = fieldValue;
            }

            else if ((fieldName == "sc") || (fieldName == "seaconditions"))
            {
                seaConditions = fieldValue;
            }

            else if ((fieldName == "sr") || (fieldName == "scanrate"))
            {
                scanRate = int.Parse(fieldValue);
            }

            else if ((fieldName == "sp") || (fieldName == "serialport"))
            {
                // We are looking at a serial port definition
                string[] subFields     = fieldValue.Split(',');
                int      serialPortNum = int.Parse(subFields[0]);
                if ((serialPortNum >= 0) && (serialPortNum < 6))
                {
                    PortAssignment portAssignment = null;

                    if (subFields.Length < 2)
                    {
                        portAssignment = new PortAssignment("", "");
                    }

                    else if (subFields.Length < 3)
                    {
                        portAssignment = new PortAssignment(subFields[1], "");
                    }

                    else
                    {
                        portAssignment = new PortAssignment(subFields[1], subFields[2]);
                    }

                    portAssignments[serialPortNum] = portAssignment;
                }
            }


            else if ((fieldName == "wc") || (fieldName == "weatherconditions"))
            {
                weatherConditions = fieldValue;
            }

            else if ((fieldName == "wh") || (fieldName == "waveheight"))
            {
                waveHeight = fieldValue;
            }

            else
            {
                found = false;
            }
        } /* ParseDataFileLine */
コード例 #4
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();
        }