How to enable Live view function setting in canon camera using EDSDK

403 Views Asked by At

Somtimes the canon camera live view func set to disable. and i cant start live view from my program. I need to enable that settings from the program. I try to run that code and I get error "EOSDigital.API.ExecutionException: 'DEVICE_BUSY'".

MainCamera.SetSetting(PropertyID.Evf_OutputDevice, (int)EvfOutputDevice.PC);

While the camera not busy.

The EOS Utility using EDSDK and there is enable option from there. enter image description here

How can i Enable that setting from my C# program using EDSDK?

1

There are 1 best solutions below

0
dor On

I found the solution

this the prop that i look for: public const uint PropID_Evf_Mode = 0x00000501;

need to make sure that this setting set to 1 before setting Evf_OutputDevice

    public void StartLiveView()
    {
        var isLiveModeEnable = GetSetting(EDSDK.PropID_Evf_Mode);

        if(isLiveModeEnable == 0)
            SetSetting(EDSDK.PropID_Evf_Mode, 1);

        SetSetting(EDSDK.PropID_Evf_OutputDevice, EDSDK.EvfOutputDevice_PC);
    }

    public uint GetSetting(uint PropID)
    {
        if (MainCamera.Ref != IntPtr.Zero)
        {
            uint property = 0;
            Error = EDSDK.EdsGetPropertyData(MainCamera.Ref, PropID, 0, out property);
            return property;
        }
        else { throw new ArgumentNullException("Camera or camera reference is null/zero"); }
    }

    public void SetSetting(uint PropID, long Value)
    {
        if (MainCamera.Ref != IntPtr.Zero)
        {
            SendSDKCommand(delegate
            {
                int propsize;
                EDSDK.EdsDataType proptype;
                //get size of property
                Error = EDSDK.EdsGetPropertySize(MainCamera.Ref, PropID, 0, out proptype, out propsize);
                //set given property
                Error = EDSDK.EdsSetPropertyData(MainCamera.Ref, PropID, 0, propsize, (uint)Value);
            });
        }
        else { throw new ArgumentNullException("Camera or camera reference is null/zero"); }
    }