//
        // Constructor - Must be public for COM registration!
        //
        public Focuser()
        {
            MessageBox.Show("Creating Focuser Driver");
            EventLogger.LogMessage("Constructing new instance of Gemini ASCOM Driver 1", System.Diagnostics.TraceLevel.Info);

            // Get a ID for the driver based on it's type, then make it unique by adding a number on the end of it.
            uniqueDriverID = HubFocRot.GetUniqueDriverId(Marshal.GenerateProgIdForType(this.GetType()));
            driverID = Marshal.GenerateProgIdForType(this.GetType());
            myFoc = SharedResources.HubFoc1;
            //Create the list of SupporedActions
            GeminiSupportedActions = new ArrayList();
            GeminiSupportedActions.Add("RefreshConfigNow");
            GeminiSupportedActions.Add("HomeDevice");
            GeminiSupportedActions.Add("CenterDevice");
            GeminiSupportedActions.Add("GetFocuserNumber");
            GeminiSupportedActions.Add("GetDeviceNickname");
            GeminiSupportedActions.Add("SetDeviceNickname");
            GeminiSupportedActions.Add("GetTempCoeffValue");
            GeminiSupportedActions.Add("SetTempCoeffValue");
            GeminiSupportedActions.Add("GetTempCoeffName");
            GeminiSupportedActions.Add("SetTempCoeffName");
            GeminiSupportedActions.Add("GetSelectedTempCompMode");
            GeminiSupportedActions.Add("SetTempCompMode");
            GeminiSupportedActions.Add("GetTempComp");
            GeminiSupportedActions.Add("SetTempComp");
            GeminiSupportedActions.Add("GetLEDBrightness");
            GeminiSupportedActions.Add("SetLEDBrightness");
            GeminiSupportedActions.Add("GetDeviceType");
            GeminiSupportedActions.Add("SetDeviceType");
            GeminiSupportedActions.Add("GetBacklashCompSteps");
            GeminiSupportedActions.Add("SetBacklashCompSteps");
            GeminiSupportedActions.Add("GetBacklashCompEnabled");
            GeminiSupportedActions.Add("SetBacklashCompEnabled");
            GeminiSupportedActions.Add("GetFirmwareVersion");
            GeminiSupportedActions.Add("GetCOMPortName");
            GeminiSupportedActions.Add("ForceHubDisconnect");
            GeminiSupportedActions.Add("GetConnectionType");
            GeminiSupportedActions.Add("SetTempCompAtStart");
            GeminiSupportedActions.Add("GetTempCompAtStart");
            GeminiSupportedActions.Add("SetTempOffset");
            GeminiSupportedActions.Add("GetTempOffset");
            GeminiSupportedActions.Add("SyncPosition");
            GeminiSupportedActions.Add("ResetToDefaults");
            GeminiSupportedActions.Add("GetWiFiConnectionState");
            GeminiSupportedActions.Add("GetWiFiAttachedState");
            GeminiSupportedActions.Add("GetWiFiFirmware");
            GeminiSupportedActions.Add("GetWiFiIPAddress");
            GeminiSupportedActions.Add("GetWiFiNetworkName");
            GeminiSupportedActions.Add("SetWiFiNetworkName");
            GeminiSupportedActions.Add("GetWiFiSecurityType");
            GeminiSupportedActions.Add("SetWiFiSecurityType");
            GeminiSupportedActions.Add("GetWiFiSecurityKey");
            GeminiSupportedActions.Add("SetWiFiSecurityKey");
            GeminiSupportedActions.Add("GetWiFiWEPIndex");
            GeminiSupportedActions.Add("SetWiFiWEPIndex");
            GeminiSupportedActions.Add("WiFiPushChanges");
            GeminiSupportedActions.Add("WiFiResetDefaults");
            GeminiSupportedActions.Add("SetupDialogNonStandard");
        }
        static HubFocRot()
        {
            // Get the connections settings from profile.
            EventLogger.LogMessage("Constructing STATIC HubFocuser class.", System.Diagnostics.TraceLevel.Info);

            Profile p = new Profile();
            p.DeviceType = "Focuser";
            PopulateFocuserTypes();

            Trace.WriteLine("Setting connection method");
            connectionMethod = (ConnectionMethods)Enum.Parse(typeof(ConnectionMethods),
                p.GetValue(pDriverID, pConnMeth, "", ConnectionMethods.Serial.ToString()));

            Trace.WriteLine("Finished setting connection method");

            //// Add note to inform users that the second profile item is not used to hold settings...
            //string msg = "This profile item is not used to store any settings. It's only purpose is to link " +
            //    " the Gemini Focuser 2, shown in the chooser, to a ProgID used for COM object creation.";
            //p.WriteValue(pUnusedDriverID, "Note:", msg);

            // Initialize the hubFocusers
            instance1 = new HubFocRot(FOC_ROT_DEVICE.FOC);
            instance2 = new HubFocRot(FOC_ROT_DEVICE.ROT);

            setupFocuserCommunicator();
        }
 public Rotator()
 {
     uniqueDriverID = HubFocRot.GetUniqueDriverId(Marshal.GenerateProgIdForType(this.GetType()));
     driverID = Marshal.GenerateProgIdForType(this.GetType());
     myRot = SharedResources.HubFoc2;
 }
        static SharedResources()
        {
            EventLogger.LogMessage("Creating Gemini Shared Resources", System.Diagnostics.TraceLevel.Info);
            // Get the stored TraceLevel from the ASCOM Profile and convert it to a usable type.
            Utilities.Profile p = new Utilities.Profile();
            p.DeviceType = "Focuser";
            string level = p.GetValue(SharedProfileDriverID, "Trace Level", "", System.Diagnostics.TraceLevel.Info.ToString());
            System.Diagnostics.TraceLevel traceLevel = (System.Diagnostics.TraceLevel)Enum.Parse(typeof(System.Diagnostics.TraceLevel), level);
            try { EventLogger.LoggingLevel = traceLevel; }
            catch
            {
                // This means someone keyed in an invalid value for trace level. Fix the problem
                p.WriteValue(SharedProfileDriverID, "Trace Level", System.Diagnostics.TraceLevel.Error.ToString());
                EventLogger.LoggingLevel = System.Diagnostics.TraceLevel.Warning;
                EventLogger.LogMessage("Invalid Trace Level string found in settings profile. Value was: "
                    + level + ". Trace Level has been automatically set to Warning now. Problem automatically resolved!", System.Diagnostics.TraceLevel.Warning);
            }

            //myFocuserManager = FocuserManager.GetInstance();    // Focuser Manager is implemented as a singleton just so that
                                                                // there is no chance of creating multiple instances of it.

            hubFocuser1 = HubFocRot.Instance1;
            hubFocuser2 = HubFocRot.Instance2;
            EventLogger.LogMessage("myFocuserManager Created Successfully!", System.Diagnostics.TraceLevel.Info);
        }