Pigweed
 
Loading...
Searching...
No Matches
pw::bluetooth::gatt::Server2 Class Referenceabstract

Interface for a GATT server that serves many GATT services. More...

#include <server2.h>

Classes

struct  LocalServiceInfo
 Parameters for registering a local GATT service. More...
 

Public Types

enum class  PublishServiceError {
  kInternalError = 0 , kInvalidHandle = 1 , kInvalidUuid = 2 , kInvalidCharacteristics = 3 ,
  kInvalidIncludes = 4
}
 
using PublishServiceResult = pw::expected< LocalService2::Ptr, PublishServiceError >
 The Result passed by PublishService.
 

Public Member Functions

virtual async2::OnceReceiver< PublishServiceResultPublishService (const LocalServiceInfo &info, LocalServiceDelegate2 &delegate)=0
 

Detailed Description

Interface for a GATT server that serves many GATT services.

Member Enumeration Documentation

◆ PublishServiceError

Enumerator
kInvalidHandle 

The service handle provided was not unique.

kInvalidUuid 

Invalid service UUID provided.

kInvalidCharacteristics 

Invalid service characteristics provided.

kInvalidIncludes 

Invalid service includes provided.

Member Function Documentation

◆ PublishService()

virtual async2::OnceReceiver< PublishServiceResult > pw::bluetooth::gatt::Server2::PublishService ( const LocalServiceInfo info,
LocalServiceDelegate2 delegate 
)
pure virtual

Publishes the service defined by info and implemented by delegate so that it is available to all remote peers.

The caller must assign distinct handles to the characteristics and descriptors listed in info per call to PublishService (handles can be reused across calls). These identifiers will be used in requests sent to delegate.

Returns
On success, a LocalService::Ptr is returned via result_sender. When the LocalService::Ptr is destroyed or an error occurs (LocalServiceDelegate.OnError), the service will be unpublished.

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