Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
direct_bt::DBGattServer Class Reference

Representing a complete list of Gatt Service objects from the GATTRole::Server perspective, i.e. More...

#include <DBGattServer.hpp>

Inheritance diagram for direct_bt::DBGattServer:
Collaboration diagram for direct_bt::DBGattServer:

Classes

class  Listener
 Listener to remote master device's operations on the local GATT-Server. More...
 

Public Types

typedef jau::darray< DBGattServiceRef, size_typeGattServiceList_t
 
typedef jau::cow_darray< ListenerRef, size_typeListenerList_t
 
typedef std::shared_ptr< ListenerListenerRef
 
enum class  Mode : uint8_t { NOP = 0 , DB = 1 , FWD = 2 }
 Operating mode of a DBGattServer instance. More...
 
typedef jau::nsize_t size_type
 

Public Member Functions

 DBGattServer ()
 DBGattServer in Mode::NOP mode. More...
 
 DBGattServer (BTDeviceRef fwdServer_)
 DBGattServer in Mode::FWD to the given forward BTDevice. More...
 
 DBGattServer (jau::darray< DBGattServiceRef > &&services_)
 DBGattServer in Mode::DB mode if given services_ are not empty, otherwise in Mode::NOP mode. More...
 
 DBGattServer (uint16_t max_att_mtu_, jau::darray< DBGattServiceRef > &&services_)
 DBGattServer in Mode::DB mode if given services_ are not empty, otherwise in Mode::NOP mode. More...
 
 ~DBGattServer () noexcept override
 
bool addListener (const ListenerRef &l)
 
DBGattCharRef findGattChar (const jau::uuid_t &service_uuid, const jau::uuid_t &char_uuid) noexcept
 
DBGattCharRef findGattCharByValueHandle (const uint16_t char_value_handle) noexcept
 
DBGattDescRef findGattClientCharConfig (const jau::uuid_t &service_uuid, const jau::uuid_t &char_uuid) noexcept
 
DBGattServiceRef findGattService (const jau::uuid_t &type) noexcept
 
std::string get_java_class () const noexcept override
 
BTDeviceRef getFwdServer () noexcept
 
uint16_t getMaxAttMTU () const noexcept
 Used maximum server Rx ATT_MTU, defaults to 512+1. More...
 
Mode getMode () const noexcept
 
jau::darray< DBGattServiceRef > & getServices () noexcept
 List of Services. More...
 
ListenerList_tlistener ()
 
bool removeListener (const ListenerRef &l)
 
bool resetGattClientCharConfig (const jau::uuid_t &service_uuid, const jau::uuid_t &char_uuid) noexcept
 
void setMaxAttMTU (const uint16_t v) noexcept
 Set maximum server Rx ATT_MTU, defaults to 512+1 limit. More...
 
size_type setServicesHandles ()
 Sets all handles of all service instances and all its owned childs, i.e. More...
 
std::string toFullString ()
 
std::string toString () const noexcept override
 

Static Public Member Functions

static std::string java_class () noexcept
 
static std::string toModeString (const Mode m) noexcept
 

Detailed Description

Representing a complete list of Gatt Service objects from the GATTRole::Server perspective, i.e.

the Gatt Server database.

One instance shall be attached to BTAdapter when advertising via BTAdapter::startAdvertising(), changing its operating mode to Gatt Server mode, i.e. GATTRole::Server.

The instance can also be retrieved via BTAdapter::getGATTServerData().

See Direct-BT Overview.

This class is not thread safe and only intended to be prepared by the user at startup and processed by the Gatt Server facility.

Since
2.4.0
Examples
dbt_peripheral00.cpp, and dbt_repeater00.cpp.

Definition at line 705 of file DBGattServer.hpp.

Member Typedef Documentation

◆ ListenerRef

Definition at line 862 of file DBGattServer.hpp.

◆ size_type

Definition at line 864 of file DBGattServer.hpp.

◆ ListenerList_t

Definition at line 865 of file DBGattServer.hpp.

◆ GattServiceList_t

Definition at line 866 of file DBGattServer.hpp.

Member Enumeration Documentation

◆ Mode

enum class direct_bt::DBGattServer::Mode : uint8_t
strong

Operating mode of a DBGattServer instance.

Enumerator
NOP 

No operation mode, i.e.

w/o any DBGattService.

DB 

Database mode, the default operating on given list of DBGattService.

FWD 

Forward mode, acting as a proxy forwarding all requests to a 3rd remote GATT server BTDevice.

Definition at line 710 of file DBGattServer.hpp.

Constructor & Destructor Documentation

◆ ~DBGattServer()

direct_bt::DBGattServer::~DBGattServer ( )
inlineoverridenoexcept

Definition at line 906 of file DBGattServer.hpp.

◆ DBGattServer() [1/4]

direct_bt::DBGattServer::DBGattServer ( )
inline

DBGattServer in Mode::NOP mode.

Definition at line 916 of file DBGattServer.hpp.

◆ DBGattServer() [2/4]

direct_bt::DBGattServer::DBGattServer ( uint16_t  max_att_mtu_,
jau::darray< DBGattServiceRef > &&  services_ 
)
inline

DBGattServer in Mode::DB mode if given services_ are not empty, otherwise in Mode::NOP mode.

Parameters
max_att_mtu_
services_

Definition at line 928 of file DBGattServer.hpp.

◆ DBGattServer() [3/4]

direct_bt::DBGattServer::DBGattServer ( jau::darray< DBGattServiceRef > &&  services_)
inline

DBGattServer in Mode::DB mode if given services_ are not empty, otherwise in Mode::NOP mode.

Ctor using default maximum ATT_MTU of 512+1

Parameters
services_

Definition at line 941 of file DBGattServer.hpp.

◆ DBGattServer() [4/4]

direct_bt::DBGattServer::DBGattServer ( BTDeviceRef  fwdServer_)
inline

DBGattServer in Mode::FWD to the given forward BTDevice.

Parameters
fwdServer_

Definition at line 953 of file DBGattServer.hpp.

Member Function Documentation

◆ toModeString()

static std::string direct_bt::DBGattServer::toModeString ( const Mode  m)
staticnoexcept

◆ getMaxAttMTU()

uint16_t direct_bt::DBGattServer::getMaxAttMTU ( ) const
inlinenoexcept

Used maximum server Rx ATT_MTU, defaults to 512+1.

Definition at line 881 of file DBGattServer.hpp.

◆ setMaxAttMTU()

void direct_bt::DBGattServer::setMaxAttMTU ( const uint16_t  v)
inlinenoexcept

Set maximum server Rx ATT_MTU, defaults to 512+1 limit.

Method can only be issued before passing instance to BTAdapter::startAdvertising()

See also
BTAdapter::startAdvertising()

Definition at line 889 of file DBGattServer.hpp.

◆ getServices()

jau::darray< DBGattServiceRef > & direct_bt::DBGattServer::getServices ( )
inlinenoexcept

List of Services.

Definition at line 892 of file DBGattServer.hpp.

◆ getMode()

Mode direct_bt::DBGattServer::getMode ( ) const
inlinenoexcept

Definition at line 894 of file DBGattServer.hpp.

◆ getFwdServer()

BTDeviceRef direct_bt::DBGattServer::getFwdServer ( )
inlinenoexcept

Definition at line 896 of file DBGattServer.hpp.

◆ java_class()

static std::string direct_bt::DBGattServer::java_class ( )
inlinestaticnoexcept

Definition at line 898 of file DBGattServer.hpp.

Here is the caller graph for this function:

◆ get_java_class()

std::string direct_bt::DBGattServer::get_java_class ( ) const
inlineoverridevirtualnoexcept

Implements jau::jni::JavaUplink.

Definition at line 902 of file DBGattServer.hpp.

◆ findGattService()

DBGattServiceRef direct_bt::DBGattServer::findGattService ( const jau::uuid_t type)
inlinenoexcept

Definition at line 960 of file DBGattServer.hpp.

Here is the caller graph for this function:

◆ findGattChar()

DBGattCharRef direct_bt::DBGattServer::findGattChar ( const jau::uuid_t service_uuid,
const jau::uuid_t char_uuid 
)
inlinenoexcept

Definition at line 968 of file DBGattServer.hpp.

Here is the caller graph for this function:

◆ findGattClientCharConfig()

DBGattDescRef direct_bt::DBGattServer::findGattClientCharConfig ( const jau::uuid_t service_uuid,
const jau::uuid_t char_uuid 
)
inlinenoexcept

Definition at line 975 of file DBGattServer.hpp.

Here is the caller graph for this function:

◆ resetGattClientCharConfig()

bool direct_bt::DBGattServer::resetGattClientCharConfig ( const jau::uuid_t service_uuid,
const jau::uuid_t char_uuid 
)
inlinenoexcept

Definition at line 982 of file DBGattServer.hpp.

◆ findGattCharByValueHandle()

DBGattCharRef direct_bt::DBGattServer::findGattCharByValueHandle ( const uint16_t  char_value_handle)
inlinenoexcept

Definition at line 991 of file DBGattServer.hpp.

◆ setServicesHandles()

size_type direct_bt::DBGattServer::setServicesHandles ( )
inline

Sets all handles of all service instances and all its owned childs, i.e.

DBGattChars elements and its DBGattDesc elements.

Start handle is 1.

Method is being called by BTAdapter when advertising is enabled via BTAdapter::startAdvertising().

Returns
number of set handles, i.e. ( end_handle - handle ) + 1
See also
BTAdapter::startAdvertising()

Definition at line 1013 of file DBGattServer.hpp.

◆ addListener()

bool DBGattServer::addListener ( const ListenerRef l)

Definition at line 87 of file DBGattServer.cpp.

◆ removeListener()

bool DBGattServer::removeListener ( const ListenerRef l)

Definition at line 94 of file DBGattServer.cpp.

◆ listener()

ListenerList_t & direct_bt::DBGattServer::listener ( )
inline

Definition at line 1026 of file DBGattServer.hpp.

◆ toFullString()

std::string direct_bt::DBGattServer::toFullString ( )
inline

Definition at line 1028 of file DBGattServer.hpp.

◆ toString()

std::string DBGattServer::toString ( ) const
overridevirtualnoexcept

Reimplemented from jau::jni::JavaUplink.

Definition at line 103 of file DBGattServer.cpp.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: