public State(StateCallbacks callback, IPhy phy)
        {
            _callback = callback;
            phy.GetDeviceAddress(out aExtendedAddress);
            int phyMtu;

            phy.GetMtuSize(out phyMtu, out phyFrameHead, out phyFrameTail);

            phy.IsCapabilitySupported(Capabilities.Ieee2006, out phySupports2006);

            Reset();
        }
Example #2
0
        private bool _rxThreadExit;        // A flag that tells the receive thread to exit

        public MacLayer(IPhy phy)
        {
            // poweron Phy first
            _phy = phy;
            _phy.IsCapabilitySupported(Capabilities.PowerOff, out _phyCapPower);
            if (_phyCapPower)
            {
                _phy.SetPower(true); // should be on-demand
            }

            _state             = new State(this, phy);
            _taskAddedEvent    = new AutoResetEvent(false);
            _taskQueue         = new TaskQueue(cQueueCmdSize, cQueueDataSize, _taskAddedEvent);
            _taskProcessorExit = false;
            _taskProcessor     = new Thread(TaskProcessor);
#if !MICROFRAMEWORK
            _taskProcessor.IsBackground = true;
#endif
            _sendReceive    = new PhySendReceive(_state, _phy, this);
            _scannedBeacons = new ArrayList();

            ResetHandler();

            // initialize channels
            Phy.Status   status;
            Phy.PibValue value;
            _phy.GetRequest(Phy.PibAttribute.phyCurrentPage, out status, out value);
            _state.phyChannelPage = (Byte)value.Int;
            _phy.GetRequest(Phy.PibAttribute.phyCurrentChannel, out status, out value);
            _state.phyChannelNumber = (Byte)value.Int;

            _rxFrameQueue = new Frame.Queue(cQueueRxSize, true, 0);
            _rxThread     = new Thread(DataIndicationThread);
#if !MICROFRAMEWORK
            _rxThread.IsBackground = true;
#endif
            _rxEvent      = new AutoResetEvent(false);
            _rxThreadExit = false;
            _rxThread.Start();

            _taskProcessor.Start();
        }
Example #3
0
        private bool _rxThreadExit;        // A flag that tells the receive thread to exit

        public MacLayer(IPhy phy)
        {
            // poweron Phy first
            _phy = phy;
            _phy.IsCapabilitySupported(Capabilities.PowerOff, out _phyCapPower);
            if (_phyCapPower)
            {
                _phy.SetPower(true); // should be on-demand
            }

            _state = new State(this, phy);
            _taskAddedEvent = new AutoResetEvent(false);
            _taskQueue = new TaskQueue(cQueueCmdSize, cQueueDataSize, _taskAddedEvent);
            _taskProcessorExit = false;
            _taskProcessor = new Thread(TaskProcessor);
#if !MICROFRAMEWORK
            _taskProcessor.IsBackground = true;
#endif
            _sendReceive = new PhySendReceive(_state, _phy, this);
            _scannedBeacons = new ArrayList();

            ResetHandler();

            // initialize channels
            Phy.Status status;
            Phy.PibValue value;
            _phy.GetRequest(Phy.PibAttribute.phyCurrentPage, out status, out value);
            _state.phyChannelPage = (Byte)value.Int;
            _phy.GetRequest(Phy.PibAttribute.phyCurrentChannel, out status, out value);
            _state.phyChannelNumber = (Byte)value.Int;

            _rxFrameQueue = new Frame.Queue(cQueueRxSize, true, 0);
            _rxThread = new Thread(DataIndicationThread);
#if !MICROFRAMEWORK
            _rxThread.IsBackground = true;
#endif
            _rxEvent = new AutoResetEvent(false);
            _rxThreadExit = false;
            _rxThread.Start();

            _taskProcessor.Start();
        }
        public PhySendReceive(State state, IPhy phy, SendReceiveCallbacks mac)
        {
            _state = state;
            _phy = phy;
            _mac = mac;

            _ackPending = false;
            _ackReceived = new AutoResetEvent(false);

            _phy.IsCapabilitySupported(Capabilities.AutoFcs, out _phyCapAutoFCS);
            if (_phyCapAutoFCS)
            {
                _phy.SetAutoFCS(true);
            }

            _phy.IsCapabilitySupported(Capabilities.AddressFilter, out _phyCapAddressFilter);
            _phy.IsCapabilitySupported(Capabilities.AutoAck, out _phyCapAutoAck);
            _phy.IsCapabilitySupported(Capabilities.TxCache, out _phyCapTxCache);

            _filterEnabled = false;
        }
Example #5
0
        public PhySendReceive(State state, IPhy phy, SendReceiveCallbacks mac)
        {
            _state = state;
            _phy   = phy;
            _mac   = mac;

            _ackPending  = false;
            _ackReceived = new AutoResetEvent(false);

            _phy.IsCapabilitySupported(Capabilities.AutoFcs, out _phyCapAutoFCS);
            if (_phyCapAutoFCS)
            {
                _phy.SetAutoFCS(true);
            }

            _phy.IsCapabilitySupported(Capabilities.AddressFilter, out _phyCapAddressFilter);
            _phy.IsCapabilitySupported(Capabilities.AutoAck, out _phyCapAutoAck);
            _phy.IsCapabilitySupported(Capabilities.TxCache, out _phyCapTxCache);

            _filterEnabled = false;
        }
Example #6
0
 public Program()
 {
     phy = new CC2420(CC2420PinConfig.DefaultiMXS(), false);
     leds = new Leds();
 }
Example #7
0
 public Program()
 {
     phy  = new CC2420(CC2420PinConfig.DefaultiMXS(), false);
     leds = new Leds();
 }
 public Program()
 {
     phy = new CC2420(CC2420PinConfig.DefaultiMXS());
 }
Example #9
0
 public Program()
 {
     phy = new CC2420(CC2420PinConfig.DefaultiMXS());
 }
Example #10
0
        public State(StateCallbacks callback, IPhy phy)
        {
            _callback = callback;
            phy.GetDeviceAddress(out aExtendedAddress);
            int phyMtu;
            phy.GetMtuSize(out phyMtu, out phyFrameHead, out phyFrameTail);

            phy.IsCapabilitySupported(Capabilities.Ieee2006, out phySupports2006);

            Reset();
        }