Hi All:
I wrote a program to get the End device information, such as short address, IEEE address etc. But when I tried to get the Coordinator address, I got nothing, just messy code. I don't know why.
The structure I defined:
typedef struct RFTXBUF
{
uint8 type[3];
uint8 myNWK[4];
uint8 myMAC[16];
uint8 pNWK[4];
uint8 pMAC[16];
}RFTX;
In the End device SendTheMessage() function:
if (DistanceApp_NwState == DEV_END_DEVICE)
{
osal_memcpy(rftx.type,"END",3);
}
if (DistanceApp_NwState == DEV_ROUTER)
{
osal_memcpy(rftx.type,"ROU",3);
}
nwk = NLME_GetShortAddr();
To_string(rftx.myNWK,(uint8 *)&nwk,2);
To_string(rftx.myMAC,NLME_GetExtAddr(),8); //The IEEE address is right
nwk = NLME_GetCoordShortAddr();
To_string(rftx.pNWK,(uint8 *)&nwk,2);
NLME_GetCoordExtAddr(buf); //there is only messy code in the buf;
To_string(rftx.myMAC,buf,8);