afRegister( endPointDesc_t *epDesc )这个函数用来注册一个新的端点到task,这样当空中有这个端点的数据到来会直接发送到对应的task。
传入参数:
typedef struct
{
byte endPoint; //端点号
byte *task_id; //端点对应的任务号
SimpleDescriptionFormat_t *simpleDesc; //简单描述符
afNetworkLatencyReq_t latencyReq; //必须用noLatencyReqs来填充
} endPointDesc_t;
afStatus_t afRegister( endPointDesc_t *epDesc )
{
epList_t *ep;
// Look for duplicate endpoint
if ( afFindEndPointDescList( epDesc->endPoint ) )
return ( afStatus_INVALID_PARAMETER );
//在端点的链表中搜索新的端点描述符,看看能不能搜到。如果能搜到,则返回错误。
//如果不能搜到,则说明这个端点在此之前没有被注册,则调用afRegisterExtended( epDesc, NULL )函数注册这个端点。
ep = afRegisterExtended( epDesc, NULL )