summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/NWK/include/nwkRouteInfo.h
blob: 679d393d94017053d2214ff97e0825f182df02ae (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
/**************************************************************************//**
  \file nwkRouteInfo.h

  \brief Public route information.

  \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-05-07 Max Gekk - Created.
   Last change:
    $Id: nwkRouteInfo.h 17448 2011-06-09 13:53:59Z ataradov $
 ******************************************************************************/
#if !defined _NWK_ROUTE_INFO_H
#define _NWK_ROUTE_INFO_H

/******************************************************************************
                               Includes section
 ******************************************************************************/
#include <appFramework.h>

/******************************************************************************
                              Definitions section
 ******************************************************************************/
/* Invalid concentrator descriptor. */
#define NWK_INVALID_CONCENTRATOR (UINT8_MAX)
/* Macro return true if concentrator descriptor is valid. */
#define IS_VALID_CONCENTRATOR(descr) (NWK_INVALID_CONCENTRATOR != (descr))

/******************************************************************************
                                Types section
 ******************************************************************************/
/* Type of concentrator descriptor. */
typedef uint8_t NWK_Concentrator_t;

/* Type of concentrator indication structure. */
typedef struct _NWK_ConcentratorInd_t
{
  /** Service fields - for internal needs. */
  struct
  {
    QueueElement_t qelem; /**< link used for queuing */
  } service;
  /* This function is called when new concentrator is found. */
  void (* NWK_ConcentratorInd)(NWK_Concentrator_t concentrator);
} NWK_ConcentratorInd_t;

/******************************************************************************
                              Prototypes section
 ******************************************************************************/
/**************************************************************************//**
  \brief This function return the 16-bit network address of the next hop on
     the way to the destination.

  \return The network address of the next hop.
 ******************************************************************************/
ShortAddr_t NWK_GetNextHop(ShortAddr_t dstAddr);

/**************************************************************************//**
  \brief Get descriptor of next concentrator.

  Example:
    NWK_Concentrator_t c = NWK_INVALID_CONCENTRATOR;

    while (IS_VALID_CONCENTRATOR(c = NWK_NextConcentrator(c)))
    {
      cAddr = NWK_ShortAddrOfConcentrator(c);
      if (MASTER_CONCENTRATOR_ADDR == cAddr)
        ...
      ...
    }

  \param[in] prevConcentrator - descriptor of previous concentrator or
    NWK_INVALID_CONCENTRATOR if it's initial call.

  \return if next concentrator is found then return valid descriptor otherwise
    return NWK_INVALID_CONCENTRATOR.
 ******************************************************************************/
NWK_Concentrator_t NWK_NextConcentrator(const NWK_Concentrator_t prevConcentrator);

/**************************************************************************//**
  \brief Get short address of given concentrator.

    Note: Call this function and NWK_NextConcentrator() in same task.

  \param[in] concentrator - descriptor of concentrator (see NWK_NextConcentrator).
  \return Short address of concentrator.
 ******************************************************************************/
ShortAddr_t NWK_ShortAddrOfConcentrator(const NWK_Concentrator_t concentrator);

/**************************************************************************//**
  \brief Get short address of next hop node for given concentrator.

    Note: Call this function and NWK_NextConcentrator() in same task.

  \param[in] concentrator - descriptor of concentrator (see NWK_NextConcentrator).
  \return Short address of next hop.
 ******************************************************************************/
ShortAddr_t NWK_NextHopToConcentrator(const NWK_Concentrator_t concentrator);

/**************************************************************************//**
  \brief Subscribe to indication about new concentrators.

  \param[in] ind - pointer to concentrator indication structure.
  \return None.
 ******************************************************************************/
void NWK_SubscribeToConcentratorInfo(NWK_ConcentratorInd_t *const ind);

/**************************************************************************//**
  \brief Unsubscribe from indication about new concentrators.

  \param[in] ind - pointer to concentrator indication structure.
  \return None.
 ******************************************************************************/
void NWK_UnsubscribeFromConcentratorInfo(NWK_ConcentratorInd_t *const ind);

#endif /* _NWK_ROUTE_INFO_H */
/** eof nwkRouteInfo.h */