Kallisto Linux API
Library for interacting with Kallisto devices
|
#include <kallisto_impl.hpp>
Public Member Functions | |
KallistoImpl (kallisto::bluetooth::BluetoothDevice &bluetooth_device, const bluetooth::BluetoothAdapter::ScanListener::ScanRecord &record, bool legacy_discovery, util::Executor &event_dispatcher, SensorFactory &sensor_factory) | |
virtual | ~KallistoImpl () |
void | close () |
bool | getBeingUsed () |
bool | getLinkLoss () |
error::KallistoDetailedResult | registerListener (KallistoEventListener &listener) |
error::KallistoDetailedResult | unregisterListener (KallistoEventListener &listener) |
error::KallistoDetailedResult | stayConnected (bool enable) |
std::vector< Sensor * > | getSensors () |
Sensor * | getSensor (unsigned int handle) |
error::KallistoDetailedResult | registerSensorListener (Sensor &sensor, std::map< std::string, const void *> parameters, SensorEventListener &listener) |
error::KallistoDetailedResult | unregisterSensorListener (Sensor &sensor, SensorEventListener &listener) |
error::KallistoDetailedResult | onBluetoothDeviceRecovered (kallisto::bluetooth::BluetoothDevice &bluetooth_device) |
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) |
Public Member Functions inherited from Kallisto | |
std::string | getName () const |
std::string | getAddress () const |
std::string | getManufacturer () const |
std::string | getSoftwareVersion () const |
std::string | getFirmwareVersion () const |
std::string | getHardwareVersion () const |
bool | operator== (const Kallisto &other) const |
bool | operator!= (const Kallisto &other) const |
Public Member Functions inherited from BluetoothDispatcher | |
virtual error::KallistoDetailedResult | enableNotification (std::string service_uuid, std::string characteristic_uuid, NotificationListener &listener)=0 |
virtual error::KallistoDetailedResult | disableNotification (std::string service_uuid, std::string characteristic_uuid, NotificationListener &listener)=0 |
Additional Inherited Members | |
Protected Member Functions inherited from Kallisto | |
Kallisto (std::string name, std::string address) | |
virtual | ~Kallisto () |
Kallisto (Kallisto const &)=delete | |
Kallisto (Kallisto &&)=delete | |
void | operator= (Kallisto const &)=delete |
void | operator= (Kallisto &&)=delete |
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 |
Protected Attributes inherited from Kallisto | |
const std::string | m_name |
const std::string | m_address |
std::string | m_manufacturer |
std::string | m_software_version |
std::string | m_firmware_version |
std::string | m_hardware_version |
Class that implements an Kallisto device.
KallistoImpl | ( | kallisto::bluetooth::BluetoothDevice & | bluetooth_device, |
const bluetooth::BluetoothAdapter::ScanListener::ScanRecord & | record, | ||
bool | legacy_discovery, | ||
util::Executor & | event_dispatcher, | ||
SensorFactory & | sensor_factory | ||
) |
Constructor.
Note: Can throw.
bluetooth_device | The Bluetooth device. |
record | The scan data record. |
legacy_discovery | True if the device should connect for discovery. |
event_dispatcher | Interface for the sensors to send events. The device should run the callbacks using this executor. |
sensor_factory | The factory to generate sensors. |
|
virtual |
Destructor.
void close | ( | ) |
Cleans and closes the device. It is called when the object is no longer needed and invalidates the instance.
|
virtual |
|
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.
|
virtual |
|
virtual |
Get the current RSSI value.
[out] | buffer | The RSSI value.. |
Implements BluetoothDispatcher.
Sensor* getSensor | ( | unsigned int | handle | ) |
Returns the sensor with the passed handle
std::vector<Sensor*> getSensors | ( | ) |
Returns the sensors in this device.
|
virtual |
Get the remote device BLE service list.
Implements BluetoothDispatcher.
error::KallistoDetailedResult onBluetoothDeviceRecovered | ( | kallisto::bluetooth::BluetoothDevice & | bluetooth_device | ) |
Called by the Core when the device appears in a scan during a link loss.
bluetooth_device | The new instance of the bluetooth device. |
|
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.
error::KallistoDetailedResult registerListener | ( | KallistoEventListener & | listener | ) |
error::KallistoDetailedResult registerSensorListener | ( | Sensor & | sensor, |
std::map< std::string, const void *> | parameters, | ||
SensorEventListener & | listener | ||
) |
Registers the passed sensor listener with the sensor with the passed handle.
handle | The sensor handle. |
parameters | The map of parameters. |
listener | The sensor listener. |
error::KallistoDetailedResult stayConnected | ( | bool | enable | ) |
Signals that the system should keep a connection to the passed Kallisto even when not in use. Use the enable param to control this behaviour.
enable | If true, the system will maintain a connection to the device even when not in use. If the device is not connected it will connect right away. |
error::KallistoDetailedResult unregisterListener | ( | KallistoEventListener & | listener | ) |
Unregisters the passed listener.
listener | The Kallisto listener. |
error::KallistoDetailedResult unregisterSensorListener | ( | Sensor & | sensor, |
SensorEventListener & | listener | ||
) |
Unregisters the passed sensor listener from the sensor with the passed handle.
handle | The sensor handle. |
listener | The sensor listener. |
|
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.