X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2Ftests%2Ftkn154%2Fbeacon-enabled%2FTestIndirect%2Fdevice%2FTestDeviceReceiverC.nc;h=dc2482d3954c746eb8e2746bde15e132cb39e497;hb=4944808843447cbd5a337e2dc35c26e9ec1fe422;hp=197a0430e0b342362b38aeca7d9a5898ef38c64c;hpb=2d7854932f7589657e485cfca01a0a6863587967;p=tinyos-2.x.git diff --git a/apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestDeviceReceiverC.nc b/apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestDeviceReceiverC.nc index 197a0430..dc2482d3 100644 --- a/apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestDeviceReceiverC.nc +++ b/apps/tests/tkn154/beacon-enabled/TestIndirect/device/TestDeviceReceiverC.nc @@ -55,7 +55,7 @@ module TestDeviceReceiverC uint8_t m_coordAddressMode; ieee154_macPANId_t m_coordPANID; ieee154_PANDescriptor_t m_PANDescriptor; - bool m_isPANDescriptorValid; + bool m_wasScanSuccessful; void startApp(); event void Boot.booted() { @@ -82,6 +82,7 @@ module TestDeviceReceiverC // through the MLME_BEACON_NOTIFY interface, i.e. // we set the macAutoRequest attribute to FALSE call MLME_SET.macAutoRequest(FALSE); + m_wasScanSuccessful = FALSE; call MLME_SCAN.request ( PASSIVE_SCAN, // ScanType channel, // ScanChannels @@ -99,21 +100,15 @@ module TestDeviceReceiverC { // received a beacon frame during SCAN ieee154_phyCurrentPage_t page = call MLME_GET.phyCurrentPage(); - ieee154_macBSN_t beaconSequenceNumber = call BeaconFrame.getBSN(frame); - if (beaconSequenceNumber & 1) - call Leds.led2On(); - else - call Leds.led2Off(); - - if (!m_isPANDescriptorValid && call BeaconFrame.parsePANDescriptor( + if (!m_wasScanSuccessful && call BeaconFrame.parsePANDescriptor( frame, RADIO_CHANNEL, page, &m_PANDescriptor) == SUCCESS){ // let's see if the beacon is from our coordinator... if (m_PANDescriptor.CoordAddrMode == ADDR_MODE_SHORT_ADDRESS && m_PANDescriptor.CoordPANId == PAN_ID && m_PANDescriptor.CoordAddress.shortAddress == COORDINATOR_ADDRESS){ // wait until SCAN is finished, then syncronize to beacons - m_isPANDescriptorValid = TRUE; + m_wasScanSuccessful = TRUE; } } return frame; @@ -130,7 +125,7 @@ module TestDeviceReceiverC ieee154_PANDescriptor_t* PANDescriptorList ) { - if (m_isPANDescriptorValid){ + if (m_wasScanSuccessful){ // set the macAutoRequest attribute to TRUE, so indirect // transmissions are automatically carried through call MLME_SET.macAutoRequest(TRUE); @@ -158,7 +153,6 @@ module TestDeviceReceiverC ieee154_security_t *security) { call Leds.led1Off(); - startApp(); } event message_t* MCPS_DATA.indication (message_t* frame)