summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/APS/include/apsmeUpdateDevice.h
blob: 748fc80fba324a43db15f6aca28719a25aaea729 (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/**************************************************************************//**
  \file apsmeUpdateDevice.h

  \brief Interface of APS Update Device Service.

  \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:
    2010-11-24 Max Gekk - Created.
   Last change:
    $Id: apsmeUpdateDevice.h 17448 2011-06-09 13:53:59Z ataradov $
 ******************************************************************************/
#if !defined _APSME_UPDATE_DEVICE_H
#define _APSME_UPDATE_DEVICE_H
/**//**
 *
 *  The APS-layer provides services that allow a device (for example, a router)
 * to inform another device (for example, a Trust Center) that a third device
 * has changed its status (for example, joined or left the network). See ZigBee
 * Specification r19, 4.4.4, page 459.
 *
 **/
/******************************************************************************
                               Includes section
 ******************************************************************************/
#include <apsCommon.h>

#if defined _SECURITY_
/******************************************************************************
                                Types section
 ******************************************************************************/
/** Status of creating and sending a update device command frame. */
typedef enum
{
  APS_UPDATE_SUCCESS_STATUS           = 0x00,
  APS_UPDATE_NO_SHORT_ADDRESS_STATUS  = 0x01,
  APS_UPDATE_SECURITY_FAIL_STATUS     = 0x02,
  APS_UPDATE_NOT_SENT_STATUS          = 0x03,
  /* These names are deprecated and will be removed. */
  APS_UDR_SUCCESS_STATUS           = APS_UPDATE_SUCCESS_STATUS,
  APS_UDR_NO_SHORT_ADDRESS_STATUS  = APS_UPDATE_NO_SHORT_ADDRESS_STATUS,
  APS_UDR_SECURITY_FAIL_STATUS     = APS_UPDATE_SECURITY_FAIL_STATUS,
  APS_UDR_NOT_SENT_STATUS          = APS_UPDATE_NOT_SENT_STATUS
} APS_UpdateStatus_t;

/** This type is deprecated and will be removed. */
typedef APS_UpdateStatus_t APS_UdrStatus_t;

/**//**
 * \struct APS_UpdateDeviceConf_t apsmeUpdateDevice.h "aps.h"
 *
 * \brief Type of confirmation parameters of APSME-UPDATE-DEVICE.confirm.
 **/
typedef struct
{
  APS_UpdateStatus_t status;
} APS_UpdateDeviceConf_t;

/** Type is used to indicate the updated status of the device
 * given by the DeviceAddress parameter. See ZigBee Spec. r19, Table 4.20. */
typedef enum
{
  APS_UPDATE_DEVICE_STATUS_STANDARD_SECURED_REJOIN        = 0x00,
  APS_UPDATE_DEVICE_STATUS_STANDARD_UNSECURED_JOIN        = 0x01,
  APS_UPDATE_DEVICE_STATUS_LEFT                           = 0x02,
  APS_UPDATE_DEVICE_STATUS_STANDARD_UNSECURED_REJOIN      = 0x03,
  APS_UPDATE_DEVICE_STATUS_HIGH_SECURITY_SECURED_REJOIN   = 0x04,
  APS_UPDATE_DEVICE_STATUS_HIGH_SECURITY_UNSECURED_JOIN   = 0x05,
  APS_UPDATE_DEVICE_STATUS_RESERVED                       = 0x06,
  APS_UPDATE_DEVICE_STATUS_HIGH_SECURITY_UNSECURED_REJOIN = 0x07
} APS_UpdateDeviceStatus_t;

/**//**
 * \struct APS_UpdateDeviceReq_t apsmeUpdateDevice.h "aps.h"
 *
 * \brief Parameters of APSME-UPDATE-DEVICE.request primitive.
 *  See ZigBee Specification r19, 4.4.4.1, page 459.
 **/
typedef struct
{
  /** \cond SERVICE_FIELDS **/
  struct
  {
    /** Request to send APS Update Device command. */
    ApsCommandReq_t commandReq;
  } service;
  /** \endcond **/

  /** \ref Endian "[LE]" The extended 64-bit address of the device that shall
   * be sent the update information. */
  ExtAddr_t destAddress;
  /** \ref Endian "[LE]"
   * The extended 64-bit address of the device whose status is being updated. */
  ExtAddr_t deviceAddress;
  /** This parameter Indicates the updated status of the device given
   * by the deviceAddress parameter. */
  APS_UpdateDeviceStatus_t status;
  /** \ref Endian "[LE]"
   * The 16-bit network address of the device whose status is being updated. */
  ShortAddr_t deviceShortAddress;
  /** Confirm primitive as a parameter of the callback function. */
  APS_UpdateDeviceConf_t confirm;
  /** Callback function pointer as a handler of corresponding
   * confirm primitive. */
  void (*APS_UpdateDeviceConf)(APS_UpdateDeviceConf_t *conf);
} APS_UpdateDeviceReq_t;

/**//**
 * \struct APS_UpdateDeviceInd_t apsmeUpdateDevice.h "aps.h"
 *
 * \brief Parameters of APSME-UPDATE-DEVICE.indication primitive.
 *  See ZigBee Specification r19, 4.4.4.2, page 461.
 **/
typedef struct
{
  /** \ref Endian "[LE]" The extended 64-bit address of the device originating
   * the update-device command. */
  ExtAddr_t srcAddress;
  /** \ref Endian "[LE]"
   * The extended 64-bit address of the device whose status is being updated. */
  ExtAddr_t deviceAddress;
  /** This parameter Indicates the updated status of the device given
   * by the deviceAddress parameter. */
  APS_UpdateDeviceStatus_t status;
  /** \ref Endian "[LE]"
   * The 16-bit network address of the device whose status is being updated. */
  ShortAddr_t deviceShortAddress;
} APS_UpdateDeviceInd_t;

/******************************************************************************
                              Prototypes section
 ******************************************************************************/
/**************************************************************************//**
  \brief Request to inform a device that another device has new status.

    The ZDO (for example, on a router or ZigBee coordinator) shall initiate
   the APSME-UPDATE-DEVICE.request primitive when it wants to send updated
   device information to another device (for example, the Trust Center).
   See ZigBee Specification r15, 4.4.1, page 459.

  \param[in] req - pointer to APSME-UPDATE-DEVICE.request's parameters.

  \return None.
 ******************************************************************************/
void APS_UpdateDeviceReq(APS_UpdateDeviceReq_t *req);

/**************************************************************************//**
  \brief Inform the upper-layer that it received an update-device command frame.

  \param[in] ind - pointer to APSME-UPDATE-DEVICE.indication's parameters.

  \return None.
 ******************************************************************************/
void APS_UpdateDeviceInd(APS_UpdateDeviceInd_t *ind);

#endif /* _SECURITY_ */
#endif /* _APSME_UPDATE_DEVICE_H */
/** eof apsmeUpdateDevice.h */