找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3709|回复: 0
打印 上一主题 下一主题
收起左侧

ZigBee开源协议栈MpZBee源码

[复制链接]
跳转到指定楼层
楼主
欢迎做ZIGBEE开发交流


单片机源程序如下:
  1. /*********************************************************************

  2.                     Device Description File

  3. This file contains descriptor information needed to describe and
  4. implement a ZigBee application.  This file is application-specific -
  5. each application should have its own file.

  6. In the future, this file should be automatically generated by a ZigBee
  7. configuration tool.

  8. *********************************************************************
  9. * FileName:        MyZigBee.c
  10. * Dependencies:
  11. * Processor:       PIC18
  12. * Complier:        MCC18 v1.00.50 or higher
  13. *                  HITECH PICC-18 V8.10PL1 or higher
  14. * Company:         Microchip Technology, Inc.
  15. *
  16. * Software License Agreement
  17. *
  18. * The software supplied herewith by Microchip Technology Incorporated
  19. * (the 揅ompany? for its PICmicro?Microcontroller is intended and
  20. * supplied to you, the Company抯 customer, for use solely and
  21. * exclusively on Microchip PICmicro Microcontroller products. The
  22. * software is owned by the Company and/or its supplier, and is
  23. * protected under applicable copyright laws. All rights are reserved.
  24. * Any use in violation of the foregoing restrictions may subject the
  25. * user to criminal sanctions under applicable laws, as well as to
  26. * civil liability for the breach of the terms and conditions of this
  27. * license.
  28. *
  29. * THIS SOFTWARE IS PROVIDED IN AN 揂S IS?CONDITION. NO WARRANTIES,
  30. * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
  31. * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  32. * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
  33. * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
  34. * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  35. *
  36. *
  37. * Author               Date    Comment
  38. *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  39. * DF/KO                04/29/05 Microchip ZigBee Stack v1.0-2.0
  40. * DF/KO                07/27/05 Microchip ZigBee Stack v1.0-3.1
  41. * DF/KO                09/08/05 Microchip ZigBee Stack v1.0-3.3
  42. ********************************************************************/

  43. #include "zigbee.h"
  44. #include "zdo.h"

  45. //******************************************************************************
  46. // Node Descriptor
  47. //
  48. // This structure describes the node type and its capabilities
  49. //******************************************************************************

  50. ROM NODE_DESCRIPTOR Config_Node_Descriptor =
  51. {
  52.     NODE_LOGICAL_TYPE,
  53.     NODE_FREQ_BAND,
  54.     ALT_PAN_COORD | DEVICE_TYPE | POWER_SOURCE | RECEIVER_ON_IDLE | SECURITY_CAPABILITY,
  55.     NODE_MAX_BUFFER_SIZE,
  56.     NODE_MAX_TRANSFER_SIZE
  57. };

  58. //******************************************************************************
  59. // Node Power Descriptor
  60. //
  61. // This structure describes the node's power characteristics.
  62. //******************************************************************************

  63. // Current version does not support variable charge level advertisement.
  64. ROM NODE_POWER_DESCRIPTOR Config_Power_Descriptor =
  65. {
  66.     NODE_CURRENT_POWER_MODE | (NODE_AVAILABLE_POWER_SOURCES << 4),
  67.     NODE_AVAILABLE_POWER_SOURCES | (0x0f << 4)
  68. };

  69. //******************************************************************************
  70. // Simple Descriptors
  71. //
  72. // This structure defines all endpoints that are implemented in the application.
  73. // The first endpoint is the ZigBee Device Object endpoint - DO NOT MODIFY.
  74. // The following endpoints describe the application endpoints.
  75. //******************************************************************************

  76. ROM NODE_SIMPLE_DESCRIPTOR Config_Simple_Descriptors[NUM_DEFINED_ENDPOINTS] =
  77. {
  78. //------------------------------------------------------------------------------
  79. // ZigBee Device Object Endpoint
  80. // DO NOT MODIFY THIS DESCRIPTOR!!!
  81. //------------------------------------------------------------------------------
  82.     {
  83.         EP_ZDO,                         // ZDO Endpoint is endpoint 0
  84.         {MY_PROFILE_ID_LSB,MY_PROFILE_ID_MSB},                  // Application Profile ID, from the ZigBee Alliance
  85.         {0x00,0x00},                         // ZDO Device ID
  86.         0x00,                           // ZDO Device Version
  87.         NO_OTHER_DESCRIPTOR_AVAILABLE,  // Application Flags
  88.         ZDO_INPUT_CLUSTERS,             // Application Input Cluster Count
  89.         { NWK_ADDR_REQ, IEEE_ADDR_REQ, NODE_DESC_REQ, POWER_DESC_REQ,
  90.           SIMPLE_DESC_REQ, ACTIVE_EP_REQ, MATCH_DESC_REQ
  91.             #ifdef INCLUDE_OPTIONAL_NODE_MANAGEMENT_SERVICES
  92.                 , MGMT_NWK_DISC_REQ, MGMT_LQI_REQ, MGMT_RTG_REQ,
  93.                 MGMT_BIND_REQ, MGMT_LEAVE_REQ, MGMT_DIRECT_JOIN_REQ
  94.             #endif
  95.             #ifdef INCLUDE_OPTIONAL_SERVICE_DISCOVERY_RESPONSES
  96.                 , COMPLEX_DESC_REQ, USER_DESC_REQ, DISCOVERY_REGISTER_REQ,
  97.                 END_DEVICE_ANNCE, USER_DESC_SET
  98.             #endif
  99.             #if defined(I_AM_COORDINATOR) && defined(SUPPORT_END_DEVICE_BINDING)
  100.                 , END_DEVICE_BIND_REQ
  101.             #endif
  102.             #if defined(I_AM_COORDINATOR) || defined(I_SUPPORT_BINDINGS)
  103.                 , BIND_REQ, UNBIND_REQ
  104.             #endif
  105.             #ifdef I_AM_COORDINATOR
  106.                 , CUSTOM_DEMO_BIND            // Demo only!
  107.             #endif
  108.         },                              // Application Input Cluster List
  109.         ZDO_OUTPUT_CLUSTERS,            // Application Output Cluster Count
  110.         { NWK_ADDR_RSP, IEEE_ADDR_RSP, NODE_DESC_RSP, POWER_DESC_RSP,
  111.           SIMPLE_DESC_RSP, ACTIVE_EP_RSP, MATCH_DESC_RSP
  112.             #ifdef INCLUDE_OPTIONAL_NODE_MANAGEMENT_SERVICES
  113.                 , MGMT_NWK_DISC_RSP, MGMT_LQI_RSP, MGMT_RTG_RSP,
  114.                 MGMT_BIND_RSP, MGMT_LEAVE_RSP, MGMT_DIRECT_JOIN_RSP
  115.             #endif
  116.             #ifdef INCLUDE_OPTIONAL_SERVICE_DISCOVERY_RESPONSES
  117.                 , COMPLEX_DESC_RSP, USER_DESC_RSP, DISCOVERY_REGISTER_RSP,
  118.                 USER_DESC_CONF
  119.             #endif
  120.             #if defined(I_AM_COORDINATOR) && defined(SUPPORT_END_DEVICE_BINDING)
  121.                 , END_DEVICE_BIND_REQ
  122.             #endif
  123.             #if defined(I_AM_COORDINATOR) || defined(I_SUPPORT_BINDINGS)
  124.                 , BIND_REQ, UNBIND_REQ
  125.             #endif
  126.         }                               // Application Output Cluster List
  127.     },

  128. //------------------------------------------------------------------------------
  129. // User Descriptors
  130. //
  131. // Enter application endpoint descriptors here.
  132. //------------------------------------------------------------------------------
  133. //------------------------------------------------------------------------------
  134. // Switch endpoint information
  135. //------------------------------------------------------------------------------
  136.     {
  137.         EP_SWITCH,                      // Endpoint number
  138.         {MY_PROFILE_ID_LSB,MY_PROFILE_ID_MSB},                  // Application Profile ID, from the ZigBee Alliance
  139.         {SW_REMOTE_CONTROL_DEV_ID_LSB,SW_REMOTE_CONTROL_DEV_ID_MSB},   // Application Device ID, from the ZigBee Alliance
  140.         SW_REMOTE_CONTROL_DEV_VER,  // Application Device Version, from the ZigBee Alliance
  141.         NO_OTHER_DESCRIPTOR_AVAILABLE,  // Application Flags
  142.         0x00,                           // Application Input Cluster Count
  143.         { NO_CLUSTER },                 // Application Input Cluster List
  144.         0x01,                           // Application Output Cluster Count
  145.         { OnOffSRC_CLUSTER }            // Application Output Cluster List
  146.     }
  147. };

  148. //******************************************************************************
  149. // Complex Descriptor
  150. //
  151. // This structure is optional  It contains more information about the device.
  152. //******************************************************************************

  153. //******************************************************************************
  154. // User Descriptor
  155. //
  156. // This structure is option.  It can be one character string up to 16 characters
  157. // long.
  158. //******************************************************************************

  159. //******************************************************************************
  160. // Network Mode and Parameters
  161. //******************************************************************************

  162. ROM _Config_NWK_Mode_and_Params Config_NWK_Mode_and_Params =
  163. {
  164.      PROFILE_nwkcProtocolVersion,   // BYTE ProtocolVersion;
  165.      MY_STACK_PROFILE_ID,           // BYTE StackProfile;
  166.      15,                            // BYTE BeaconOrder; (non-slotted)
  167.      15,                            // BYTE SuperframeOrder; (non-slotted)
  168.      FALSE,                         // BYTE BatteryLifeExtension;
  169.      PROFILE_nwkSecurityLevel,      // BYTE SecuritySetting;
  170.      {0xFFFF}                       // WORD Channels (scan all channels)
  171. };
复制代码

所有资料51hei提供下载:
ZigBee开源协议栈MpZBee.rar (4.07 MB, 下载次数: 44)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表