Esempio n. 1
0
        public AppCommon.APPErrors Start()
        {
            m_frameNumber = 1;
            m_running     = true;

            m_fgControl = new FrameGrabberControl();

            while (m_running)
            {
                SLog.Instance().Write(AppCommon.MODULES.MANAGER_MODULE, "Start frame: " + m_frameNumber);
                if (m_fgControl.Start(m_config.num1, m_config.num2, m_fgEvent) == AppCommon.APPErrors.STATUS_FG_PENDING)
                {
                    bool b;
                    if ((b = m_fgEvent.WaitOne(m_config.FrameGrabberMaxTimeout)) == false)
                    {
                        if (m_running == false)
                        {
                            return(AppCommon.APPErrors.STATUS_OK);
                        }
                        return(AppCommon.APPErrors.STATUS_FG_TIMEOUT);
                    }
                    if (m_running == false)
                    {
                        return(AppCommon.APPErrors.STATUS_OK);
                    }
                    m_fgBuffer = m_fgControl.RowData;
                    SLog.Instance().Write(AppCommon.MODULES.FG_MODULE, "Got row data to pass to IP size of: " + m_fgControl.BufferLength);
                }


                m_frameNumber++;
            }

            return(AppCommon.APPErrors.STATUS_OK);
        }
Esempio n. 2
0
        void LoadSettings()
        {
            try
            {
                if (File.Exists(ConfigFileName) == false)
                {
                    return;
                }

                using (StreamReader file = File.OpenText(ConfigFileName))
                {
                    JsonSerializer serializer = new JsonSerializer();
                    m_appConfig = (AppConfig)serializer.Deserialize(file, typeof(AppConfig));
                }

                txtIpAddress.Text = m_appConfig.IpAddress;
                txtNum1.Text      = m_appConfig.num1.ToString();
                txtNum2.Text      = m_appConfig.num2.ToString();
                txtPort.Text      = m_appConfig.port.ToString();
                m_appConfig.FrameGrabberMaxTimeout = 10000;
                chkOnFile.Checked   = m_appConfig.logOnFile;
                chkOnScreen.Checked = m_appConfig.logOnScreen;

                SLog.Instance().EnableLog(m_appConfig.logOnFile);
            }
            catch (Exception err)
            {
                throw (new SystemException(err.Message));
            }
        }
Esempio n. 3
0
        public Form1()
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
            InitDataGrid();
            SLog.Instance().Initialize("ImageProcessingApp.csv");
            LoadSettings();

            SLog.ManagerCallbackMsg p = new SLog.ManagerCallbackMsg(AppManagerCallback);
            SLog.Instance().SetCallback(p);
        }
Esempio n. 4
0
        public AppCommon.APPErrors Start(int num1, int num2, AutoResetEvent ev)
        {
            m_fgComplete = false;

            ProgressCallback callback =
                (Buffer, length) =>
            {
                if (m_running == false)
                {
                    return;
                }
                //Console.WriteLine("Progress = {0}", length);

                if (m_fgBuffer == null || length != m_lastLength)
                {
                    m_fgBuffer = new byte[length];
                }
                Marshal.Copy(Buffer, m_fgBuffer, 0, length);
                m_lastLength = length;
                SLog.Instance().Write(m_module, "Got response");
                m_fgComplete = true;
                ev.Set();
                return;
            };

            m_running = true;
            try
            {
                DoWork(callback, num1, num2);
                SLog.Instance().Write(m_module, "Called to acquire frame");
                return(AppCommon.APPErrors.STATUS_FG_PENDING);
            }
            catch (Exception err)
            {
                throw (new SystemException(err.Message));
            }
        }
Esempio n. 5
0
 private void chkOnFile_CheckedChanged(object sender, EventArgs e)
 {
     m_appConfig.logOnFile = chkOnFile.Checked;
     SLog.Instance().EnableLog(m_appConfig.logOnFile);
 }