BlueToe
an alternative GATT/BLE implementation
Loading...
Searching...
No Matches
change_advertising_example.cpp

This example demonstrates how to change the advertising type. The link layer is configured to support two different advertising types (bluetoe::link_layer::connectable_undirected_advertising and bluetoe::link_layer::connectable_directed_advertising). Now, the change_advertising() function can be used to switch between both advertising types.

#include <bluetoe/server.hpp>
#include <bluetoe/bindings/nrf52.hpp>
static std::uint8_t write_handler( bool flag );
using gatt = bluetoe::server<
>
>
>;
gatt,
> link_layer;
static std::uint8_t write_handler( bool flag )
{
// change the advertising type according to the give flag value
if ( flag )
{
}
else
{
bluetoe::link_layer::random_device_address( { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 } ) );
}
}
A characteristic is a typed value that is accessable by a GATT client hosted by a GATT server.
Definition: characteristic.hpp:160
Root of the declaration of a GATT server.
Definition: server.hpp:85
a 128-Bit UUID used to identify a service.
Definition: service.hpp:57
a service with zero or more characteristics
Definition: service.hpp:150
@ success
Definition: codes.hpp:154
typename nrf52_details::link_layer_factory< Server, details::requires_encryption_support_t< Server >::value, typename nrf52_details::radio_options< Options... >::result, typename nrf52_details::link_layer_options< Options... >::result >::link_layer nrf52
binding for nRF52 microcontrollers
Definition: nrf52.hpp:988
binds a free function as a write handler for the given characteristic
Definition: characteristic_value.hpp:1253