summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/ZCL/include/zclBACnetProtocolTunnelCluster.h
blob: da679d3ed21cccdd184d453ea6818ee8eb985958 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/***************************************************************************//**
  \file zclBACnetProtocolTunnelCluster.h

  \brief
    The header file describes the ZCL BACnet Protocol Tunnel Cluster and its interface

    The file describes the types and interface of the ZCL BACnet Protocol Tunnel Cluster

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
    History:
    20.10.09 D. Kasyanov - Created.
*******************************************************************************/

#ifndef _ZCLBACNETPROTOCOLTUNNELCLUSTER_H
#define _ZCLBACNETPROTOCOLTUNNELCLUSTER_H

/*!
Attributes and commands for determining basic information about a device,
setting user device information such as location, enabling a device and resetting it
to factory defaults.
*/
/*******************************************************************************
                   Includes section
*******************************************************************************/
#include <zcl.h>
#include <clusters.h>
/*******************************************************************************
                   Define(s) section
*******************************************************************************/
/***************************************************************************//**
  \brief ZCL BACnet Protocol Tunnel Cluster server side attributes amount
*******************************************************************************/
#define ZCL_BACNET_PRTOCOL_TUNNEL_CLUSTER_SERVER_ATTRIBUTES_AMOUNT        0
/***************************************************************************//**
  \brief ZCL BACnet Protocol Tunnel client side attributes amount
*******************************************************************************/
#define ZCL_BACNET_PRTOCOL_TUNNEL_CLUSTER_CLIENT_ATTRIBUTES_AMOUNT        0
//There are no any attributes at the client side
/***************************************************************************//**
  \brief ZCL BACnet Protocol Tunnel Cluster derver side commands amount
*******************************************************************************/
#define ZCL_BACNET_PROTOCOL_TUNNEL_COMMANDS_AMOUNT          1
/**
 * \brief Generic tunnel client side commands identifiers.
*/
#define ZCL_BACNET_PROTOCOL_TRANSFER_NPDU_COMMAND_ID 0x00

#define ZCL_DEFINE_BACNET_PROTOCOL_CLUSTER_TUNNEL_CLUSTER_COMMANDS(transferNPDUCommandInd) \
    DEFINE_COMMAND(transferNPDUCommand, ZCL_BACNET_PROTOCOL_TRANSFER_NPDU_COMMAND_ID, COMMAND_OPTIONS(CLIENT_TO_SERVER, ZCL_THERE_IS_NO_RELEVANT_RESPONSE, ZCL_COMMAND_ACK), transferNPDUCommandInd)

#define BACNET_PROTOCOL_TUNNEL_ZCL_CLIENT_CLUSTER_TYPE(clattributes, clcommands) \
{   \
  .id = BACNET_PROTOCOL_TUNNEL_CLUSTER_ID, \
  .options = {.type = ZCL_CLIENT_CLUSTER_TYPE, .security = ZCL_APPLICATION_LINK_KEY_CLUSTER_SECURITY}, \
  .attributesAmount = ZCL_BACNET_PRTOCOL_TUNNEL_CLUSTER_CLIENT_ATTRIBUTES_AMOUNT, \
  .attributes = (uint8_t *)clattributes, \
  .commandsAmount = ZCL_BACNET_PROTOCOL_TUNNEL_COMMANDS_AMOUNT, \
  .commands = (uint8_t *)clcommands \
}

#define BACNET_PROTOCOL_TUNNEL_ZCL_SERVER_CLUSTER_TYPE(clattributes, clcommands) \
{ \
  .id = BACNET_PROTOCOL_TUNNEL_CLUSTER_ID, \
  .options = {.type = ZCL_SERVER_CLUSTER_TYPE, .security = ZCL_APPLICATION_LINK_KEY_CLUSTER_SECURITY}, \
  .attributesAmount = ZCL_BACNET_PRTOCOL_TUNNEL_CLUSTER_SERVER_ATTRIBUTES_AMOUNT, \
  .attributes = (uint8_t *)clattributes, \
  .commandsAmount = ZCL_BACNET_PROTOCOL_TUNNEL_COMMANDS_AMOUNT, \
  .commands = (uint8_t *)clcommands \
}

#define DEFINE_BACNET_PROTOCOL_TUNNEL_CLUSTER(cltype, clattributes, clcommands) BACNET_PROTOCOL_TUNNEL_CLUSTER##cltype(clattributes, clcommands)
/*******************************************************************************
                    Types section
*******************************************************************************/
BEGIN_PACK
/**
 * \brief Transfer NPDU Command Payload format.
*/
typedef struct PACK
{
    uint8_t npdu[1]; //!<npdu octet string
} ZCL_TransferNPDU_t;
END_PACK
/**
 * \brief BACnet protocol tunnel cluster commands.
*/
typedef struct
{
    struct
    {
        ZCL_CommandId_t id;
        ZclCommandOptions_t options;
        ZCL_Status_t (*transferNPDUCommand)(ZCL_Addressing_t *addressing, uint8_t payloadLength, ZCL_TransferNPDU_t *payload);
    } transferNPDUCommand;
} ZCL_BACnetProtocolTunnelCommands_t;

#endif /* _ZCLBACNETPROTOCOLTUNNELCLUSTER_H */