示例#1
0
        public static List <IWeatherData> GetWeatherDataSources(IProfileService profileService)
        {
            var l            = new List <IWeatherData>();
            var ascomDevices = new ASCOM.Utilities.Profile();

            foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("ObservingConditions"))
            {
                try {
                    AscomObservingConditions obsdev = new AscomObservingConditions(device.Key, device.Value);
                    l.Add(obsdev);
                } catch (Exception) {
                }
            }
            return(l);
        }
示例#2
0
        public static List <IRotator> GetRotators(IProfileService profileService)
        {
            var l = new List <IRotator>();

            using (var ascomDevices = new ASCOM.Utilities.Profile()) {
                foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("Rotator"))
                {
                    try {
                        AscomRotator rotator = new AscomRotator(device.Key, device.Value);
                        l.Add(rotator);
                    } catch (Exception) {
                        //only add filter wheels which are supported. e.g. x86 drivers will not work in x64
                    }
                }
                return(l);
            }
        }
示例#3
0
        public static List <ITelescope> GetTelescopes(IProfileService profileService)
        {
            var l = new List <ITelescope>();

            using (var ascomDevices = new ASCOM.Utilities.Profile()) {
                foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("Telescope"))
                {
                    try {
                        AscomTelescope telescope = new AscomTelescope(device.Key, device.Value, profileService);
                        l.Add(telescope);
                    } catch (Exception) {
                        //only add telescopes which are supported. e.g. x86 drivers will not work in x64
                    }
                }
                return(l);
            }
        }
示例#4
0
        public static List <ICamera> GetCameras(IProfileService profileService)
        {
            var l = new List <ICamera>();

            using (var ascomDevices = new ASCOM.Utilities.Profile()) {
                foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("Camera"))
                {
                    try {
                        AscomCamera cam = new AscomCamera(device.Key, device.Value + " (ASCOM)", profileService);
                        Logger.Trace(string.Format("Adding {0}", cam.Name));
                        l.Add(cam);
                    } catch (Exception) {
                        //only add cameras which are supported. e.g. x86 drivers will not work in x64
                    }
                }
                return(l);
            }
        }
示例#5
0
        private void GetTelescopes()
        {
            using (var ascomDevices = new ASCOM.Utilities.Profile()) {
                foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("Telescope"))
                {
                    try {
                        AscomTelescope cam = new AscomTelescope(device.Key, device.Value, profileService);
                        Devices.Add(cam);
                    } catch (Exception) {
                        //only add telescopes which are supported. e.g. x86 drivers will not work in x64
                    }
                }

                if (Devices.Count > 0)
                {
                    var selected = (from device in Devices where device.Id == profileService.ActiveProfile.TelescopeSettings.Id select device).First();
                    SelectedDevice = selected;
                }
            }
        }
示例#6
0
        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();
                }
            }
        }