コード例 #1
0
        /// <summary>
        /// Switch a remote switch off (Type A with 10 pole DIP switches).
        /// </summary>
        /// <param name="switchGroupAddress">
        /// Code of the switch group (refers to DIP switches 1 - 5, where
        /// "1" = on and "0" = off, if all DIP switches are on it's "11111").
        /// </param>
        /// <param name="device">
        /// The switch device number.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="switchGroupAddress"/> cannot be null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="switchGroupAddress"/> cannot have more than 5 bits.
        /// </exception>
        public void SwitchOff(BitSet switchGroupAddress, RCSwitchDevNum device)
        {
            if (switchGroupAddress == null)
            {
                throw new ArgumentNullException("switchGroupAddress");
            }

            if (switchGroupAddress.Length > 5)
            {
                throw new ArgumentException("Cannot accept a switch group address with more than 5 bits.");
            }

            if (device == RCSwitchDevNum.None)
            {
                return;
            }

            String state = this.GetCodeWordA(switchGroupAddress, (ChannelCode)((Int32)device), false);

            this.SendTriState(state.ToCharArray());
        }
コード例 #2
0
ファイル: RCSwitchDevice.cs プロジェクト: cyrusbuilt/MonoPi
		/// <summary>
		/// Switch a remote switch off (Type A with 10 pole DIP switches).
		/// </summary>
		/// <param name="switchGroupAddress">
		/// Code of the switch group (refers to DIP switches 1 - 5, where
		/// "1" = on and "0" = off, if all DIP switches are on it's "11111").
		/// </param>
		/// <param name="device">
		/// The switch device number.
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="switchGroupAddress"/> cannot be null.
		/// </exception>
		/// <exception cref="ArgumentException">
		/// <paramref name="switchGroupAddress"/> cannot have more than 5 bits.
		/// </exception>
		public void SwitchOff(BitSet switchGroupAddress, RCSwitchDevNum device) {
			if (switchGroupAddress == null) {
				throw new ArgumentNullException("switchGroupAddress");
			}

			if (switchGroupAddress.Length > 5) {
				throw new ArgumentException("Cannot accept a switch group address with more than 5 bits.");
			}

			if (device == RCSwitchDevNum.None) {
				return;
			}

			String state = this.GetCodeWordA(switchGroupAddress, (ChannelCode)((Int32)device), false);
			this.SendTriState(state.ToCharArray());
		}