Service

A service is a logical grouping of characteristics. For example, if your peripheral has the service Battery Monitor, then it may contain characteristics relating to the device’s battery, such as a characteristic to read the value of the battery charge.

class bluetooth::Service

Represents a service.

Public Functions

std::shared_ptr<Characteristic> find_characteristic(const std::string &uuid)

Scan the device for given advertised characteristic. Return the characteristic if found, otherwise returns a nullptr.

Return

the characteristic or nullptr.

Parameters
  • uuid: uuid of the characteristic.

std::shared_ptr<Characteristic> characteristic(const std::string &uuid)

Retrieved connected characteristic. If the characteristic isn’t discovered and connected yet, then return nullptr.

Return

the characteristic or nullptr.

Parameters
  • char_uuid: uuid of characteristic.