BlueToe
an alternative GATT/BLE implementation
Public Types | Public Member Functions | List of all members
bluetoe::server< Options > Class Template Reference

Root of the declaration of a GATT server. More...

#include <bluetoe/server.hpp>

Public Types

using connection_data = details::link_state< details::client_characteristic_configurations< number_of_client_configs > >
 per connection data More...
 

Public Member Functions

 server ()
 a server takes no runtime construction parameters
 
template<class T >
bool notify (const T &value)
 notifies all connected clients about this value More...
 
template<class CharacteristicUUID >
bool notify ()
 
template<class T >
bool indicate (const T &value)
 sends indications to all connceted clients. More...
 
template<class CharacteristicUUID >
bool indicate ()
 sends indications to all connceted clients. More...
 
template<class CharacteristicUUID >
bool configured_for_indications (const details::client_characteristic_configuration &) const
 returns true, if the given connection is configured to send indications for the given characteristic
 
template<class CharacteristicUUID >
bool configured_for_notifications (const details::client_characteristic_configuration &) const
 returns true, if the given connection is configured to send notifications for the given characteristic
 
template<class CharacteristicUUID >
bool configured_for_notifications_or_indications (const details::client_characteristic_configuration &) const
 returns true, if the given connection is configured to send indications or notifications for the given characteristic
 

Detailed Description

template<typename ... Options>
class bluetoe::server< Options >

Root of the declaration of a GATT server.

The server serves one or more services configured by the given Options. To configure the server, pass one or more bluetoe::service types as parameters.

example:

unsigned temperature_value = 0;
bluetoe::bind_characteristic_value< decltype( temperature_value ), &temperature_value >,
>
>
> small_temperature_service;
See also
service
shared_write_queue
extend_server
server_name
appearance
requires_encryption
Examples
change_advertising_example.cpp, include_example.cpp, priorities_example.cpp, read_write_handler_example.cpp, and server_example.cpp.

Member Typedef Documentation

◆ connection_data

template<typename ... Options>
using bluetoe::server< Options >::connection_data = details::link_state< details::client_characteristic_configurations< number_of_client_configs > >

per connection data

The underlying layer have to provide the memory for a connection and pass the connection_data to l2cap_input(). The purpose of this class is to store all connection related data that must be keept per connection and must be reset with a new connection.

Member Function Documentation

◆ indicate() [1/2]

template<typename ... Options>
template<class CharacteristicUUID >
bool bluetoe::server< Options >::indicate ( )

sends indications to all connceted clients.

The function is mostly similar to notify(). Instead of an ATT notification, an ATT indication is send.

Returns
The function will return false, if the given indication was ignored, because the characteristic is already queued for indication, but not yet send out or the confirmation to a previous send out indication of this characteristic was not received yet.

◆ indicate() [2/2]

template<typename ... Options>
template<class T >
bool bluetoe::server< Options >::indicate ( const T &  value)

sends indications to all connceted clients.

The function is mostly similar to notify(). Instead of an ATT notification, an ATT indication is send.

Returns
The function will return false, if the given indication was ignored, because the characteristic is already queued for indication, but not yet send out or the confirmation to a previous send out indication of this characteristic was not received yet.

◆ notify() [1/2]

template<typename ... Options>
template<class CharacteristicUUID >
bool bluetoe::server< Options >::notify ( )

Notify a characteristic, by giving the characteristic UUID.

The charactieristic to be notify, must have been configured for notificaton. If multiple characteristics exists with the given UUID, the first characteristic will be notified.

See also
notify
characteristic

Example:

Returns
The function will return false, if the given notification was ignored, because the characteristic is already queued for notification, but not yet send out.

◆ notify() [2/2]

template<typename ... Options>
template<class T >
bool bluetoe::server< Options >::notify ( const T &  value)

notifies all connected clients about this value

There is no check whether there was actual a change to the value or not. It's safe to call this function from a different thread or from an interrupt service routine. But there is a check whether or not clients enabled notifications.

The characteristic<> must have been given the notify parameter.

See also
notify
characteristic

Example:

std::int32_t temperature;
bluetoe::bind_characteristic_value< decltype( temperature ), &temperature >,
>
> temperature_service;
int main()
{
temperature_service server;
server.notify( temperature );
}
Returns
The function will return false, if the given notification was ignored, because the characteristic is already queued for notification, but not yet send out.

The documentation for this class was generated from the following files:
bluetoe::notify
adds the ability to notify this characteristic.
Definition: characteristic_value.hpp:88
bluetoe::service_uuid
a 128-Bit UUID used to identify a service.
Definition: service.hpp:56
bluetoe::server
Root of the declaration of a GATT server.
Definition: server.hpp:56
bluetoe::server::server
server()
a server takes no runtime construction parameters
bluetoe::service
a service with zero or more characteristics
Definition: service.hpp:133
bluetoe::characteristic_uuid16
a 16-Bit UUID used to identify a characteristic.
Definition: characteristic.hpp:78
bluetoe::characteristic
A characteristic is a typed value that is accessable by a GATT client hosted by a GATT server.
Definition: characteristic.hpp:155
bluetoe::bind_characteristic_value
a very simple device to bind a characteristic to a global variable to provide access to the character...
Definition: characteristic_value.hpp:225
bluetoe::no_write_access
if added as option to a characteristic, write access is removed from the characteristic
Definition: characteristic_value.hpp:68