public override void CapturePhotoNoAf() { lock (Locker) { MTPDataResponse response = ExecuteReadDataEx(CONST_CMD_GetDevicePropValue, CONST_PROP_LiveViewStatus); ErrorCodes.GetException(response.ErrorCode); // test if live view is on if (response.Data != null && response.Data.Length > 0 && response.Data[0] > 0) { if (CaptureInSdRam) { DeviceReady(); ErrorCodes.GetException(StillImageDevice.ExecuteWithNoData(CONST_CMD_InitiateCaptureRecInSdram, 0xFFFFFFFF)); return; } StopLiveView(); } DeviceReady(); byte oldval = 0; var val = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropValue, CONST_PROP_AFModeSelect); if (val.Data != null && val.Data.Length > 0) { oldval = val.Data[0]; } SetProperty(CONST_CMD_SetDevicePropValue, new[] { (byte)4 }, CONST_PROP_AFModeSelect); DeviceReady(); ErrorCodes.GetException(StillImageDevice.ExecuteWithNoData(CONST_CMD_InitiateCapture)); if (val.Data != null && val.Data.Length > 0) { SetProperty(CONST_CMD_SetDevicePropValue, new[] { oldval }, CONST_PROP_AFModeSelect); } } }
public override void EndBulbMode() { lock (Locker) { DeviceReady(); ErrorCodes.GetException(StillImageDevice.ExecuteWithNoData(CONST_CMD_TerminateCapture, 0, 0)); DeviceReady(); StillImageDevice.ExecuteWithNoData(CONST_CMD_ChangeCameraMode, 0); } }
public uint ExecuteWithNoData(int code, uint param1, int loop, int counter) { WaitForReady(); uint res = 0; bool allok; do { allok = true; res = StillImageDevice.ExecuteWithNoData(code, param1); if ((res == ErrorCodes.MTP_Device_Busy || res == PortableDeviceErrorCodes.ERROR_BUSY) && counter < loop) { Thread.Sleep(CONST_READY_TIME); counter++; allok = false; } } while (!allok); return(res); }
public override void StartBulbMode() { DeviceReady(); StillImageDevice.ExecuteWithNoData(CONST_CMD_ChangeCameraMode, 1); SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes((UInt16)0x0001), CONST_PROP_ExposureProgramMode, -1); SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes((UInt32)0xFFFFFFFF), CONST_PROP_ExposureTime, -1); ErrorCodes.GetException(CaptureInSdRam ? StillImageDevice.ExecuteWithNoData(CONST_CMD_InitiateCaptureRecInMedia, 0xFFFFFFFF, 0x0001) : StillImageDevice.ExecuteWithNoData(CONST_CMD_InitiateCaptureRecInMedia, 0xFFFFFFFF, 0x0000)); }
/// <summary> /// Take picture with no autofocus /// If live view runnig the live view is stoped after done restarted /// </summary> public override void CapturePhotoNoAf() { lock (Locker) { byte oldval = 0; byte[] val = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropValue, CONST_PROP_AFModeSelect, -1); if (val != null && val.Length > 0) oldval = val[0]; ErrorCodes.GetException(StillImageDevice.ExecuteWriteData(CONST_CMD_SetDevicePropValue, new[] { (byte)4 }, CONST_PROP_AFModeSelect, -1)); ErrorCodes.GetException(StillImageDevice.ExecuteWithNoData(CONST_CMD_InitiateCapture)); if (val != null && val.Length > 0) ErrorCodes.GetException(StillImageDevice.ExecuteWriteData(CONST_CMD_SetDevicePropValue, new[] { oldval }, CONST_PROP_AFModeSelect, -1)); } }
public override void UnLockCamera() { StillImageDevice.ExecuteWithNoData(CONST_CMD_ChangeCameraMode, 0); }