summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macScan.h
blob: e5ae53b96b0576f482b7e6e9520dc311a7974582 (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
/**************************************************************************//**
  \file macScan.h
  
  \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 
    scanning primitives.
    
  \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:     
      18/06/07 ALuzhetsky - Created.
******************************************************************************/

#ifndef _MACSCAN_H
#define _MACSCAN_H

/******************************************************************************
                        Includes section
******************************************************************************/
#include <phy.h>
#include <macAddr.h>
#include <macBeacon.h>
#include <macCommon.h>

/******************************************************************************
                        Defines section
******************************************************************************/
//! Set of MAC scanning types. IEEE 802.15.4-2006 Table 67.
typedef enum
{
  MAC_ED_SCAN      = 0x00,
  MAC_ACTIVE_SCAN  = 0x01,
  MAC_PASSIVE_SCAN = 0x02,
  MAC_ORPHAN_SCAN  = 0x03
} MAC_ScanType_t;


/******************************************************************************
                        Types section
******************************************************************************/
/**
 * \brief Scanning results union. Contains results of energy scanning 
 * procedure and passive/active scan procedures.
 */
typedef union
{
  //! Energy scanning procedure results.
  PHY_EnergyLevel_t   (*energy)[];
  //! Active/passive scanning procedure results.
  MAC_PanDescriptor_t (*panDescr)[];
}  MAC_ScanResult_t;

/**
 * \brief MLME-SCAN confirm primitive's parameters structure declaration.
 * IEEE 802.15.4-2006 7.1.11.2 MLME-SCAN.confirm
 */
typedef struct
{
  //! The status of the scan request.
  MAC_Status_t     status;
  //! Indicates the type of scan performed:
  MAC_ScanType_t   type;
  //! The channel page on which the scan was performed TBD
  uint8_t          page;
  //! Indicates which channels given in the request were not scanned.
  uint32_t         unScannedChannels;
  //! The number of elements returned in the appropriate result lists.
  uint8_t          resultSize;
  //! EnergyDetectList and PANDescriptorList union. Non-standard addition.
  MAC_ScanResult_t result;
}  MAC_ScanConf_t;

/**
 * \brief MLME-SCAN request primitive's parameters structure declaration.
 * IEEE 802.15.4-2006 7.1.11.1 MLME-SCAN.request.
 */
typedef struct
{
  //! Service field - for internal needs.
  MAC_Service_t  service;
  //! Indicates the type of scan performed.
  MAC_ScanType_t type;
  //! The 27 bits indicate which channels are to be scanned.
  uint32_t       channels;
  //! A value used to calculate the length of time to spend scanning each channel 
  //! for ED, active, and passive scans. This parameter is ignored for orphan scans.
  uint8_t        duration;
  //! The channel page on which to perform the scan.
  uint8_t        page;
  //! Non-standard addition. Max number of scan results.
  uint8_t        maxResultSize;
  // MLME-SCAN confirm callback function's pointer.
  void (*MAC_ScanConf)(MAC_ScanConf_t *conf);
  // MLME-SCAN confirm parameters structure.
  MAC_ScanConf_t confirm;
}  MAC_ScanReq_t;


/******************************************************************************
                        Prototypes section
******************************************************************************/
/**************************************************************************//**
  \brief MLME-SCAN request primitive's prototype.
  \param reqParams - MLME-SCAN request parameters' structure pointer.
  \return none.
******************************************************************************/
void MAC_ScanReq(MAC_ScanReq_t *reqParams);

#endif /* _MACSCAN_H */

// eof macScan.h