コード例 #1
0
        private static int RunApplication(IServiceProvider svc)
        {
            //TODO put in config
            const int camNumber = 0;

            IBcmHost  host   = svc.GetRequiredService <IBcmHost>();
            LedMatrix matrix = svc.GetRequiredService <LedMatrix>();

            CameraInfo camInfo;

            using (var camInfoComp = host.MMAL.ComponentCreateCameraInfo())
            {
                Console.WriteLine("Getting camera info");
                camInfo = camInfoComp.GetCameraInfo(camNumber);
            }
            Console.WriteLine($"Camera name='{camInfo.Name}' res={camInfo.Width}x{camInfo.Height}");
            //create_camera_component
            using (var camera = host.MMAL.ComponentCreateCamera())
            {
                create_camera_component(camera, camNumber);

                //camera.Enable();

                while (true)
                {
                    //TODO : capture image
                    matrix.UpdateCanvas(canvas =>
                    {
                        //TODO : put image to canvas
                    });
                }
            }

            app.Error.WriteLine("Camera capture not implemented");
            return(-1);
        }
コード例 #2
0
 public MmalImageProvider(IBcmHost host, ILogger <ICameraStillImageProvider> logger)
 {
     this.m_bcm    = host;
     this.m_logger = logger;
 }