FreeRTOS:
BLE
BLE
|
Return to main page ↑ |
#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... | |
Represents the standard BT-GATT server interface.
BTStatus_t( * BTGattServerInterface_t::pxRegisterServer) (BTUuid_t *pxUuid) |
Registers a GATT server application with the stack.
Triggers BTRegisterServerCallback_t.
[in] | pxUuid | Server UUID. |
BTStatus_t( * BTGattServerInterface_t::pxUnregisterServer) (uint8_t ucServerIf) |
Unregister a server application from the stack.
Triggers BTUnregisterServerCallback_t.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
BTStatus_t( * BTGattServerInterface_t::pxGattServerInit) (const BTGattServerCallbacks_t *pxCallbacks) |
Initializes the interface and provides callback routines.
[in] | pxCallbacks | Initialized callbacks for GAT server. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | pxBdAddr | Address of the Remote device. |
[in] | bIsDirect | Set to True for direct connection. |
[in] | xTransport | Specify if BLE and BT classic is being used. |
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)"
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | pxBdAddr | Address of the Remote device. |
[in] | usConnId | Connection Identifier, created and return on connection event, when BTConnectionCallback_t is invoked. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in,out] | pxService | GATT Service structure. When pxAddServiceBlob returns, pxService->pusHandlesBuffer is filled with corresponding attribute handles. |
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
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | pxSrvcId | Service ID, returned on BTServiceAddedCallback_t after calling pxAddService. |
[in] | usNumHandles | Number of handles in the service. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | usServiceHandle | Handle of the service containing the attributes. |
[in] | usIncludedHandle | Handle of the included service. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | usServiceHandle | Handle of the service containing the attributes. |
[in] | pxUuid | UUID of the attribute. |
[in] | xProperties | Properties of the characteristic. |
[in] | xPermissions | Permission to read/write the characteristic. |
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.
[in] | pxValue | APP response. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | usServiceHandle | Handle of the service containing the attributes. |
[in] | pxUuid | UUID of the attribute. |
[in] | ulPermissions | Permissions to read/write the descriptor. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | usServiceHandle | Handle of the service containing the attributes. |
[in] | xTransport | Specify if BLE and BT classic is being used. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | usServiceHandle | Handle of the service containing the attributes. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | usServiceHandle | Handle of the service containing the attributes. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | usAttributeHandle. | |
[in] | usConnId | Connection Identifier, created and return on connection event, when BTConnectionCallback_t is invoked. |
[in] | xLen | Data length. |
[in] | pucValue | Data. |
[in] | bConfirm | True for indication, false for notification. |
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.
[in] | usConnId | Connection Identifier, created and return on connection event, when BTConnectionCallback_t is invoked. |
[in] | ulTransId. | Transaction ID |
[in] | xStatus | Status returned by the APP. |
[in] | pxResponse | APP response. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | pxBdAddr | Address of the Remote device. |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | pxBdAddr | Array of addresses of Remote devices. |
[in] | ucNumberOfDevices | Number of bluetooth device address passes |
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.
[in] | ucServerIf | Server interface, return on the callback BTRegisterServerCallback_t after successful pxRegisterServer call. |
[in] | pxBdAddr | Array of addresses of Remote devices. |
[in] | ucNumberOfDevices | Number of bluetooth device address passes |
BTStatus_t( * BTGattServerInterface_t::pxConfigureMtu) (uint8_t ucServerIf, uint16_t usMtu) |
Configure the MTU for gatt server.
[in] | ucServerIf | Server interface |
[in] | usMtu | mtu that needs to be used for the gatt connection |