AF层学习总结
来源:互联网 发布:js switch 编辑:程序博客网 时间:2024/04/29 05:43
AF层学习总结
2010-03-16 19:00
/*
* afInit - Initialize the AF.
*/
extern void afInit( void );
作用:初始化AF层,在ZMain中mian()函数中调用
/*
* afRegisterExtended - Register an Application's EndPoint description
* with a callback function for descriptors.
*
*/
extern epList_t *afRegisterExtended( endPointDesc_t *epDesc, pDescCB descFn );
作用:在afRegister()中调用,注册一个端点描述符,可以选择是否需要为端点设定回调函数,
默认为空,即不设定
/*
* afRegister - Register an Application's EndPoint description.
*
*/
extern afStatus_t afRegister( endPointDesc_t *epDesc );
作用:任务中注册一个端点描述符,示例如下:
GenericApp_epDesc.endPoint = GENERICAPP_ENDPOINT;
GenericApp_epDesc.task_id = &GenericApp_TaskID;
GenericApp_epDesc.simpleDesc
= (SimpleDescriptionFormat_t *)&GenericApp_SimpleDesc;
GenericApp_epDesc.latencyReq = noLatencyReqs;
// Register the endpoint description with the AF
afRegister( &GenericApp_epDesc );
/*
* afDataConfirm - APS will call this function after a data message
* has been sent.
*/
extern void afDataConfirm( uint8 endPoint, uint8 transID, ZStatus_t status );
作用:应用层AF_DataRequest()函数中先调用APSDE_DataReq()向下层发送,再调用这个函数,
向与端点相关联的应用层任务中注册一个AF_DATA_CONFIRM_CMD事件,表示确认数据已经发送出去
/*
* afIncomingData - APS will call this function when an incoming
* message is received.
*/
extern void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress,
uint8 LinkQuality, byte SecurityUse, uint32 timestamp );
作用:在APS层接收到数据后,会调用这个函数,函数内部调用afBuildMSGIncoming(),
如果项目中定义了MT_AF_CB_FUNC,则向MT注册SPI_CB_AF_DATA_IND事件,否则向应用层注册
AF_INCOMING_MSG_CMD事件,两者只取其一
afStatus_t AF_DataRequest( afAddrType_t *dstAddr, endPointDesc_t *srcEP,
uint16 cID, uint16 len, uint8 *buf, uint8 *transID,
uint8 options, uint8 radius );
作用:应用层利用此函数,向目标网络地址的设备发送buf中的数据
/*********************************************************************
* Direct Access Functions - ZigBee Device Object
*/
/*
* afFindEndPointDesc - Find the endpoint description entry from the
* endpoint number.
*/
extern endPointDesc_t *afFindEndPointDesc( byte endPoint );
作用:该函数可以返回与某个端点相关的端点描述符,示例如下:
endPointDesc_t * epDesc = afFindEndPointDesc( endPoint );
/*
* afFindSimpleDesc - Find the Simple Descriptor from the endpoint number.
* If return value is not zero, the descriptor memory must be freed.
*/
extern byte afFindSimpleDesc( SimpleDescriptionFormat_t **ppDesc, byte EP );
作用:该函数可以获取与端点EP相关的简单描述符,保存到ppDesc中,示例如下
SimpleDescriptionFormat_t *sDesc = NULL;
byte free = false;
free = afFindSimpleDesc( &sDesc, endPoint );
/*
* afDataReqMTU - Get the Data Request MTU(Max Transport Unit)
*/
extern uint8 afDataReqMTU( afDataReqMTU_t* fields );
作用:该函数可以查询应用层可以发送的最大数据单元,示例如下:
if (len > afDataReqMTU( &mtu ) )
{
//不发送数据
}
else
{
//否则发送数据
stat = APSDE_DataReq( &req );
}
/*
* afGetMatch - Get the action for the Match Descriptor Response
* TRUE allow match descriptor response
*/
extern uint8 afGetMatch( uint8 ep );
作用:获取端点的行为是否允许Response,返回true则允许,否则不允许
/*
* afSetMatch - Set the action for the Match Descriptor Response
* TRUE allow match descriptor response
*/
extern uint8 afSetMatch( uint8 ep, uint8 action );
作用:设定AF层端点的行为是否允许Response,action为true则允许,否则不允许
示例如下:
afSetMatch(sapi_epDesc.simpleDesc->EndPoint, FALSE);
/*
* afNumEndPoints - returns the number of endpoints defined.
*/
extern byte afNumEndPoints( void );
作用:获取AF层注册的端点的个数,示例如下:
uint8 cnt = afNumEndPoints() - 1; // -1 for ZDO endpoint descriptor
/*
* afCnvtSP_uint16 - Converts uint16 to semi-precision structure format.
*/
extern uint16 afCnvtSP_uint16( afSemiPrecision_t sp );
作用:微精度(afSemiPrecision_t)格式数据转换成普通16位数格式数据
/*
* afCnvtuint16_SP - Converts uint16 to semi-precision structure format.
*/
extern afSemiPrecision_t afCnvtuint16_SP( uint16 rawSP );
作用:把普通16位数格式的数据转换成微精度格式数据
/*
* afCnvtFloat_SP - Converts float to semi-precision
* structure format
* NOTE: This function will convert to the closest possible
* representation in a 16 bit format. Meaning that
* the number may not be exact. For example, 10.7 will
* convert to 10.69531, because .7 is a repeating binary
* number. The mantissa for afSemiPrecision_t is 10 bits
* and .69531 is the 10 bit representative of .7.
*/
extern afSemiPrecision_t afCnvtFloat_SP( float f );
作用:把普通float格式数据转换成微精度格式数据
/*
* afCnvtSP_Float - Converts semi-precision structure format to float.
*/
extern float afCnvtSP_Float( afSemiPrecision_t sp );
作用:转换微精度格式数据为普通float格式数据
/*
* afCopyAddress
*
*/
extern void afCopyAddress (afAddrType_t *afAddr, zAddrType_t *zAddr);
作用:AF层地址拷贝,示例如下:
afCopyAddress( &MSGpkt->srcAddr, SrcAddress );
- AF层学习总结
- AF层学习总结
- AF层学习总结
- ZigBee学习之13——ZStack ZDO和AF层API解读
- MTK android AF调试总结
- z-stack 数据传输AF层application frame
- ZStack ZDO和AF层API解读
- af
- af
- AF
- af
- 二层学习效果总结
- PB两层学习总结
- Photoshop图层学习总结
- 关于在AF层注册的具体过程
- linux RAW SOCKET加Packet af定制2层报文
- jsf学习总结(页面层)
- 关于OSI七层模型第三层学习总结-NEtwork(自己每天的学习总结)
- error C2504: 未定义基类
- vmware-tool 安装缺少头文件 What is the location of the directory of C header files that match your running
- 标准C++中的string类的用法总结
- Timeout expired , The timeout period elapsed prior to completion of the operation or the server
- iphone开发中的一些小技巧
- AF层学习总结
- WebService 测试窗体只能用于来自本地计算机的请求
- Linux设备模型(总线、设备、驱动程序和类)之三:device_driver && 多厂家驱动自动识别
- ThinkPHP学习笔记(十二)ThinkPHP的分页以及验证码的使用
- 电阻器阻值标识的相关知识
- linux 安装HTSeq
- OpenStack多节点部署(二)——操作系统安装
- 公交车上乘客进食,司机不管,一大叔打那女孩一耳光
- C++ 对象的内存布局(下)