@@ -95,6 +95,10 @@ namespace ble {
95
95
* the nature of the server initiated is not relevant.
96
96
*/
97
97
#if !defined(DOXYGEN_ONLY)
98
+ namespace impl {
99
+ class GattServer ;
100
+ }
101
+
98
102
namespace interface {
99
103
#endif // !defined(DOXYGEN_ONLY)
100
104
class GattServer {
@@ -415,7 +419,10 @@ class GattServer {
415
419
* function.
416
420
*/
417
421
template <typename T>
418
- void onDataSent (T *objPtr, void (T::*memberPtr)(unsigned count));
422
+ void onDataSent (T *objPtr, void (T::*memberPtr)(unsigned count))
423
+ {
424
+ onDataSent ({objPtr, memberPtr});
425
+ }
419
426
420
427
/* *
421
428
* Access the callchain of data sent event handlers.
@@ -448,7 +455,10 @@ class GattServer {
448
455
void onDataWritten (
449
456
T *objPtr,
450
457
void (T::*memberPtr)(const GattWriteCallbackParams *context)
451
- );
458
+ )
459
+ {
460
+ onDataWritten ({objPtr, memberPtr});
461
+ }
452
462
453
463
/* *
454
464
* Access the callchain of data written event handlers.
@@ -495,7 +505,10 @@ class GattServer {
495
505
ble_error_t onDataRead (
496
506
T *objPtr,
497
507
void (T::*memberPtr)(const GattReadCallbackParams *context)
498
- );
508
+ )
509
+ {
510
+ onDataRead ({objPtr, memberPtr});
511
+ }
499
512
500
513
/* *
501
514
* Access the callchain of data read event handlers.
@@ -537,7 +550,10 @@ class GattServer {
537
550
* function.
538
551
*/
539
552
template <typename T>
540
- void onShutdown (T *objPtr, void (T::*memberPtr)(const GattServer *));
553
+ void onShutdown (T *objPtr, void (T::*memberPtr)(const GattServer *))
554
+ {
555
+ onShutdown ({objPtr, memberPtr});
556
+ }
541
557
542
558
/* *
543
559
* Access the callchain of shutdown event handlers.
@@ -578,72 +594,8 @@ class GattServer {
578
594
*/
579
595
void onConfirmationReceived (EventCallback_t callback);
580
596
581
- /* Entry points for the underlying stack to report events back to the user. */
582
- protected:
583
- /* *
584
- * Helper function that notifies all registered handlers of an occurrence
585
- * of a data written event.
586
- *
587
- * @attention Vendor implementation must invoke this function after one of
588
- * the GattServer attributes has been written.
589
- *
590
- * @param[in] params The data written parameters passed to the registered
591
- * handlers.
592
- */
593
- void handleDataWrittenEvent (const GattWriteCallbackParams *params);
594
-
595
- /* *
596
- * Helper function that notifies all registered handlers of an occurrence
597
- * of a data read event.
598
- *
599
- * @attention Vendor implementation must invoke this function after one of
600
- * the GattServer attributes has been read.
601
- *
602
- * @param[in] params The data read parameters passed to the registered
603
- * handlers.
604
- */
605
- void handleDataReadEvent (const GattReadCallbackParams *params);
606
-
607
- /* *
608
- * Helper function that notifies the registered handler of an occurrence
609
- * of updates enabled, updates disabled or confirmation received events.
610
- *
611
- * @attention Vendor implementation must invoke this function when a client
612
- * subscribes to characteristic updates, unsubscribes from characteristic
613
- * updates or a notification confirmation has been received.
614
- *
615
- * @param[in] type The type of event that occurred.
616
- * @param[in] attributeHandle The handle of the attribute concerned by the
617
- * event.
618
- */
619
- void handleEvent (
620
- GattServerEvents::gattEvent_e type,
621
- GattAttribute::Handle_t attributeHandle
622
- );
623
-
624
- /* *
625
- * Helper function that notifies all registered handlers of an occurrence
626
- * of a data sent event.
627
- *
628
- * @attention Vendor implementation must invoke this function after the
629
- * emission of a notification or an indication.
630
- *
631
- * @param[in] count Number of packets sent.
632
- */
633
- void handleDataSentEvent (unsigned count);
634
-
635
- /* *
636
- * Get preferred connection paramters.
637
- *
638
- */
639
- Gap::PreferredConnectionParams_t getPreferredConnectionParams ();
640
-
641
- /* *
642
- * Set preferred connection parameters.
643
- *
644
- * @param[in] params Preferred connection parameter values to set.
645
- */
646
- void setPreferredConnectionParams (const Gap::PreferredConnectionParams_t& params);
597
+ private:
598
+ impl::GattServer *impl;
647
599
};
648
600
649
601
/* *
@@ -655,13 +607,16 @@ class GattServer {
655
607
#if !defined(DOXYGEN_ONLY)
656
608
} // namespace interface
657
609
#endif // !defined(DOXYGEN_ONLY)
610
+
611
+ using ble::interface::GattServer;
612
+
658
613
} // ble
659
614
660
615
/* This includes the concrete class implementation, to provide a an alternative API implementation
661
616
* disable ble-api-implementation and place your header in a path with the same structure */
662
- #include " ble/internal/GattServerImpl.h"
617
+ // #include "ble/internal/GattServerImpl.h"
663
618
664
619
/* * @deprecated Use the namespaced ble::GattServer instead of the global GattServer. */
665
- using ble::GattServer;
620
+ using ble::interface:: GattServer;
666
621
667
622
#endif /* ifndef MBED_GATT_SERVER_H__ */
0 commit comments