public TaskDataRequest( MacAddressingMode srcAddrMode, MacAddress dstAddr, UInt16 dstPANId, Frame msdu, Byte msduHandle, TxOptions options, SecurityOptions securityOptions, DataConfirmHandler handler) : base(TaskType.DataRequest) { this.srcAddrMode = srcAddrMode; this.dstAddr = dstAddr; this.dstPANId = dstPANId; this.msdu = msdu; this.msduHandle = msduHandle; this.options = options; this.securityOptions = securityOptions; this.handler = handler; }
public void OrphanResponse( UInt64 orphanAddress, UInt16 shortAddr, bool associatedMember, SecurityOptions securityOptions) { TaskOrphanResponse task = new TaskOrphanResponse( orphanAddress, shortAddr, associatedMember, securityOptions); _taskQueue.Add(task); }
public void GtsRequest( GtsCharacteristics gtsCharacteristics, SecurityOptions securityOptions, GtsConfirmHandler handler) { TaskGtsRequest task = new TaskGtsRequest( gtsCharacteristics, securityOptions, handler); if (!_taskQueue.Add(task) && handler != null) { handler.Invoke(this, gtsCharacteristics, MacEnum.Congested); } }
public void DisassociateRequest( MacAddress deviceAddr, UInt16 devicePanId, DisassociationReason reason, bool txIndirect, SecurityOptions securityOptions, DisassociateConfirmHandler handler) { TaskDisassociateRequest task = new TaskDisassociateRequest( deviceAddr, devicePanId, reason, txIndirect, securityOptions, handler); if (!_taskQueue.Add(task) && handler != null) { handler.Invoke(this, MacEnum.Congested, new MacAddress(), 0); } }
public void AssociateResponse( UInt64 deviceAddress, UInt16 assocShortAddress, MacEnum status, SecurityOptions securityOptions) { TaskAssociateResponse task = new TaskAssociateResponse( deviceAddress, assocShortAddress, status, securityOptions); _taskQueue.Add(task); }
public void AssociateRequest( Byte logicalChannel, Byte channelPage, MacAddress coordAddr, UInt16 coordPanId, CapabilityInformation capability, SecurityOptions securityOptions, AssociateConfirmHandler handler) { TaskAssociateRequest task = new TaskAssociateRequest( logicalChannel, channelPage, coordAddr, coordPanId, capability, securityOptions, handler); if (!_taskQueue.Add(task) && handler != null) { handler.Invoke(this, State.cReservedShortAddr, MacEnum.Congested, new SecurityOptions()); } }
public TaskAssociateResponse( UInt64 deviceAddress, UInt16 assocShortAddress, MacEnum status, SecurityOptions securityOptions) : base(TaskType.AssociateResponse) { this.deviceAddress = deviceAddress; this.assocShortAddress = assocShortAddress; this.status = status; this.securityOptions = securityOptions; }
public void PollRequest( MacAddress coordAddr, UInt16 coordPanId, SecurityOptions securityOptions, PollConfirmHandler handler) { TaskPollRequest task = new TaskPollRequest( coordAddr, coordPanId, securityOptions, handler); if (!_taskQueue.Add(task) && handler != null) { handler.Invoke(this, MacEnum.Congested); } }
public TaskPollRequest( MacAddress coordAddr, UInt16 coordPanId, SecurityOptions securityOptions, PollConfirmHandler handler) : base(TaskType.PollRequest) { this.coordAddr = coordAddr; this.coordPanId = coordPanId; this.securityOptions = securityOptions; this.handler = handler; }
public TaskScanRequest( ScanType scanType, UInt32 scanChannels, byte scanDuration, byte channelPage, SecurityOptions securityOptions, ScanChannelConfirmHandler handler) : base(TaskType.ScanRequest) { this.scanType = scanType; this.scanChannels = scanChannels; this.scanDuration = scanDuration; this.channelPage = channelPage; this.securityOptions = securityOptions; this.handler = handler; }
public TaskStartRequest( UInt16 panId, Byte logicalChannel, Byte channelPage, UInt16 startTime, byte beaconOrder, byte superframeOrder, bool panCoordinator, bool batteryLifeExtension, bool coordRealignment, SecurityOptions coordRealignSecutiryOptions, SecurityOptions beaconSecurityOptions, StartConfirmHandler handler) : base(TaskType.StartRequest) { this.panId = panId; this.logicalChannel = logicalChannel; this.channelPage = channelPage; this.startTime = startTime; this.beaconOrder = beaconOrder; this.superframeOrder = superframeOrder; this.panCoordinator = panCoordinator; this.batteryLifeExtension = batteryLifeExtension; this.coordRealignment = coordRealignment; this.coordRealignSecutiryOptions = coordRealignSecutiryOptions; this.beaconSecurityOptions = beaconSecurityOptions; this.handler = handler; }
public TaskOrphanResponse( UInt64 orphanAddress, UInt16 shortAddr, bool associatedMember, SecurityOptions securityOptions) : base(TaskType.OrphanResponse) { this.orphanAddress = orphanAddress; this.shortAddr = shortAddr; this.associatedMember = associatedMember; this.securityOptions = securityOptions; }
public TaskGtsRequest( GtsCharacteristics gtsCharacteristics, SecurityOptions securityOptions, GtsConfirmHandler handler) : base(TaskType.GTSRequest) { this.gtsCharacteristics = gtsCharacteristics; this.securityOptions = securityOptions; this.handler = handler; }
public TaskDisassociateRequest( MacAddress deviceAddr, UInt16 devicePanId, DisassociationReason reason, bool txIndirect, SecurityOptions securityOptions, DisassociateConfirmHandler handler) : base(TaskType.DisassociateRequest) { this.deviceAddr = deviceAddr; this.devicePanId = devicePanId; this.reason = reason; this.txIndirect = txIndirect; this.securityOptions = securityOptions; this.handler = handler; }
public void ScanRequest( ScanType scanType, UInt32 scanChannels, byte scanDuration, byte channelPage, SecurityOptions securityOptions, ScanChannelConfirmHandler handler) { TaskScanRequest task = new TaskScanRequest( scanType, scanChannels, scanDuration, channelPage, securityOptions, handler); if (!_taskQueue.Add(task) && handler != null) { handler.Invoke(this, MacEnum.Congested, scanType, channelPage, scanChannels, null, null); } }
// iterator to scan next channel page private void ScanNextPage() { for (; ; ) { if (_scanChannels == null || _scanChannelsCurrent > _scanChannels.Length - 1) // array starts at 0 { FinishScanning(Status.Success); return; } UInt32 channels = (UInt32)_scanChannels[_scanChannelsCurrent]; UInt32 page = (channels >> 27); channels &= 0x07FFFFFF; // remove page _scanChannelsCurrent++; if (channels != 0) // skip empty pages { SecurityOptions so = new SecurityOptions(); so.SecurityLevel = SecurityLevelIdentifier.None; // FIXME: how to select scanDuration? byte scanDuration = 5; _net.Mac.ScanRequest(ScanType.ActiveScan, channels, scanDuration, (byte)page, so, HandlerScanResult); return; } } }
public void StartRequest( UInt16 panId, Byte logicalChannel, Byte channelPage, UInt16 startTime, byte beaconOrder, byte superframeOrder, bool panCoordinator, bool batteryLifeExtension, bool coordRealignment, SecurityOptions coordRealignSecutiryOptions, SecurityOptions beaconSecurityOptions, StartConfirmHandler handler) { TaskStartRequest task = new TaskStartRequest( panId, logicalChannel, channelPage, startTime, beaconOrder, superframeOrder, panCoordinator, batteryLifeExtension, coordRealignment, coordRealignSecutiryOptions, beaconSecurityOptions, handler); if (!_taskQueue.Add(task) && handler != null) { handler.Invoke(this, MacEnum.Congested); } }
public void DataRequest( MacAddressingMode srcAddrMode, MacAddress dstAddr, UInt16 dstPanId, ref Frame msdu, Byte msduHandle, TxOptions options, SecurityOptions securityOptions, DataConfirmHandler handler) { TaskDataRequest task = new TaskDataRequest( srcAddrMode, dstAddr, dstPanId, msdu, msduHandle, options, securityOptions, handler); if (!_taskQueue.Add(task)) { Frame.Release(ref msdu); if (handler != null) handler.Invoke(this, msduHandle, MacEnum.Congested); } msdu = null; // in any case, remove frame ownership from caller }
/// <summary> /// Handler for Mac sdu frames /// </summary> private void MacDataIndHandler( IMacDataSap sender, MacAddress srcAddr, UInt16 srcPanId, MacAddress dstAddr, UInt16 dstPanId, Frame sdu, Byte linkQuality, Byte DSN, UInt32 timeStamp, SecurityOptions securityOptions) { bool ok = true; ok &= (srcPanId == _panId && dstPanId == _panId); switch (dstAddr.Mode) { case MacAddressingMode.ShortAddress: ok &= (dstAddr.ShortAddress == _addrShort) || (dstAddr.ShortAddress == cBroadcastShortAddr); break; case MacAddressingMode.ExtendedAddress: ok &= (dstAddr.ExtendedAddress == _addrExt); break; default: ok &= false; break; } if (srcAddr.Mode == MacAddressingMode.NoAddress) ok = false; if (sdu == null || sdu.LengthDataUsed == 0) ok = false; if (ok) { Messages6LoWPAN.Dispatch dispatch; ok = Messages6LoWPAN.GetType(sdu, out dispatch); if (ok) { if (dispatch == Messages6LoWPAN.Dispatch.NonLowPan) { Message.Type type; ok = Message.GetType(sdu, out type); if (ok) { switch (type) { case Message.Type.AddressRequest: HandleAddressRequest(srcAddr, dstAddr, ref sdu); break; case Message.Type.AddressReply: HandleAddressReply(srcAddr, dstAddr, ref sdu); break; case Message.Type.RouteRequest: case Message.Type.RouteReply: HandleRoutingMessage(srcAddr, dstAddr, ref sdu, linkQuality); break; case Message.Type.RouteError: HandleRouteError(srcAddr, dstAddr, ref sdu); break; case Message.Type.NeighborhoodDiscovery: HandleNeighborhoodDiscovery(srcAddr, dstAddr, ref sdu, linkQuality); break; case Message.Type.Data: if (srcAddr.Mode == MacAddressingMode.ShortAddress && dstAddr.Mode == MacAddressingMode.ShortAddress) { HandleData(srcAddr.ShortAddress, dstAddr.ShortAddress, ref sdu); } break; case Message.Type.DiscoveryReply: { if (srcAddr.Mode == MacAddressingMode.ShortAddress && _isAddrServer) { Message.DiscoveryReply drep = new Message.DiscoveryReply(); if (drep.ReadFromFrame(sdu)) { _addrServer.HandleDiscoveryReply(srcAddr.ShortAddress); } } } break; } } } else { if (srcAddr.Mode == MacAddressingMode.ShortAddress && dstAddr.Mode == MacAddressingMode.ShortAddress) { HandleData(srcAddr.ShortAddress, dstAddr.ShortAddress, ref sdu); } } } } Frame.Release(ref sdu); }
public TaskAssociateRequest( Byte logicalChannel, Byte channelPage, MacAddress coordAddr, UInt16 coordPanId, CapabilityInformation capability, SecurityOptions securityOptions, AssociateConfirmHandler handler) : base(TaskType.AssociateRequest) { this.logicalChannel = logicalChannel; this.channelPage = channelPage; this.coordAddr = coordAddr; this.coordPanId = coordPanId; this.capability = capability; this.securityOptions = securityOptions; this.handler = handler; }