Exemple #1
0
        public ImportImageDrive(APPLICATION_DATA appData)
        {
            InitializeComponent();
            m_AppData = appData;
            m_AppData.AddOnClosing(Stop, APPLICATION_DATA.CLOSE_ORDER.MIDDLE);
            m_Log = (ErrorLog)m_AppData.Logger;

            m_PathManager = (PATHS)m_AppData.PathManager;
            m_DVR = (DVR)m_AppData.DVR;

            m_CancelMove = new CancelObject();
            m_CancelMove.cancel = false;
        }
        public AnalystsWorkstationMainForm()
        {
            InitializeComponent();

            m_LPRCore = new LPRServiceEntryPoint();
            m_AppData = m_LPRCore.GetAppData();

            this.Text = "First Evidence Plate Analysts Workstation, version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            ///
            ///    enable LPR Diagnostics
            ///

            if (Application.ExecutablePath.Contains("Visual Studio")) // assumes I am debugging on Vista
            {
                m_AppData.LPRDiagEnabled = true;
            }
            else
            {
                m_AppData.LPRDiagEnabled = false;
            }

            m_AppData.LPRDiagEnabled = false;

            //  Remove Diagnostic tabs if not in diag mode

            if (!m_AppData.LPRDiagEnabled)
            {
                tabControlMain.TabPages.Remove(tabPageLPRDiagnostics);
                tabControlMain.TabPages.Remove(tabPageOCRLib);
            }
            else
            {
                OCRSourceFolder = UserSettings.Get(UserSettingTags.AW_OCRLibSourceDirectory);
                labelOCRSourceFolder.Text = OCRSourceFolder;

                OCRDestinationFolder = UserSettings.Get(UserSettingTags.AW_OCRLibDestinationDirectory);
                labelOCRDestinationFolder.Text = OCRDestinationFolder;
            }

            //// need some channel names assigned as place holders, off-line processing simulates hardware channels to the rest of the chain

            //for (int i = 0; i < m_AppData.MAX_VIRTUAL_CHANNELS; i++)
            //    UserSettings.Set(UserSettingTags.ChannelNames.Name(i), i.ToString());

            // allow parallel processing based on the number of cores. The ProcessorCount returns the number of cores

            m_AppData.MAX_VIRTUAL_CHANNELS = Math.Min(Environment.ProcessorCount,m_AppData.MAX_PHYSICAL_CHANNELS);

            m_DataGridRowIndex = new ThreadSafeHashTable(m_AppData.MAX_MOVIE_FILES_TO_LOAD);

            m_AppData.MoviePlayerParentForm = (object)this;

            m_AppData.RunninAsService = false;

            m_LPRCore.Start(m_AppData.RunninAsService);

            m_LPREngine = (LPREngine)m_AppData.LPREngine;
            m_LPREngine.OnNewFilteredPlateGroupEvent += new LPREngine.NewPlateEvent(m_LPREngine_OnNewPlateEvent);

            m_Log = (ErrorLog)m_AppData.Logger;

            m_FrameGenerator = (FrameGenerator)m_AppData.FrameGenerator;

            this.FormClosing += new FormClosingEventHandler(AnalystsWorkstationMainForm_FormClosing);

            m_PathManager = (PATHS)m_AppData.PathManager;
            m_DVR = (DVR)m_AppData.DVR;

            m_SmartSearchUC = new SmartSearchLibUC(m_AppData, OnSearchFatalError);

            m_SmartSearchUC.Location = new Point(0, 0);
            m_SmartSearchUC.Dock = DockStyle.Fill;

            CreateBatchModeVideoDisplayPanels();
            m_FrameGenerator.MovieFileController.DisplayPanels = m_VideoDisplayPanels;

            m_FrameGenerator.MovieFileController.OnStatusUpdateFromPlayerEvent += new MovieFiles.OnStatusUpdateFromPlayer(MovieFileController_OnStatusUpdateFromPlayerEvent);
            tabPageSearch.Controls.Add(m_SmartSearchUC);

            InitMainContainerGrid(dataGridViewFilesInProcess, new System.Drawing.Size(761, 200), new System.Drawing.Point(273, 483));

            m_EditModePictureSelectionViewer = new ListView();
            m_EditModePictureSelectionViewer.Location = new Point(219, 200);
            m_EditModePictureSelectionViewer.View = View.LargeIcon;
            m_EditModePictureSelectionViewer.Size = new Size(this.Size.Width - 275, this.Size.Height - 300);
            m_EditModePictureSelectionViewer.ItemSelectionChanged += new ListViewItemSelectionChangedEventHandler(m_EditModePictureSelectionViewer_ItemSelectionChanged);
            buttonListViewVisible.Text = m_ShowThumbNails;

            m_EditModePictureSelectionViewer.Enabled = false;
            m_EditModePictureSelectionViewer.Visible = false;
            m_EditModePictureSelectionViewer.SendToBack();

            tabPageEditMode.Controls.Add(m_EditModePictureSelectionViewer);

            tabControlLPRResults.TabPages.Clear();

            // get DVR storage mode for the batch and edit mode processing

            string sm = UserSettings.Get(UserSettingTags.DVR_StorageMode);
            if (sm != null)
            {
                if (sm.Contains(UserSettingTags.DVR_StorageModeValueStoreOnMotion))
                {
                    m_AppData.DVRMode = APPLICATION_DATA.DVR_MODE.STORE_ON_MOTION;

                    radioButtonStoreOnMotion.Checked = true;
                    radioButtonStoreOnPlate.Checked = false;
                }
                else
                {
                    radioButtonStoreOnMotion.Checked = false;
                    radioButtonStoreOnPlate.Checked = true;
                    m_AppData.DVRMode = APPLICATION_DATA.DVR_MODE.STORE_ON_PLATE_FOUND;
                }
            }
            else
            {
                radioButtonStoreOnMotion.Checked = false;
                radioButtonStoreOnPlate.Checked = true;
                m_AppData.DVRMode = APPLICATION_DATA.DVR_MODE.STORE_ON_PLATE_FOUND;
            }

            // by default, store batch outputs to repository

            radioToRepository.Checked = true;
            radioButtonToUserSpecifiedStorage.Checked = false;
            m_AppData.DVR_StoreToUserSpecifiedFolder = false;

            // now see if the user has previously chosen to store to specific folder -- get the user specified (if present) storage path for batch and edit mode processing

            string p = UserSettings.Get(UserSettingTags.DVR_UserSpecifiedStoragePath);
            if (p != null)
            {
                if (p.Contains(UserSettingTags.BOOL_TRUE))
                {
                    // the user want the batch processing results to go to a special folder and not the repository

                    radioToRepository.Checked = false;
                    string s = UserSettings.Get(UserSettingTags.DVR_UserSpecifiedStoragePath);
                    if (s == null)
                    {
                        // error condition, the config setting says use userspecfifiedstorage, but the path is not there

                        UserSettings.Set(UserSettingTags.DVR_StoreToUserSpecifiedFolder, UserSettingTags.BOOL_FALSE);
                        radioButtonToUserSpecifiedStorage.Checked = false;
                        string drive = null;

                        if (m_PathManager.Drive == null)
                            drive = "No repository found";
                        else
                            drive = m_PathManager.Drive;

                        textBoxUserSpecifiedStorageLocation.Text = drive;
                    }
                    else
                    {
                        // the good condition, all as it should be
                        m_AppData.DVR_UserSpecifiedStoragePath = s;

                        textBoxUserSpecifiedStorageLocation.Text = s;
                    }
                }
                else
                {
                    // the auto condition, use the DVRSTORAGE default storage area to put images and results into

                    radioButtonToUserSpecifiedStorage.Checked = false;
                    string drive = null;

                    if (m_PathManager.Drive == null)
                    {
                        // if the user has configured a standard repository, then create one in the default user data folder
                        string dirPath = Application.UserAppDataPath + "\\DVRSTORAGE";
                        if (!Directory.Exists(dirPath))
                        {
                            Directory.CreateDirectory(Application.UserAppDataPath + "\\DVRSTORAGE");
                        }

                        drive = m_PathManager.Drive;
                    }
                    else
                    {
                        drive = m_PathManager.Drive;
                    }

                    textBoxUserSpecifiedStorageLocation.Text = drive;
                }
            }

            // display to the user the time stamps from the processed images so that user has a clue where to find
            //  this images when searching in the search tool
            {
                int consumerID = ((FrameGenerator)m_AppData.FrameGenerator).GetNewConsumerID();
                int maxChannels = ((FrameGenerator)m_AppData.FrameGenerator).GetNumberOfPhysicalChannels();

                for (int c = 0; c < maxChannels; c++)
                    ((FrameGenerator)m_AppData.FrameGenerator).RegisterToConsumeChannel(consumerID, c, OnReceiveNewFrameToExtractTimeStamp); // get callback on new frames

                m_ToDisplayProcessedTimeStampsQ = new ThreadSafeQueue<FRAME>(240);     // store the frames into a Q when calledback.
                m_DisplayBatchTimeStampsThread = new Thread(DisplayBatchTimeStampsLoop); // empty the Q with this thread, dump to the listbox for user display
                m_DisplayBatchTimeStampsThread.Start();
            }

            // install the  user control to allow the user to import images from a field drive
            m_ImportImageDrive = new ImportImageDrive(m_AppData);
            tabPageImportImages.Controls.Add(m_ImportImageDrive);

            // show the results of LPR strings to the user
            m_LPRResultsToPostQ = new ThreadSafeQueue<LPR_RESULT_TO_POST>(100);
            m_LPRPostResultsThread = new Thread(LPRPostResultsLoop);
            m_LPRPostResultsThread.Start();

            // keep tabs on the repository - find one and keep checking for lost drives
            m_CheckRepositoryStatusThread = new Thread(CheckRepositoryLoop);
            m_CheckRepositoryStatusThread.Start();

            //    m_LPRCore.OnSelfDestruct += CloseThis;
        }
Exemple #3
0
        public void Start(bool AsService)
        {
            try
            {
                m_AppData.RunninAsService = AsService;

                //////////////////////////////////////
                //
                // setup system wide health statistics

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_Drive].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_frameGrabber_2].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_frameGrabber_1].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_GPS].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_Hotswap].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_Service].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_videoChannel1].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_videoChannel2].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_videoChannel3].StatString.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_videoChannel4].StatString.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_DVR_DirectyToStorageQ].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_DVR_MotionDetectedQ].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_DVR_NewFrameQ].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_DVR_NewLPRRecordQ].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_FG_AllFramesConsumerPushQ].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_FG_MotionDetectedConsumerPushQ].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_FG_MotionDetectionQ].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_LPR_LPRFinalPlateGroupOutputQ].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_LPR_LPRPerFrameReadingQ].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_LPR_LPRProcessQ].Accumulator.RegisterForUse(true);

                //////////////////////////////////////
                //
                // start error reporting lib  ( decides if local and/or remote reporting)

                m_AppData.Logger = new ErrorLog(m_AppData);

                m_Log = (ErrorLog)m_AppData.Logger;

                m_Log.Log("Starting LPR Services", ErrorLog.LOG_TYPE.INFORMATIONAL);
                m_Log.Log("using file in path: " + UserSettings.GetAppPath(), ErrorLog.LOG_TYPE.INFORMATIONAL);

                //////////////////////////////////////
                //
                // start email lib (used by error reporting lib for remote error notifications and by the watch list processor)

                m_Log.Log("Loading Email module", ErrorLog.LOG_TYPE.INFORMATIONAL);

                m_AppData.EmailServices = new EmailServices(m_AppData);
                m_Email = (EmailServices)m_AppData.EmailServices;

                //////////////////////////////////////
                //
                // load the Frame Generator

                m_Log.Log("Loading Frame Generator module", ErrorLog.LOG_TYPE.INFORMATIONAL);
                m_AppData.FrameGenerator = (object)new FrameGenerator(m_AppData, AsService);

                //////////////////////////////////////
                //
                // load the DVR

                m_AppData.DVRMode = APPLICATION_DATA.DVR_MODE.STORE_ON_MOTION;
                m_Log.Log("Loading DVR module", ErrorLog.LOG_TYPE.INFORMATIONAL);
                m_DVR = new DVR(m_AppData);
                m_AppData.DVR = (object)m_DVR;

                //////////////////////////////////////
                //
                // start the TCP Server
                if (m_AppData.RunninAsService)
                {
                    m_Log.Log("Loading TCP module", ErrorLog.LOG_TYPE.INFORMATIONAL);
                    m_RCServer = new RemoteConnectionServer.RemoteConnectionServer(m_AppData);
                }

                //////////////////////////////////////
                //
                // load the LPR Engine

                m_Log.Log("Loading LPR Engine", ErrorLog.LOG_TYPE.INFORMATIONAL);
                m_LPREngine = new LPREngine(m_AppData);
                m_AppData.LPREngine = m_LPREngine;

                //////////////////////////////////////
                //
                // load the Watch List Processor

                m_Log.Log("Loading Watch List module", ErrorLog.LOG_TYPE.INFORMATIONAL);

                m_WatchList = new WatchLists(m_AppData);

                //  now that all modules are loaded, let them register with each other for event communications
                m_Log.Log("Starting registrations", ErrorLog.LOG_TYPE.INFORMATIONAL);
                if (m_AppData.RunninAsService)
                {
                    m_RCServer.StartRegistration();
                }
                m_DVR.StartRegistration();
                m_LPREngine.StartRegistration();
                m_WatchList.StartRegistration();

                // now let all modules start their threads
                if (m_AppData.RunninAsService)
                {
                    m_Log.Log("Starting TCP Server", ErrorLog.LOG_TYPE.INFORMATIONAL);
                    m_RCServer.StartThreads();
                }

                m_Log.Log("Starting DVR", ErrorLog.LOG_TYPE.INFORMATIONAL);
                m_DVR.StartThreads();

                m_Log.Log("Starting LPR Engine", ErrorLog.LOG_TYPE.INFORMATIONAL);
                m_LPREngine.StartThreads();

                m_Log.Log("Starting Watch list processor", ErrorLog.LOG_TYPE.INFORMATIONAL);
                m_WatchList.StartThreads();

                m_Log.Log("Starting Email Services", ErrorLog.LOG_TYPE.INFORMATIONAL);
                m_Email.StartThreads();

                // is everyone happy?
                //if (!m_DVR.GetDVRReady || !((FrameGenerator)m_AppData.FrameGenerator).GetReadyStatus)
                //{
                //    m_Log.Log("Error, self destruct", ErrorLog.LOG_TYPE.FATAL);
                //    m_AppData.SelfDestruct();
                //}
            }
            catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); }
        }
Exemple #4
0
        public void StartRegistration()
        {
            m_LPREngine = (LPREngine)m_AppData.LPREngine;
            m_LPREngine.OnNewFilteredPlateGroupEvent += new LPREngine.NewPlateEvent(NewLPRResultsEvent_OnNewPlateEvent);

            m_EmailService = (EmailServices) m_AppData.EmailServices;
            m_DVR = (DVR)m_AppData.DVR;
        }
Exemple #5
0
        public void Start()
        {
            //////////////////////////////////////
            //
            // start error reporting lib  ( decides if local and/or remote reporting)

            m_AppData.Logger = new ErrorLog(m_AppData);

            m_Log = (ErrorLog)  m_AppData.Logger;

            //////////////////////////////////////
            //
            // start email lib (used by error reporting lib for remote error notifications and by the watch list processor)

            m_AppData.EmailServices = new EmailServices(m_AppData);
            m_Email = (EmailServices)m_AppData.EmailServices;

            //////////////////////////////////////
            //
            // load the Frame Generator

            m_AppData.FrameGenerator = (object)new FrameGenerator(m_AppData);

            //////////////////////////////////////
            //
            // load the DVR

            m_DVR = new DVR(m_AppData);
            m_AppData.DVR = (object)m_DVR;

            //////////////////////////////////////
            //
            // start the TCP Server
            m_RCServer = new RemoteConnectionServer.RemoteConnectionServer(m_AppData);

            //m_TCPServerThread = new Thread(TCPServer);
            //m_TCPServerThread.Start();

            //////////////////////////////////////
            //
            // load the LPR Engine

            m_LPREngine = new LPREngine (m_AppData);
            m_AppData.LPREngine = m_LPREngine;

            //////////////////////////////////////
            //
            // load the Watch List Processor

            m_WatchList = new WatchLists(m_AppData);

            //  now that all modules are loaded, let them register with each other for event communications
            m_RCServer.StartRegistration();
            m_DVR.StartRegistration();
            m_LPREngine.StartRegistration();
            m_WatchList.StartRegistration();

            // now let all modules start their threads
            m_RCServer.StartThreads();
            m_DVR.StartThreads();
            m_LPREngine.StartThreads();
            m_WatchList.StartThreads();
            m_Email.StartThreads();

            // is everyone happy?
            if (!m_DVR.GetDVRReady || !((FrameGenerator) m_AppData.FrameGenerator).GetReadyStatus)
                m_AppData.SelfDestruct();
        }