/// <summary> /// Initializes a new instance of the <see cref="TelescopeBaseClass"/> class. /// Must be public for COM registration. /// </summary> public TelescopeBaseClass(string RequiredDriverNumber, string RequiredDriverDisplayName, string RequiredProgId) { try { // Initialise variables unique to this particular driver with values passed from the calling class DriverNumber = RequiredDriverNumber; DriverDisplayName = RequiredDriverDisplayName; // Driver description that displays in the ASCOM Chooser. DriverProgId = RequiredProgId; if (TL == null) { TL = new TraceLoggerPlus("", string.Format(SharedConstants.TRACELOGGER_NAME_FORMAT_STRING, DriverNumber, DEVICE_TYPE)); } RemoteClientDriver.ReadProfile(clientNumber, TL, DEVICE_TYPE, DriverProgId, ref traceState, ref debugTraceState, ref ipAddressString, ref portNumber, ref remoteDeviceNumber, ref serviceType, ref establishConnectionTimeout, ref standardServerResponseTimeout, ref longServerResponseTimeout, ref userName, ref password, ref manageConnectLocally, ref imageArrayTransferType, ref imageArrayCompression); Version version = Assembly.GetEntryAssembly().GetName().Version; TL.LogMessage(clientNumber, DEVICE_TYPE, "Starting initialisation, Version: " + version.ToString()); clientNumber = RemoteClientDriver.GetUniqueClientNumber(); TL.LogMessage(clientNumber, DEVICE_TYPE, "This instance's unique client number: " + clientNumber); RemoteClientDriver.ConnectToRemoteServer(ref client, ipAddressString, portNumber, serviceType, TL, clientNumber, DEVICE_TYPE, standardServerResponseTimeout, userName, password); URIBase = string.Format("{0}{1}/{2}/{3}/", SharedConstants.API_URL_BASE, SharedConstants.API_VERSION_V1, DEVICE_TYPE, remoteDeviceNumber.ToString()); TL.LogMessage(clientNumber, DEVICE_TYPE, "This devices's base URI: " + URIBase); TL.LogMessage(clientNumber, DEVICE_TYPE, "Establish communications timeout: " + establishConnectionTimeout.ToString()); TL.LogMessage(clientNumber, DEVICE_TYPE, "Standard server response timeout: " + standardServerResponseTimeout.ToString()); TL.LogMessage(clientNumber, DEVICE_TYPE, "Long server response timeout: " + longServerResponseTimeout.ToString()); TL.LogMessage(clientNumber, DEVICE_TYPE, string.Format("User name is Null or Empty: {0}, User name is Null or White Space: {1}", string.IsNullOrEmpty(userName), string.IsNullOrWhiteSpace(userName))); TL.LogMessage(clientNumber, DEVICE_TYPE, string.Format("User name length: {0}", password.Length)); TL.LogMessage(clientNumber, DEVICE_TYPE, string.Format("Password is Null or Empty: {0}, Password is Null or White Space: {1}", string.IsNullOrEmpty(password), string.IsNullOrWhiteSpace(password))); TL.LogMessage(clientNumber, DEVICE_TYPE, string.Format("Password length: {0}", password.Length)); TL.LogMessage(clientNumber, DEVICE_TYPE, "Completed initialisation"); } catch (Exception ex) { TL.LogMessageCrLf(clientNumber, DEVICE_TYPE, ex.ToString()); } }