public void StopBulbCapture() { // Terminate capture NkMAIDTerminateCapture terminate = new NkMAIDTerminateCapture(); terminate.ulParameter1 = 0; terminate.ulParameter2 = 0; unsafe { IntPtr terminatePointer = new IntPtr(&terminate); Start( eNkMAIDCapability.kNkMAIDCapability_TerminateCapture, eNkMAIDDataType.kNkMAIDDataType_GenericPtr, terminatePointer); } // Restore original shutter speed NikonEnum shutterSpeed = GetEnum(eNkMAIDCapability.kNkMAIDCapability_ShutterSpeed); shutterSpeed.Index = _bulbCaptureShutterSpeedBackup; SetEnum(eNkMAIDCapability.kNkMAIDCapability_ShutterSpeed, shutterSpeed); // Unlock camera SetBoolean( eNkMAIDCapability.kNkMAIDCapability_LockCamera, false); }
public void SetEnum(eNkMAIDCapability cap, NikonEnum value) { Set(cap, value); }
public void StartBulbCapture() { // Lock camera SetBoolean( eNkMAIDCapability.kNkMAIDCapability_LockCamera, true); // Change the exposure mode to 'Manual' NikonEnum exposureMode = GetEnum(eNkMAIDCapability.kNkMAIDCapability_ExposureMode); bool foundManual = false; for (int i = 0; i < exposureMode.Length; i++) { if ((uint)exposureMode[i] == (uint)eNkMAIDExposureMode.kNkMAIDExposureMode_Manual) { exposureMode.Index = i; foundManual = true; SetEnum(eNkMAIDCapability.kNkMAIDCapability_ExposureMode, exposureMode); break; } } // Throw exception if the 'Manual' exposure mode wasn't found if (!foundManual) { throw new NikonException("Failed to find the 'Manual' exposure mode"); } // Change the shutterspeed to 'Bulb' NikonEnum shutterSpeed = GetEnum(eNkMAIDCapability.kNkMAIDCapability_ShutterSpeed); _bulbCaptureShutterSpeedBackup = shutterSpeed.Index; bool foundBulb = false; for (int i = 0; i < shutterSpeed.Length; i++) { if (shutterSpeed[i].ToString().ToLower().Contains("bulb")) { shutterSpeed.Index = i; foundBulb = true; SetEnum(eNkMAIDCapability.kNkMAIDCapability_ShutterSpeed, shutterSpeed); break; } } // Throw exception if the 'Bulb' shutterspeed wasn't found if (!foundBulb) { throw new NikonException("Failed to find the 'Bulb' shutter speed"); } // Capture try { Capture(); } catch (NikonException ex) { // Ignore 'BulbReleaseBusy' exception - it's expected if (ex.ErrorCode != eNkMAIDResult.kNkMAIDResult_BulbReleaseBusy) { throw; } } }