summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionQueue.h
blob: 584924a004918f995660bd8cee98af78c6c967c7 (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
/******************************************************************************
  \file machwiTransactionQueue.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:
      25/06/07 A. Mandychev - Created.
******************************************************************************/

#ifndef _MACHWITRANSACTIONQUEUE_H
#define _MACHWITRANSACTIONQUEUE_H
#ifdef _FFD_

/******************************************************************************
                    Includes section
******************************************************************************/
#include <types.h>
#include <macData.h>
#include <macFrame.h>
#include <macAssociate.h>
#include <macDisassociate.h>

/******************************************************************************
                    Define(s) section
******************************************************************************/

/******************************************************************************
                    Types section
******************************************************************************/
// Transaction event.
typedef enum
{
  MAC_TRANSACTION_EXPIRED_EVENT = MAC_TRANSACTION_EXPIRED_STATUS,
  MAC_TRANSACTION_ACTIVATED_EVENT
} MachwiTransactionEvent_t;

// Transaction.
typedef union
{
  MAC_DataReq_t         dataReq;
  MAC_AssociateResp_t   associateResp;
  MAC_DisassociateReq_t disassociateReq;
} MachwiTransaction_t;

/******************************************************************************
                    Constants section
******************************************************************************/

/******************************************************************************
                    External variables
******************************************************************************/

/******************************************************************************
                    Prototypes section
******************************************************************************/
/******************************************************************************
  TBD.
******************************************************************************/
void machwiPutTransactionToQueue(MachwiTransaction_t *transaction);

/******************************************************************************
  TBD.
******************************************************************************/
result_t machwiPurgeTransactionFromQueue(uint8_t msduHandle);

/**************************************************************************//**
 \brief Compares MAC Data Request command's parameters with transactions in the
  transaction queue. If matched - transaction is marked as "activated".

 \param frameDescr - Data Request MAC command descriptor.
 \return true if transaction to be transmitted is found, false otherwise
******************************************************************************/
bool machwiTestAndKickQueueTransactions(MAC_FrameDescr_t *frameDescr);

/**************************************************************************//**
 \brief Finds trunsactions which were already activated.

  \return Activated transaction pointer if found, NULL otherwise.
******************************************************************************/
MachwiTransaction_t *machwiGetActivatedTransactionFromQueue(void);

/******************************************************************************
  TBD.
******************************************************************************/
uint8_t* machwiFillPendingAddrSpecAndList(uint8_t *beaconPayload);

/******************************************************************************
  Resets transaction queue.
  Parameters:
    none.
  Returns:
    none.
******************************************************************************/
void machwiResetTransactionQueue(void);

/******************************************************************************
 Deletes transaction from queue.
 Parameters:
   transaction - pointer to transaction wich should be deleted.
 Returns:
  none.
******************************************************************************/
void machwiDeleteTransactionFromQueue(MachwiTransaction_t *transaction);

/******************************************************************************
 Checks if MAC transaction queue is empty
 Parameters:
   none
 Returns:
  true, if MAC transaction queue is empty, false otherwise.
******************************************************************************/
bool machwiTransactionQueueEmpty(void);

#endif //_FFD_
#endif /* _MACHWITRANSACTIONQUEUE_H */

// eof machwiTransactionQueue.h