Exemplo n.º 1
0
        public VsCamera(int camID, string camName, string camDesp,
            long syncTimer,
            string pcHost, string pcDirt,
            string dbHost, string dbUser, string dbPasswd, string dbDatabase,
            string smtpHost, string smtpUser, string smtpPasswd, string emailFrom, string emailTo,
            bool bPreview, bool bStream, bool bAnalysis, bool bRecord, bool bEventAlert, bool bDataAlert, bool bMailAlert)
        {
            try
            {
                // camera
                this.camID = camID;
                this.camName = camName;
                this.camDesp = camDesp;
                this.syncTimer = syncTimer;

                // local host
                this.pcHost = pcHost;
                this.pcDirt = pcDirt;

                // data host
                this.dbHost = dbHost;
                this.dbUser = dbUser;
                this.dbPasswd = dbPasswd;
                this.dbDatabase = dbDatabase;

                // mail host
                this.smtpHost = smtpHost;
                this.smtpUser = smtpUser;
                this.smtpPasswd = smtpPasswd;
                this.emailFrom = emailFrom;
                this.emailTo = emailTo;

                // action
                this.bPreview = bPreview;
                this.bStream = bStream;
                this.bAnalysis = bAnalysis;
                this.bRecord = bRecord;
                this.bDataAlert = bDataAlert;
                this.bEventAlert = bEventAlert;
                this.bEmailAlert = bMailAlert;

                // Streamer 
                vsStreamer = new VsStreamer(syncTimer, 320, 240, 74);

                // Data Generator 
                vsDataAlert = new VsDataGenerator(syncTimer, dbHost, dbUser, dbPasswd, dbDatabase);

                // Event Generator
                vsEventAlert = new VsEventGenerator(syncTimer, dbHost, dbUser, dbPasswd, dbDatabase);

                // Email Generation
                vsEmailAlert = new VsEmailGenerator(syncTimer, smtpHost, smtpUser, smtpPasswd, emailFrom, emailTo);

                // syncronized queue
                imgBuffer = Queue.Synchronized(new Queue());

                // timer
                tcallback = new TimerCallback(process_NewFrame);

                // define the dueTime and period 
                long dTime = 1000;           // wait before the first tick (in ms) 
                // instantiate the Timer object 
                timer = new Timer(tcallback, null, dTime, syncTimer);
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
            }
        }
Exemplo n.º 2
0
        // destructor
        public void Dispose()
        {
            try
            {
                if (vsStreamer != null)
                {
                    vsStreamer.Dispose();
                    vsStreamer = null;
                }

                if (vsEventAlert != null)
                {
                    vsEventAlert.Dispose();
                    vsEventAlert = null;
                }

                if (vsDataAlert != null)
                {
                    vsDataAlert.Dispose();
                    vsDataAlert = null;
                }

                // stop process
                if (timer != null)
                {
                    timer.Dispose();
                    timer = null;
                }
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
            }
        } 
Exemplo n.º 3
0
        public VsCamera(string camName, long syncTimer)
        {
            try
            {
                // camera
                this.camName = camName;
                this.syncTimer = syncTimer;

                // action
                this.bPreview = true;
                this.bStream = false;
                this.bAnalysis = false;
                this.bRecord = false;
                this.bDataAlert = false;
                this.bEventAlert = false;

                // Streamer 
                vsStreamer = new VsStreamer(syncTimer, 320, 240, 74);

                // Data Generator 
                vsDataAlert = new VsDataGenerator(syncTimer, dbHost, dbUser, dbPasswd, dbDatabase);

                // Event Generator
                vsEventAlert = new VsEventGenerator(syncTimer, dbHost, dbUser, dbPasswd, dbDatabase);

                // syncronized queue
                imgBuffer = Queue.Synchronized(new Queue());

                // timer
                tcallback = new TimerCallback(process_NewFrame);

                // define the dueTime and period 
                long dTime = 1000;           // wait before the first tick (in ms) 
                // instantiate the Timer object 
                timer = new Timer(tcallback, null, dTime, syncTimer);
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
            }
        }