예제 #1
0
 /// <summary>   EllDevice Constructor. </summary>
 /// <param name="deviceID">         Identifier for the device. </param>
 /// <param name="messageUpdater">   Thea message handler. To receive feedback on progress, supply a meddage handler, derived from
 ///                                 <see cref="MessageUpdater"/> to process feedback. </param>
 internal ELLPaddlePolariser(DeviceID deviceID, MessageUpdater messageUpdater)
     : base(deviceID, 3, messageUpdater)
 {
     MinPos        = (16m / 1023) * deviceID.Travel;
     MinPosRounded = Math.Ceiling(MinPos * 10) / 10;
     MaxPos        = (1006m / 1023) * deviceID.Travel;
     MaxPosRounded = Math.Floor(MinPos * 10) / 10;
 }
예제 #2
0
 /// <summary>   EllDevice Constructor. </summary>
 /// <param name="deviceID"> Identifier for the device. </param>
 public ELLPaddlePolariser(DeviceID deviceID)
     : base(deviceID, 3)
 {
     MinPos        = (16m / 1023) * deviceID.Travel;
     MinPosRounded = Math.Ceiling(MinPos * 10) / 10;
     MaxPos        = (1006m / 1023) * deviceID.Travel;
     MaxPosRounded = Math.Floor(MinPos * 10) / 10;
 }
예제 #3
0
        private void InitializeClass(DeviceID deviceID, char motorCount)
        {
            for (char c = '1'; c <= motorCount; c++)
            {
                _motorInfo.Add(c, new MotorInfo(c));
            }

            DeviceInfo   = deviceID;
            Address      = deviceID.Address;
            DeviceStatus = new DeviceStatus();
        }
예제 #4
0
        public static DeviceID Configure(string deviceID, MessageUpdater messageUpdater)
        {
            if (string.IsNullOrEmpty(deviceID))
            {
                return(null);
            }
            char address = deviceID[0];

            if (!IsValidAddress(address))
            {
                return(null);
            }
            DeviceID di = new DeviceID(deviceID);

            messageUpdater?.UpdateParameter(MessageUpdater.UpdateTypes.DeviceInfo, address, di);
            return(di);
        }
예제 #5
0
        /// <summary> Configures the given device address. </summary>
        /// <param name="deviceID"> Identifier for the device. </param>
        /// <returns> Success. </returns>
        public bool Configure(string deviceID)
        {
            if (string.IsNullOrEmpty(deviceID))
            {
                return(false);
            }
            char address = deviceID[0];

            if (ELLBaseDevice.ValidAddresses.Contains(address))
            {
                DeviceID di = ELLBaseDevice.Configure(deviceID, _messageUpdater);
                if (di.DeviceType == DeviceID.DeviceTypes.Paddle)
                {
                    _devices[address] = new ELLPaddlePolariser(di, _messageUpdater);
                    _selectedDevice   = _devices[address];
                }
                else
                {
                    _devices[address] = new ELLDevice(di, _messageUpdater);
                    _selectedDevice   = _devices[address];
                }
            }
            return(true);
        }
예제 #6
0
 /// <summary>   EllDevice Constructor. </summary>
 /// <param name="deviceID"> Identifier for the device. </param>
 public ELLDevice(DeviceID deviceID)
     : base(deviceID, 2)
 {
 }
예제 #7
0
 /// <summary>   EllDevice Constructor. </summary>
 /// <param name="deviceID">         Identifier for the device. </param>
 /// <param name="messageUpdater">   Thea message handler. To receive feedback on progress, supply a meddage handler, derived from
 ///                                 <see cref="MessageUpdater"/> to process feedback. </param>
 internal ELLDevice(DeviceID deviceID, MessageUpdater messageUpdater)
     : base(deviceID, 2, messageUpdater)
 {
 }
예제 #8
0
 /// <summary>   Specialised default constructor for use only by derived class. </summary>
 /// <param name="deviceID">     Identifier for the device. </param>
 /// <param name="motorCount">   Number of motors. </param>
 protected ELLBaseDevice(DeviceID deviceID, int motorCount)
 {
     _messageUpdater = null;
     InitializeClass(deviceID, (char)('0' + motorCount));
 }
예제 #9
0
 /// <summary>   EllDevice Constructor. </summary>
 /// <param name="deviceID">         Identifier for the device. </param>
 /// <param name="motorCount">       Number of motors. </param>
 /// <param name="messageUpdater">   Thea message handler. To receive feedback on progress, supply a meddage handler, derived from
 ///                                 <see cref="MessageUpdater"/> to process feedback. </param>
 internal ELLBaseDevice(DeviceID deviceID, int motorCount, MessageUpdater messageUpdater)
 {
     _messageUpdater = messageUpdater;
     InitializeClass(deviceID, (char)('0' + motorCount));
 }