FreeRTOS: BLE
BLE
Return to main page ↑
BTGattServerInterface_t Struct Reference

#include <bt_hal_gatt_server.h>

Data Fields

BTStatus_t(* pxRegisterServer )(BTUuid_t *pxUuid)
 Registers a GATT server application with the stack. More...
 
BTStatus_t(* pxUnregisterServer )(uint8_t ucServerIf)
 Unregister a server application from the stack. More...
 
BTStatus_t(* pxGattServerInit )(const BTGattServerCallbacks_t *pxCallbacks)
 Initializes the interface and provides callback routines. More...
 
BTStatus_t(* pxConnect )(uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr, bool bIsDirect, BTTransport_t xTransport)
 Create a connection to a remote peripheral. More...
 
BTStatus_t(* pxDisconnect )(uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr, uint16_t usConnId)
 Disconnect an established connection or cancel a pending one. More...
 
BTStatus_t(* pxAddServiceBlob )(uint8_t ucServerIf, BTService_t *pxService)
 Create a new service with all its components (descriptors/characteristic/included services, etc..). The service is started automatically. @Warning: Not all platform supports changes to the attribute table while connected. It should be checked that calling this API while connected is supported by the vendor's API. More...
 
BTStatus_t(* pxAddService )(uint8_t ucServerIf, BTGattSrvcId_t *pxSrvcId, uint16_t usNumHandles)
 Create a new service. More...
 
BTStatus_t(* pxAddIncludedService )(uint8_t ucServerIf, uint16_t usServiceHandle, uint16_t usIncludedHandle)
 Assign an included service to it's parent service. More...
 
BTStatus_t(* pxAddCharacteristic )(uint8_t ucServerIf, uint16_t usServiceHandle, BTUuid_t *pxUuid, BTCharProperties_t xProperties, BTCharPermissions_t xPermissions)
 Add a characteristic to a service. Note: Characteristic declaration is added automatically. More...
 
BTStatus_t(* pxSetVal )(BTGattResponse_t *pxValue)
 Set the primitive/complete values only. i.e data can be read in one transaction, if we need multiple then we need to use send response. More...
 
BTStatus_t(* pxAddDescriptor )(uint8_t ucServerIf, uint16_t usServiceHandle, BTUuid_t *pxUuid, BTCharPermissions_t ulPermissions)
 Add a descriptor to a given service. More...
 
BTStatus_t(* pxStartService )(uint8_t ucServerIf, uint16_t usServiceHandle, BTTransport_t xTransport)
 Starts a local service. More...
 
BTStatus_t(* pxStopService )(uint8_t ucServerIf, uint16_t usServiceHandle)
 Stops a local service if supported by the underlying stack. More...
 
BTStatus_t(* pxDeleteService )(uint8_t ucServerIf, uint16_t usServiceHandle)
 Delete a local service. More...
 
BTStatus_t(* pxSendIndication )(uint8_t ucServerIf, uint16_t usAttributeHandle, uint16_t usConnId, size_t xLen, uint8_t *pucValue, bool bConfirm)
 Send value indication to a remote device. More...
 
BTStatus_t(* pxSendResponse )(uint16_t usConnId, uint32_t ulTransId, BTStatus_t xStatus, BTGattResponse_t *pxResponse)
 Send a response to a read/write operation. More...
 
BTStatus_t(* pxReconnect )(uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr)
 Start directed advertising to the device address passed this device should be already part of the white list. More...
 
BTStatus_t(* pxAddDevicesToWhiteList )(uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr, uint32_t ulNumberOfDevices)
 Add devices to whitelist. More...
 
BTStatus_t(* pxRemoveDevicesFromWhiteList )(uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr, uint32_t ulNumberOfDevices)
 Remove device from whitelist and stops any ongoing directed advertisements. More...
 
BTStatus_t(* pxConfigureMtu )(uint8_t ucServerIf, uint16_t usMtu)
 Configure the MTU for gatt server. More...
 

Detailed Description

Represents the standard BT-GATT server interface.

Field Documentation

◆ pxRegisterServer

BTStatus_t( * BTGattServerInterface_t::pxRegisterServer) (BTUuid_t *pxUuid)

Registers a GATT server application with the stack.

Triggers BTRegisterServerCallback_t.

Parameters
[in]pxUuidServer UUID.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxUnregisterServer

BTStatus_t( * BTGattServerInterface_t::pxUnregisterServer) (uint8_t ucServerIf)

Unregister a server application from the stack.

Triggers BTUnregisterServerCallback_t.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxGattServerInit

BTStatus_t( * BTGattServerInterface_t::pxGattServerInit) (const BTGattServerCallbacks_t *pxCallbacks)

Initializes the interface and provides callback routines.

Parameters
[in]pxCallbacksInitialized callbacks for GAT server.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxConnect

BTStatus_t( * BTGattServerInterface_t::pxConnect) (uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr, bool bIsDirect, BTTransport_t xTransport)

Create a connection to a remote peripheral.

Triggers BTConnectionCallback_t with bConnected = true.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]pxBdAddrAddress of the Remote device.
[in]bIsDirectSet to True for direct connection.
[in]xTransportSpecify if BLE and BT classic is being used.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxDisconnect

BTStatus_t( * BTGattServerInterface_t::pxDisconnect) (uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr, uint16_t usConnId)

Disconnect an established connection or cancel a pending one.

Triggers BTConnectionCallback_t with bConnected = false. When available the returned reason for disconnection should be REMOTE USER TERMINATED CONNECTION (0x13)"

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]pxBdAddrAddress of the Remote device.
[in]usConnIdConnection Identifier, created and return on connection event, when BTConnectionCallback_t is invoked.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxAddServiceBlob

BTStatus_t( * BTGattServerInterface_t::pxAddServiceBlob) (uint8_t ucServerIf, BTService_t *pxService)

Create a new service with all its components (descriptors/characteristic/included services, etc..). The service is started automatically. @Warning: Not all platform supports changes to the attribute table while connected. It should be checked that calling this API while connected is supported by the vendor's API.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in,out]pxServiceGATT Service structure. When pxAddServiceBlob returns, pxService->pusHandlesBuffer is filled with corresponding attribute handles.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxAddService

BTStatus_t( * BTGattServerInterface_t::pxAddService) (uint8_t ucServerIf, BTGattSrvcId_t *pxSrvcId, uint16_t usNumHandles)

Create a new service.

Triggers BTServiceAddedCallback_t. @Warning: Not all platform supports changes to the attribute table while connected. It should be checked that calling this API while connected is supported by the vendor's API.e

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]pxSrvcIdService ID, returned on BTServiceAddedCallback_t after calling pxAddService.
[in]usNumHandlesNumber of handles in the service.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxAddIncludedService

BTStatus_t( * BTGattServerInterface_t::pxAddIncludedService) (uint8_t ucServerIf, uint16_t usServiceHandle, uint16_t usIncludedHandle)

Assign an included service to it's parent service.

Triggers BTIncludedServiceAddedCallback_t. @Warning: Not all platform supports changes to the attribute table while connected. It should be checked that calling this API while connected is supported by the vendor's API.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]usServiceHandleHandle of the service containing the attributes.
[in]usIncludedHandleHandle of the included service.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxAddCharacteristic

BTStatus_t( * BTGattServerInterface_t::pxAddCharacteristic) (uint8_t ucServerIf, uint16_t usServiceHandle, BTUuid_t *pxUuid, BTCharProperties_t xProperties, BTCharPermissions_t xPermissions)

Add a characteristic to a service. Note: Characteristic declaration is added automatically.

Characteristics are created in order in which the function pxAddCharacteristic is called. Descriptor created will belong to the characteristic that was created last. Triggers BTCharacteristicAddedCallback_t. @Warning: Not all platform supports changes to the attribute table while connected. It should be checked that calling this API while connected is supported by the vendor's API.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]usServiceHandleHandle of the service containing the attributes.
[in]pxUuidUUID of the attribute.
[in]xPropertiesProperties of the characteristic.
[in]xPermissionsPermission to read/write the characteristic.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxSetVal

BTStatus_t( * BTGattServerInterface_t::pxSetVal) (BTGattResponse_t *pxValue)

Set the primitive/complete values only. i.e data can be read in one transaction, if we need multiple then we need to use send response.

Triggers BTSetValCallback_t.

Parameters
[in]pxValueAPP response.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxAddDescriptor

BTStatus_t( * BTGattServerInterface_t::pxAddDescriptor) (uint8_t ucServerIf, uint16_t usServiceHandle, BTUuid_t *pxUuid, BTCharPermissions_t ulPermissions)

Add a descriptor to a given service.

The descriptor will belong to the first characteristic above it in the attribute table for that service. @WARNING: CCCD need to be created first so they are just below their respective characteristics. Since some stacks will add them automatically right after the characteristic. @Warning: Not all platform supports changes to the attribute table while connected. It should be checked that calling this API while connected is supported by the vendor's API.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]usServiceHandleHandle of the service containing the attributes.
[in]pxUuidUUID of the attribute.
[in]ulPermissionsPermissions to read/write the descriptor.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxStartService

BTStatus_t( * BTGattServerInterface_t::pxStartService) (uint8_t ucServerIf, uint16_t usServiceHandle, BTTransport_t xTransport)

Starts a local service.

Triggers BTServiceStartedCallback_t. A service become discoverable after being started.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]usServiceHandleHandle of the service containing the attributes.
[in]xTransportSpecify if BLE and BT classic is being used.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxStopService

BTStatus_t( * BTGattServerInterface_t::pxStopService) (uint8_t ucServerIf, uint16_t usServiceHandle)

Stops a local service if supported by the underlying stack.

Triggers BTServiceStoppedCallback_t. @NOTE: Not a mandatory API as not every stack supports it.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]usServiceHandleHandle of the service containing the attributes.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxDeleteService

BTStatus_t( * BTGattServerInterface_t::pxDeleteService) (uint8_t ucServerIf, uint16_t usServiceHandle)

Delete a local service.

Triggers BTServiceDeletedCallback_t. @Warning: Not all platform supports changes to the attribute table while connected. It should be checked that calling this API while connected is supported by the vendor's API.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]usServiceHandleHandle of the service containing the attributes.
Returns
Returns eBTStatusSuccess on successful call

◆ pxSendIndication

BTStatus_t( * BTGattServerInterface_t::pxSendIndication) (uint8_t ucServerIf, uint16_t usAttributeHandle, uint16_t usConnId, size_t xLen, uint8_t *pucValue, bool bConfirm)

Send value indication to a remote device.

Triggers BTIndicationSentCallback_t.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]usAttributeHandle.
[in]usConnIdConnection Identifier, created and return on connection event, when BTConnectionCallback_t is invoked.
[in]xLenData length.
[in]pucValueData.
[in]bConfirmTrue for indication, false for notification.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxSendResponse

BTStatus_t( * BTGattServerInterface_t::pxSendResponse) (uint16_t usConnId, uint32_t ulTransId, BTStatus_t xStatus, BTGattResponse_t *pxResponse)

Send a response to a read/write operation.

Triggers BTResponseConfirmationCallback_t.

Parameters
[in]usConnIdConnection Identifier, created and return on connection event, when BTConnectionCallback_t is invoked.
[in]ulTransId.Transaction ID
[in]xStatusStatus returned by the APP.
[in]pxResponseAPP response.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxReconnect

BTStatus_t( * BTGattServerInterface_t::pxReconnect) (uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr)

Start directed advertising to the device address passed this device should be already part of the white list.

On connection triggers BTConnectionCallback_t with bConnected = true.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]pxBdAddrAddress of the Remote device.
Returns
Returns eBTStatusSuccess on successful call.

◆ pxAddDevicesToWhiteList

BTStatus_t( * BTGattServerInterface_t::pxAddDevicesToWhiteList) (uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr, uint32_t ulNumberOfDevices)

Add devices to whitelist.

Triggers BTWhiteListChangedCallback_t with bIsAdded = true.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]pxBdAddrArray of addresses of Remote devices.
[in]ucNumberOfDevicesNumber of bluetooth device address passes
Returns
Returns eBTStatusSuccess on successful call.

◆ pxRemoveDevicesFromWhiteList

BTStatus_t( * BTGattServerInterface_t::pxRemoveDevicesFromWhiteList) (uint8_t ucServerIf, const BTBdaddr_t *pxBdAddr, uint32_t ulNumberOfDevices)

Remove device from whitelist and stops any ongoing directed advertisements.

Triggers BTWhiteListChangedCallback_t with bIsAdded = false.

Parameters
[in]ucServerIfServer interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call.
[in]pxBdAddrArray of addresses of Remote devices.
[in]ucNumberOfDevicesNumber of bluetooth device address passes
Returns
Returns eBTStatusSuccess on successful call.

◆ pxConfigureMtu

BTStatus_t( * BTGattServerInterface_t::pxConfigureMtu) (uint8_t ucServerIf, uint16_t usMtu)

Configure the MTU for gatt server.

Parameters
[in]ucServerIfServer interface
[in]usMtumtu that needs to be used for the gatt connection
Returns
Returns eBTStatusSuccess on successful call.

The documentation for this struct was generated from the following file: