Exemple #1
0
        public IEnumerator <ITask> ReplaceHandler(Replace req)
        {
            Fault fault = null;

            yield return(Arbiter.Choice(_scribblerPort.SetCamParam(0, req.Body.Darkness),
                                        delegate(DefaultUpdateResponseType r) { },
                                        delegate(Fault f) { fault = f; }));

            if (fault == null)
            {
                yield return(Arbiter.Choice(_scribblerPort.SetCamParam(1, req.Body.Val1),
                                            delegate(DefaultUpdateResponseType r) { },
                                            delegate(Fault f) { fault = f; }));
            }

            if (fault == null)
            {
                yield return(Arbiter.Choice(_scribblerPort.SetCamParam(2, req.Body.Val2),
                                            delegate(DefaultUpdateResponseType r) { },
                                            delegate(Fault f) { fault = f; }));
            }

            if (fault == null)
            {
                yield return(Arbiter.Choice(_scribblerPort.SetCamParam(
                                                b.ScribblerHelper.CameraParams.CAM_BRT, req.Body.Brightness),
                                            delegate(DefaultUpdateResponseType r) { },
                                            delegate(Fault f) { fault = f; }));
            }

            if (fault == null)
            {
                yield return(Arbiter.Choice(_scribblerPort.SetCamParam(
                                                b.ScribblerHelper.CameraParams.CAM_EXP, req.Body.Exposure),
                                            delegate(DefaultUpdateResponseType r) { },
                                            delegate(Fault f) { fault = f; }));
            }

            byte coma = req.Body.AutoWhiteBalance ?
                        b.ScribblerHelper.CameraParams.CAM_COMA_WHITE_BALANCE_ON :
                        b.ScribblerHelper.CameraParams.CAM_COMA_WHITE_BALANCE_OFF;

            if (fault == null)
            {
                yield return(Arbiter.Choice(_scribblerPort.SetCamParam(
                                                b.ScribblerHelper.CameraParams.CAM_COMA, coma),
                                            delegate(DefaultUpdateResponseType r) { },
                                            delegate(Fault f) { fault = f; }));
            }

            byte comb = b.ScribblerHelper.CameraParams.CAM_COMB_DEFAULT;

            comb = (byte)(req.Body.AutoGain ?
                          comb | b.ScribblerHelper.CameraParams.CAM_COMB_GAIN_CONTROL_ON :
                          comb & b.ScribblerHelper.CameraParams.CAM_COMB_GAIN_CONTROL_OFF);
            comb = (byte)(req.Body.AutoExposure ?
                          comb | b.ScribblerHelper.CameraParams.CAM_COMB_EXPOSURE_CONTROL_ON :
                          comb & b.ScribblerHelper.CameraParams.CAM_COMB_EXPOSURE_CONTROL_OFF);
            if (fault == null)
            {
                yield return(Arbiter.Choice(_scribblerPort.SetCamParam(
                                                b.ScribblerHelper.CameraParams.CAM_COMB, comb),
                                            delegate(DefaultUpdateResponseType r) { },
                                            delegate(Fault f) { fault = f; }));
            }

            if (fault == null)
            {
                req.ResponsePort.Post(DefaultReplaceResponseType.Instance);
                _state = req.Body;
            }
            else
            {
                req.ResponsePort.Post(fault);
            }
        }
Exemple #2
0
 public Replace(CamControlState b) : base(b)
 {
 }