COMMON IO-BLE v1.0.0
Hardware abstraction layer for Bluetooth
 
Loading...
Searching...
No Matches
bt_hal_gatt_client.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
40#ifndef _BT_HAL_GATT_CLIENT_H_
41#define _BT_HAL_GATT_CLIENT_H_
42
43#include <stdint.h>
44#include "bt_hal_gatt_types.h"
46
47
52typedef struct
53{
54 uint8_t ucValue[ btGATT_MAX_ATTR_LEN ];
55 uint16_t usLen;
57
62typedef struct
63{
64 uint16_t usHandle;
66 uint16_t usValueType;
67 uint8_t ucStatus;
69
74typedef struct
75{
79 uint8_t ucStatus;
81
86typedef struct
87{
88 uint8_t ucValue[ btGATT_MAX_ATTR_LEN ];
90 uint16_t usHandle;
91 size_t xLen;
92 bool bIsNotify;
94
99typedef struct
100{
103 uint16_t usU1;
104 uint16_t usU2;
105 uint16_t usU3;
106 uint16_t usU4;
107 uint16_t usU5;
109
110
115typedef enum
116{
132
148 uint8_t ucClientIf,
149 BTUuid_t * pxAppUuid );
150
162typedef void ( * BTSearchCompleteCallback_t)( uint16_t usConnId,
163 BTGattStatus_t xStatus );
164
181typedef void ( * BTRegisterForNotificationCallback_t)( uint16_t usConnId,
182 bool bRegistered,
183 BTGattStatus_t xStatus,
184 uint16_t usHandle );
185
197typedef void ( * BTNotifyCallback_t)( uint16_t usConnId,
198 BTGattNotifyParams_t * pxData );
199
212typedef void ( * BTReadCharacteristicCallback_t)( uint16_t usConnId,
213 BTGattStatus_t xStatus,
214 BTGattReadParams_t * pxData );
215
229typedef void ( * BTWriteCharacteristicCallback_t)( uint16_t usConnId,
230 BTGattStatus_t xStatus,
231 uint16_t usHandle );
232
243typedef void ( * BTExecuteWriteCallback_t)( uint16_t usConnId,
244 BTGattStatus_t xStatus );
245
258typedef void ( * BTReadDescriptorCallback_t)( uint16_t usConnId,
259 BTGattStatus_t xStatus,
260 BTGattReadParams_t * pxData );
261
274typedef void ( * BTWriteDescriptorCallback_t)( uint16_t usConnId,
275 BTGattStatus_t xStatus,
276 uint16_t usHandle );
277
286typedef void ( * BTListenCallback_t)( BTGattStatus_t xStatus,
287 uint32_t ulServerIf );
288
302typedef void ( * BTConfigureMtuCallback_t)( uint16_t usConnId,
303 BTGattStatus_t xStatus,
304 uint32_t ulMtu );
305
318typedef void ( * BTGetGattDbCallback_t)( uint16_t usConnId,
319 BTGattDbElement_t * pxDb,
320 uint32_t ulCount );
321
334typedef void ( * BTServicesRemovedCallback_t)( uint16_t usConnId,
335 uint16_t usStartHandle,
336 uint16_t usEndHandle );
337
350typedef void ( * BTServicesAddedCallback_t)( uint16_t usConnId,
351 BTGattDbElement_t * pxAdded,
352 uint32_t ulAddedCount );
353
358typedef struct
359{
379
384typedef struct
385{
394 BTStatus_t ( * pxRegisterClient )( BTUuid_t * pxUuid );
395
405 BTStatus_t ( * pxUnregisterClient )( uint8_t ucClientIf );
406
415 BTStatus_t ( * pxGattClientInit )( const BTGattClientCallbacks_t * pxCallbacks );
416
432 BTStatus_t ( * pxConnect )( uint8_t ucClientIf,
433 const BTBdaddr_t * pxBdAddr,
434 bool bIsDirect,
435 BTTransport_t xTransport );
436
451 BTStatus_t ( * pxDisconnect )( uint8_t ucClientIf,
452 const BTBdaddr_t * pxBdAddr,
453 uint16_t usConnId );
454
466 BTStatus_t ( * pxRefresh )( uint8_t ucClientIf,
467 const BTBdaddr_t * pxBdAddr );
468
482 BTStatus_t ( * pxSearchService )( uint16_t usConnId,
483 BTUuid_t * pxFilterUuid );
484
498 BTStatus_t ( * pxReadCharacteristic )( uint16_t usConnId,
499 uint16_t usHandle,
500 uint32_t ulAuthReq );
501
520 BTStatus_t ( * pxWriteCharacteristic )( uint16_t usConnId,
521 uint16_t usHandle,
522 BTAttrWriteRequests_t xWriteType,
523 size_t xLen,
524 uint32_t ulAuthReq,
525 char * pcValue );
526
540 BTStatus_t ( * pxReadDescriptor )( uint16_t usConnId,
541 uint16_t usHandle,
542 uint32_t ulAuthReq );
543
563 BTStatus_t ( * pxWriteDescriptor )( uint16_t usConnId,
564 uint16_t usHandle,
565 BTAttrWriteRequests_t xWriteType,
566 size_t xLen,
567 uint32_t ulAuthReq,
568 char * pcValue );
569
581 BTStatus_t ( * pxExecuteWrite )( uint16_t usConnId,
582 bool bExecute );
583
598 BTStatus_t ( * pxRegisterForNotification )( uint8_t ucClientIf,
599 const BTBdaddr_t * pxBdAddr,
600 uint16_t usHandle );
601
616 BTStatus_t ( * pxUnregisterForNotification )( uint8_t ucClientIf,
617 const BTBdaddr_t * pxBdAddr,
618 uint16_t usHandle );
619
631 BTStatus_t ( * pxReadRemoteRssi )( uint8_t ucClientIf,
632 const BTBdaddr_t * pxBdAddr );
633
642 BTTransport_t ( * pxGetDeviceType )( const BTBdaddr_t * pxBdAddr );
643
655 BTStatus_t ( * pxConfigureMtu )( uint16_t usConnId,
656 uint16_t usMtu );
657
667 BTStatus_t ( * pxTestCommand )( uint32_t ulCommand,
668 BTGattTestParams_t * pxParams );
669
678 BTStatus_t ( * pxGetGattDb )( uint16_t usConnId );
680
681#endif /* #ifndef _BT_HAL_GATT_CLIENT_H_ */
T HAL provides the standard defintions used by BT GATT interfaces.
void(* BTConnectCallback_t)(uint16_t usConnId, BTGattStatus_t xStatus, uint8_t ucClientIf, BTBdaddr_t *pxBda)
Definition: bt_hal_gatt_types.h:308
void(* BTDisconnectCallback_t)(uint16_t usConnId, BTGattStatus_t xStatus, uint8_t ucClientIf, BTBdaddr_t *pxBda)
Definition: bt_hal_gatt_types.h:314
void(* BTReadRemoteRssiCallback_t)(uint8_t ucClientIf, BTBdaddr_t *pxBda, uint32_t ulRssi, BTStatus_t xStatus)
Definition: bt_hal_gatt_types.h:321
void(* BTCongestionCallback_t)(uint16_t usConnId, bool bCongested)
Definition: bt_hal_gatt_types.h:331
This BT HAL provides the interfaces to control the Bluetooth power states ,local device control and d...
void(* BTListenCallback_t)(BTGattStatus_t xStatus, uint32_t ulServerIf)
Callback indicating the status of a listen() operation.
Definition: bt_hal_gatt_client.h:286
void(* BTNotifyCallback_t)(uint16_t usConnId, BTGattNotifyParams_t *pxData)
Remote device notification callback, invoked when a remote device sends a notification or indication ...
Definition: bt_hal_gatt_client.h:197
void(* BTGetGattDbCallback_t)(uint16_t usConnId, BTGattDbElement_t *pxDb, uint32_t ulCount)
GATT get database callback. Triggered by pxGetGattDb.
Definition: bt_hal_gatt_client.h:318
void(* BTServicesAddedCallback_t)(uint16_t usConnId, BTGattDbElement_t *pxAdded, uint32_t ulAddedCount)
GATT services were added.
Definition: bt_hal_gatt_client.h:350
void(* BTRegisterClientCallback_t)(BTGattStatus_t xStatus, uint8_t ucClientIf, BTUuid_t *pxAppUuid)
Callback invoked in response pxRegisterClient when the GATT client registration has been completed.
Definition: bt_hal_gatt_client.h:147
void(* BTReadDescriptorCallback_t)(uint16_t usConnId, BTGattStatus_t xStatus, BTGattReadParams_t *pxData)
Callback invoked in response to pxReadDescriptor.
Definition: bt_hal_gatt_client.h:258
void(* BTReadCharacteristicCallback_t)(uint16_t usConnId, BTGattStatus_t xStatus, BTGattReadParams_t *pxData)
Reports result of a GATT read operation. Triggered by pxReadCharacteristic.
Definition: bt_hal_gatt_client.h:212
void(* BTServicesRemovedCallback_t)(uint16_t usConnId, uint16_t usStartHandle, uint16_t usEndHandle)
GATT services between startHandle and endHandle were removed.
Definition: bt_hal_gatt_client.h:334
void(* BTConfigureMtuCallback_t)(uint16_t usConnId, BTGattStatus_t xStatus, uint32_t ulMtu)
Callback invoked when the MTU for a given connection changes. Triggered by pxConfigureMtu.
Definition: bt_hal_gatt_client.h:302
void(* BTSearchCompleteCallback_t)(uint16_t usConnId, BTGattStatus_t xStatus)
Callback invoked in response to pxSearchService when the GATT service search has been completed.
Definition: bt_hal_gatt_client.h:162
void(* BTWriteDescriptorCallback_t)(uint16_t usConnId, BTGattStatus_t xStatus, uint16_t usHandle)
Callback invoked in response to pxWriteDescriptor.
Definition: bt_hal_gatt_client.h:274
void(* BTExecuteWriteCallback_t)(uint16_t usConnId, BTGattStatus_t xStatus)
GATT execute prepared write callback. Triggered by pxExecuteWrite.
Definition: bt_hal_gatt_client.h:243
void(* BTWriteCharacteristicCallback_t)(uint16_t usConnId, BTGattStatus_t xStatus, uint16_t usHandle)
GATT write characteristic operation callback. Triggered by pxWriteCharacteristic.
Definition: bt_hal_gatt_client.h:229
void(* BTRegisterForNotificationCallback_t)(uint16_t usConnId, bool bRegistered, BTGattStatus_t xStatus, uint16_t usHandle)
Callback invoked in response to pxRegisterForNotification and pxUnregisterForNotification.
Definition: bt_hal_gatt_client.h:181
#define btGATT_MAX_ATTR_LEN
Definition: bt_hal_gatt_types.h:50
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
BTAttrWriteRequests_t
Write request type.
Definition: bt_hal_gatt_types.h:131
BTGattcError_t
BT GATT client error codes.
Definition: bt_hal_gatt_client.h:116
BTGattStatus_t
GATT Status Codes.
Definition: bt_hal_gatt_types.h:59
@ eBTGattcDelayedEncryptionCheck
Definition: bt_hal_gatt_client.h:129
@ eBTGattcIncorrectState
Definition: bt_hal_gatt_client.h:124
@ eBTGattcUnknownAddr
Definition: bt_hal_gatt_client.h:125
@ eBTGattcCommandStarted
Definition: bt_hal_gatt_client.h:118
@ eBTGattcIllegalValue
Definition: bt_hal_gatt_client.h:123
@ eBTGattcInvalidControllerOutput
Definition: bt_hal_gatt_client.h:127
@ eBTGattcCommandSuccess
Definition: bt_hal_gatt_client.h:117
@ eBTGattcCommandBusy
Definition: bt_hal_gatt_client.h:119
@ eBTGattcCommandStored
Definition: bt_hal_gatt_client.h:120
@ eBTGattcNoResources
Definition: bt_hal_gatt_client.h:121
@ eBTGattcErrProcessing
Definition: bt_hal_gatt_client.h:130
@ eBTGattcSecurityError
Definition: bt_hal_gatt_client.h:128
@ eBTGattcModeUnsupported
Definition: bt_hal_gatt_client.h:122
@ eBTGattcDeviceTimeout
Definition: bt_hal_gatt_client.h:126
BT/BLE address.
Definition: bt_hal_manager_types.h:77
Represents the BT-GATT client callbacks.
Definition: bt_hal_gatt_client.h:359
BTNotifyCallback_t pxNotifyCb
Definition: bt_hal_gatt_client.h:365
BTDisconnectCallback_t pxCloseCb
Definition: bt_hal_gatt_client.h:362
BTConfigureMtuCallback_t pxConfigureMtuCb
Definition: bt_hal_gatt_client.h:373
BTReadDescriptorCallback_t pxReadDescriptorCb
Definition: bt_hal_gatt_client.h:368
BTListenCallback_t pxListenCb
Definition: bt_hal_gatt_client.h:372
BTWriteCharacteristicCallback_t pxWriteCharacteristicCb
Definition: bt_hal_gatt_client.h:367
BTWriteDescriptorCallback_t pxWriteDescriptorCb
Definition: bt_hal_gatt_client.h:369
BTReadRemoteRssiCallback_t pxReadRemoteRssiCb
Definition: bt_hal_gatt_client.h:371
BTServicesAddedCallback_t pxServicesAddedCb
Definition: bt_hal_gatt_client.h:377
BTServicesRemovedCallback_t pxServicesRemovedCb
Definition: bt_hal_gatt_client.h:376
BTGetGattDbCallback_t pxGetGattDbCb
Definition: bt_hal_gatt_client.h:375
BTSearchCompleteCallback_t pxSearchCompleteCb
Definition: bt_hal_gatt_client.h:363
BTRegisterClientCallback_t pxRegisterClientCb
Definition: bt_hal_gatt_client.h:360
BTConnectCallback_t pxOpenCb
Definition: bt_hal_gatt_client.h:361
BTCongestionCallback_t pxCongestionCb
Definition: bt_hal_gatt_client.h:374
BTRegisterForNotificationCallback_t pxRegisterForNotificationCb
Definition: bt_hal_gatt_client.h:364
BTReadCharacteristicCallback_t pxReadCharacteristicCb
Definition: bt_hal_gatt_client.h:366
BTExecuteWriteCallback_t pxExecuteWriteCb
Definition: bt_hal_gatt_client.h:370
Represents the standard BT-GATT client interface.
Definition: bt_hal_gatt_client.h:385
BLE GATT Db element.
Definition: bt_hal_gatt_types.h:286
GATT service instance ID.
Definition: bt_hal_gatt_types.h:154
Parameters for attribute change notifications.
Definition: bt_hal_gatt_client.h:87
size_t xLen
Definition: bt_hal_gatt_client.h:91
BTBdaddr_t xBda
Definition: bt_hal_gatt_client.h:89
bool bIsNotify
Definition: bt_hal_gatt_client.h:92
uint16_t usHandle
Definition: bt_hal_gatt_client.h:90
Parameters for GATT read operations.
Definition: bt_hal_gatt_client.h:63
uint8_t ucStatus
Definition: bt_hal_gatt_client.h:67
uint16_t usHandle
Definition: bt_hal_gatt_client.h:64
uint16_t usValueType
Definition: bt_hal_gatt_client.h:66
BTGattUnformattedValue_t xValue
Definition: bt_hal_gatt_client.h:65
GATT Service ID.
Definition: bt_hal_gatt_types.h:164
Parameters for test command interface.
Definition: bt_hal_gatt_client.h:100
BTBdaddr_t * pxBda1
Definition: bt_hal_gatt_client.h:101
BTUuid_t * pxUuid1
Definition: bt_hal_gatt_client.h:102
uint16_t usU4
Definition: bt_hal_gatt_client.h:106
uint16_t usU1
Definition: bt_hal_gatt_client.h:103
uint16_t usU2
Definition: bt_hal_gatt_client.h:104
uint16_t usU3
Definition: bt_hal_gatt_client.h:105
uint16_t usU5
Definition: bt_hal_gatt_client.h:107
Buffer type for unformatted reads/writes.
Definition: bt_hal_gatt_client.h:53
uint16_t usLen
Definition: bt_hal_gatt_client.h:55
Parameters for GATT write operations.
Definition: bt_hal_gatt_client.h:75
BTGattSrvcId_t xSrvcId
Definition: bt_hal_gatt_client.h:76
BTGattInstanceId_t xCharId
Definition: bt_hal_gatt_client.h:77
uint8_t ucStatus
Definition: bt_hal_gatt_client.h:79
BTGattInstanceId_t xDescrId
Definition: bt_hal_gatt_client.h:78
UUID.
Definition: bt_hal_manager_types.h:96