标题:
ZigBee开源协议栈MpZBee源码
[打印本页]
作者:
xiaoysdf
时间:
2018-8-27 18:29
标题:
ZigBee开源协议栈MpZBee源码
欢迎做ZIGBEE开发交流
0.png
(41.32 KB, 下载次数: 68)
下载附件
2018-8-27 19:26 上传
单片机源程序如下:
/*********************************************************************
Device Description File
This file contains descriptor information needed to describe and
implement a ZigBee application. This file is application-specific -
each application should have its own file.
In the future, this file should be automatically generated by a ZigBee
configuration tool.
*********************************************************************
* FileName: MyZigBee.c
* Dependencies:
* Processor: PIC18
* Complier: MCC18 v1.00.50 or higher
* HITECH PICC-18 V8.10PL1 or higher
* Company: Microchip Technology, Inc.
*
* Software License Agreement
*
* The software supplied herewith by Microchip Technology Incorporated
* (the 揅ompany? for its PICmicro?Microcontroller is intended and
* supplied to you, the Company抯 customer, for use solely and
* exclusively on Microchip PICmicro Microcontroller products. The
* software is owned by the Company and/or its supplier, and is
* protected under applicable copyright laws. All rights are reserved.
* Any use in violation of the foregoing restrictions may subject the
* user to criminal sanctions under applicable laws, as well as to
* civil liability for the breach of the terms and conditions of this
* license.
*
* THIS SOFTWARE IS PROVIDED IN AN 揂S IS?CONDITION. NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
*
* Author Date Comment
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* DF/KO 04/29/05 Microchip ZigBee Stack v1.0-2.0
* DF/KO 07/27/05 Microchip ZigBee Stack v1.0-3.1
* DF/KO 09/08/05 Microchip ZigBee Stack v1.0-3.3
********************************************************************/
#include "zigbee.h"
#include "zdo.h"
//******************************************************************************
// Node Descriptor
//
// This structure describes the node type and its capabilities
//******************************************************************************
ROM NODE_DESCRIPTOR Config_Node_Descriptor =
{
NODE_LOGICAL_TYPE,
NODE_FREQ_BAND,
ALT_PAN_COORD | DEVICE_TYPE | POWER_SOURCE | RECEIVER_ON_IDLE | SECURITY_CAPABILITY,
NODE_MAX_BUFFER_SIZE,
NODE_MAX_TRANSFER_SIZE
};
//******************************************************************************
// Node Power Descriptor
//
// This structure describes the node's power characteristics.
//******************************************************************************
// Current version does not support variable charge level advertisement.
ROM NODE_POWER_DESCRIPTOR Config_Power_Descriptor =
{
NODE_CURRENT_POWER_MODE | (NODE_AVAILABLE_POWER_SOURCES << 4),
NODE_AVAILABLE_POWER_SOURCES | (0x0f << 4)
};
//******************************************************************************
// Simple Descriptors
//
// This structure defines all endpoints that are implemented in the application.
// The first endpoint is the ZigBee Device Object endpoint - DO NOT MODIFY.
// The following endpoints describe the application endpoints.
//******************************************************************************
ROM NODE_SIMPLE_DESCRIPTOR Config_Simple_Descriptors[NUM_DEFINED_ENDPOINTS] =
{
//------------------------------------------------------------------------------
// ZigBee Device Object Endpoint
// DO NOT MODIFY THIS DESCRIPTOR!!!
//------------------------------------------------------------------------------
{
EP_ZDO, // ZDO Endpoint is endpoint 0
{MY_PROFILE_ID_LSB,MY_PROFILE_ID_MSB}, // Application Profile ID, from the ZigBee Alliance
{0x00,0x00}, // ZDO Device ID
0x00, // ZDO Device Version
NO_OTHER_DESCRIPTOR_AVAILABLE, // Application Flags
ZDO_INPUT_CLUSTERS, // Application Input Cluster Count
{ NWK_ADDR_REQ, IEEE_ADDR_REQ, NODE_DESC_REQ, POWER_DESC_REQ,
SIMPLE_DESC_REQ, ACTIVE_EP_REQ, MATCH_DESC_REQ
#ifdef INCLUDE_OPTIONAL_NODE_MANAGEMENT_SERVICES
, MGMT_NWK_DISC_REQ, MGMT_LQI_REQ, MGMT_RTG_REQ,
MGMT_BIND_REQ, MGMT_LEAVE_REQ, MGMT_DIRECT_JOIN_REQ
#endif
#ifdef INCLUDE_OPTIONAL_SERVICE_DISCOVERY_RESPONSES
, COMPLEX_DESC_REQ, USER_DESC_REQ, DISCOVERY_REGISTER_REQ,
END_DEVICE_ANNCE, USER_DESC_SET
#endif
#if defined(I_AM_COORDINATOR) && defined(SUPPORT_END_DEVICE_BINDING)
, END_DEVICE_BIND_REQ
#endif
#if defined(I_AM_COORDINATOR) || defined(I_SUPPORT_BINDINGS)
, BIND_REQ, UNBIND_REQ
#endif
#ifdef I_AM_COORDINATOR
, CUSTOM_DEMO_BIND // Demo only!
#endif
}, // Application Input Cluster List
ZDO_OUTPUT_CLUSTERS, // Application Output Cluster Count
{ NWK_ADDR_RSP, IEEE_ADDR_RSP, NODE_DESC_RSP, POWER_DESC_RSP,
SIMPLE_DESC_RSP, ACTIVE_EP_RSP, MATCH_DESC_RSP
#ifdef INCLUDE_OPTIONAL_NODE_MANAGEMENT_SERVICES
, MGMT_NWK_DISC_RSP, MGMT_LQI_RSP, MGMT_RTG_RSP,
MGMT_BIND_RSP, MGMT_LEAVE_RSP, MGMT_DIRECT_JOIN_RSP
#endif
#ifdef INCLUDE_OPTIONAL_SERVICE_DISCOVERY_RESPONSES
, COMPLEX_DESC_RSP, USER_DESC_RSP, DISCOVERY_REGISTER_RSP,
USER_DESC_CONF
#endif
#if defined(I_AM_COORDINATOR) && defined(SUPPORT_END_DEVICE_BINDING)
, END_DEVICE_BIND_REQ
#endif
#if defined(I_AM_COORDINATOR) || defined(I_SUPPORT_BINDINGS)
, BIND_REQ, UNBIND_REQ
#endif
} // Application Output Cluster List
},
//------------------------------------------------------------------------------
// User Descriptors
//
// Enter application endpoint descriptors here.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Switch endpoint information
//------------------------------------------------------------------------------
{
EP_SWITCH, // Endpoint number
{MY_PROFILE_ID_LSB,MY_PROFILE_ID_MSB}, // Application Profile ID, from the ZigBee Alliance
{SW_REMOTE_CONTROL_DEV_ID_LSB,SW_REMOTE_CONTROL_DEV_ID_MSB}, // Application Device ID, from the ZigBee Alliance
SW_REMOTE_CONTROL_DEV_VER, // Application Device Version, from the ZigBee Alliance
NO_OTHER_DESCRIPTOR_AVAILABLE, // Application Flags
0x00, // Application Input Cluster Count
{ NO_CLUSTER }, // Application Input Cluster List
0x01, // Application Output Cluster Count
{ OnOffSRC_CLUSTER } // Application Output Cluster List
}
};
//******************************************************************************
// Complex Descriptor
//
// This structure is optional It contains more information about the device.
//******************************************************************************
//******************************************************************************
// User Descriptor
//
// This structure is option. It can be one character string up to 16 characters
// long.
//******************************************************************************
//******************************************************************************
// Network Mode and Parameters
//******************************************************************************
ROM _Config_NWK_Mode_and_Params Config_NWK_Mode_and_Params =
{
PROFILE_nwkcProtocolVersion, // BYTE ProtocolVersion;
MY_STACK_PROFILE_ID, // BYTE StackProfile;
15, // BYTE BeaconOrder; (non-slotted)
15, // BYTE SuperframeOrder; (non-slotted)
FALSE, // BYTE BatteryLifeExtension;
PROFILE_nwkSecurityLevel, // BYTE SecuritySetting;
{0xFFFF} // WORD Channels (scan all channels)
};
复制代码
所有资料51hei提供下载:
ZigBee开源协议栈MpZBee.rar
(4.07 MB, 下载次数: 44)
2018-8-27 18:29 上传
点击文件名下载附件
下载积分: 黑币 -5
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1