Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dt_client_app.h « App « STM32_WPAN « BLE_DataThroughput « BLE « Applications « P-NUCLEO-WB55.Nucleo « Projects - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3ee8fe15088fbd446e39c38715ccda5e6ab02717 (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201

/**
 ******************************************************************************
 * @file    dt_client_app.h
 * @author  MCD Application Team
 * @brief   Header for dt_client_app.c module
 ******************************************************************************
 * @attention
 *
 * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
 * All rights reserved.</center></h2>
 *
 * This software component is licensed by ST under Ultimate Liberty license
 * SLA0044, the "License"; You may not use this file except in compliance with
 * the License. You may obtain a copy of the License at:
 *                             www.st.com/SLA0044
 *
 ******************************************************************************
 */


/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DTC_APPLICATION_H
#define __DTC_APPLICATION_H

#ifdef __cplusplus
extern "C" {
#endif

  typedef enum
{
  DTC_UNINITIALIZED = 0,
  DTC_INITIALIZED = 1,
  DTC_IDLE = 2,
  DTC_DISCOVER_SERVICES = 3,
  DTC_DISCOVER_CHARACS = 4,
  DTC_DISCOVER_TX_CHAR_DESC = 5,
  DTC_DISCOVER_RX_CHAR_DESC = 6,
  DTC_ENABLE_NOTIFICATION_TX_DESC = 7,
  DTC_DISABLE_NOTIFICATION_TX_DESC = 8,
  DTC_CONNECTED = 9,
  DTC_CONNECTED_ADVERTISING = 10,
  DTC_DISCOVER_NOTIFICATION_CHAR_DESC = 11,
} DTC_ProfileState;

  typedef struct
{
  /**
   * state of the Data Transfer
   * state machine
   */
  DTC_ProfileState state;

  /**
   * connection handle
   */
  uint16_t connHandle;

  /**
   * bitmask of the attributes
   * discovered
   */
  uint8_t featuresFound;

  /**
   * flag which maintains
   * the connection status
   */
  uint8_t disconnected;

  /**
   * handle of the Data Transfer service
   */
  uint16_t DataTransferServiceHandle;

  /**
   * end handle of the Data Transfer service
   */
  uint16_t DataTransferServiceEndHandle;

  /**
   * handle of the Tx characteristic
   *
   */
  uint16_t DataTransferTxCharHdle;

  /**
   * handle of the client configuration
   * descriptor of Tx characteristic
   */
  uint16_t DataTransferTxDescHandle;

  /**
   * handle of the client configuration
   * descriptor of new alert characteristic
   */
  uint16_t DataTransferRxCharHdle; /**< Characteristic handle */
  uint16_t DataTransferRxDescHandle; /**< Characteristic handle */
  uint16_t DTNotificationCharHdle;
  uint16_t ButtonDescHandle;
} DataTransferContext_t;

typedef enum
{  
  DT_IDLE                         = 0,
  DT_DISCOVER_SERVICES	           = 1,
  DT_DISCOVER_CHARACS		   = 2,
  DT_DISCOVER_LED_CHAR_DESC	   = 3,
  DT_DISCOVER_BUTTON_CHAR_DESC	   = 4,
  DT_ENABLE_NOTIFICATION_BUTTON_DESC  = 5,
  DT_DISABLE_NOTIFICATION_TX_DESC = 6,
  DT_ADV                          =7,
  DT_SCAN                         =8,
  DT_CONNECTING                   =9,
  DT_CONNECTED		           = 10,		
} DT_Gap_Gatt_State;  
typedef struct{
  /**
   * state of the Data Transfer
   * state machine
   */ 
  DT_Gap_Gatt_State state;

  /**
   * connection handle 
   */ 
  uint16_t connHandle;

   /**
   * handle of the P2P service
   */ 
  uint16_t P2PServiceHandle;

  /**
   * end handle of the P2P service
   */ 
  uint16_t P2PServiceEndHandle;

  /**
   * handle of the Tx characteristic - Write To Server
   * 
   */ 
  uint16_t P2PWriteToServerCharHdle;

  /**
   * handle of the client configuration
   * descriptor of Tx characteristic
   */ 
  uint16_t P2PWriteToServerDescHandle;

   /**
   * handle of the Rx characteristic - Notification From Server
   * 
   */ 
  uint16_t P2PNotificationCharHdle;

  /**
   * handle of the client configuration
   * descriptor of Rx characteristic
   */ 
  uint16_t P2PNotificationDescHandle;
  uint8_t  NotificationStatus;
  uint8_t WriteStatus;

}DT_ClientContext_t;

typedef enum
{
  DT_CONNECTION_ESTABLISHED,
  DT_PASSKEY_REQ_EVT,
  DT_PAIRING_COMPLETE,
  DT_READ_PHY,
  DT_SET_PHY,
  DT_MTU_EXCHANGED,
  DT_DISCONN_COMPLETE,
} Connection_Evt_t;

typedef struct
{
Connection_Evt_t Evt_Opcode;
uint16_t connection_handle;

} Connection_Context_t;
  /* Includes ------------------------------------------------------------------*/
  /* Exported types ------------------------------------------------------------*/
  /* Exported constants --------------------------------------------------------*/
  /* External variables --------------------------------------------------------*/
  /* Exported macros -----------------------------------------------------------*/
  /* Exported functions ------------------------------------------------------- */
  
void DT_Client_App_Init(void);
void enable_notification(void);
void DT_App_Notification( Connection_Context_t *pNotification );

#ifdef __cplusplus
}
#endif

#endif /*__DTC_APPLICATION_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/