Hello,everyone,
I'm establishing a zigbee network between a device and coordinator in 
tinyos-2.x,but when I write the code in coordinator.nc in the event 
MLME_ASSOCIATE.indication :
 event void MLME_ASSOCIATE.indication (
                          uint64_t DeviceAddress,
                          ieee154_CapabilityInformation_t CapabilityInformation,
                          ieee154_security_t *security
                        )
  {
    uint16_t *addr = (uint16_t *) &DeviceAddress;
    call MLME_ASSOCIATE.response(DeviceAddress, *addr, 
IEEE154_ASSOCIATION_SUCCESSFUL, 0);
    printf("exaddr = %u, addr = %u, addr1 = %u, %u\n", *addr, *(addr+1), 
*(addr+2), *(addr+3));
    printfflush();
  }
 
and in device.nc the event:
event void MLME_ASSOCIATE.confirm    (
                          uint16_t AssocShortAddress,
                          uint8_t status,
                          ieee154_security_t *security
                        )
  {
    if ( status == IEEE154_SUCCESS ) {
      atomic m_wasAssociationSuccessful = TRUE;
      call Frame.setAddressingFields(
          &m_frame,               
          ADDR_MODE_SHORT_ADDRESS,        // SrcAddrMode,
          ADDR_MODE_SHORT_ADDRESS,        // DstAddrMode,
          m_PANDescriptor.CoordPANId,     // DstPANId,
          &m_PANDescriptor.CoordAddress,  // DstAddr,
          NULL                            // security
          );
    } else {
      call MLME_ASSOCIATE.request(
          m_PANDescriptor.LogicalChannel,
          m_PANDescriptor.ChannelPage,
          m_PANDescriptor.CoordAddrMode,
          m_PANDescriptor.CoordPANId,
          m_PANDescriptor.CoordAddress,
          m_capabilityInformation,
          NULL  // security
          );
    }
  }

but the flag  m_wasAssociationSuccessful always keep the FALSE,I really don't 
what's the problem,can anybody help me,thank you very much!
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to