]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/mac/tkn154/AssociateP.nc
- macShortAddress PIB attribute is now updated automatically after a successful assoc...
[tinyos-2.x.git] / tos / lib / mac / tkn154 / AssociateP.nc
index 11f96f0d492a40eb9338e1449e4a49bed31f6142..3d697f65d474fbe0f8717ff43471373f6d3c078b 100644 (file)
@@ -175,6 +175,7 @@ implementation
     if (!m_associationOngoing)
       return;
     // have not received an AssociationResponse yet, poll the coordinator now
+    dbg_serial("AssociationP", "Polling the coordinator for an AssociationResponse now...\n");
     if (m_coordAddrMode == ADDR_MODE_SHORT_ADDRESS)
       *((nxle_uint16_t*) &coordAddress) = call MLME_GET.macCoordShortAddress();
     else
@@ -184,6 +185,7 @@ implementation
       m_shortAddress = 0xFFFF;
       m_assocRespStatus = IEEE154_TRANSACTION_OVERFLOW;
       signal DataRequest.pollDone();
+      dbg_serial("AssociationP", "Poll failed (locally)...\n");
     }
   }
 
@@ -202,6 +204,8 @@ implementation
     if (m_associationOngoing) {
       call ResponseTimeout.stop();
       m_associationOngoing = FALSE;
+      if (m_assocRespStatus == IEEE154_ASSOCIATION_SUCCESSFUL)
+        call MLME_SET.macShortAddress(m_shortAddress);
       signal MLME_ASSOCIATE.confirm(m_shortAddress, m_assocRespStatus, 0);
       dbg_serial("AssociationP", "confirm: %lx, %lu\n", 
           (uint32_t) m_shortAddress, (uint32_t) m_assocRespStatus);
@@ -236,7 +240,9 @@ implementation
     for (i=0; i<MAX_PENDING_ASSOC_RESPONSES;i++)
       if (m_payloadAssocResponse[i][0] == S_IDLE)
         break;    
-    if (i == MAX_PENDING_ASSOC_RESPONSES || !(txFrame = call TxFramePool.get()))
+    if (security && security->SecurityLevel)
+      txStatus = IEEE154_UNSUPPORTED_SECURITY;
+    else if (i == MAX_PENDING_ASSOC_RESPONSES || !(txFrame = call TxFramePool.get()))
       txStatus = IEEE154_TRANSACTION_OVERFLOW;
     else if (!(txControl = call TxControlPool.get())) {
       call TxFramePool.put(txFrame);