Z-stack StubAPS的使用
来源:互联网 发布:网络流量分析软件 编辑:程序博客网 时间:2024/06/06 09:48
· Add “stub_aps.c” and “stub_aps.h” files in the NWK directory of your project. You can locate these files in “ZStack-XXXX\Components\stack\nwk”.· Include “stub_aps.h” in “GenericApp.c” and “OSAL_GenericApp.c” (“#include "stub_aps.h"”)· In “OSAL_GenericApp.c” add the red lines: const pTaskEventHandlerFn tasksArr[] = { macEventLoop, nwk_event_loop, Hal_ProcessEvent,#if defined( MT_TASK ) MT_ProcessEvent,#endif APS_event_loop,#if defined ( ZIGBEE_FRAGMENTATION ) APSF_ProcessEvent,#endif ZDApp_event_loop,#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT ) ZDNwkMgr_event_loop,#endif GenericApp_ProcessEvent, StubAPS_ProcessEvent}; void osalInitTasks( void ){ uint8 taskID = 0; tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt); osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt)); macTaskInit( taskID++ ); nwk_init( taskID++ ); Hal_Init( taskID++ );#if defined( MT_TASK ) MT_TaskInit( taskID++ );#endif APS_Init( taskID++ );#if defined ( ZIGBEE_FRAGMENTATION ) APSF_Init( taskID++ );#endif ZDApp_Init( taskID++ );#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT ) ZDNwkMgr_Init( taskID++ );#endif GenericApp_Init( taskID++ ); StubAPS_Init( taskID );} · In “GenericApp.c” in function “void GenericApp_Init( byte task_id )” add:// Fill out the endpoint description.GenericApp_epDesc.endPoint = GENERICAPP_ENDPOINT; GenericApp_epDesc.task_id = &GenericApp_TaskID;GenericApp_epDesc.simpleDesc = (SimpleDescriptionFormat_t *)&GenericApp_SimpleDesc;GenericApp_epDesc.latencyReq = noLatencyReqs; // INTERPAN - Register the endpoint description for INTERPANStubAPS_RegisterApp( &GenericApp_epDesc );// Register the endpoint description with the AFafRegister( &GenericApp_epDesc ); To send an menssagevoid GenericApp_INTERPAN( void ){ /* Seleciona do canal do interpan */ StubAPS_SetInterPanChannel( 0x19 ); /* Buffer com o IEEE MAC Address, cria-se o buffer de traz pra frente */ uint8 buffadd[8] = {0xF3,0x22,0x07,0x01,0x00,0x4B,0x12,0x00}; /* Definições do modo de envio, com endereço 64bit e endpoint INTERPAN */ GenericApp_DstAddr.addrMode = afAddr64Bit; GenericApp_DstAddr.endPoint = STUBAPS_INTER_PAN_EP; /* Copia o buffer para o endereço do destino */ (void)osal_memcpy(GenericApp_DstAddr.addr.extAddr, buffadd, Z_EXTADDR_LEN); /* PAN de destino */ GenericApp_DstAddr.panId = 0x6666; /* Mensagem */ char theMessageData[] = "0"; valorEnv++; /* Envio */ if ( AF_DataRequest( &GenericApp_DstAddr, &GenericApp_epDesc, GENERICAPP_CLUSTERID, (byte)osal_strlen( theMessageData ) + 1, (byte *)&theMessageData, &GenericApp_TransID, AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS ) { /* Verifica se a aplicação INTERPAN foi enviada */ if (StubAPS_InterPan(6666, STUBAPS_INTER_PAN_EP)) { HalLcdWriteStringValue( "InterPan Env", valorEnv, 10, HAL_LCD_LINE_1 ); } } else { // Error occurred in request to send. } /* Volta o canal para IntraPAN */ StubAPS_SetIntraPanChannel();}
阅读全文
0 0
- Z-stack StubAPS的使用
- Z-stack 串口的使用
- Zigbee协议栈--Z-Stack的使用
- Z-Stack中HalUARTWrite的使用以及osal_strlen()的使用
- z-stack相关函数使用
- 目前使用Z-Stack未解决的一些问题
- 修改Z-Stack的PAN_ID
- Z-Stack 定位的配置文件
- zigbee z-stack 同时使用两个串口
- 学习Z-stack的 好的网站
- Z-stack中对按键的处理
- 关于z-stack串口的一些看法
- Z-Stack 的应用层参数修改
- Z-stack中端点的作用
- TI的CC2530使用2400波特率的步骤,协议Z-Stack Home 1.2.2.42930
- z-stack/cc2530协议栈如何修改LED的设置及HalLedBlink的使用
- Z-stack 2.6.1中新增的ZIGBEE_CHILD_AGING模式怎么使用?
- 我为了调试 Z-stack 3.0 是如何免费使用 IAR 9.30.1 的
- 欢迎使用CSDN-markdown编辑器
- 在Windows中如何启用多个Tomcat
- Machine Learning---1--KNN
- JAVA分布式快速开发基础平台iBase4J
- 阿里fast-json方式解析和创建字符串
- Z-stack StubAPS的使用
- S4 Smartforms 改为WORD编辑器
- python在windows下安装libsvm库
- linux 查看ubuntu版本信息
- 论图片上传的实质
- php发送get和post的方法
- ls -l 运行结果的各个字段的意义
- 用VSCode写python的正确姿势
- 丢失的三个元素、网格走法