private static void pktrimble_ObsMessage(object sender, EventArgs e) { piksi.piksimsg msg = (piksi.piksimsg)sender; var hdr = msg.payload.ByteArrayToStructure <piksi.msg_obs_header_t>(0); // relay packet if (msg.sender == 0) { return; } // total is number of packets int total = hdr.seq >> piksi.MSG_OBS_HEADER_SEQ_SHIFT; // this is packet count number int count = hdr.seq & piksi.MSG_OBS_HEADER_SEQ_MASK; int lenhdr = Marshal.SizeOf(hdr); int lenobs = Marshal.SizeOf(new piksi.msg_obs_content_t()); int obscount = (msg.length - lenhdr) / lenobs; DateTime gpstime = StaticUtils.GetFromGps(hdr.t.wn, hdr.t.tow / 1000.0); DateTime local = gpstime.ToLocalTime(); List <piksi.msg_obs_content_t> obs = new List <piksi.msg_obs_content_t>(); for (int a = 0; a < obscount; a++) { var ob = msg.payload.ByteArrayToStructure <piksi.msg_obs_content_t>(lenhdr + a * lenobs); obs.Add(ob); } if (deststream != null) { try { if (DateTime.Now.Second % 10 == 0) { Trimble.writeTrimble15(deststream, hdr.t.wn, hdr.t.tow); } Trimble.writeTrimbleR17(deststream, hdr.t.tow, obs); } catch (Exception) { } } }
static void pktrimble_EphMessage(object sender, EventArgs e) { piksi.piksimsg msg = (piksi.piksimsg)sender; var eph = msg.payload.ByteArrayToStructure <piksi.ephemeris_t>(0); if (eph.valid > 0) { try { Trimble.writeTrimble55_1(deststream, eph, (int)eph.sid + 1); } catch { } } }