summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/ZDO/include/private/zdoNwkManager.h
blob: 6c9d4ef86279ae216969ff5cb0ef2c57a8ea5029 (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
/************************************************************************//**
  \file zdoNwkManager.h

  \brief The header file describes the constants, types and internal interface
  of ZDO network manager

  \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:
    07/06/07 I. Kalganova - Modified
******************************************************************************/

#ifndef _ZDONWKMANAGER_H
#define _ZDONWKMANAGER_H

/******************************************************************************
                    Includes section
******************************************************************************/
#include <macAddr.h>
#include <nwk.h>
#include <zdo.h>
#include <zdoTaskManager.h>
#include <aps.h>

/******************************************************************************
                    Types section
******************************************************************************/
/********************************************************************************//**
\brief States of ZDO NWKUpdateState functionality
***********************************************************************************/
typedef enum
{ 
  ZDO_IDLE_NWK_UPDATE_STATE, 
  ZDO_INTERNAL_NWK_UPDATE_STATE,
  ZDO_EXTERNAL_NWK_UPDATE_STATE,
  ZDO_EXTERNAL_ERROR_NWK_UPDATE_STATE
} ZdoNWKUpdateState_t;

typedef struct _ZdoNwkManager_t
{
  uint8_t               statusIndCounter: 4;
  bool                  resendAnnce: 1;
  bool                  zdpDataReqBusy: 1;
  bool                  updateDeviceReqBusy: 1;
  bool                  updateDeviceReqPending: 1;
  ZDO_ZdpReq_t          zdpDataReq;
  void                  (*deviceAnnceConf)(ZDO_ZdpResp_t *zdpResp);
  void                  (*resendAnnceConf)(ZDO_ZdpResp_t *zdpResp);
  MAC_SetReq_t          macSetReq;
  ZDO_SetTxPowerReq_t   *txPowerReq;
#ifdef _SECURITY_
  APS_UpdateDeviceReq_t apsUpdateDeviceReq;
#endif //_SECURITY_
  uint16_t              totalTransactions;
  uint16_t              failTransactions;
  bool                  badLink;
  HAL_AppTimer_t        updateNwkWaitTimer;
  ZdoNWKUpdateState_t   updateState;
  uint8_t               transSeqNum; 
} ZdoNwkManager_t;

/******************************************************************************
                    Prototypes section
******************************************************************************/
void zdoNwkManagerReset(void);
void zdoSendDeviceAnnce(void (*deviceAnnceConf)(ZDO_ZdpResp_t *zdpResp));

/******************************************************************************
  Check if short address is available for given extended address and send
  appropriate request if not.
  Parameters:
    addr - extended address to check
  Return:
    true - short address already available
    false - short address currently is not available, request was sent
******************************************************************************/
bool zdoDiscoverNwkAddress(const ExtAddr_t *const addr);

#endif // _ZDONWKMANAGER_H

// eof zdoNwkManager.h