summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/NWK/include/private/nwkStatusInd.h
blob: ee464c825169b5faa7f81da539cea83653e26d82 (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
/**************************************************************************//**
  \file nwkStatusInd.h

  \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:
    2007-06-14 V. Panov - Created
    2009-06-16 M. Gekk - Refactoring.
   Last change:
    $Id: nwkStatusInd.h 17448 2011-06-09 13:53:59Z ataradov $
 ******************************************************************************/
#if !defined _NWK_STATUS_IND_H
#define _NWK_STATUS_IND_H

/******************************************************************************
                             Includes section
 ******************************************************************************/
#include <nwkConfig.h>
#include <nlmeNwkStatus.h>
#include <nwkFrame.h>
#include <nwkRx.h>

/******************************************************************************
                          Inline functions section
 ******************************************************************************/
/**************************************************************************//**
  \brief Wrapper for NLME-NWK-STATUS indication primitive.

  \param[in] shortAddr - a network address of the device associated with
     the status information.
  \param[in] status - error code associated with the status indication.
  \return None.
 ******************************************************************************/
INLINE void nwkStatusIndicate(const ShortAddr_t shortAddr,
  const NWK_StatusIndErrorCodes_t status)
{
  NWK_NwkStatusInd_t ind;

  ind.shortAddress = shortAddr;
  ind.status = status;
  NWK_NwkStatusInd(&ind);
}

/******************************************************************************
                             Prototypes section
 ******************************************************************************/
#if defined(_ROUTER_) || defined(_COORDINATOR_)
/**************************************************************************//**
  \brief NWK status command has been received.

  \param[in] payload - pointer to status code field and destination address.
  \param[in] header - NWK header of the network status command.
  \param[in] parse - parsed NWK header.
  \return 'true' if continue processing of command packet otherwise 'false'.
 ******************************************************************************/
NWK_PRIVATE bool nwkStatusFrameInd(const uint8_t *const payload,
  const NwkFrameHeader_t *const header, const NwkParseHeader_t *const parse);

#else /* _ROUTER_ or _COORDINATOR_ */
#define nwkStatusFrameInd NULL
#endif /* _ROUTER_ or _COORDINATOR_ */

#if defined NWK_ROUTING_CAPACITY && defined _NWK_MANY_TO_ONE_ROUTING_
/**************************************************************************//**
  \brief Is it the input many-to-one network status.

  \param[in] inPkt - pointer to the input packet

  \return 'true' if the input packet is network status command with status code
           equal to many-to-one route error otherwise 'false'.
 ******************************************************************************/
NWK_PRIVATE
bool nwkIsManyToOneNetworkStatus(const NwkInputPacket_t *const inPkt);

#else
#define nwkIsManyToOneNetworkStatus(inPkt) false
#endif /* NWK_ROUTING_CAPACITY and _NWK_MANY_TO_ONE_ROUTING_ */
#endif /* _NWK_STATUS_IND_H */
/** eof nwkStatusInd.h */