Mistake on this page?
Report an issue in GitHub or email us
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 
34 public:
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 
61  void onUpdatesEnabled(const GattUpdatesEnabledCallbackParams &params) override {
62  execute_on_all(&ble::GattServer::EventHandler::onUpdatesEnabled, params);
63  }
64 
66  execute_on_all(&ble::GattServer::EventHandler::onUpdatesDisabled, params);
67  }
68 
71  }
72 
73 };
74 
75 #endif /* MBED_CHAINABLEGATTSERVEREVENTHANDLER_H_ */
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...
Construct and operates a GATT server.
Definition: GattServer.h:102
void onDataRead(const GattReadCallbackParams &params) override
Function invoked when a client reads an attribute.
uintptr_t connection_handle_t
Opaque reference to a connection.
void onDataSent(const GattDataSentCallbackParams &params) override
Function invoked when the server has sent data to a client as part of a notification/indication.
virtual void onConfirmationReceived(const GattConfirmationReceivedCallbackParams &params)
Function invoked when an ACK has been received for an indication sent to the client.
Definition: GattServer.h:197
void onUpdatesDisabled(const GattUpdatesDisabledCallbackParams &params) override
Function invoked when the client has unsubscribed to characteristic updates.
virtual void onDataWritten(const GattWriteCallbackParams &params)
Function invoked when a client writes an attribute.
Definition: GattServer.h:141
void onDataWritten(const GattWriteCallbackParams &params) override
Function invoked when a client writes an attribute.
virtual void onDataSent(const GattDataSentCallbackParams &params)
Function invoked when the server has sent data to a client as part of a notification/indication.
Definition: GattServer.h:131
void onShutdown(const GattServer &server) override
Function invoked when the GattServer instance is about to be shut down.
Gatt Data Sent Attribute related events.
virtual void onUpdatesEnabled(const GattUpdatesEnabledCallbackParams &params)
Function invoked when the client has subscribed to characteristic updates.
Definition: GattServer.h:176
virtual void onDataRead(const GattReadCallbackParams &params)
Function invoked when a client reads an attribute.
Definition: GattServer.h:158
Definition of the general handler of GattServer related events.
Definition: GattServer.h:107
GATT Write event definition.
Base class for chainable EventHandlers.
GATT Read event definition.
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:116
void onUpdatesEnabled(const GattUpdatesEnabledCallbackParams &params) override
Function invoked when the client has subscribed to characteristic updates.
Gatt Updates Changed Attribute related events.
void onConfirmationReceived(const GattConfirmationReceivedCallbackParams &params) override
Function invoked when an ACK has been received for an indication sent to the client.
virtual void onUpdatesDisabled(const GattUpdatesDisabledCallbackParams &params)
Function invoked when the client has unsubscribed to characteristic updates.
Definition: GattServer.h:186
GattServer::EventHandler implementation that allows the application to register multiple separate Eve...
virtual void onShutdown(const GattServer &server)
Function invoked when the GattServer instance is about to be shut down.
Definition: GattServer.h:166
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.