public override void GetEquipment() { Devices.Clear(); Devices.Add(new Model.DummyDevice(Locale.Loc.Instance["LblNoCamera"])); /* ASI */ try { Logger.Trace("Adding ASI Cameras"); for (int i = 0; i < ASICameras.Count; i++) { var cam = ASICameras.GetCamera(i, profileService); if (!string.IsNullOrEmpty(cam.Name)) { Logger.Trace(string.Format("Adding {0}", cam.Name)); Devices.Add(cam); } } } catch (Exception ex) { Logger.Error(ex); } /* Altair */ try { Logger.Trace("Adding Altair Cameras"); foreach (var instance in Altair.AltairCam.EnumV2()) { var cam = new AltairCamera(instance, profileService); Devices.Add(cam); } } catch (Exception ex) { Logger.Error(ex); } /* Atik */ try { Logger.Trace("Adding Atik Cameras"); var atikDevices = AtikCameraDll.GetDevicesCount(); Logger.Trace($"Cameras found: {atikDevices}"); if (atikDevices > 0) { for (int i = 0; i < atikDevices; i++) { var cam = new AtikCamera(i, profileService); Devices.Add(cam); } } } catch (Exception ex) { Logger.Error(ex); } /* FLI */ try { Logger.Trace("Adding FLI Cameras"); List <string> cameras = FLICameras.GetCameras(); if (cameras.Count > 0) { foreach (var entry in cameras) { var camera = new FLICamera(entry, profileService); if (!string.IsNullOrEmpty(camera.Name)) { Logger.Debug($"Adding FLI camera {camera.Id} (as {camera.Name})"); Devices.Add(camera); } } } } catch (Exception ex) { Logger.Error(ex); } /* QHYCCD */ try { Logger.Trace("Adding QHYCCD Cameras"); uint numCameras = QHYCameras.Count; if (numCameras > 0) { for (uint i = 0; i < numCameras; i++) { var cam = QHYCameras.GetCamera(i, profileService); if (!string.IsNullOrEmpty(cam.Name)) { Logger.Debug($"Adding QHY camera {i}: {cam.Id} (as {cam.Name})"); Devices.Add(cam); } } } } catch (Exception ex) { Logger.Error(ex); } /* ToupTek */ try { Logger.Debug("Adding ToupTek Cameras"); foreach (var instance in ToupTek.ToupCam.EnumV2()) { var cam = new ToupTekCamera(instance, profileService); Devices.Add(cam); } } catch (Exception ex) { Logger.Error(ex); } /* Omegon */ try { Logger.Debug("Adding Omegon Cameras"); foreach (var instance in Omegon.Omegonprocam.EnumV2()) { var cam = new OmegonCamera(instance, profileService); Devices.Add(cam); } } catch (Exception ex) { Logger.Error(ex); } /* ASCOM */ try { foreach (ICamera cam in ASCOMInteraction.GetCameras(profileService)) { Devices.Add(cam); } } catch (Exception ex) { Logger.Error(ex); } /* CANON */ try { IntPtr cameraList; try { EDSDKLocal.Initialize(); } catch (Exception ex) { Logger.Error(ex); Utility.Notification.Notification.ShowError(ex.Message); } uint err = EDSDK.EdsGetCameraList(out cameraList); if (err == EDSDK.EDS_ERR_OK) { int count; err = EDSDK.EdsGetChildCount(cameraList, out count); for (int i = 0; i < count; i++) { IntPtr cam; err = EDSDK.EdsGetChildAtIndex(cameraList, i, out cam); EDSDK.EdsDeviceInfo info; err = EDSDK.EdsGetDeviceInfo(cam, out info); Logger.Trace(string.Format("Adding {0}", info.szDeviceDescription)); Devices.Add(new EDCamera(cam, info, profileService)); } } } catch (Exception ex) { Logger.Error(ex); } /* NIKON */ try { Devices.Add(new NikonCamera(profileService, telescopeMediator)); } catch (Exception ex) { Logger.Error(ex); } Devices.Add(new Model.MyCamera.FileCamera(profileService, telescopeMediator)); Devices.Add(new Model.MyCamera.Simulator.SimulatorCamera(profileService, telescopeMediator)); DetermineSelectedDevice(profileService.ActiveProfile.CameraSettings.Id); }
private void GetCameras() { using (var ascomDevices = new ASCOM.Utilities.Profile()) { foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("Camera")) { try { AscomCamera cam = new AscomCamera(device.Key, "ASCOM --- " + device.Value, profileService); Devices.Add(cam); } catch (Exception) { //only add cameras which are supported. e.g. x86 drivers will not work in x64 } } } for (int i = 0; i < ASICameras.Count; i++) { var cam = ASICameras.GetCamera(i, profileService); if (!string.IsNullOrEmpty(cam.Name)) { Devices.Add(cam); } } /*IntPtr cameraList; * uint err = EDSDK.EdsGetCameraList(out cameraList); * if (err == EDSDK.EDS_ERR_OK) { * int count; * err = EDSDK.EdsGetChildCount(cameraList, out count); * * for(int i = 0; i < count; i++) { * IntPtr cam; * err = EDSDK.EdsGetChildAtIndex(cameraList, i, out cam); * * EDSDK.EdsDeviceInfo info; * err = EDSDK.EdsGetDeviceInfo(cam, out info); * * Devices.Add(new EDCamera(cam, info));*/ /*err = EDSDK.EdsOpenSession(cam); * * IntPtr saveTo = (IntPtr)EDSDK.EdsSaveTo.Host; * err = EDSDK.EdsSetPropertyData(cam, EDSDK.PropID_SaveTo, 0, 4, saveTo); * * EDSDK.EdsCapacity capacity = new EDSDK.EdsCapacity(); * capacity.NumberOfFreeClusters = 0x7FFFFFFF; * capacity.BytesPerSector = 0x1000; * capacity.Reset = 1; * err = EDSDK.EdsSetCapacity(cam, capacity); * * err = EDSDK.EdsSendCommand(cam, EDSDK.CameraCommand_TakePicture, 0); * * err = EDSDK.EdsCloseSession(cam);*/ /* } * }*/ if (Devices.Count > 0) { var items = (from device in Devices where device.Id == profileService.ActiveProfile.CameraSettings.Id select device); if (items.Count() > 0) { SelectedDevice = items.First(); } else { SelectedDevice = Devices.First(); } } }