Пример #1
0
        byte[] GetCurrentJpeg(string channel, out string timeStamp, out string currentPlateReading, out int channelIndex)
        {
            timeStamp           = " ";
            currentPlateReading = " ";
            channelIndex        = 0;
            int c;

            try
            {
                c = m_FrameGenerator.GetChannelIndex(channel);
                if (c < 0)
                {
                    m_Log.Log("GetCurrentJpeg received bad channel index: " + c.ToString(), ErrorLog.LOG_TYPE.FATAL);
                    return(null);
                }

                channelIndex = c;

                FRAME currentFrame = null;

                lock (m_FrameLock)
                {
                    if (m_CurrentImageQ[c].Count > 0)
                    {
                        currentFrame = m_CurrentImageQ[c].Dequeue();
                        timeStamp    = currentFrame.TimeStamp.ToString(m_AppData.TimeFormatStringForFileNames);

                        // is there an LPR result available at this time?
                        FRAME lprResultFrame = m_CurrentPlateNumberQ[c].Dequeue();
                        if (lprResultFrame != null)
                        {
                            StringBuilder sb = new StringBuilder();
                            for (int i = 0; i < lprResultFrame.PlateNumberLatin.Length; i++)
                            {
                                string s = lprResultFrame.PlateNumberLatin[i];
                                if (i < lprResultFrame.PlateNumberLatin.Length - 1)
                                {
                                    sb.Append(s + "^ ");  // use the ^ to seperate strings, the comma  is a parse field delimeter so do not use that
                                }
                                else
                                {
                                    sb.Append(s);   // do not put a delimeter after the last string
                                }
                            }
                            currentPlateReading = sb.ToString();
                        }

                        return(currentFrame.Jpeg);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); return(null); }
        }