Пример #1
0
        /// <summary>
        /// Parse a depth sentence with this structure:
        ///     DPT,d.d,o.o
        ///     d.d: depth, meters
        ///     o.o: offset from transducer
        /// </summary>
        /// <param name="talkerId"></param>
        /// <param name="sentence"></param>
        private void ParseDepth(string talkerId, string[] words, string sentence)
        {
            if (words.Length < 2)
            {
                DebugLog.WriteLine("Invalid DPT sentence: " + sentence);
                return;
            }

            double depth;

            try
            {
                depth = Double.Parse(words[1]);
            }
            catch (Exception e)
            {
                DebugLog.WriteLine("Could not parse double: " + sentence + " e:" + e.ToString());
                return;
            }

            DebugLog.WriteLine("depth update: depth=" + depth);

            if (DepthEvent != null)
            {
                var args = new NmeaDepthEventArgs(depth, 0);
                DepthEvent(this, args);
            }
        }
Пример #2
0
 void m_nmeaInputPort_DepthEvent(object sender, NmeaDepthEventArgs args)
 {
     DisplayVariables.Depth.Value = args.Depth * 3.280839895013123;
 }