TinyB  0.5.1
TinyB - The Tiny Bluetooth LE library
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
tinyb::BluetoothGattDescriptor Class Reference

#include <BluetoothGattDescriptor.hpp>

Inheritance diagram for tinyb::BluetoothGattDescriptor:
tinyb::BluetoothObject

Public Member Functions

virtual std::string get_java_class () const
 
virtual std::string get_class_name () const
 
virtual std::string get_object_path () const
 
virtual BluetoothType get_bluetooth_type () const
 
 BluetoothGattDescriptor (const BluetoothGattDescriptor &object)
 
virtual BluetoothGattDescriptorclone () const
 
std::vector< unsigned char > read_value (uint16_t offset=0)
 
bool write_value (const std::vector< unsigned char > &arg_value, uint16_t offset=0)
 
bool enable_value_notifications (std::function< void(BluetoothGattDescriptor &descriptor, std::vector< unsigned char > &value, void *userdata)> callback, void *user_data)
 
bool enable_value_notifications (std::function< void(std::vector< unsigned char > &value)> callback)
 
bool disable_value_notifications ()
 
std::string get_uuid ()
 
BluetoothGattCharacteristic get_characteristic ()
 
std::vector< unsigned char > get_value ()
 
- Public Member Functions inherited from tinyb::BluetoothObject
virtual bool operator== (const BluetoothObject &other) const
 
virtual bool operator!= (const BluetoothObject &other) const
 

Static Public Member Functions

static std::string java_class ()
 
static BluetoothType class_type ()
 
- Static Public Member Functions inherited from tinyb::BluetoothObject
static BluetoothType class_type ()
 
static std::string java_class ()
 

Protected Member Functions

 BluetoothGattDescriptor (GattDescriptor1 *object)
 
- Protected Member Functions inherited from tinyb::BluetoothObject
bool lock ()
 
void unlock ()
 

Static Protected Member Functions

static std::unique_ptr< BluetoothGattDescriptormake (Object *object, BluetoothType type=BluetoothType::GATT_DESCRIPTOR, std::string *name=nullptr, std::string *identifier=nullptr, BluetoothObject *parent=nullptr)
 

Protected Attributes

std::function< void(std::vector< unsigned char > &)> value_changed_callback
 
- Protected Attributes inherited from tinyb::BluetoothObject
std::mutex lk
 
std::atomic_bool valid
 

Friends

class tinyb::BluetoothGattCharacteristic
 
class tinyb::BluetoothManager
 
class tinyb::BluetoothEventManager
 
class tinyb::BluetoothNotificationHandler
 

Detailed Description

Provides access to Bluetooth GATT descriptor. Follows the BlueZ adapter API available at: http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt

Member Function Documentation

virtual BluetoothGattDescriptor* tinyb::BluetoothGattDescriptor::clone ( ) const
virtual

Returns a raw pointer to a clone of the object

Returns
A raw pointer to a clone of the object

Reimplemented from tinyb::BluetoothObject.

bool tinyb::BluetoothGattDescriptor::enable_value_notifications ( std::function< void(BluetoothGattDescriptor &descriptor, std::vector< unsigned char > &value, void *userdata)>  callback,
void *  user_data 
)

Enables notifications for changes of the value of the descriptor and triggers the callback when the value changes. Uninstalls the previous value callback, if any was installed.

Parameters
callbackA function of the form void(BluetoothGattDescriptor &, std::vector<unsigned char> &, void *), where BluetoothGattDescriptor& is the adapter for which the callback was set, vector<unsigned char>& will contain the new value of the powered property and void* contains optional, user set data
userdataThe data which will be delivered to the callback when it is triggered. Memory of this parameter must be managed by user.
bool tinyb::BluetoothGattDescriptor::enable_value_notifications ( std::function< void(std::vector< unsigned char > &value)>  callback)

Enables notifications (including at BLE level) for changes of the value of the characteristic and triggers the callback when the value changes. Uninstalls the previous powered callback, if any was installed.

Parameters
callbackA function of the form void(std::vector<unsigned char> &), where std::vector<unsigned char>& will contain the new value
virtual BluetoothType tinyb::BluetoothGattDescriptor::get_bluetooth_type ( ) const
virtual

Returns the BluetoothType of this object

Returns
The BluetoothType of this object

Reimplemented from tinyb::BluetoothObject.

BluetoothGattCharacteristic tinyb::BluetoothGattDescriptor::get_characteristic ( )

Returns the characteristic to which this descriptor belongs to.

Returns
The characteristic.
virtual std::string tinyb::BluetoothGattDescriptor::get_class_name ( ) const
virtual

Returns the class name of this object

Returns
A std::string containing the class name of this object

Reimplemented from tinyb::BluetoothObject.

virtual std::string tinyb::BluetoothGattDescriptor::get_java_class ( ) const
virtual

Returns the complete Java class of this object

Returns
A std::string containing the java class of this object

Reimplemented from tinyb::BluetoothObject.

virtual std::string tinyb::BluetoothGattDescriptor::get_object_path ( ) const
virtual

Returns the DBus object path of this object

Returns
A std::string containing the DBus object path of this object

Reimplemented from tinyb::BluetoothObject.

std::string tinyb::BluetoothGattDescriptor::get_uuid ( )

Get the UUID of this descriptor.

Returns
The 128 byte UUID of this descriptor, NULL if an error occurred
std::vector<unsigned char> tinyb::BluetoothGattDescriptor::get_value ( )

Returns the cached value of this descriptor, if any.

Returns
The cached value of this descriptor.
std::vector<unsigned char> tinyb::BluetoothGattDescriptor::read_value ( uint16_t  offset = 0)

Reads the value of this descriptor

Returns
A vector<uchar> containing data from this descriptor
bool tinyb::BluetoothGattDescriptor::write_value ( const std::vector< unsigned char > &  arg_value,
uint16_t  offset = 0 
)

Writes the value of this descriptor.

Parameters
[in]arg_valueThe data as vector<uchar> to be written packed in a GBytes struct
Returns
TRUE if value was written succesfully

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