Mistake on this page?
Report an issue in GitHub or email us
GattClient.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 
20 #ifndef MBED_GATT_CLIENT_H__
21 
22 #define MBED_GATT_CLIENT_H__
23 
24 #include "ble/common/CallChainOfFunctionPointersWithContext.h"
25 #include "ble/common/blecommon.h"
26 
27 #include "ble/gatt/GattAttribute.h"
28 #include "ble/gatt/ServiceDiscovery.h"
29 #include "ble/gatt/CharacteristicDescriptorDiscovery.h"
30 #include "ble/gatt/GattCallbackParamTypes.h"
31 #include "ble/gatt/DiscoveredService.h"
32 #include "ble/gatt/DiscoveredCharacteristic.h"
33 
34 namespace ble {
35 
36 #if !defined(DOXYGEN_ONLY)
37 namespace impl {
38 class GattClient;
39 }
40 #endif // !defined(DOXYGEN_ONLY)
41 
42 /**
43  * @addtogroup ble
44  * @{
45  * @addtogroup gatt
46  * @{
47  * @addtogroup client
48  * @{
49  */
50 
51 /**
52  * Define procedures required for interacting with a distant GATT server.
53  *
54  * @par Discovery procedures
55  *
56  * A GATT server hosts a fixed set of services. These services are a logical
57  * composition of characteristics that may be discovered, read, written or also
58  * broadcast their state to a connected client. These characteristics may also
59  * contain metainformation named characteristic descriptors. A characteristic
60  * descriptor may be used to indicate the unit used for a characteristic value,
61  * describe in a textual form the characterisic purpose or allow a client to
62  * register for notification of updates of the characteristic value.
63  *
64  * Prior to any interaction with server characteristic, a GATT client
65  * discovers the layout of the services and characteristics present on the
66  * server.
67  *
68  * The layout of the descriptors of a characteristic may also be issued to
69  * as an extra discovery step.
70  *
71  * @par Attribute manipulation
72  *
73  * As a result of the discovery process, the client can start interacting with
74  * the characteristic discovered. Depending on the characteristic properties
75  * (acquired during discovery), a client can read or write the value of a given
76  * characteristic.
77  *
78  * Mbed BLE abstracts most read and write operations to offer a single API that
79  * can be used to read or write characteristics values. Application code does not
80  * have to handle the fragmentation/reassembly process necessary if the attribute
81  * value to transported cannot fit in a single data packet.
82  *
83  * @par Server Initiated events
84  *
85  * If a characteristic has to notify or indicate a property set; then, a client may
86  * register to a notification or indication from the characteristic. When the
87  * server updates the characteristic value, the server can forward the
88  * new value to the registered clients. The notification/indication mechanism
89  * prevents polling from the client and therefore minimize the transactions
90  * involved between a client and a server.
91  *
92  * Registration is made by writing the Client Characteristic Configuration
93  * Descriptor, which is present in the characteristic if the notify or
94  * indicate properties are set. The client discovers that descriptor
95  * if it intends to register to server initiated events.
96  */
97 class GattClient {
98 public:
99  /**
100  * Definition of the general handler of GattClient related events.
101  */
102  struct EventHandler {
103  /**
104  * Function invoked when the connections changes the ATT_MTU which controls
105  * the maximum size of an attribute that can be read in a single L2CAP packet
106  * which might be fragmented across multiple packets.
107  *
108  * @param connectionHandle The handle of the connection that changed the size.
109  * @param attMtuSize
110  *
111  * @see negotiateAttMtu()
112  */
113  virtual void onAttMtuChange(
114  ble::connection_handle_t connectionHandle,
115  uint16_t attMtuSize
116  ) {
117  (void)connectionHandle;
118  (void)attMtuSize;
119  }
120  protected:
121  /**
122  * Prevent polymorphic deletion and avoid unnecessary virtual destructor
123  * as the GattClient class will never delete the instance it contains.
124  */
125  ~EventHandler() = default;
126  };
127 
128  /**
129  * Assign the event handler implementation that will be used by the
130  * module to signal events back to the application.
131  *
132  * @param handler Application implementation of an EventHandler.
133  */
134  void setEventHandler(EventHandler *handler);
135 
136  /**
137  * Attribute read event handler.
138  *
139  * @see GattClient::onDataRead().
140  * @deprecated Use the version in global ble namespace.
141  */
144 
145  /**
146  * Callchain of attribute read event handlers.
147  * @deprecated Use the version in global ble namespace.
148  */
151 
152  /**
153  * GATT write operations.
154  */
155  enum WriteOp_t {
156  /**
157  * Write request.
158  *
159  * It is used to request the server to write the value of an attribute
160  * and acknowledge that this has been achieved in a Write Response.
161  */
162  GATT_OP_WRITE_REQ = 0x01,
163 
164  /**
165  * Write command.
166  *
167  * It is used to request the server to write the value of an attribute.
168  * The server does not acknowledge the status of the operation.
169  */
170  GATT_OP_WRITE_CMD = 0x02,
171 
172  /**
173  * Signed Write command.
174  *
175  * It is used to request the server to write the value of an attribute
176  * using a signed packet. The server does not acknowledge the status
177  * of the operation.
178  */
179  GATT_OP_SIGNED_WRITE_CMD = 0x03
180  };
181 
182  /**
183  * Attribute write event handler.ble::WriteCallback_t
184  *
185  * @see GattClient::onDataWrite().
186  * @deprecated Use the version in global ble namespace.
187  */
190 
191  /**
192  * Callchain of attribute write event handlers.
193  *
194  * @see GattClient::onDataWrite().
195  * @deprecated Use the version in global ble namespace.
196  */
199 
200  /**
201  * Handle value notification/indication event handler.
202  *
203  * @see to GattClient::onHVX().
204  */
207 
208  /**
209  * Callchain of handle value notification/indication event handlers.
210  *
211  * @see GattClient::onHVX().
212  */
215 
216  /**
217  * Shutdown event handler.
218  *
219  * @see GattClient::onShutdown().
220  */
223 
224 
225  /**
226  * Callchain of shutdown event handlers.
227  *
228  * @see to GattClient::onShutown().
229  */
232 
233  /*
234  * The following functions are meant to be overridden in the platform
235  * specific subclass.
236  */
237 
238  ~GattClient() = default;
239 
240  /**
241  * Launch the service and characteristic discovery procedure of a GATT server
242  * peer.
243  *
244  * The procedure invokes application callbacks for matching services or
245  * characteristics. The process ends after all the services and
246  * characteristics present on the distant GATT server have been discovered.
247  * Termination callbacks registered with onServiceDiscoveryTermination() are
248  * invoked to notify the application of the termination of the procedure.
249  *
250  * Application code can track the status of the procedure by invoking the
251  * function isServiceDiscoveryActive(), which returns true if the
252  * procedure is ongoing.
253  *
254  * At any point, application code can prematurely terminate the discovery
255  * procedure by calling terminateServiceDiscovery().
256  *
257  * @param[in] connectionHandle Handle of the connection with the peer GATT
258  * server.
259  * @param[in] sc Service discovered event handler invoked when a matching
260  * service has been discovered. This parameter may be NULL.
261  * @param[in] cc Characteristic discovered event handler invoked when a
262  * matching characteristic has been found. This parameter may be NULL.
263  * @param[in] matchingServiceUUID UUID of the service the caller is
264  * interested in. If a service discovered matches this filter, then @p sc is
265  * invoked with it. The special value BLE_UUID_UNKNOWN acts as a wildcard,
266  * which can be used to discover all services present on the peer GATT
267  * server.
268  * @param[in] matchingCharacteristicUUIDIn UUID of the characteristic the
269  * caller is interested in. If a characteristic discovered matches this
270  * filter, then @p cc is invoked with it. The special value BLE_UUID_UNKNOWN
271  * acts as a wildcard, which can be used to discover all services present on
272  * the peer GATT server.
273  *
274  * @par Discovery procedure implementation detail
275  *
276  * It is recommended to implement several strategies based on the
277  * combination of callbacks and filters passed in input to efficiently
278  * realize the discovery procedure:
279  * - If @p sc and @p cc are NULL, then it is not necessay to initiate any
280  * discovery, and the termination handlers can be invoked immediately.
281  * - If @p matchingServiceUUID is set, then the GATT discover services by
282  * service UUID procedure should be used; otherwise, the GATT discover primary
283  * services procedure should be used.
284  * - If @p cc is NULL, then the discovery process should end after the discovery
285  * of the services.
286  *
287  * @return BLE_ERROR_NONE if the discovery procedure has been successfully
288  * started and an appropriate error otherwise.
289  */
290  ble_error_t launchServiceDiscovery(
291  ble::connection_handle_t connectionHandle,
294  const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN),
295  const UUID &matchingCharacteristicUUIDIn = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)
296  );
297 
298  /**
299  * Launch the service discovery procedure of a GATT server peer.
300  *
301  * The procedure invokes the application callback for matching services.
302  * The process ends after all the services present on the distant GATT
303  * server have been discovered.
304  * Termination callbacks registered with onServiceDiscoveryTermination() are
305  * invoked to notify the application of the termination of the procedure.
306  *
307  * Application code can track the status of the procedure by invoking the
308  * function isServiceDiscoveryActive(), which returns true if the
309  * procedure is ongoing.
310  *
311  * At any point, application code can prematurely terminate the discovery
312  * procedure by calling terminateServiceDiscovery().
313  *
314  * @param[in] connectionHandle Handle of the connection with the peer GATT
315  * server.
316  * @param[in] callback Service discovered event handler invoked when a
317  * matching service has been discovered. This parameter may be NULL.
318  * @param[in] matchingServiceUUID UUID of the service the caller is
319  * interested in. If a service discovered matches this filter, then @p sc is
320  * invoked with it. The special value BLE_UUID_UNKNOWN act is a wildcard,
321  * which can be used to discover all services present on the peer GATT
322  * server.
323  *
324  * @return BLE_ERROR_NONE if the discovery procedure has been successfully
325  * started and an appropriate error otherwise.
326  */
327  ble_error_t discoverServices(
328  ble::connection_handle_t connectionHandle,
330  const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)
331  );
332 
333  /**
334  * Launch the service discovery procedure of a GATT server peer.
335  *
336  * The process ends after all the services present in the attribute range @p
337  * startHandle to @p endHandle have been discovered.
338  *
339  * Termination callbacks registered with onServiceDiscoveryTermination() are
340  * invoked to notify the application of the termination of the procedure.
341  *
342  * Application code can track the status of the procedure by invoking the
343  * function isServiceDiscoveryActive(), which returns true if the
344  * procedure is ongoing.
345  *
346  * At any point, application code can prematurely terminate the discovery
347  * procedure by calling terminateServiceDiscovery().
348  *
349  * @param[in] connectionHandle Handle of the connection with the peer GATT
350  * server.
351  * @param[in] callback Service discovered event handler invoked when a
352  * matching service has been discovered. This parameter may be NULL.
353  * @param[in] startHandle First attribute handle of the discovery range.
354  * @param[in] endHandle end Lasr attribute handle of the discovery range.
355  *
356  * @return BLE_ERROR_NONE if the discovery procedure has been successfully
357  * started and an appropriate error otherwise.
358  */
359  ble_error_t discoverServices(
360  ble::connection_handle_t connectionHandle,
362  GattAttribute::Handle_t startHandle,
363  GattAttribute::Handle_t endHandle
364  );
365 
366  /**
367  * Check if the service discovery procedure is currently active.
368  *
369  * @return true if service discovery procedure is active and false otherwise.
370  */
371  bool isServiceDiscoveryActive() const;
372 
373  /**
374  * Terminate all ongoing service discovery procedures.
375  *
376  * It results in an invocation of the service discovery termination handler
377  * registered with onServiceDiscoveryTermination().
378  */
379  void terminateServiceDiscovery();
380 
381  /**
382  * Initiate the read procedure of an attribute handle.
383  *
384  * Once the attribute value has been read in its entirety, the process issues
385  * an attribute read event and passes it to all events handlers registered
386  * by onDataRead.
387  *
388  * @param[in] connHandle Handle of the connection used to send the read
389  * request.
390  * @param[in] attributeHandle Handle of the attribute to read data from.
391  * @param[in] offset The offset from the start of the attribute value to be
392  * read.
393  *
394  * @return BLE_ERROR_NONE if read procedure successfully started.
395  *
396  * @par Implementation notes:
397  *
398  * Reading the attribute value in its entirety may involve sending several
399  * GATT requests to the peer. The following algorithm may be used to
400  * implement the process:
401  *
402  * If the offset is equal to 0, then send a read request; otherwise, send a
403  * read blob request at the specified offset.
404  *
405  * While the attribute data in the response are MTU - 1 long:
406  * - Concat the response to the value containing the previous responses.
407  * - Increment the value of the offset by MTU - 1.
408  * - Send a read blob request with the updated offset.
409  *
410  * Finally, concat the last response with the value containing all the
411  * previous responses and forward that value to the event handlers.
412  */
413  ble_error_t read(
414  ble::connection_handle_t connHandle,
415  GattAttribute::Handle_t attributeHandle,
416  uint16_t offset
417  ) const;
418 
419  /**
420  * Initiate a write procedure on an attribute value.
421  *
422  * If @p cmd is equal to GATT_OP_WRITE_REQ, then the status of the operation
423  * is reported to the event handlers registered through onDataWritten().
424  *
425  * @param[in] cmd Type of the write procedure used. If GATT_OP_WRITE_CMD
426  * is set, then value length is not greater than the size of the mtu
427  * of connHandle minus three.
428  * @param[in] connHandle Handle of the connection used to send the write
429  * request or command.
430  * @param[in] attributeHandle Handle of the attribute value to write.
431  * @param[in] length Number of bytes present in @p value.
432  * @param[in] value Data buffer to write to attributeHandle.
433  *
434  * @return BLE_ERROR_NONE if the write procedure successfully started.
435  *
436  * @par Implementation notes:
437  *
438  * If the operation is a write command, then an implementation uses the
439  * GATT write without response procedure and an error is returned if
440  * the data buffer to write is larger than the size of the MTU - 3.
441  *
442  * If the operation is a write command and the size of the data buffer to
443  * write is less than than the size of the MTU - 3, then the ATT write request
444  * procedure is used, and the response is reported to the handlers
445  * listening for write response.
446  *
447  * Otherwise, the data buffer to write is divided in chunks with a
448  * maximum size of MTU - 5. Those chunks are sent sequentially to the
449  * peer in ATT prepare write requests. If an error response is received
450  * during the process, the procedure ends immediately, the prepared
451  * write is discarded and an error is reported to the application handlers.
452  * Once all the chunks have been sent, the transaction is completed
453  * by sending an execute write request to the peer. The peer response is
454  * forwarded to the application handlers.
455  */
456  ble_error_t write(
458  ble::connection_handle_t connHandle,
459  GattAttribute::Handle_t attributeHandle,
460  size_t length,
461  const uint8_t *value
462  ) const;
463 
464  /* Event callback handlers. */
465 
466  /**
467  * Register an attribute read event handler.
468  *
469  * @note It is possible to unregister a callback using
470  * onDataRead().detach(callbackToRemove).
471  *
472  * @param[in] callback Event handler being registered.
473  */
474  void onDataRead(ble::ReadCallback_t callback);
475 
476  /**
477  * Get the callchain of attribute read event handlers.
478  *
479  * @return A reference to the read event callback chain.
480  *
481  * @note It is possible to register new handlers using
482  * onDataRead().add(callback).
483  *
484  * @note It is possible to unregister an handler by using
485  * onDataRead().detach(callback).
486  */
487  ble::ReadCallbackChain_t& onDataRead();
488 
489  /**
490  * Register an attribute write event handler.
491  *
492  * @param[in] callback Event handler being registered.
493  *
494  * @note It is possible to remove registered handlers using
495  * onDataWritten().detach(callbackToRemove).
496  *
497  * @note Write commands (issued using writeWoResponse) don't generate a
498  * response.
499  */
500  void onDataWritten(ble::WriteCallback_t callback);
501 
502  /**
503  * Get the callchain of attribute write event handlers.
504  *
505  * @return A reference to the data written callbacks chain.
506  *
507  * @note It is possible to register new handlers by using
508  * onDataWritten().add(callback).
509  *
510  * @note It is possible to unregister an handler by using
511  * onDataWritten().detach(callback).
512  */
513  ble::WriteCallbackChain_t& onDataWritten();
514 
515  /**
516  * Register a service discovery termination event handler.
517  *
518  * @param[in] callback Event handler being registered.
519  */
520  void onServiceDiscoveryTermination(
522  );
523 
524  /**
525  * Initiate the descriptor discovery procedure for a given characteristic.
526  *
527  * When a descriptor is discovered the discovered descriptor is forwarded
528  * to @p discoveryCallback. After the discovery of all the descriptors, the
529  * procedure ends and send a descriptor discovery termination event to @p
530  * termination callback.
531  *
532  * Application code may monitor the discovery process by querying its status
533  * with isCharacteristicDescriptorDiscoveryActive(). It can also end the
534  * discovery process by calling terminateCharacteristicDescriptorDiscovery().
535  *
536  * @param[in] characteristic The characteristic owning the descriptors to
537  * discover.
538  * @param[in] discoveryCallback Handle descriptor discovered events for the
539  * duration of the procedure.
540  * @param[in] terminationCallback Handle descriptor discovery termination
541  * event of the procedure.
542  *
543  * @return BLE_ERROR_NONE if the characteristic descriptor discovery
544  * procedure has been launched successfully otherwise an appropriate error.
545  */
546  ble_error_t discoverCharacteristicDescriptors(
547  const DiscoveredCharacteristic& characteristic,
550  );
551 
552  /**
553  * Query status of the descriptor discovery procedure for a given
554  * characteristic.
555  *
556  * @param[in] characteristic The characteristic concerned by the descriptors
557  * discovery.
558  *
559  * @return true if a descriptors discovery is active for the characteristic
560  * in input otherwise false.
561  */
562  bool isCharacteristicDescriptorDiscoveryActive(
563  const DiscoveredCharacteristic& characteristic
564  ) const;
565 
566  /**
567  * @brief Terminate an ongoing characteristic descriptor discovery procedure.
568  *
569  * If the procedure is active, then it ends, and the termination handler
570  * associated with the procedure is called.
571  *
572  * @param[in] characteristic The characteristic containing the descriptors
573  * being discovered.
574  */
575  void terminateCharacteristicDescriptorDiscovery(
576  const DiscoveredCharacteristic& characteristic
577  );
578 
579  /**
580  * Trigger MTU negotiation. This might result in a Gap event onAttMtuChange
581  * being called if MTU changes.
582  *
583  * @note This does not guarantee a change in MTU size. If size remains
584  * unchanged no event will be generated.
585  *
586  * @param connection Connection on which the MTU is to be negotiated.
587  *
588  * @return BLE_ERROR_NONE if the procedure has been launched successfully
589  * otherwise an appropriate error.
590  */
591  ble_error_t negotiateAttMtu(ble::connection_handle_t connection);
592 
593  /**
594  * Register an handler for Handle Value Notification/Indication events.
595  *
596  * @param callback Event handler to register.
597  *
598  * @note It is possible to unregister a callback by using
599  * onHVX().detach(callbackToRemove).
600  */
601  void onHVX(HVXCallback_t callback);
602 
603  /**
604  * Register a shutdown event handler.
605  *
606  * The registered handler is invoked when the GattClient instance is
607  * about to be shut down.
608  *
609  * @param[in] callback Event handler to invoke when a shutdown event is
610  * available.
611  *
612  * @note onShutdown().detach(callback) may be used to unregister a given
613  * callback.
614  *
615  * @see BLE::shutdown()
616  */
617  void onShutdown(const GattClientShutdownCallback_t& callback);
618 
619  /**
620  * Register a shutdown event handler.
621  *
622  * The registered handler is invoked when the GattClient instance is
623  * about to be shut down.
624  *
625  * @param[in] objPtr Instance that will be used to invoke @p memberPtr.
626  * @param[in] memberPtr Event handler to invoke when a shutdown event is
627  * available.
628  */
629  template <typename T>
630  void onShutdown(T *objPtr, void (T::*memberPtr)(const GattClient *))
631  {
632  onShutdown({objPtr, memberPtr});
633  }
634 
635  /**
636  * Get the callchain of shutdown event handlers.
637  *
638  * @return A reference to the shutdown event callbacks chain.
639  *
640  * @note onShutdown().add(callback) may be used to register new handlers.
641  *
642  * @note onShutdown().detach(callback) may be used to unregister an handler.
643  */
644  GattClientShutdownCallbackChain_t& onShutdown();
645 
646  /**
647  * @brief provide access to the callchain of HVX callbacks.
648  *
649  * @return A reference to the HVX callbacks chain.
650  *
651  * @note It is possible to register callbacks using onHVX().add(callback).
652  *
653  * @note It is possible to unregister callbacks using onHVX().detach(callback).
654  */
655  HVXCallbackChain_t& onHVX();
656 
657  /**
658  * Reset the state of the GattClient instance.
659  *
660  * Prior to any state modification, shutdown event handlers are notified
661  * that the GattClient instance is about to be shut down. Then, running
662  * procedures end. Finally, the state of the instance is reset.
663  *
664  * @par implementation note
665  *
666  * This function is meant to be overridden in the platform-specific
667  * subclass. Nevertheless, the subclass only resets its
668  * state and not the data held in GattClient members. This is achieved
669  * by a call to GattClient::reset() from the subclass' reset()
670  * implementation.
671  *
672  * @return BLE_ERROR_NONE on success.
673  */
674  ble_error_t reset();
675 
676  /* Entry points for the underlying stack to report events back to the user. */
677 
678  /**
679  * Forward an attribute read event to all registered handlers.
680  *
681  * @attention This function is meant to be called from the vendor
682  * implementation when an attribute read event occurs.
683  *
684  * @param[in] params Attribute read event to pass to the registered handlers.
685  */
686  void processReadResponse(const GattReadCallbackParams *params);
687 
688  /**
689  * Forward an attribute written event to all registered handlers.
690  *
691  * @attention This function is meant to be called from the vendor
692  * implementation when an attribute written event occurs.
693  *
694  * @param[in] params Attribute written event to pass to the registered
695  * handlers.
696  */
697  void processWriteResponse(const GattWriteCallbackParams *params);
698 
699  /**
700  * Forward a handle value notification or indication event to all registered
701  * handlers.
702  *
703  * @attention This function is meant to be called from the vendor
704  * implementation when a notification or indication event is available.
705  *
706  * @param[in] params Notification or Indication event to pass to the
707  * registered handlers.
708  */
709  void processHVXEvent(const GattHVXCallbackParams *params);
710 
711 #if !defined(DOXYGEN_ONLY)
712  GattClient(impl::GattClient* impl) : impl(impl) { }
713  GattClient(const GattClient&) = delete;
714  GattClient& operator=(const GattClient&) = delete;
715 #endif // !defined(DOXYGEN_ONLY)
716 
717 private:
718  impl::GattClient *impl;
719 };
720 
721 /**
722  * @}
723  * @}
724  * @}
725  */
726 
727 } // namespace ble
728 
729 /** @deprecated Use the namespaced ble::GattClient instead of the global GattClient. */
730 using ble::GattClient;
731 
732 #endif /* ifndef MBED_GATT_CLIENT_H__ */
Function like object adapter over freestanding and member functions.
Definition of the general handler of GattClient related events.
Definition: GattClient.h:102
FunctionPointerWithContext< const GattClient * > GattClientShutdownCallback_t
Shutdown event handler.
Definition: GattClient.h:222
uintptr_t connection_handle_t
Opaque reference to a connection.
Representation of a characteristic discovered.
Handle Value Notification/Indication event.
CallChainOfFunctionPointersWithContext< const GattReadCallbackParams * > ReadCallbackChain_t
Callchain of attribute read event handlers.
Definition: GattClient.h:150
CallChainOfFunctionPointersWithContext< const GattWriteCallbackParams * > WriteCallbackChain_t
Callchain of attribute write event handlers.
Definition: GattClient.h:198
Callback< R(ArgTs...)> callback(R(*func)(ArgTs...)=nullptr) noexcept
Create a callback class with type inferred from the arguments.
Definition: Callback.h:678
Representation of a Universally Unique Identifier (UUID).
Definition: common/UUID.h:76
FunctionPointerWithContext< const GattHVXCallbackParams * > HVXCallback_t
Handle value notification/indication event handler.
Definition: GattClient.h:206
ble::attribute_handle_t Handle_t
Representation of an attribute handle.
FunctionPointerWithContext< const GattWriteCallbackParams * > WriteCallback_t
Attribute write event handler.ble::WriteCallback_t.
Definition: GattClient.h:189
GATT Write event definition.
void onShutdown(T *objPtr, void(T::*memberPtr)(const GattClient *))
Register a shutdown event handler.
Definition: GattClient.h:630
uint16_t ShortUUIDBytes_t
Type for a 16-bit UUID.
Definition: common/UUID.h:114
GATT Read event definition.
WriteOp_t
GATT write operations.
Definition: GattClient.h:155
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: GattClient.h:113
Define procedures required for interacting with a distant GATT server.
Definition: GattClient.h:97
CallChainOfFunctionPointersWithContext< const GattClient * > GattClientShutdownCallbackChain_t
Callchain of shutdown event handlers.
Definition: GattClient.h:231
Function like object hosting a list of FunctionPointerWithContext.
Reserved UUID.
FunctionPointerWithContext< const GattReadCallbackParams * > ReadCallback_t
Attribute read event handler.
Definition: GattClient.h:143
Entry namespace for all BLE API definitions.
CallChainOfFunctionPointersWithContext< const GattHVXCallbackParams * > HVXCallbackChain_t
Callchain of handle value notification/indication event handlers.
Definition: GattClient.h:214
ble_error_t
Error codes for the BLE API.
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.