示例#1
0
 private void updateData(SofrelogData sd)
 {
     if (sd.Shape != null)
     {
         if (OnReceivedData != null)
         {
             OnReceivedData(sd);
         }
     }
 }
示例#2
0
 void _receiver_OnReceivedData(SofrelogData data)
 {
     lock (_tracksData)
     {
         var target = new VTSSofrelogTarget(data.TrackID);
         target.MMSI = data.MMSI;
         target.Update(data.Lon, data.Lat, data.SOG, data.COG, DateTime.Now);
         target.Name         = data.Name;
         target.ReceiverTime = data.Time;
         _tracksData.UpdateDynamicEvent(target);
     }
 }
示例#3
0
        private void parseTrackData(bool isNewTrack, int trackID, byte[] buf, int start)
        {
            if (isNewTrack)
            {
                dropTrack(trackID);
            }

            SofrelogData sd = new SofrelogData(trackID);

            sd.Src     = "";
            sd.Time    = DateTime.Now;
            sd.TrackID = trackID;
            uint msgCount = getUInt32(buf, start);

            sd.MMSI          = (int)getUInt32(buf, start + 4);
            sd.MainRadar     = (int)getUInt32(buf, start + 8);
            sd.TrackPlatform = (SofrelogData.TrackPlatforms)getUInt32(buf, start + 12);
            int classification = (int)getUInt32(buf, start + 16);

            if (classification > 0)
            {
                sd.Classification = classification;
            }
            sd.QualityFactor   = (int)getUInt32(buf, start + 20);
            sd.LackOfDetection = (int)getUInt32(buf, start + 24);
            sd.PlotCells       = (int)getUInt32(buf, start + 28);
            double lon       = (double)getUInt32(buf, start + 32);
            double lonMinute = getFloat(buf, start + 36);

            lon += lonMinute / 60;
            double lat       = (double)getUInt32(buf, start + 40);
            double latMinute = getFloat(buf, start + 44);

            lat     += latMinute / 60;
            sd.Shape = new GeoPointShape(lon, lat);
            sd.COG   = getFloat(buf, start + 48);
            sd.SOG   = getFloat(buf, start + 52);
            long secs    = (long)getUInt32(buf, start + 56);
            int  milsecs = (int)getUInt32(buf, start + 60);

            sd.TimeStamp = new DateTime(1970, 1, 1) + new TimeSpan((secs * 1000 + milsecs) * 10000);
            sd.TrackLock = (SofrelogData.TrackLocks)getUInt32(buf, start + 64);

            updateData(sd);
        }