-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #36 ble::profile::connectable: add gatts, gattc classes struct ble::profile::connectable::gatts Aggregates ble::gatts::event_observer ble::gatts::operations. struct ble::profile::connectable::gattc Aggregates ble::gatts::event_observer, ble::gatts::operations, ble::gattc::service_builder. Instead of registering each observer, wrapped in a nordic observer template, with each nodic BLE event observable register just the object ble::profile::connectable with the BLE stack events.
- Loading branch information
Showing
18 changed files
with
1,414 additions
and
1,381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* @file ble/gap_event_observable.h | ||
* @copyright (c) 2018, natersoz. Distributed under the Apache 2.0 license. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "ble/gap_event_observer.h" | ||
|
||
namespace ble | ||
{ | ||
namespace gap | ||
{ | ||
|
||
class event_observable | ||
{ | ||
virtual ~event_observable() = default; | ||
|
||
event_observable() = default; | ||
event_observable(event_observable const&) = delete; | ||
event_observable(event_observable &&) = delete; | ||
event_observable& operator=(event_observable const&) = delete; | ||
event_observable& operator=(event_observable&&) = delete; | ||
|
||
void attach(event_observer& observer) | ||
{ | ||
if (not observer.hook.is_linked()) | ||
{ | ||
this->observer_list.push_back(observer); | ||
} | ||
} | ||
|
||
void attach_first(event_observer& observer) | ||
{ | ||
if (not observer.hook.is_linked()) | ||
{ | ||
this->observer_list.push_front(observer); | ||
} | ||
} | ||
|
||
void detach(event_observer& observer) | ||
{ | ||
if (observer.hook.is_linked()) | ||
{ | ||
observer.hook.unlink(); | ||
} | ||
} | ||
|
||
private: | ||
using list_type = boost::intrusive::list< | ||
event_observer, | ||
boost::intrusive::constant_time_size<false>, | ||
boost::intrusive::member_hook< | ||
event_observer, | ||
typename event_observer::list_hook_type, | ||
&event_observer::hook> | ||
>; | ||
|
||
list_type observer_list; | ||
}; | ||
|
||
} // namespace gap | ||
} // namespace ble | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.