Пример #1
0
        public RemoteSocketController WithRemoteSocket(int id, LPD433MHzCodeSequencePair codeSequencePair)
        {
            if (codeSequencePair == null)
            {
                throw new ArgumentNullException(nameof(codeSequencePair));
            }

            lock (_syncRoot)
            {
                var port = new RemoteSocketOutputPort(id, codeSequencePair, _sender);
                port.Write(BinaryState.Low);

                _ports.Add(id, port);
            }

            return(this);
        }
        public RemoteSocketOutputPort RegisterRemoteSocket(int id, LPD433MHzCodeSequencePair codeSequencePair)
        {
            if (codeSequencePair == null) throw new ArgumentNullException(nameof(codeSequencePair));

            if (Sender == null)
            {
                throw new InvalidOperationException("No sender is set for remote sockets. Registration not possible.");
            }

            lock (_syncRoot)
            {
                var port = new RemoteSocketOutputPort(codeSequencePair, Sender);
                port.Write(BinaryState.Low);

                _ports.Add(id, port);

                return port;
            }
        }
Пример #3
0
        public RemoteSocketOutputPort RegisterRemoteSocket(int id, LPD433MHzCodeSequencePair codeSequencePair)
        {
            if (codeSequencePair == null)
            {
                throw new ArgumentNullException(nameof(codeSequencePair));
            }

            if (Sender == null)
            {
                throw new InvalidOperationException("No sender is set for remote sockets. Registration not possible.");
            }

            lock (_syncRoot)
            {
                var port = new RemoteSocketOutputPort(codeSequencePair, Sender);
                port.Write(BinaryState.Low);

                _ports.Add(id, port);

                return(port);
            }
        }