Kallisto Linux API
Library for interacting with Kallisto devices
|
#include <bluetooth_device.hpp>
Public Types | |
typedef std::function< void(bool connected)> | ConnectionListener |
Public Member Functions | |
BluetoothDevice (std::string name, std::string address) | |
virtual | ~BluetoothDevice () |
BluetoothDevice (BluetoothDevice const &)=delete | |
void | operator= (BluetoothDevice const &)=delete |
BluetoothDevice (BluetoothDevice &&other) | |
BluetoothDevice & | operator= (BluetoothDevice &&other) |
std::string | getName () const |
std::string | getAddress () const |
error::KallistoDetailedResult | connect (ConnectionListener listener) |
error::KallistoDetailedResult | disconnect (bool no_callback) |
bool | getConnected () |
void | close () |
error::KallistoDetailedResult | getRssi (int &buffer) |
std::vector< std::string > | getServices () |
std::vector< std::string > | getCharacteristics (std::string service_uuid) |
error::KallistoDetailedResult | readCharacteristic (std::string service_uuid, std::string characteristic_uuid, std::vector< unsigned char > &buffer) |
error::KallistoDetailedResult | writeCharacteristic (std::string service_uuid, std::string characteristic_uuid, std::vector< unsigned char > &buffer) |
error::KallistoDetailedResult | enableNotification (std::string service_uuid, std::string characteristic_uuid, BluetoothDispatcher::NotificationListener &listener) |
error::KallistoDetailedResult | disableNotification (std::string service_uuid, std::string characteristic_uuid, BluetoothDispatcher::NotificationListener &listener) |
bool | operator== (const BluetoothDevice &other) const |
bool | operator!= (const BluetoothDevice &other) const |
Additional Inherited Members | |
Protected Member Functions inherited from BluetoothDispatcher | |
BluetoothDispatcher () | |
virtual | ~BluetoothDispatcher () |
BluetoothDispatcher (BluetoothDispatcher const &)=delete | |
BluetoothDispatcher (BluetoothDispatcher &&)=delete | |
void | operator= (BluetoothDispatcher const &)=delete |
void | operator= (BluetoothDispatcher &&)=delete |
Class that represents a Bluetooth device.
typedef std::function<void(bool connected)> ConnectionListener |
Called when there is a change in connection status.
connected |
BluetoothDevice | ( | std::string | name, |
std::string | address | ||
) |
Constructor.
|
virtual |
Destructor.
|
delete |
Remove copy.
BluetoothDevice | ( | BluetoothDevice && | other | ) |
Move constructor.
void close | ( | ) |
Cleans and closes the BLE device. It is called when the object is no longer needed and invalidates the instance.
error::KallistoDetailedResult connect | ( | ConnectionListener | listener | ) |
Connects to device
listener | listener for connection events. |
|
virtual |
Disables notifications of the the characteristic with the passed UUID of the service with the passed UUID.
service_uuid | The UUID of the service containing the characteristic that should have its' notifications disabled. |
characteristic_uuid | The UUID of the characteristic that should have its' notifications disabled. |
listener | The listener used in enableNotification(std::string, std::string, NotificationListener) call. |
Implements BluetoothDispatcher.
error::KallistoDetailedResult disconnect | ( | bool | no_callback | ) |
Disconnects from the device
no_callback | Set to true if no disconnection callback is required. This allows devices to disconnect in destructor. |
|
virtual |
Enables notifications of the the characteristic with the passed UUID of the service with the passed UUID.
service_uuid | The UUID of the service containing the characteristic that should have its' notifications enabled. |
characteristic_uuid | The UUID of the characteristic that should have its' notifications enabled. |
listener | The listener to receive notifications. |
Implements BluetoothDispatcher.
|
inline |
Returns this device address.
|
virtual |
Get the remote device BLE characteristic list of the service with the passed UUID.
service_uuid | The UUID of the service whose characteristic should be returned. |
Implements BluetoothDispatcher.
bool getConnected | ( | ) |
Checks if the BLE device is connected
|
inline |
Returns this device name.
|
virtual |
Get the current RSSI value.
[out] | buffer | The RSSI value.. |
Implements BluetoothDispatcher.
|
virtual |
Get the remote device BLE service list.
Implements BluetoothDispatcher.
BluetoothDevice& operator= | ( | BluetoothDevice && | other | ) |
Move assigment.
|
virtual |
Reads the characteristic with the passed UUID of the service with the passed UUID.
[in] | service_uuid | The UUID of the service containing the characteristic that should be read. |
[in] | characteristic_uuid | The UUID of the characteristic that should be read. |
[out] | buffer | The data read. |
Implements BluetoothDispatcher.
|
virtual |
Writes the passed data to the characteristic with the passed UUID of the service with the passed UUID.
[in] | service_uuid | The UUID of the service containing the characteristic that should be written. |
[in] | characteristic_uuid | The UUID of the characteristic that should be written. |
[in] | buffer | A byte buffer with the data to be written. |
Implements BluetoothDispatcher.