一、函数定义: /********************************************************************* * @fn AF_DataRequest * * @brief Common functionality for invoking APSDE_DataReq() for both * SendMulti and MSG-Send. * * input parameters * * @param *dstAddr - Full ZB destination address: Nwk Addr + End Point.目的地址 * @param *srcEP - Origination (i.e. respond to or ack to) End Point Descr.源终端描述 * @param cID - A valid cluster ID as specified by the Profile.Profile指定的簇ID * @param len - Number of bytes of data pointed to by next param.要发送的字节数 * @param *buf - A pointer to the data bytes to send.要发送的数据 * @param *transID - A pointer to a byte which can be modified and which will任务ID号 * be used as the transaction sequence number of the msg. * @param options - Valid bit mask of Tx options.有效位掩码的发送选项 * @param radius - Normally set to AF_DEFAULT_RADIUS.传送跳数,通常设为AF_DEFAULT_RADIUS * * output parameters * * @param *transID - Incremented by one if the return value is success. * * @return afStatus_t - See previous definition of afStatus_... types. */ afStatus_t AF_DataRequest(afAddrType_t *dstAddr,endPointDesc_t *srcEP, uint16 cID,uint16 len,uint8 *buf,uint8 *transID, uint8 options,uint8 radius) 参数: 1、afAddrType_t *dstAddr:目的网路地址指针,除了指定网络地址外,还要指定目的地址的模式参数。 typedef struct { union { uint16 shortAddr; //短地址 ZLongAddr_t extAddr; //长地址 } addr; afAddrMode_t addrMode; //地址类型,afAddrMode_t是一个枚举类型模式参数 byte endPoint; //指定端点号,端点241-254保留,只能使用1-240 uint16 panId; // used for the INTER_PAN feature } afAddrType_t;
typedef enum { afAddrNotPresent = AddrNotPresent,//间接传送,不指定 afAddr16Bit = Addr16Bit,//指定地址单点传送,16位短地址 afAddr64Bit = Addr64Bit, //指定地址单点传送,64位长地址 afAddrGroup = AddrGroup,//组寻址 afAddrBroadcast = AddrBroadcast//广播传送 } afAddrMode_t;
2、endPointDesc_t *srcEP:目的网络地址描述,每个终端都必须要有一个ZigBee的简单描述。 typedef struct { byte endPoint;//端点号 byte *task_id; // Pointer to location of the Application task ID. SimpleDescriptionFormat_t *simpleDesc;//设备的简单描述 afNetworkLatencyReq_t latencyReq;//枚举结构,必须用noLatencyReqs填充 } endPointDesc_t;
typedef struct { byte EndPoint; uint16 AppProfId; uint16 AppDeviceId; byte AppDevVer:4; byte Reserved:4; // AF_V1_SUPPORT uses for AppFlags:4. byte AppNumInClusters;//终端支持的输入簇的个数 cId_t *pAppInClusterList;//指向输入Cluster ID列表的指针 byte AppNumOutClusters;//输出簇的个数 cId_t *pAppOutClusterList;//指向输出Cluster ID列表的指针 } SimpleDescriptionFormat_t;
typedef enum { noLatencyReqs, fastBeacons, slowBeacons } afNetworkLatencyReq_t;
3、uint16 cID:簇ID 4、uint16 len:要发送数据的长度 5、uint8 *buf:指向发送数据缓冲的指针 6、uint8 *transID:事物序列号指针。如果消息缓存发送,这个函数将增加这个数字 7、uint8 options: 8、uint8 radius |
|
来自: xingwangjy > 《CC2530》