COMMON IO-BLE v1.0.0
Hardware abstraction layer for Bluetooth
 
Loading...
Searching...
No Matches
bt_hal_gatt_server.h
Go to the documentation of this file.
1/*
2 * FreeRTOS BLE HAL V5.1.0
3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * SPDX-License-Identifier: MIT
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * http://aws.amazon.com/freertos
25 * http://www.FreeRTOS.org
26 */
27
44#ifndef _BT_HAL_GATT_SERVER_H_
45#define _BT_HAL_GATT_SERVER_H_
46
47#include "bt_hal_gatt_types.h"
48
49
54typedef enum
55{
62
67typedef struct
68{
69 uint16_t usHandle;
70 uint8_t * pucValue;
71 uint16_t usOffset;
72 size_t xLen;
75
79typedef union
80{
82 uint16_t usHandle;
84
98typedef void (* BTRegisterServerCallback_t)( BTStatus_t xStatus,
99 uint8_t ucServerIf,
100 BTUuid_t * pxAppUuid );
101
114typedef void (* BTUnregisterServerCallback_t)( BTStatus_t xStatus,
115 uint8_t ucServerIf );
116
131typedef void (* BTConnectionCallback_t)( uint16_t usConnId,
132 uint8_t ucServerIf,
133 bool bConnected,
134 BTBdaddr_t * pxBda );
135
151typedef void (* BTServiceAddedCallback_t)( BTStatus_t xStatus,
152 uint8_t ucServerIf,
153 BTGattSrvcId_t * pxSrvcId,
154 uint16_t usServiceHandle );
155
171 uint8_t ucServerIf,
172 uint16_t usServiceHandle,
173 uint16_t usInclSrvcHandle );
174
192 uint8_t ucServerIf,
193 BTUuid_t * pxUuid,
194 uint16_t usServiceHandle,
195 uint16_t usCharHandle );
196
206typedef void (* BTSetValCallback_t)( BTStatus_t xStatus,
207 uint16_t usAttrHandle );
208
225typedef void (* BTDescriptorAddedCallback_t)( BTStatus_t xStatus,
226 uint8_t ucServerIf,
227 BTUuid_t * pxUuid,
228 uint16_t usServiceHandle,
229 uint16_t usDescrHandle );
230
243typedef void (* BTServiceStartedCallback_t)( BTStatus_t xStatus,
244 uint8_t ucServerIf,
245 uint16_t usServiceHandle );
246
259typedef void (* BTServiceStoppedCallback_t)( BTStatus_t xStatus,
260 uint8_t ucServerIf,
261 uint16_t usServiceHandle );
262
275typedef void (* BTServiceDeletedCallback_t)( BTStatus_t xStatus,
276 uint8_t ucServerIf,
277 uint16_t usServiceHandle );
278
298typedef void (* BTRequestReadCallback_t)( uint16_t usConnId,
299 uint32_t ulTransId,
300 BTBdaddr_t * pxBda,
301 uint16_t usAttrHandle,
302 uint16_t usOffset );
303
331typedef void (* BTRequestWriteCallback_t)( uint16_t usConnId,
332 uint32_t ulTransId,
333 BTBdaddr_t * pxBda,
334 uint16_t usAttrHandle,
335 uint16_t usOffset,
336 size_t xLength,
337 bool bNeedRsp,
338 bool bIsPrep,
339 uint8_t * pucValue );
340
357typedef void (* BTRequestExecWriteCallback_t)( uint16_t usConnId,
358 uint32_t ulTransId,
359 BTBdaddr_t * pxBda,
360 bool bExecWrite );
361
373 uint16_t usHandle );
374
385typedef void (* BTIndicationSentCallback_t)( uint16_t usConnId,
386 BTStatus_t xStatus );
387
398typedef void (* BTMtuChangedCallback_t)( uint16_t usConnId,
399 uint16_t usMtu );
400
410typedef void (* BTWhiteListChangedCallback_t)( const BTBdaddr_t * pxBdAddr,
411 bool bIsAdded );
412
417typedef struct
418{
439
445typedef struct
446{
456 BTStatus_t ( * pxRegisterServer )( BTUuid_t * pxUuid );
457
468 BTStatus_t ( * pxUnregisterServer )( uint8_t ucServerIf );
469
477 BTStatus_t ( * pxGattServerInit )( const BTGattServerCallbacks_t * pxCallbacks );
478
495 BTStatus_t ( * pxConnect )( uint8_t ucServerIf,
496 const BTBdaddr_t * pxBdAddr,
497 bool bIsDirect,
498 BTTransport_t xTransport );
499
516 BTStatus_t ( * pxDisconnect )( uint8_t ucServerIf,
517 const BTBdaddr_t * pxBdAddr,
518 uint16_t usConnId );
519
533 BTStatus_t ( * pxAddServiceBlob )( uint8_t ucServerIf,
534 BTService_t * pxService );
535
552 BTStatus_t ( * pxAddService )( uint8_t ucServerIf,
553 BTGattSrvcId_t * pxSrvcId,
554 uint16_t usNumHandles );
555
572 BTStatus_t ( * pxAddIncludedService )( uint8_t ucServerIf,
573 uint16_t usServiceHandle,
574 uint16_t usIncludedHandle );
575
598 BTStatus_t ( * pxAddCharacteristic )( uint8_t ucServerIf,
599 uint16_t usServiceHandle,
600 BTUuid_t * pxUuid,
601 BTCharProperties_t xProperties,
602 BTCharPermissions_t xPermissions );
603
614 BTStatus_t ( * pxSetVal )( BTGattResponse_t * pxValue );
615
636 BTStatus_t ( * pxAddDescriptor )( uint8_t ucServerIf,
637 uint16_t usServiceHandle,
638 BTUuid_t * pxUuid,
639 BTCharPermissions_t ulPermissions );
640
656 BTStatus_t ( * pxStartService )( uint8_t ucServerIf,
657 uint16_t usServiceHandle,
658 BTTransport_t xTransport );
659
673 BTStatus_t ( * pxStopService )( uint8_t ucServerIf,
674 uint16_t usServiceHandle );
675
690 BTStatus_t ( * pxDeleteService )( uint8_t ucServerIf,
691 uint16_t usServiceHandle );
692
714 BTStatus_t ( * pxSendIndication )( uint8_t ucServerIf,
715 uint16_t usAttributeHandle,
716 uint16_t usConnId,
717 size_t xLen,
718 uint8_t * pucValue,
719 bool bConfirm );
720
737 BTStatus_t ( * pxSendResponse )( uint16_t usConnId,
738 uint32_t ulTransId,
739 BTStatus_t xStatus,
740 BTGattResponse_t * pxResponse );
741
756 BTStatus_t ( * pxReconnect )( uint8_t ucServerIf,
757 const BTBdaddr_t * pxBdAddr );
758
773 BTStatus_t ( * pxAddDevicesToWhiteList )( uint8_t ucServerIf,
774 const BTBdaddr_t * pxBdAddr,
775 uint32_t ulNumberOfDevices );
776
791 BTStatus_t ( * pxRemoveDevicesFromWhiteList )( uint8_t ucServerIf,
792 const BTBdaddr_t * pxBdAddr,
793 uint32_t ulNumberOfDevices );
794
805 BTStatus_t ( * pxConfigureMtu )( uint8_t ucServerIf,
806 uint16_t usMtu );
808
809#endif /* _BT_HAL_GATT_SERVER_H_ */
T HAL provides the standard defintions used by BT GATT interfaces.
uint16_t BTCharProperties_t
Definition: bt_hal_gatt_types.h:104
uint16_t BTCharPermissions_t
Definition: bt_hal_gatt_types.h:124
void(* BTCongestionCallback_t)(uint16_t usConnId, bool bCongested)
Definition: bt_hal_gatt_types.h:331
void(* BTServiceDeletedCallback_t)(BTStatus_t xStatus, uint8_t ucServerIf, uint16_t usServiceHandle)
Callback invoked in response to pxDeleteService.
Definition: bt_hal_gatt_server.h:275
void(* BTMtuChangedCallback_t)(uint16_t usConnId, uint16_t usMtu)
Callback invoked when the MTU for a given connection changes.
Definition: bt_hal_gatt_server.h:398
void(* BTResponseConfirmationCallback_t)(BTStatus_t xStatus, uint16_t usHandle)
Callback triggered in response to sendResponse if the remote device sends a confirmation.
Definition: bt_hal_gatt_server.h:372
void(* BTServiceStoppedCallback_t)(BTStatus_t xStatus, uint8_t ucServerIf, uint16_t usServiceHandle)
Callback invoked in response to pxStopService.
Definition: bt_hal_gatt_server.h:259
void(* BTServiceAddedCallback_t)(BTStatus_t xStatus, uint8_t ucServerIf, BTGattSrvcId_t *pxSrvcId, uint16_t usServiceHandle)
Callback invoked in response to pxAddService.
Definition: bt_hal_gatt_server.h:151
void(* BTIncludedServiceAddedCallback_t)(BTStatus_t xStatus, uint8_t ucServerIf, uint16_t usServiceHandle, uint16_t usInclSrvcHandle)
Callback invoked in response to pxAddIncludedService.
Definition: bt_hal_gatt_server.h:170
void(* BTRegisterServerCallback_t)(BTStatus_t xStatus, uint8_t ucServerIf, BTUuid_t *pxAppUuid)
Callback invoked in response to pxRegisterServer.
Definition: bt_hal_gatt_server.h:98
void(* BTServiceStartedCallback_t)(BTStatus_t xStatus, uint8_t ucServerIf, uint16_t usServiceHandle)
Callback invoked in response to pxStartService.
Definition: bt_hal_gatt_server.h:243
void(* BTConnectionCallback_t)(uint16_t usConnId, uint8_t ucServerIf, bool bConnected, BTBdaddr_t *pxBda)
Callback invoked on a connection event.
Definition: bt_hal_gatt_server.h:131
void(* BTRequestExecWriteCallback_t)(uint16_t usConnId, uint32_t ulTransId, BTBdaddr_t *pxBda, bool bExecWrite)
Callback invoked on execute write event.
Definition: bt_hal_gatt_server.h:357
void(* BTWhiteListChangedCallback_t)(const BTBdaddr_t *pxBdAddr, bool bIsAdded)
Callback for notifying modification in white list.
Definition: bt_hal_gatt_server.h:410
void(* BTCharacteristicAddedCallback_t)(BTStatus_t xStatus, uint8_t ucServerIf, BTUuid_t *pxUuid, uint16_t usServiceHandle, uint16_t usCharHandle)
Callback invoked in response to pxAddCharacteristic.
Definition: bt_hal_gatt_server.h:191
void(* BTDescriptorAddedCallback_t)(BTStatus_t xStatus, uint8_t ucServerIf, BTUuid_t *pxUuid, uint16_t usServiceHandle, uint16_t usDescrHandle)
Callback invoked in response to pxAddDescriptor.
Definition: bt_hal_gatt_server.h:225
void(* BTIndicationSentCallback_t)(uint16_t usConnId, BTStatus_t xStatus)
Callback on confirmation device from the remote device to an indication. Or confirm a Notification as...
Definition: bt_hal_gatt_server.h:385
void(* BTRequestReadCallback_t)(uint16_t usConnId, uint32_t ulTransId, BTBdaddr_t *pxBda, uint16_t usAttrHandle, uint16_t usOffset)
Callback invoked on read event.
Definition: bt_hal_gatt_server.h:298
void(* BTSetValCallback_t)(BTStatus_t xStatus, uint16_t usAttrHandle)
Callback invoked in response to pxSetVal.
Definition: bt_hal_gatt_server.h:206
void(* BTRequestWriteCallback_t)(uint16_t usConnId, uint32_t ulTransId, BTBdaddr_t *pxBda, uint16_t usAttrHandle, uint16_t usOffset, size_t xLength, bool bNeedRsp, bool bIsPrep, uint8_t *pucValue)
Callback invoked on write event.
Definition: bt_hal_gatt_server.h:331
void(* BTUnregisterServerCallback_t)(BTStatus_t xStatus, uint8_t ucServerIf)
Callback invoked in response to pxUnregisterServer.
Definition: bt_hal_gatt_server.h:114
BTStatus_t
Bluetooth Error Status .
Definition: bt_hal_manager_types.h:111
BTTransport_t
Preferred physical Transport for GATT connection .
Definition: bt_hal_manager.h:120
BTRspErrorStatus_t
Error status sent inside response to a read or write from the client.
Definition: bt_hal_gatt_server.h:55
@ eBTRspErrorSignedMitm
Definition: bt_hal_gatt_server.h:60
@ eBTRspErrorNo_mitm
Definition: bt_hal_gatt_server.h:57
@ eBTRspErrorMitm
Definition: bt_hal_gatt_server.h:58
@ eBTRspErrorNone
Definition: bt_hal_gatt_server.h:56
@ eBTRspErrorSignedNoMitm
Definition: bt_hal_gatt_server.h:59
BT/BLE address.
Definition: bt_hal_manager_types.h:77
Callback structure for GATT server.
Definition: bt_hal_gatt_server.h:418
BTDescriptorAddedCallback_t pxDescriptorAddedCb
Definition: bt_hal_gatt_server.h:426
BTWhiteListChangedCallback_t pxBTWhiteListChangedCb
Definition: bt_hal_gatt_server.h:437
BTSetValCallback_t pxSetValCallbackCb
Definition: bt_hal_gatt_server.h:425
BTUnregisterServerCallback_t pxUnregisterServerCb
Definition: bt_hal_gatt_server.h:420
BTRegisterServerCallback_t pxRegisterServerCb
Definition: bt_hal_gatt_server.h:419
BTServiceStoppedCallback_t pxServiceStoppedCb
Definition: bt_hal_gatt_server.h:428
BTServiceStartedCallback_t pxServiceStartedCb
Definition: bt_hal_gatt_server.h:427
BTIncludedServiceAddedCallback_t pxIncludedServiceAddedCb
Definition: bt_hal_gatt_server.h:423
BTIndicationSentCallback_t pxIndicationSentCb
Definition: bt_hal_gatt_server.h:434
BTResponseConfirmationCallback_t pxResponseConfirmationCb
Definition: bt_hal_gatt_server.h:433
BTConnectionCallback_t pxConnectionCb
Definition: bt_hal_gatt_server.h:421
BTRequestExecWriteCallback_t pxRequestExecWriteCb
Definition: bt_hal_gatt_server.h:432
BTCharacteristicAddedCallback_t pxCharacteristicAddedCb
Definition: bt_hal_gatt_server.h:424
BTCongestionCallback_t pxCongestionCb
Definition: bt_hal_gatt_server.h:435
BTServiceDeletedCallback_t pxServiceDeletedCb
Definition: bt_hal_gatt_server.h:429
BTMtuChangedCallback_t pxMtuChangedCb
Definition: bt_hal_gatt_server.h:436
BTRequestReadCallback_t pxRequestReadCb
Definition: bt_hal_gatt_server.h:430
BTServiceAddedCallback_t pxServiceAddedCb
Definition: bt_hal_gatt_server.h:422
BTRequestWriteCallback_t pxRequestWriteCb
Definition: bt_hal_gatt_server.h:431
Represents the standard BT-GATT server interface.
Definition: bt_hal_gatt_server.h:446
GATT Service ID.
Definition: bt_hal_gatt_types.h:164
GATT value type used in response to remote read/Write requests.
Definition: bt_hal_gatt_server.h:68
uint16_t usHandle
Definition: bt_hal_gatt_server.h:69
BTRspErrorStatus_t xRspErrorStatus
Definition: bt_hal_gatt_server.h:73
uint16_t usOffset
Definition: bt_hal_gatt_server.h:71
size_t xLen
Definition: bt_hal_gatt_server.h:72
uint8_t * pucValue
Definition: bt_hal_gatt_server.h:70
UUID.
Definition: bt_hal_manager_types.h:96
GATT response to read and write.
Definition: bt_hal_gatt_server.h:80
uint16_t usHandle
Definition: bt_hal_gatt_server.h:82
BTGattValue_t xAttrValue
Definition: bt_hal_gatt_server.h:81