原型:
afStatus_t AF_DataRequest( afAddrType_t *dstAddr, endPointDesc_t *srcEP,
uint16 cID, uint16 len, uint8 *buf, uint8 *transID,
uint8 options, uint8 radius );
参数说明:
typedef struct
{
union
{
uint16 shortAddr;//短地址
ZLongAddr_t extAddr;
} addr;
afAddrMode_t addrMode;//传送模式 <wbr>
uint8 endPoint;//端点号 <wbr>
uint16 panId; // used for the INTER_PAN feature
} afAddrType_t;</wbr></wbr>
typedef struct
{
uint8 endPoint;//端点号
uint8 *task_id; // Pointer to location of the Application task ID.(调用任务的ID)
SimpleDescriptionFormat_t *simpleDesc;//简单的端点描述
afNetworkLatencyReq_t latencyReq;
} endPointDesc_t;
typedef struct
{
byte EndPoint; //端口号
uint16 AppProfId; //应用规范ID
uint16 AppDeviceId; //应用设备ID
uint8 AppDevVer:4; //应用设备版本号 4bit 这里使用的是位域
uint8 Reserved:4; // AF_V1_SUPPORT uses for AppFlags:4.
uint8 AppNumInClusters; //输入簇包含的命令个数
cId_t *pAppInClusterList; //输入簇列表 可有<span style='line-height: 18px; font-family: Consolas,"Courier New",Courier,mono,serif; background-color: rgb(248, 248, 248);'>GENERICAPP_MAX_CLUSTERS个输入命令</span>
uint8 AppNumOutClusters; //输出簇包含的命令个数
cId_t *pAppOutClusterList;//输出簇列表 可有<span style='line-height: 18px; font-family: Consolas,"Courier New",Courier,mono,serif; background-color: rgb(248, 248, 248);'>GENERICAPP_MAX_CLUSTERS个输出命令</span>
} SimpleDescriptionFormat_t;
#define AF_PREPROCESS 0x04 // Will force APS to callback to preprocess before calling NWK layer
#define AF_LIMIT_CONCENTRATOR 0x08
#define AF_ACK_REQUEST 0x10
#define AF_DISCV_ROUTE 0x20 // This option is no longer used, and will be taken out later
#define AF_EN_SECURITY 0x40
#define AF_SKIP_ROUTING 0x80
对于非广播消息,有两种基本的消息重试类型:端到端的确认(APS ACK)和单级确认(single hop acknowledgement)(MAC ACK)。MAC ACK默认情况下是一直打开的,通常能够充分保证网络的高可靠性。为了提供附加的可靠性,同时使发送设备能够得到数据包已经被发送到目的地的确认,可以使用APS ACK。
APS acknowledgement在APS层完成,是从目标设备到源设备的一个消息确认系统。源设备将保留这个消息知道目标设备发送一个APS ACK消息表明它已经收到了消息。对于每个发出的消息可以通过调用函数AF_DataRequest()的选项来使能/禁止来禁止这个功能。这个选项区域是一个位映射选项,对于将要发送的消息的选项区域或上(OR)AF_ACK_REQUEST就可以使能APS ACK。消息重试(如果APS ACK消息没有收到)的次数和重试之间的时间间隔的配置项在f8wConfig.cfg文件中。APSC_MAX_FRAME_RETRIES是APS层在放弃发送数据之前,没有收到APS ACK确认重新发送消息的次数。APSC_ACK_WAIT_DURATION_POLLED是重新发送之间的时间间隔。