BlueToe
an alternative GATT/BLE implementation
Loading...
Searching...
No Matches
Classes | 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>

Inheritance diagram for bluetoe::server< Options >:

Classes

class  connection_data
 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
 
template<class CharacteristicUUID >
bool notify ()
 
template<class T >
bool indicate (const T &value)
 sends indications to all connceted clients.
 
template<class CharacteristicUUID >
bool indicate ()
 sends indications to all connceted clients.
 
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;
a very simple device to bind a characteristic to a global variable to provide access to the character...
Definition: characteristic_value.hpp:254
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
if added as option to a characteristic, write access is removed from the characteristic
Definition: characteristic_value.hpp:69
See also
service
shared_write_queue
extend_server
server_name
appearance
requires_encryption
max_mtu_size
Examples
change_advertising_example.cpp, include_example.cpp, priorities_example.cpp, read_write_handler_example.cpp, and server_example.cpp.

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:

std::int32_t temperature;
bluetoe::bind_characteristic_value< decltype( temperature ), &temperature >,
>
> temperature_service;
int main()
{
temperature_service server;
}
bool notify(const T &value)
notifies all connected clients about this value
server()
a server takes no runtime construction parameters
a 16-Bit UUID used to identify a characteristic.
Definition: characteristic.hpp:79
adds the ability to notify this characteristic.
Definition: characteristic_value.hpp:89
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: