Ejemplo n.º 1
0
        public void MultiCastLevel(byte level)
        {
            _multiCastLevel = level;
            //_radio.OperatingMode = OperatingModes.StandBy;
            IReceivePipe receivePipe = _radio.ReceivePipes[0];

            receivePipe.Address = BitConverter.GetBytes(NetworkAddressing.PipeAddress(NetworkAddressing.LevelToAddress(level), 0)).ReverseBytes();
            receivePipe.Enabled = true;
            // _radio.OperatingMode = OperatingModes.ReceiveMode;
        }
Ejemplo n.º 2
0
        public void Begin(byte channel, ushort nodeAddress)
        {
            if (!NetworkAddressing.IsValidAddress(nodeAddress))
            {
                return;
            }
            NetworkAddressing.NodeAddress = nodeAddress;
            if (channel != Configuration.UseCurrentChannel)
            {
                _radio.Configuration.Channel = channel;
            }
            _radio.RegisterContainer.EnableAutoAcknowledgementRegister.EnableAutoAcknowledgementPipe0 = false;
            _radio.RegisterContainer.EnableAutoAcknowledgementRegister.Save();

            _radio.Configuration.DynamicPayloadLengthEnabled = true;

            AutoRetransmitDelays retryVar = (AutoRetransmitDelays)((((nodeAddress % 6) + 1) * 2) + 3);

            _radio.Configuration.AutoRetransmitDelay = retryVar;
            _radio.Configuration.AutoRetransmitCount = 5;

            TransmitTimeout = 25;
            RouteTimeout    = TransmitTimeout * 3;

            NetworkAddressing.SetupAddress();

            byte i = 6;

            while (i-- > 0)
            {
                IReceivePipe receivePipe = _radio.ReceivePipes[i];
                receivePipe.Address = BitConverter.GetBytes(NetworkAddressing.PipeAddress(nodeAddress, i)).ReverseBytes();
                receivePipe.Enabled = true;
            }

            _radio.OperatingMode = OperatingModes.ReceiveMode;
        }
 public Network(ILoggerFactoryAdapter loggerFactoryAdapter)
 {
     _loggerFactoryAdapter = loggerFactoryAdapter;
     _logger = _loggerFactoryAdapter.GetLogger(GetType());
     NetworkAddressing = new NetworkAddressing(_loggerFactoryAdapter);
 }
Ejemplo n.º 4
0
 public bool MultiCast(INetworkHeader networkHeader, byte[] message, ushort length, byte level)
 {
     networkHeader.ToNode   = 0100;
     networkHeader.FromNode = NetworkAddressing.NodeAddress;
     return(Write(networkHeader, message, length, NetworkAddressing.LevelToAddress(level)));
 }
Ejemplo n.º 5
0
 public Network(ILoggerFactoryAdapter loggerFactoryAdapter)
 {
     _loggerFactoryAdapter = loggerFactoryAdapter;
     _logger           = _loggerFactoryAdapter.GetLogger(GetType());
     NetworkAddressing = new NetworkAddressing(_loggerFactoryAdapter);
 }