Mbed OS Reference
Loading...
Searching...
No Matches
ChainableGattServerEventHandler.h
1/* mbed Microcontroller Library
2 * Copyright (c) 2006-2020 ARM Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef MBED_CHAINABLEGATTSERVEREVENTHANDLER_H_
20#define MBED_CHAINABLEGATTSERVEREVENTHANDLER_H_
21
22#include "ble/GattServer.h"
23#include "ble/common/ChainableEventHandler.h"
24
25/**
26 * GattServer::EventHandler implementation that allows the application
27 * to register multiple separate EventHandlers to be called when
28 * GattServer events happen.
29 */
31 public ChainableEventHandler<ble::GattServer::EventHandler>
32{
33
34public:
35
37
39
40 void onAttMtuChange(ble::connection_handle_t connectionHandle, uint16_t attMtuSize) override {
42 connectionHandle, attMtuSize);
43 }
44
45 void onDataSent(const GattDataSentCallbackParams &params) override {
46 execute_on_all(&ble::GattServer::EventHandler::onDataSent, params);
47 }
48
49 void onDataWritten(const GattWriteCallbackParams &params) override {
50 execute_on_all(&ble::GattServer::EventHandler::onDataWritten, params);
51 }
52
53 void onDataRead(const GattReadCallbackParams &params) override {
54 execute_on_all(&ble::GattServer::EventHandler::onDataRead, params);
55 }
56
57 void onShutdown(const GattServer &server) override {
58 execute_on_all(&ble::GattServer::EventHandler::onShutdown, server);
59 }
60
63 }
64
67 }
68
71 }
72
73};
74
75#endif /* MBED_CHAINABLEGATTSERVEREVENTHANDLER_H_ */
Base class for chainable EventHandlers.
GattServer::EventHandler implementation that allows the application to register multiple separate Eve...
void onShutdown(const GattServer &server) override
Function invoked when the GattServer instance is about to be shut down.
void onDataRead(const GattReadCallbackParams &params) override
Function invoked when a client reads an attribute.
void onUpdatesEnabled(const GattUpdatesEnabledCallbackParams &params) override
Function invoked when the client has subscribed to characteristic updates.
void onDataSent(const GattDataSentCallbackParams &params) override
Function invoked when the server has sent data to a client.
void onAttMtuChange(ble::connection_handle_t connectionHandle, uint16_t attMtuSize) override
Function invoked when the connections changes the ATT_MTU which controls the maximum size of an attri...
void onUpdatesDisabled(const GattUpdatesDisabledCallbackParams &params) override
Function invoked when the client has unsubscribed from characteristic updates.
void onConfirmationReceived(const GattConfirmationReceivedCallbackParams &params) override
Event not used.
void onDataWritten(const GattWriteCallbackParams &params) override
Function invoked when a client writes an attribute.
Construct and operates a GATT server.
Definition: GattServer.h:102
uintptr_t connection_handle_t
Opaque reference to a connection.
Gatt Data Sent Attribute related events.
GATT Read event definition.
Gatt Updates Changed Attribute related events.
GATT Write event definition.
Definition of the general handler of GattServer related events.
Definition: GattServer.h:107
virtual void onShutdown(const GattServer &server)
Function invoked when the GattServer instance is about to be shut down.
Definition: GattServer.h:169
virtual void onDataWritten(const GattWriteCallbackParams &params)
Function invoked when a client writes an attribute.
Definition: GattServer.h:144
virtual void onAttMtuChange(ble::connection_handle_t connectionHandle, uint16_t attMtuSize)
Function invoked when the connections changes the ATT_MTU which controls the maximum size of an attri...
Definition: GattServer.h:118
virtual void onDataRead(const GattReadCallbackParams &params)
Function invoked when a client reads an attribute.
Definition: GattServer.h:161
virtual void onConfirmationReceived(const GattConfirmationReceivedCallbackParams &params)
Event not used.
Definition: GattServer.h:201
virtual void onDataSent(const GattDataSentCallbackParams &params)
Function invoked when the server has sent data to a client.
Definition: GattServer.h:134
virtual void onUpdatesDisabled(const GattUpdatesDisabledCallbackParams &params)
Function invoked when the client has unsubscribed from characteristic updates.
Definition: GattServer.h:189
virtual void onUpdatesEnabled(const GattUpdatesEnabledCallbackParams &params)
Function invoked when the client has subscribed to characteristic updates.
Definition: GattServer.h:179