您可以利用zb_GetDeviceInfo()函数在应用层获取PANID及信道等信息
查看该函数定义即可知用法:
void zb_GetDeviceInfo ( uint8 param, void *pValue )
[
switch(param)
[
case ZB_INFO_DEV_STATE:
osal_memcpy(pValue, &devState, sizeof(uint8));
break;
case ZB_INFO_IEEE_ADDR:
osal_memcpy(pValue, &aExtendedAddress, Z_EXTADDR_LEN);
break;
case ZB_INFO_SHORT_ADDR:
osal_memcpy(pValue, &_NIB.nwkDevAddress, sizeof(uint16));
break;
case ZB_INFO_PARENT_SHORT_ADDR:
osal_memcpy(pValue, &_NIB.nwkCoordAddress, sizeof(uint16));
break;
case ZB_INFO_PARENT_IEEE_ADDR:
osal_memcpy(pValue, &_NIB.nwkCoordExtAddress, Z_EXTADDR_LEN);
break;
case ZB_INFO_CHANNEL:
osal_memcpy(pValue, &_NIB.nwkLogicalChannel, sizeof(uint8));
break;
case ZB_INFO_PAN_ID:
osal_memcpy(pValue, &_NIB.nwkPanId, sizeof(uint16));
break;
case ZB_INFO_EXT_PAN_ID:
osal_memcpy(pValue, &_NIB.extendedPANID, Z_EXTADDR_LEN);
break;
]
]
例如要获取设备短地址,可以这样:
uint16 my_panid;
zb_GetDeviceInfo(ZB_INFO_PAN_ID,my_panid);
您可以利用zb_GetDeviceInfo()函数在应用层获取PANID及信道等信息
查看该函数定义即可知用法:
void zb_GetDeviceInfo ( uint8 param, void *pValue )
[
switch(param)
[
case ZB_INFO_DEV_STATE:
osal_memcpy(pValue, &devState, sizeof(uint8));
break;
case ZB_INFO_IEEE_ADDR:
osal_memcpy(pValue, &aExtendedAddress, Z_EXTADDR_LEN);
break;
case ZB_INFO_SHORT_ADDR:
osal_memcpy(pValue, &_NIB.nwkDevAddress, sizeof(uint16));
break;
case ZB_INFO_PARENT_SHORT_ADDR:
osal_memcpy(pValue, &_NIB.nwkCoordAddress, sizeof(uint16));
break;
case ZB_INFO_PARENT_IEEE_ADDR:
osal_memcpy(pValue, &_NIB.nwkCoordExtAddress, Z_EXTADDR_LEN);
break;
case ZB_INFO_CHANNEL:
osal_memcpy(pValue, &_NIB.nwkLogicalChannel, sizeof(uint8));
break;
case ZB_INFO_PAN_ID:
osal_memcpy(pValue, &_NIB.nwkPanId, sizeof(uint16));
break;
case ZB_INFO_EXT_PAN_ID:
osal_memcpy(pValue, &_NIB.extendedPANID, Z_EXTADDR_LEN);
break;
]
]
例如要获取设备短地址,可以这样:
uint16 my_panid;
zb_GetDeviceInfo(ZB_INFO_PAN_ID,my_panid);
举报