Esempio n. 1
0
        /// <summary>
        /// Removes a connection channel.
        /// Button events will no longer be received after the server has received this command.
        /// </summary>
        /// <param name="channel">A ButtonConnectionChannel</param>
        public void RemoveConnectionChannel(ButtonConnectionChannel channel)
        {
            if (channel == null)
            {
                throw new ArgumentNullException(nameof(channel));
            }

            SendPacket(new CmdRemoveConnectionChannel {
                ConnId = channel.ConnId
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a connection channel.
        /// The CreateConnectionChannelResponse event will be raised with the response.
        /// If the response was success, button events will be raised when the button is pressed.
        /// </summary>
        /// <param name="channel">A ButtonConnectionChannel</param>
        public void AddConnectionChannel(ButtonConnectionChannel channel)
        {
            if (channel == null)
            {
                throw new ArgumentNullException(nameof(channel));
            }
            if (!_connectionChannels.TryAdd(channel.ConnId, channel))
            {
                throw new ArgumentException("Connection channel already added");
            }

            channel.FlicClient = this;

            SendPacket(new CmdCreateConnectionChannel {
                ConnId = channel.ConnId, BdAddr = channel.BdAddr, LatencyMode = channel.LatencyMode, AutoDisconnectTime = channel.AutoDisconnectTime
            });
        }