public MotionSensorStartup(MotionSensorSetup setup)
        {
            //setup the extractor
            imageExtractor = new ImageExtractor(setup.camera);
            imageExtractor.framerateBroadcast += new ImageExtractor.FramerateBroadcastEvent(FramerateBroadcastEventHandler);
            imageExtractor.asyncrohous = true;

            //set up the save file object
            imageSaver = new ImageSaver(setup.imageSaveLocation, "movement", setup.camera.cameraId);
            imageSaver.saveToFileServer = true; //setup.saveImagesToFileServer;
            imageSaver.saveToDatabase = setup.saveImagesToDatabase;
            imageSaver.ParentDirectory = setup.imageSaveLocation;
            captureId = imageSaver.captureId;

            //set up the database object
            if(setup.saveImagesToDatabase)
            {
                database = new CaptureDb(ConfigurationManager.ConnectionStrings["LOCALDB"].ConnectionString);
                database.CreateCaptureSession(captureId, imageSaver.SaveDirectory);
                detectionId = database.CreateDetectionSession(captureId);
                imageSaver.detectionId = detectionId;
            }

            //setup the motion sensor
            motionSensor = new MotionSensor_2a();
            motionSensor.settings = new MotionSensorSettings();
            motionSensor.settings.LoadDefaults();

            motionSensor.motionDetected += new MotionSensor_2.MotionDetected(imageSaver.ImageCreatedAsync);

            //create the validator 
            imageValidator = new ImageValidator();
            imageValidator.ListenForImages(imageExtractor);
            imageValidator.imageValidated += new ImageValidator.ImageValidatedEvent(motionSensor.ImageCreatedAsync);//subscribe to events from the validator

            //setup the alarms
            alarms = new List<IAlarm>();
            if (setup.emailAlarm != null)
            {
                alarms.Add(setup.emailAlarm as EmailAlarm);
                imageSaver.imageCreated += new ImageSaver.ImageSavedEvent(setup.emailAlarm.ImageExtracted);
            }

            imageExtractor.Run();

        }
        public MotionSensorStartup(MotionSensorSetup setup)
        {
            //setup the extractor
            imageExtractor = new ImageExtractor(setup.camera);
            imageExtractor.framerateBroadcast += new ImageExtractor.FramerateBroadcastEvent(FramerateBroadcastEventHandler);
            imageExtractor.asyncrohous         = true;

            //set up the save file object
            imageSaver = new ImageSaver(setup.imageSaveLocation, "movement", setup.camera.cameraId);
            imageSaver.saveToFileServer = true; //setup.saveImagesToFileServer;
            imageSaver.saveToDatabase   = setup.saveImagesToDatabase;
            imageSaver.ParentDirectory  = setup.imageSaveLocation;
            captureId = imageSaver.captureId;

            //set up the database object
            if (setup.saveImagesToDatabase)
            {
                database = new CaptureDb(ConfigurationManager.ConnectionStrings["LOCALDB"].ConnectionString);
                database.CreateCaptureSession(captureId, imageSaver.SaveDirectory);
                detectionId            = database.CreateDetectionSession(captureId);
                imageSaver.detectionId = detectionId;
            }

            //setup the motion sensor
            motionSensor          = new MotionSensor_2a();
            motionSensor.settings = new MotionSensorSettings();
            motionSensor.settings.LoadDefaults();

            motionSensor.motionDetected += new MotionSensor_2.MotionDetected(imageSaver.ImageCreatedAsync);

            //create the validator
            imageValidator = new ImageValidator();
            imageValidator.ListenForImages(imageExtractor);
            imageValidator.imageValidated += new ImageValidator.ImageValidatedEvent(motionSensor.ImageCreatedAsync);//subscribe to events from the validator

            //setup the alarms
            alarms = new List <IAlarm>();
            if (setup.emailAlarm != null)
            {
                alarms.Add(setup.emailAlarm as EmailAlarm);
                imageSaver.imageCreated += new ImageSaver.ImageSavedEvent(setup.emailAlarm.ImageExtracted);
            }

            imageExtractor.Run();
        }
Ejemplo n.º 3
0
        }//PopulateAllCaptures

        public void PopulateCapture(bool movementData, string captureId)
        {
            list = new List<Capture>();
            ConnectionStringSettingsCollection connections = ConfigurationManager.ConnectionStrings;
            captureInfo = new ImageAnalysisDAL.CaptureDb(connections["LOCALDB"].ConnectionString);

            DataTable dt = captureInfo.ReturnCapture(captureId);

            foreach (DataRow dr in dt.Rows)
            {
                Capture capture = new Capture();
                capture.captureId = dr.Field<String>("captureId");
                capture.capturedOn = dr.Field<DateTime?>("capturedOn");
                list.Add(capture);
            }

            if (movementData) { PopulateMovement(); }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Populates metadata about each capture session available
        /// allData will load additional metadata, like when movement occurs
        /// </summary>
        /// <param name="movementData"></param>
        public void PopulateAllCaptures(bool movementData)
        {
            list = new List <Capture>();
            ConnectionStringSettingsCollection connections = ConfigurationManager.ConnectionStrings;

            captureInfo = new ImageAnalysisDAL.CaptureDb(connections["LOCALDB"].ConnectionString);
            DataTable dt = captureInfo.ReturnAllCaptures();

            foreach (DataRow dr in dt.Rows)
            {
                Capture capture = new Capture();
                capture.captureId  = dr.Field <String>("captureId");
                capture.capturedOn = dr.Field <DateTime?>("capturedOn");
                list.Add(capture);
            }

            if (movementData)
            {
                PopulateMovement();
            }
        }//PopulateAllCaptures