Beispiel #1
0
        private void Initialise()
        {
            try
            {
                URIBase = $"{AlpacaConstants.API_URL_BASE}{AlpacaConstants.API_VERSION_V1}/{DEVICE_TYPE}/{remoteDeviceNumber}/";
                Version version = Assembly.GetEntryAssembly().GetName().Version;

                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, "Starting initialisation, Version: " + version.ToString());
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, "This instance's unique client number: " + clientNumber);
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, "This devices's base URI: " + URIBase);
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, "Establish communications timeout: " + establishConnectionTimeout.ToString());
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, "Standard device response timeout: " + standardDeviceResponseTimeout.ToString());
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, "Long device response timeout: " + longDeviceResponseTimeout.ToString());
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, $"User name is Null or Empty: {string.IsNullOrEmpty(userName)}, User name is Null or White Space: {string.IsNullOrWhiteSpace(userName)}");
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, $"User name length: {password.Length}");
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, $"Password is Null or Empty: {string.IsNullOrEmpty(password)}, Password is Null or White Space: {string.IsNullOrWhiteSpace(password)}");
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, $"Password length: {password.Length}");

                DynamicClientDriver.ConnectToRemoteDevice(ref client, serviceType, ipAddressString, portNumber, clientNumber, DEVICE_TYPE, standardDeviceResponseTimeout, userName, password, TL);
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, "Completed initialisation");
            }
            catch (Exception ex)
            {
                AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, DEVICE_TYPE, ex.ToString());
            }
        }
Beispiel #2
0
        //
        // Constructor - Internal prevents public creation
        // of instances. Returned by Telescope.AxisRates.
        //
        internal AxisRates(TelescopeAxis Axis, ILogger TL)
        {
            m_axis = Axis;
            logger = TL;
            AlpacaDeviceBaseClass.LogMessage(TL, 0, "AlpacaClients.AxisRates Init", $"Supplied axis: {Axis}");

            //
            // This collection must hold zero or more Rate objects describing the
            // rates of motion ranges for the Telescope.MoveAxis() method
            // that are supported by your driver. It is OK to leave this
            // array empty, indicating that MoveAxis() is not supported.
            //
            // Note that we are constructing a rate array for the axis passed
            // to the constructor. Thus we switch() below, and each case should
            // initialize the array for the rate for the selected axis.
            //
            switch (m_axis)
            {
            case TelescopeAxis.Primary:
            case TelescopeAxis.Secondary:
            case TelescopeAxis.Tertiary:
                m_Rates = new Rate[] { };
                break;
            }
            pos = -1;
            AlpacaDeviceBaseClass.LogMessage(TL, 0, "AlpacaClients.AxisRates Init", $"Number of Rates: {m_Rates.Length}");
        }
Beispiel #3
0
 public bool MoveNext()
 {
     AlpacaDeviceBaseClass.LogMessage(logger, 0, "AlpacaClients.AxisRates.MoveNext", $"Moving to next element");
     if (++pos >= m_Rates.Length)
     {
         return(false);
     }
     return(true);
 }
Beispiel #4
0
 // The bulk of the clean-up code is implemented in Dispose(bool)
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         AlpacaDeviceBaseClass.LogMessage(logger, 0, "AlpacaClients.AxisRates.Dispose(bool)", $"SETTING m_Rates to NULL!!!");
         // free managed resources
         m_Rates = null;
     }
 }
Beispiel #5
0
        public void MoveMechanical(float Position)
        {
            Dictionary <string, string> Parameters = new Dictionary <string, string>
            {
                { AlpacaConstants.POSITION_PARAMETER_NAME, Position.ToString(CultureInfo.InvariantCulture) }
            };

            DynamicClientDriver.SetClientTimeout(client, longDeviceResponseTimeout);
            DynamicClientDriver.SendToRemoteDevice <NoReturnValue>(clientNumber, client, URIBase, strictCasing, TL, "MoveMechanical", Parameters, Method.PUT, MemberTypes.Method);
            AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, "MoveMechanical", $"Rotator moved to mechanical position {Position} OK");
        }
Beispiel #6
0
        internal void Add(double Minium, double Maximum, ILogger TL)
        {
            AlpacaDeviceBaseClass.LogMessage(TL, 0, "AlpacaClients.AxisRates.Add", "Before m_Rates.Length: " + m_Rates.Length);
            Rate r = new Rate(Minium, Maximum);                 // Create a new rate to add to the new array

            Rate[] NewRateArray = new Rate[m_Rates.Length + 1]; // Create a new Rate array to replace the current one
            AlpacaDeviceBaseClass.LogMessage(TL, 0, "AlpacaClients.AxisRates.Add", "NewRateArray.Length: " + NewRateArray.Length);
            Array.Copy(m_Rates, NewRateArray, m_Rates.Length);  // Copy the current contents of the m_Rated array to the new array
            NewRateArray[m_Rates.Length] = r;                   // Add the new rate the new Rates array.
            m_Rates = NewRateArray;                             // Make m_Rates point at the new larger array
            AlpacaDeviceBaseClass.LogMessage(TL, 0, "AlpacaClients.AxisRates.Add", "After m_Rates.Length: " + m_Rates.Length);
        }
Beispiel #7
0
        public IRate this[int index]
        {
            get
            {
                AlpacaDeviceBaseClass.LogMessage(logger, 0, "AlpacaClients.AxisRates.This[index]", $"m_rates is null: {m_Rates is null}");
                if (m_Rates != null)
                {
                    AlpacaDeviceBaseClass.LogMessage(logger, 0, "AlpacaClients.AxisRates.This[index]", $"Returning item at index: {index}");
                }

                if (index < 1 || index > this.Count)
                {
                    throw new InvalidValueException("AxisRates.Index", index.ToString(), $"1 to {this.Count}");
                }
                return(m_Rates[index - 1]);      // 1-based
            }
        }
 public void UnPark()
 {
     DynamicClientDriver.SetClientTimeout(client, longDeviceResponseTimeout);
     DynamicClientDriver.CallMethodWithNoParameters(clientNumber, client, URIBase, strictCasing, TL, "UnPark", MemberTypes.Method);
     AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, "UnPark", "Unparked OK");
 }
 public void SyncToTarget()
 {
     DynamicClientDriver.SetClientTimeout(client, standardDeviceResponseTimeout);
     DynamicClientDriver.CallMethodWithNoParameters(clientNumber, client, URIBase, strictCasing, TL, "SyncToTarget", MemberTypes.Method);
     AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, "SyncToTarget", "Slew completed OK");
 }
Beispiel #10
0
 public IEnumerator GetEnumerator()
 {
     AlpacaDeviceBaseClass.LogMessage(logger, 0, "AlpacaClients.AxisRates.GetEnumerator", $"Returning Enumerator");
     pos = -1; //Reset pointer as this is assumed by .NET enumeration
     return(this as IEnumerator);
 }
Beispiel #11
0
 public void Reset()
 {
     AlpacaDeviceBaseClass.LogMessage(logger, 0, "AlpacaClients.AxisRates.Reset", $"Resetting index");
     pos = -1;
 }
 public void CalibratorOff()
 {
     DynamicClientDriver.SetClientTimeout(client, standardDeviceResponseTimeout);
     DynamicClientDriver.CallMethodWithNoParameters(clientNumber, client, URIBase, strictCasing, TL, "CalibratorOff", MemberTypes.Method);
     AlpacaDeviceBaseClass.LogMessage(TL, clientNumber, "AbortSlew", $"Calibrator off OK");
 }