Mistake on this page?
Report an issue in GitHub or email us
dm_dev.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief DM local device management module.
6  *
7  * Copyright (c) 2009-2018 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 #ifndef DM_DEV_H
25 #define DM_DEV_H
26 
27 #include "dm_main.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /**************************************************************************************************
34  Macros
35 **************************************************************************************************/
36 
37 /* DM device event handler messages */
38 enum
39 {
40  DM_DEV_MSG_API_RESET = DM_MSG_START(DM_ID_DEV)
41 };
42 
43 /* DM device privacy event handler messages */
44 enum
45 {
46  DM_DEV_PRIV_MSG_API_START = DM_MSG_START(DM_ID_DEV_PRIV),
47  DM_DEV_PRIV_MSG_API_STOP,
48  DM_DEV_PRIV_MSG_TIMEOUT,
49  DM_DEV_PRIV_MSG_AES_CMPL,
50  DM_DEV_PRIV_MSG_RPA_START,
51  DM_DEV_PRIV_MSG_RPA_STOP,
52  DM_DEV_PRIV_MSG_CTRL,
53 };
54 
55 /* DM device privacy control messages */
56 enum
57 {
58  DM_DEV_PRIV_MSG_CONN_INIT_START, /* connection initiation started */
59  DM_DEV_PRIV_MSG_CONN_INIT_STOP, /* connection initiation stopped */
60  DM_DEV_PRIV_MSG_ADV_SET_ADD, /* advertising set created */
61  DM_DEV_PRIV_MSG_ADV_SET_REMOVE, /* advertising set removed */
62  DM_DEV_PRIV_MSG_ADV_SETS_CLEAR /* advertising sets cleared */
63 };
64 
65 /*! DM connection CTE event handler messages */
66 enum
67 {
68  /* messages from API */
69  DM_CONN_CTE_MSG_API_RX_SAMPLE_START = DM_MSG_START(DM_ID_CONN_CTE), /*!< Start sampling received CTE, and configure CTE Rx parameters to be used */
70  DM_CONN_CTE_MSG_API_RX_SAMPLE_STOP, /*!< Stop sampling received CTE */
71  DM_CONN_CTE_MSG_API_TX_CFG, /*!< Configure CTE Tx parameters */
72  DM_CONN_CTE_MSG_API_REQ_START, /*!< Start initiating CTE request */
73  DM_CONN_CTE_MSG_API_REQ_STOP, /*!< Stop initiating CTE request */
74  DM_CONN_CTE_MSG_API_RSP_START, /*!< Start responding to CTE request */
75  DM_CONN_CTE_MSG_API_RSP_STOP, /*!< Stop responding to CTE request */
76  DM_CONN_CTE_MSG_STATE /*!< DM connection state change event */
77 };
78 
79 /**************************************************************************************************
80  Data Types
81 **************************************************************************************************/
82 
83 /* Data structure for DM_DEV_PRIV_MSG_API_START */
84 typedef struct
85 {
86  wsfMsgHdr_t hdr;
87  uint16_t changeInterval;
89 
90 /* Data structure for DM_DEV_PRIV_MSG_CTRL */
91 typedef struct
92 {
93  wsfMsgHdr_t hdr;
94  uint8_t advHandle;
95  bool_t connectable;
97 
98 /* Union of all dev priv messages */
99 typedef union
100 {
101  wsfMsgHdr_t hdr;
102  dmDevPrivApiStart_t apiPrivStart;
103  dmDevPrivCtrl_t privCtrl;
104  secAes_t aes;
106 
107 /* Action function */
108 typedef void (*dmDevAct_t)(wsfMsgHdr_t *pMsg);
109 typedef void (*dmDevPrivAct_t)(dmDevPrivMsg_t *pMsg);
110 
111 /* DM device set advertising set random address callback type */
112 typedef void (*dmDevAdvSetRandAddrCback_t)(uint8_t advHandle, const uint8_t *pAddr);
113 
114 /* Main control block of the DM Dev subsystem */
115 typedef struct
116 {
117  /* Set advertising set random address callback */
118  dmDevAdvSetRandAddrCback_t advSetRandAddrCback;
119 } dmDevCb_t;
120 
121 /**************************************************************************************************
122  Global variables
123 **************************************************************************************************/
124 
125 /* Component function interface */
126 extern const dmFcnIf_t dmDevFcnIf;
127 
128 /* Control block */
129 extern dmDevCb_t dmDevCb;
130 
131 /**************************************************************************************************
132  Function declarations
133 **************************************************************************************************/
134 
135 /* dev component inteface */
136 void dmDevActReset(wsfMsgHdr_t *pMsg);
137 
138 /* dev action functions */
139 void dmDevMsgHandler(wsfMsgHdr_t *pMsg);
140 void dmDevHciHandler(hciEvt_t *pEvent);
141 
142 /* dev priv component inteface */
143 void dmDevPrivHciHandler(hciEvt_t *pEvent);
144 void dmDevPrivMsgHandler(wsfMsgHdr_t *pMsg);
145 void dmDevPrivReset(void);
146 
147 /* dev priv action functions */
148 void dmDevPrivActStart(dmDevPrivMsg_t *pMsg);
149 void dmDevPrivActStop(dmDevPrivMsg_t *pMsg);
150 void dmDevPrivActTimeout(dmDevPrivMsg_t *pMsg);
151 void dmDevPrivActAesCmpl(dmDevPrivMsg_t *pMsg);
152 void dmDevPrivActRpaStart(dmDevPrivMsg_t *pMsg);
153 void dmDevPrivActRpaStop(dmDevPrivMsg_t *pMsg);
154 void dmDevPrivActCtrl(dmDevPrivMsg_t *pMsg);
155 
156 /* utility function */
157 void dmDevPassEvtToDevPriv(uint8_t event, uint8_t param, uint8_t advHandle, bool_t connectable);
158 void dmDevPassEvtToConnCte(uint8_t state, dmConnId_t connId);
159 
160 #ifdef __cplusplus
161 };
162 #endif
163 
164 #endif /* DM_DEV_H */
uint8_t dmConnId_t
Connection identifier.
Definition: dm_api.h:588
AES Security callback parameters structure.
Definition: sec_api.h:70
Union of all event types.
Definition: hci_api.h:931
DM main module.
Common message structure passed to event handler.
Definition: wsf_os.h:106
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.