void LPREngineProcessLoop() { FRAME frm = null; int channel = 0; FrameGenerator fg = (FrameGenerator)m_AppData.FrameGenerator; int maxChannels = fg.GetNumberOfPhysicalChannels(); DateTime[] timeLastTouched = new DateTime[maxChannels]; TimeSpan timeout = new TimeSpan(0, 0, 0, 5, 0); int loopDelayInMilliSeconds = 1; while (!m_Stop) { frm = null; try { frm = m_LPRProcessQ.Dequeue(); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.LPR.LPR_ProcessQCnt].HitMe = m_LPRProcessQ.Count; if (frm != null) { // hits here on every frame where motion was detected compared to the previous frame timeLastTouched[frm.SourceChannel] = DateTime.Now; LPRProcessImage(frm); } channel++; if (channel == maxChannels) { channel = 0; } // this forces the plategroup processor to release a group if the car is parked and not moving, only works // if no motion was detected for timeout seconds if (DateTime.Now.Subtract(timeLastTouched[channel]).CompareTo(timeout) > 0) { m_LPRFuntions.PlateGroups_ProcessNewImage(channel, "", 0, 0); // if we have not had a frame to process in a while, force the plate number groupings to expire and report results from last reading } } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } Thread.Sleep(loopDelayInMilliSeconds); } }
public RemoteConnectionServer(APPLICATION_DATA appData) { try { m_AppData = appData; m_AppData.AddOnClosing(OnClose, APPLICATION_DATA.CLOSE_ORDER.MIDDLE); m_Log = (ErrorLog)m_AppData.Logger; m_FrameLock = new object(); m_FrameGenerator = (FrameGenerator)m_AppData.FrameGenerator; m_NumberChannels = m_FrameGenerator.GetNumberOfPhysicalChannels(); m_ConsumerID = m_FrameGenerator.GetNewConsumerID(); m_CurrentImageQ = new ThreadSafeQueue <FRAME> [m_NumberChannels]; m_CurrentPlateNumberQ = new ThreadSafeQueue <FRAME> [m_NumberChannels]; m_Log = (ErrorLog)m_AppData.Logger; m_LocalHostPortsTable = new ThreadSafeHashTable(5); m_Server = new List <ConnectionServer>(); } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } }