PowerStrip demo 修改如下:
上电调用 timer,发送命令
TimerStart(&NotificationTimer, 300);
NODE_LIST_STATUS
handleAssociationGetnodeList(
uint8_t groupId,
uint8_t ep,
destination_info_t ** ppList,
uint8_t* pListLen)
{
if((NUMBER_OF_ENDPOINTS + 1) < ep )
{
return NODE_LIST_STATUS_ERR_ENDPOINT_OUT_OF_RANGE;
}
if (NULL == ppList)
{
return NODE_LIST_STATUS_ERROR_LIST;
}
if (NULL == pListLen)
{
return NODE_LIST_STATUS_ERROR_LIST;
}
/*Check group number*/
if (false == isGroupIdValid(groupId, ep))
{
return NODE_LIST_STATUS_ERR_GROUP_NBR_NOT_LEGAL; /*not legal number*/
}
// Find the rootGroupID and endpoint of this groupID
AssGroupMappingLookUp(&ep, &groupId);
*ppList = GetNode(ep, groupId, 0); // Get a pointer to the first node
*pListLen = MAX_ASSOCIATION_IN_GROUP; /*default set to max*/
for (uint8_t indx = 0; indx < MAX_ASSOCIATION_IN_GROUP; indx++)
{
if (IsFree(*ppList + indx))
{
*pListLen = indx; /*number of nodes in list*/
break; /* break out of loop*/
}
(*ppList + indx)->node.nodeId = 0x01;
DPRINTF("\n nodeId = %u, endpoint = %u, BitAddress = %u",
(*ppList + indx)->node.nodeId, (*ppList + indx)->node.endpoint, (*ppList + indx)->node.BitAddress);
}
*pListLen = 1;
if(0 == *pListLen)
{
return NODE_LIST_STATUS_ASSOCIATION_LIST_EMPTY;
}
return NODE_LIST_STATUS_SUCCESS;
}