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

  \brief The header file describes the constants, types and internal interface
  of ZDP parser component. This component sends/receives ZDP commands.

  \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:
    28/11/07 A. Zemlyanov - Created.
******************************************************************************/

#ifndef _ZDP_FRAME_PROCESSOR_H
#define _ZDP_FRAME_PROCESSOR_H

/******************************************************************************
                   Includes section
******************************************************************************/
#include <types.h>
#include <queue.h>
#include <zdo.h>
#include <zdoDbg.h>
#include <aps.h>

/******************************************************************************
                   Definitions section
******************************************************************************/

/******************************************************************************
                   Types section
******************************************************************************/
typedef void (*ZdoAPSDataConf_t)(APS_DataConf_t *conf);

typedef enum
{
  ZDO_ZDP_DATA_REQ_FREE_STATE,
  ZDO_ZDP_DATA_REQ_BUSY_STATE,
  ZDO_ZDP_DATA_REQ_SEND_STATE,
  ZDO_ZDP_DATA_REQ_WAIT_CONF_STATE
} ZDO_ZdpDataReqState_t;

typedef enum
{
  ZDO_ZDP_IND_FREE_STATE,
  ZDO_ZDP_IND_BUSY_STATE
} ZDO_ZdpIndState_t;


typedef struct zdoFrameProc_t_
{
  uint8_t               requestSeqNum;
  ZDO_ZdpReq_t          *zdpRequest;                    // Currently processed zdpRequest

  ZDO_ZdpDataReqState_t apsDataReqState;
  APS_DataReq_t         apsDataReq;                     // Common for all requests to APS

  // Incoming data from APS
  ZDO_ZdpIndState_t     apsDataIndState;
  APS_DataInd_t         apsDataInd;
  uint8_t               apsAsduBuff[APS_MAX_ASDU_SIZE]; // Buffer for inconing APS ASDU
} ZdoFrameProc_t;


/******************************************************************************
                   Prototypes section
******************************************************************************/
/******************************************************************************
 Reset the ZDP Frame Processor into initial state
 Parameters:
   None
 Returns:
   None.
******************************************************************************/
void zdoZdpFrameProcessorReset(void);

/******************************************************************************
 Send ZDP request
 Parameters:
   req - pointer to request object
 Returns:
   None.
******************************************************************************/
void zdoZdpSendRequest(ZDO_ZdpReq_t *req);

/******************************************************************************
  TODO
******************************************************************************/
void zdoSetZdpDataReqState(ZDO_ZdpDataReqState_t state);

/******************************************************************************
  TODO
******************************************************************************/
void zdoSetZdpIndState(ZDO_ZdpIndState_t state);

/******************************************************************************
 Process incoming ZDP frames data from APS layer
 Parameters:
   ind - Pointer to APS_DataInd_t type object
 Returns:
   None.
******************************************************************************/
void APS_ZdoDataInd(APS_DataInd_t *ind);

/******************************************************************************
 To be called when gets frame from APS
 Parameters:
   apsInd - Pointer to APS_DataInd_t type object
 Returns:
   None.
******************************************************************************/
void zdoZdpMessageInd(APS_DataInd_t *dataInd);

void zdoZdpFrameProcessorHandler(void);

#endif /* _ZDP_FRAME_PROCESSOR_H */