////////////////////////////////////////////////////////////////////// public bool PushPacketWithID(TrackerPacket packet) { try { CTracker tracker = ConfigMgr.inst().GetTrackerByID((int)packet.m_ID); if (tracker != null) { if (packet.IsValid()) { lock (m_Queue) m_Queue.Enqueue(packet); if (packet.IsFixed(true)) { CurPosMgr.inst().AddPoint(packet); } LastPointMgr.inst().AddPoint(packet); } return(true); } } catch (Exception ex) { m_Logger.Push(LogLevel.ERROR, 0, "PushPacket:" + ex.ToString()); } return(false); }
void Load() { List <TrackerPacket> newPackets = new List <TrackerPacket>(); try { using (CDatabase db = Configuration.inst().GetDB()) { if (!db.IsConnected()) { m_Logger.Push(LogLevel.ERROR, 0, "Could not connect to database"); return; } //загрузка точек TrackerPacketList list = new TrackerPacketList(); list.Load(db, "SELECT TrackerID, Time, Lat, Lng, Alt, Speed, Status, IO, GSMInfo FROM " + m_strTable); for (int i = 0; i < list.Count; i++) { TrackerPacket packet = list[i]; if (packet.IsValid()) { lock (m_Points) if (!m_Points.ContainsKey(packet.m_ID) || m_Points[packet.m_ID].m_Time != packet.m_Time) { m_Points[packet.m_ID] = packet; newPackets.Add(packet); } } } } for (int i = 0; i < newPackets.Count; i++) { OnCurPosChange(newPackets[i]); } } catch (Exception e) { m_Logger.Push(LogLevel.ERROR, 0, e.ToString()); } }
////////////////////////////////////////////////////////////////////// public bool PushPacketWithID(TrackerPacket packet) { try { CTracker tracker = Global.m_ConfigMgr.GetTrackerByID(packet.m_ID); if (tracker != null) { if (packet.IsValid()) { lock (m_Queue) m_Queue.Enqueue(packet); } return(true); } } catch (Exception ex) { m_Logger.Push(LogLevel.ERROR, 0, "PushPacket:" + ex.ToString()); } return(false); }