⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zigbeeif.cpp

📁 基于ZIGBEE协议通讯的开关程序
💻 CPP
📖 第 1 页 / 共 3 页
字号:
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_SET_request
( 
    unsigned char Attribute, 
    unsigned char AttributeLength, 
    unsigned char *AttributeValue 
)
{
  unsigned char data[128];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_SET_REQUEST;
  data[i++] = Attribute;
  data[i++] = AttributeLength;
  for( ; AttributeLength>0 ; AttributeLength-- ) data[i++] = *AttributeValue++;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_GET_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_GET_request
( 
    unsigned char Attribute 
)
{
  unsigned char data[3];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_GET_REQUEST;
  data[i++] = Attribute;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_START_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_START_request
(
    void
)
{
  unsigned char data[2];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_START_REQUEST;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_IEEE_ADDR_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_IEEE_ADDR_request
( 
    unsigned short Network_Address, 
    unsigned char Request_type, 
    unsigned char Start_Index, 
    unsigned char TransactionType 
)
{
  unsigned char data[7];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_IEEE_ADDR_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  data[i++] = Request_type;
  data[i++] = Start_Index;
  data[i++] = TransactionType;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_NODE_DESC_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_NODE_DESC_request
( 
    unsigned short Network_Address 
)
{
  unsigned char data[4];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_NODE_DESC_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_POWER_DESC_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_POWER_DESC_request
( 
    unsigned short Network_Address 
)
{
  unsigned char data[4];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_POWER_DESC_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_SIMPLE_DESC_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_SIMPLE_DESC_request
( 
    unsigned short Network_Address, 
    unsigned char Endpoint 
)
{
  unsigned char data[5];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_SIMPLE_DESC_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  data[i++] = Endpoint;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_ACTIVE_EP_DESC_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_ACTIVE_EP_DESC_request
( 
    unsigned short Network_Address 
)
{
  unsigned char data[4];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_ACTIVE_EP_DESC_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_MATCH_DESC_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_MATCH_DESC_request
( 
    unsigned short Network_Address, 
    unsigned short ProfileId, 
    unsigned char nic, 
    unsigned char* iclist, 
    unsigned char noc, 
    unsigned char* oclist 
)
{
  unsigned char data[128];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_MATCH_DESC_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  data[i++] = ProfileId & 0xFF;
  data[i++] = (ProfileId>>8) & 0xFF;
  data[i++] = nic;
  for( ; nic>0 ; nic-- ) data[i++] = *iclist++;
  data[i++] = noc;
  for( ; noc>0 ; noc-- ) data[i++] = *oclist++;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_COMPLEX_DESC_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_COMPLEX_DESC_request
( 
    unsigned short Network_Address 
)
{
  unsigned char data[4];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_COMPLEX_DESC_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_USER_DESC_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_USER_DESC_request
( 
    unsigned short Network_Address 
)
{
  unsigned char data[4];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_USER_DESC_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_DISCOVERY_REGISTER_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_DISCOVERY_REGISTER_request
( 
    unsigned short Network_Address, 
    unsigned char* IEEE_Address 
)
{
  unsigned char data[12];
  unsigned char i = 1;
  unsigned char j;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_DISCOVERY_REGISTER_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  for ( j=0 ; j<8 ; j++ ) data[i++] = *IEEE_Address++;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_END_DEVICE_ANNCE_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_END_DEVICE_ANNCE_request
( 
    unsigned short Network_Address, 
    unsigned char* IEEE_Address 
)
{
  unsigned char data[12];
  unsigned char i = 1;
  unsigned char j;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_END_DEVICE_ANNCE_REQUEST;
  data[i++] = Network_Address & 0xFF;
  data[i++] = (Network_Address>>8) & 0xFF;
  for ( j=0 ; j<8 ; j++ ) data[i++] = *IEEE_Address++;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_USER_DESC_SET_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_USER_DESC_SET_request
( 
    unsigned short NWKAddr, 
    unsigned char length, 
    unsigned char* text 
)
{
  unsigned char data[128];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

  // Build the message buffer
  data[i++] = ZDO_USER_DESC_SET_REQUEST;
  data[i++] = NWKAddr & 0xFF;
  data[i++] = (NWKAddr>>8) & 0xFF;
  data[i++] = length;
  for ( ; length>0 ; length-- ) data[i++] = *text++;
  data[0] = i - 1;
  (ZBDLLSend)( i, &data[0] ); // Send the message
}

/*
** ============================================================================
**
** FUNCTION NAME:
**  ZDO_PERMIT_JOINING_request
**
** AUTHOR
**  Ian Marsden
**
** ============================================================================
*/
void CZigBeeIf::ZDO_PERMIT_JOINING_request
( 
    unsigned short DstShort, 
    unsigned char Significance, 
    unsigned char Duration 
)
{
  unsigned char data[6];
  unsigned char i = 1;

  if (hinstLib == NULL ) return; // Not connected so cannot send this message

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -