Beispiel #1
0
        /// <summary>
        /// Read the device configuration from the ASCOM Profile store
        /// </summary>
        private void ReadProfile()
        {
            using (Profile driverProfile = new Profile())
            {
                driverProfile.DeviceType = "Camera";

                webcamName = driverProfile.GetValue(driverID, webcamProfileName, string.Empty, webcamDefault);
                mediaType  = Webcam.Parse(driverProfile.GetValue(driverID, mediaTypeProfileName, string.Empty, mediaTypeDefault));
                pixelSizeX = Convert.ToDouble(driverProfile.GetValue(driverID, pixelSizeXProfileName, string.Empty, pixelSizeXDefault));
                pixelSizeY = Convert.ToDouble(driverProfile.GetValue(driverID, pixelSizeYProfileName, string.Empty, pixelSizeYDefault));

                comPortName  = driverProfile.GetValue(driverID, comPortProfileName, string.Empty, comPortDefault);
                baudRate     = Convert.ToInt32(driverProfile.GetValue(driverID, baudRateProfileName, string.Empty, baudRateDefault));
                parity       = (Parity)Enum.Parse(typeof(Parity), driverProfile.GetValue(driverID, parityProfileName, string.Empty, parityDefault));
                dataBits     = Convert.ToInt32(driverProfile.GetValue(driverID, dataBitsProfileName, string.Empty, dataBitsDefault));
                stopBits     = (StopBits)Enum.Parse(typeof(StopBits), driverProfile.GetValue(driverID, stopBitsProfileName, string.Empty, stopBitsDefault));
                readTimeout  = Convert.ToInt32(driverProfile.GetValue(driverID, readTimeoutProfileName, string.Empty, readTimeoutDefault));
                writeTimeout = Convert.ToInt32(driverProfile.GetValue(driverID, writeTimeoutProfileName, string.Empty, writeTimeoutDefault));

                traceLogger.Enabled = Convert.ToBoolean(driverProfile.GetValue(driverID, traceLoggerProfileName, string.Empty, traceLoggerDefault));
            }
        }