|
TinyB
0.5.1
TinyB - The Tiny Bluetooth LE library
|
#include <BluetoothDevice.hpp>
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 |
| BluetoothDevice (const BluetoothDevice &object) | |
| virtual BluetoothDevice * | clone () const |
| std::unique_ptr< BluetoothGattService > | find (std::string *identifier, std::chrono::milliseconds timeout=std::chrono::milliseconds::zero()) |
| bool | disconnect () |
| bool | connect () |
| bool | connect_profile (const std::string &arg_UUID) |
| bool | disconnect_profile (const std::string &arg_UUID) |
| bool | pair () |
| bool | remove_device () |
| bool | cancel_pairing () |
| std::vector< std::unique_ptr< BluetoothGattService > > | get_services () |
| std::string | get_address () |
| std::string | get_name () |
| std::string | get_alias () |
| void | set_alias (const std::string &value) |
| unsigned int | get_class () |
| uint16_t | get_appearance () |
| std::unique_ptr< std::string > | get_icon () |
| bool | get_paired () |
| void | enable_paired_notifications (std::function< void(BluetoothDevice &device, bool paired, void *userdata)> callback, void *userdata) |
| void | enable_paired_notifications (std::function< void(bool paired)> callback) |
| void | disable_paired_notifications () |
| bool | get_trusted () |
| void | set_trusted (bool value) |
| void | enable_trusted_notifications (std::function< void(BluetoothDevice &device, bool trusted, void *userdata)> callback, void *userdata) |
| void | enable_trusted_notifications (std::function< void(bool trusted)> callback) |
| void | disable_trusted_notifications () |
| bool | get_blocked () |
| void | set_blocked (bool value) |
| void | enable_blocked_notifications (std::function< void(BluetoothDevice &device, bool blocked, void *userdata)> callback, void *userdata) |
| void | enable_blocked_notifications (std::function< void(bool blocked)> callback) |
| void | disable_blocked_notifications () |
| bool | get_legacy_pairing () |
| int16_t | get_rssi () |
| void | enable_rssi_notifications (std::function< void(BluetoothDevice &device, int16_t rssi, void *userdata)> callback, void *userdata=nullptr) |
| void | enable_rssi_notifications (std::function< void(int16_t rssi)> callback) |
| void | disable_rssi_notifications () |
| bool | get_connected () |
| void | enable_connected_notifications (std::function< void(BluetoothDevice &device, bool connected, void *userdata)> callback, void *userdata) |
| void | enable_connected_notifications (std::function< void(bool connected)> callback) |
| void | disable_connected_notifications () |
| std::vector< std::string > | get_uuids () |
| std::unique_ptr< std::string > | get_modalias () |
| BluetoothAdapter | get_adapter () |
| std::map< uint16_t, std::vector< uint8_t > > | get_manufacturer_data () |
| void | enable_manufacturer_data_notifications (std::function< void(BluetoothDevice &device, std::map< uint16_t, std::vector< uint8_t >> &mfgdata, void *userdata)> callback, void *userdata) |
| void | enable_manufacturer_data_notifications (std::function< void(std::map< uint16_t, std::vector< uint8_t >> &mfgdata)> callback) |
| void | disable_manufacturer_data_notifications () |
| std::map< std::string, std::vector< uint8_t > > | get_service_data () |
| void | enable_service_data_notifications (std::function< void(BluetoothDevice &device, std::map< std::string, std::vector< uint8_t >> &servicedata, void *userdata)> callback, void *userdata) |
| void | enable_service_data_notifications (std::function< void(std::map< std::string, std::vector< uint8_t >> &servicedata)> callback) |
| void | disable_service_data_notifications () |
| int16_t | get_tx_power () |
| bool | get_services_resolved () |
| void | enable_services_resolved_notifications (std::function< void(BluetoothDevice &device, bool services_resolved, void *userdata)> callback, void *userdata) |
| void | enable_services_resolved_notifications (std::function< void(bool connec)> callback) |
| void | disable_services_resolved_notifications () |
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 | |
| BluetoothDevice (Device1 *object) | |
Protected Member Functions inherited from tinyb::BluetoothObject | |
| bool | lock () |
| void | unlock () |
Static Protected Member Functions | |
| static std::unique_ptr< BluetoothDevice > | make (Object *object, BluetoothType type=BluetoothType::DEVICE, std::string *name=nullptr, std::string *identifier=nullptr, BluetoothObject *parent=nullptr) |
Protected Attributes | |
| std::function< void(int16_t)> | rssi_callback |
| std::function< void(bool)> | trusted_callback |
| std::function< void(bool)> | paired_callback |
| std::function< void(bool)> | connected_callback |
| std::function< void(bool)> | blocked_callback |
| std::function< void(std::map< uint16_t, std::vector< uint8_t >> &)> | mfg_callback |
| std::function< void(std::map< std::string, std::vector< uint8_t >> &)> | service_callback |
| std::function< void(bool)> | services_resolved_callback |
Protected Attributes inherited from tinyb::BluetoothObject | |
| std::mutex | lk |
| std::atomic_bool | valid |
Friends | |
| class | tinyb::BluetoothManager |
| class | tinyb::BluetoothEventManager |
| class | tinyb::BluetoothAdapter |
| class | tinyb::BluetoothGattService |
| class | tinyb::BluetoothNotificationHandler |
Provides access to Bluetooth devices. Follows the BlueZ adapter API available at: http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/device-api.txt
| bool tinyb::BluetoothDevice::cancel_pairing | ( | ) |
Cancels an initiated pairing operation
|
virtual |
Returns a raw pointer to a clone of the object
Reimplemented from tinyb::BluetoothObject.
| bool tinyb::BluetoothDevice::connect | ( | ) |
A connection to this device is established, connecting each profile flagged as auto-connectable.
| bool tinyb::BluetoothDevice::connect_profile | ( | const std::string & | arg_UUID | ) |
Connects a specific profile available on the device, given by UUID
| arg_UUID | The UUID of the profile to be connected |
| void tinyb::BluetoothDevice::disable_blocked_notifications | ( | ) |
Disables notifications for changes of the blocked status of the device and uninstalls any callback.
| void tinyb::BluetoothDevice::disable_connected_notifications | ( | ) |
Disables notifications for changes of the connected status of the device and uninstalls any callback.
| void tinyb::BluetoothDevice::disable_manufacturer_data_notifications | ( | ) |
Disables notifications for changes in the manufacturer data of the device and uninstalls any callback.
| void tinyb::BluetoothDevice::disable_paired_notifications | ( | ) |
Disables notifications for changes of the paired status of the device and uninstalls any callback.
| void tinyb::BluetoothDevice::disable_rssi_notifications | ( | ) |
Disables notifications for changes of the RSSI value of the device and uninstalls any callback.
| void tinyb::BluetoothDevice::disable_service_data_notifications | ( | ) |
Disables notifications for changes in the service data of the device and uninstalls any callback.
| void tinyb::BluetoothDevice::disable_services_resolved_notifications | ( | ) |
Disables notifications for changes of the services resolved status of the device and uninstalls any callback.
| void tinyb::BluetoothDevice::disable_trusted_notifications | ( | ) |
Disables notifications for changes of the trusted status of the device and uninstalls any callback.
| bool tinyb::BluetoothDevice::disconnect | ( | ) |
The connection to this device is removed, removing all connected profiles.
| bool tinyb::BluetoothDevice::disconnect_profile | ( | const std::string & | arg_UUID | ) |
Disconnects a specific profile available on the device, given by UUID
| arg_UUID | The UUID of the profile to be disconnected |
| void tinyb::BluetoothDevice::enable_blocked_notifications | ( | std::function< void(BluetoothDevice &device, bool blocked, void *userdata)> | callback, |
| void * | userdata | ||
| ) |
Enables notifications for changes of the blocked status of the device and triggers the callback when the value changes. Uninstalls the previous blocked callback, if any was installed.
| callback | A function of the form void(BluetoothDevice&, bool, void *), where BluetoothDevice& is the device for which the callback was set, bool will contain the new value of the blocked property and void * contains optional, user set data |
| userdata | The data which will be delivered to the callback when it is triggered. Memory must be managed by user. |
| void tinyb::BluetoothDevice::enable_blocked_notifications | ( | std::function< void(bool blocked)> | callback | ) |
Enables notifications for changes of the blocked status of the device and triggers the callback when the value changes. Uninstalls the previous blocked callback, if any was installed.
| callback | A function of the form void(bool), where bool will contain the new value of the blocked property |
| void tinyb::BluetoothDevice::enable_connected_notifications | ( | std::function< void(BluetoothDevice &device, bool connected, void *userdata)> | callback, |
| void * | userdata | ||
| ) |
Enables notifications for changes of the connected status of the device and triggers the callback when the value changes. Uninstalls the previous connected callback, if any was installed.
| callback | A function of the form void(BluetoothDevice&, bool, void *), where BluetoothDevice& is the device for which the callback was set, bool will contain the new value of the connected property and void * contains optional, user set data |
| userdata | The data which will be delivered to the callback when it is triggered. Memory must be managed by user. |
| void tinyb::BluetoothDevice::enable_connected_notifications | ( | std::function< void(bool connected)> | callback | ) |
Enables notifications for changes of the connected status of the device and triggers the callback when the value changes. Uninstalls the previous connected callback, if any was installed.
| callback | A function of the form void(bool), where bool will contain the new value of the connected property |
| void tinyb::BluetoothDevice::enable_manufacturer_data_notifications | ( | ) |
Enables notifications for changes of the manufacturer data of the device and triggers the callback when the value changes. Uninstalls the previous connected callback, if any was installed.
| callback | A function of the form void(BluetoothDevice&, bool, void *), where BluetoothDevice& is the device for which the callback was set, bool will contain the new value of the connected property and void * contains optional, user set data |
| userdata | The data which will be delivered to the callback when it is triggered. Memory must be managed by user. |
| void tinyb::BluetoothDevice::enable_manufacturer_data_notifications | ( | ) |
Enables notifications for changes in the manufacturer data of the device and triggers the callback when the value changes. Uninstalls the previous connected callback, if any was installed.
| callback | A function of the form void(bool), where bool will contain the new value of the connected property |
| void tinyb::BluetoothDevice::enable_paired_notifications | ( | std::function< void(BluetoothDevice &device, bool paired, void *userdata)> | callback, |
| void * | userdata | ||
| ) |
Enables notifications for changes of the paired status of the device and triggers the callback when the value changes. Uninstalls the previous paired callback, if any was installed.
| callback | A function of the form void(BluetoothDevice&, bool, void *), where BluetoothDevice& is the device for which the callback was set, bool will contain the new value of the paired property and void * contains optional, user set data |
| userdata | The data which will be delivered to the callback when it is triggered. Memory must be managed by user. |
| void tinyb::BluetoothDevice::enable_paired_notifications | ( | std::function< void(bool paired)> | callback | ) |
Enables notifications for changes of the paired status of the device and triggers the callback when the value changes. Uninstalls the previous paired callback, if any was installed.
| callback | A function of the form void(bool), where bool will contain the new value of the paired property |
| void tinyb::BluetoothDevice::enable_rssi_notifications | ( | std::function< void(BluetoothDevice &device, int16_t rssi, void *userdata)> | callback, |
| void * | userdata = nullptr |
||
| ) |
Enables notifications for changes of the RSSI value of the device and triggers the callback when the value changes. Uninstalls the previous RSSI callback, if any was installed.
| callback | A function of the form void(BluetoothDevice&, int16_t, void *), where BluetoothDevice& is the device for which the callback was set, bool will contain the new value of the RSSI property and void * contains optional, user set data |
| userdata | The data which will be delivered to the callback when it is triggered. Memory must be managed by user. |
| void tinyb::BluetoothDevice::enable_rssi_notifications | ( | std::function< void(int16_t rssi)> | callback | ) |
Enables notifications for changes of the RSSI value of the device and triggers the callback when the value changes. Uninstalls the previous RSSI callback, if any was installed.
| callback | A function of the form void(int16_t), where bool will contain the new value of the RSSI property |
| void tinyb::BluetoothDevice::enable_service_data_notifications | ( | ) |
Enables notifications for changes of the service data of the device and triggers the callback when the value changes. Uninstalls the previous connected callback, if any was installed.
| callback | A function of the form void(BluetoothDevice&, bool, void *), where BluetoothDevice& is the device for which the callback was set, bool will contain the new value of the connected property and void * contains optional, user set data |
| userdata | The data which will be delivered to the callback when it is triggered. Memory must be managed by user. |
| void tinyb::BluetoothDevice::enable_service_data_notifications | ( | ) |
Enables notifications for changes in the manufacturer data of the device and triggers the callback when the value changes. Uninstalls the previous connected callback, if any was installed.
| callback | A function of the form void(bool), where bool will contain the new value of the connected property |
| void tinyb::BluetoothDevice::enable_services_resolved_notifications | ( | std::function< void(BluetoothDevice &device, bool services_resolved, void *userdata)> | callback, |
| void * | userdata | ||
| ) |
Enables notifications for changes of the services resolved status of the device and triggers the callback when the value changes. Uninstalls the previous services resolved callback, if any was installed.
| callback | A function of the form void(BluetoothDevice&, bool, void *), where BluetoothDevice& is the device for which the callback was set, bool will contain the new value of the services resolved property and void * contains optional, user set data |
| userdata | The data which will be delivered to the callback when it is triggered. Memory must be managed by user. |
| void tinyb::BluetoothDevice::enable_services_resolved_notifications | ( | std::function< void(bool connec)> | callback | ) |
Enables notifications for changes of the services resolved status of the device and triggers the callback when the value changes. Uninstalls the previous services resolved callback, if any was installed.
| callback | A function of the form void(bool), where bool will contain the new value of the services resolved property |
| void tinyb::BluetoothDevice::enable_trusted_notifications | ( | std::function< void(BluetoothDevice &device, bool trusted, void *userdata)> | callback, |
| void * | userdata | ||
| ) |
Enables notifications for changes of the trusted status of the device and triggers the callback when the value changes. Uninstalls the previous trusted callback, if any was installed.
| callback | A function of the form void(BluetoothDevice&, bool, void *), where BluetoothDevice& is the device for which the callback was set, bool will contain the new value of the trusted property and void * contains optional, user set data |
| userdata | The data which will be delivered to the callback when it is triggered. Memory must be managed by user. |
| void tinyb::BluetoothDevice::enable_trusted_notifications | ( | std::function< void(bool trusted)> | callback | ) |
Enables notifications for changes of the trusted status of the device and triggers the callback when the value changes. Uninstalls the previous trusted callback, if any was installed.
| callback | A function of the form void(bool), where bool will contain the new value of the trusted property |
| BluetoothAdapter tinyb::BluetoothDevice::get_adapter | ( | ) |
Returns the adapter on which this device was discovered or connected.
| std::string tinyb::BluetoothDevice::get_address | ( | ) |
Returns the hardware address of this device.
| std::string tinyb::BluetoothDevice::get_alias | ( | ) |
Returns an alternative friendly name of this device.
| uint16_t tinyb::BluetoothDevice::get_appearance | ( | ) |
Returns the appearance of the device, as found by GAP service.
| bool tinyb::BluetoothDevice::get_blocked | ( | ) |
Returns the blocked state the device.
|
virtual |
Returns the BluetoothType of this object
Reimplemented from tinyb::BluetoothObject.
| unsigned int tinyb::BluetoothDevice::get_class | ( | ) |
Returns the Bluetooth class of the device.
|
virtual |
Returns the class name of this object
Reimplemented from tinyb::BluetoothObject.
| bool tinyb::BluetoothDevice::get_connected | ( | ) |
Returns the connected state of the device.
| std::unique_ptr<std::string> tinyb::BluetoothDevice::get_icon | ( | ) |
Returns the proposed icon name of the device.
|
virtual |
Returns the complete Java class of this object
Reimplemented from tinyb::BluetoothObject.
| bool tinyb::BluetoothDevice::get_legacy_pairing | ( | ) |
Returns if device uses only pre-Bluetooth 2.1 pairing mechanism.
| std::map<uint16_t, std::vector<uint8_t> > tinyb::BluetoothDevice::get_manufacturer_data | ( | ) |
Returns a map containing manufacturer specific advertisement data. An entry has a uint16_t key and an array of bytes.
| std::unique_ptr<std::string> tinyb::BluetoothDevice::get_modalias | ( | ) |
Returns the local ID of the adapter, or nullptr.
| std::string tinyb::BluetoothDevice::get_name | ( | ) |
Returns the remote friendly name of this device.
|
virtual |
Returns the DBus object path of this object
Reimplemented from tinyb::BluetoothObject.
| bool tinyb::BluetoothDevice::get_paired | ( | ) |
Returns the paired state the device.
| int16_t tinyb::BluetoothDevice::get_rssi | ( | ) |
Returns the Received Signal Strength Indicator of the device (0 means unknown).
| std::map<std::string, std::vector<uint8_t> > tinyb::BluetoothDevice::get_service_data | ( | ) |
Returns a map containing service advertisement data. An entry has a UUID string key and an array of bytes.
| std::vector<std::unique_ptr<BluetoothGattService> > tinyb::BluetoothDevice::get_services | ( | ) |
Returns a list of BluetoothGattServices available on this device.
| bool tinyb::BluetoothDevice::get_services_resolved | ( | ) |
Returns true if service discovery has ended.
| bool tinyb::BluetoothDevice::get_trusted | ( | ) |
Returns the trusted state the device.
| int16_t tinyb::BluetoothDevice::get_tx_power | ( | ) |
Returns the transmission power level (0 means unknown).
| std::vector<std::string> tinyb::BluetoothDevice::get_uuids | ( | ) |
Returns the UUIDs of the device.
| bool tinyb::BluetoothDevice::pair | ( | ) |
A connection to this device is established, and the device is then paired.
| bool tinyb::BluetoothDevice::remove_device | ( | ) |
Remove the current device (like an unpair).
| void tinyb::BluetoothDevice::set_alias | ( | const std::string & | value | ) |
Sets an alternative friendly name of this device.
| void tinyb::BluetoothDevice::set_blocked | ( | bool | value | ) |
Sets the blocked state the device.
| void tinyb::BluetoothDevice::set_trusted | ( | bool | value | ) |
Sets the trusted state the device.
1.8.11