TinyCTS
Bluetooth Current Time Service client and server for Arduino
Loading...
Searching...
No Matches
tiny_cts::TinyCTSCentral Class Referenceabstract

The client side (central role) of the Bluetooth stack of the operating system: finds a device, connects to it and reads or writes the characteristics of its Current Time Service. More...

#include <TinyCTSDesktop.h>

Inheritance diagram for tiny_cts::TinyCTSCentral:
anonymous_namespace{TinyCTSCoreBluetooth.mm}::CoreBluetoothCentral anonymous_namespace{TinyCTSWinRT.cpp}::WinCentral tiny_cts::TinyCTSBlueZCentral

Public Member Functions

virtual bool connect (const std::string &device, uint32_t timeoutMs, TinyCTSScanEntry &found, std::string &error)=0
virtual void disconnect ()=0
virtual bool read (uint16_t uuid, std::vector< uint8_t > &value, std::string &error)=0
virtual bool scan (uint32_t timeoutMs, std::vector< TinyCTSScanEntry > &result, std::string &error)=0
virtual bool write (uint16_t uuid, const uint8_t *data, size_t len, std::string &error)=0

Detailed Description

The client side (central role) of the Bluetooth stack of the operating system: finds a device, connects to it and reads or writes the characteristics of its Current Time Service.

All the functions block until they are done and give the reason in the error string when they fail. BlueZ (Linux), CoreBluetooth (macOS) and WinRT (Windows) each implement it; TinyCTSClient uses it. Get an object with ctsCreateCentral().

Member Function Documentation

◆ connect()

virtual bool tiny_cts::TinyCTSCentral::connect ( const std::string & device,
uint32_t timeoutMs,
TinyCTSScanEntry & found,
std::string & error )
pure virtual

Find a device, connect and discover the Current Time Service.

Parameters
deviceAddress, identifier or name. Empty: the first device that advertises the service.
timeoutMsTime to look for the device.

Implemented in anonymous_namespace{TinyCTSCoreBluetooth.mm}::CoreBluetoothCentral, anonymous_namespace{TinyCTSWinRT.cpp}::WinCentral, and tiny_cts::TinyCTSBlueZCentral.

◆ disconnect()

virtual void tiny_cts::TinyCTSCentral::disconnect ( )
pure virtual

◆ read()

virtual bool tiny_cts::TinyCTSCentral::read ( uint16_t uuid,
std::vector< uint8_t > & value,
std::string & error )
pure virtual

◆ scan()

virtual bool tiny_cts::TinyCTSCentral::scan ( uint32_t timeoutMs,
std::vector< TinyCTSScanEntry > & result,
std::string & error )
pure virtual

◆ write()

virtual bool tiny_cts::TinyCTSCentral::write ( uint16_t uuid,
const uint8_t * data,
size_t len,
std::string & error )
pure virtual

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