Kallisto Linux API
Library for interacting with Kallisto devices
KallistoImpl Class Reference

#include <kallisto_impl.hpp>

Inheritance diagram for KallistoImpl:
Collaboration diagram for KallistoImpl:

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 ()
 
SensorgetSensor (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
 

Detailed Description

Class that implements an Kallisto device.

Constructor & Destructor Documentation

◆ KallistoImpl()

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.

Parameters
bluetooth_deviceThe Bluetooth device.
recordThe scan data record.
legacy_discoveryTrue if the device should connect for discovery.
event_dispatcherInterface for the sensors to send events. The device should run the callbacks using this executor.
sensor_factoryThe factory to generate sensors.

◆ ~KallistoImpl()

virtual ~KallistoImpl ( )
virtual

Destructor.

Member Function Documentation

◆ close()

void close ( )

Cleans and closes the device. It is called when the object is no longer needed and invalidates the instance.

◆ getBeingUsed()

bool getBeingUsed ( )
virtual

Checks if the Kallisto is under active use.

Returns
true
if the device is under use (sensor enabled, etc.).

Implements Kallisto.

◆ getCharacteristics()

std::vector<std::string> getCharacteristics ( std::string  service_uuid)
virtual

Get the remote device BLE characteristic list of the service with the passed UUID.

Parameters
service_uuidThe UUID of the service whose characteristic should be returned.
Returns
A list of UUIDs representing the BLE characteristic of the passed service. Will be empty if the service is not found.

Implements BluetoothDispatcher.

◆ getLinkLoss()

bool getLinkLoss ( )
virtual

Checks if this Kallisto device is in Link Loss.

Link loss represents a state where the device should be connected but that connection was lost. The system will actively try to recover the connection.

Returns
true
if this Kallisto is in Link Loss.

Implements Kallisto.

◆ getRssi()

error::KallistoDetailedResult getRssi ( int &  buffer)
virtual

Get the current RSSI value.

Parameters
[out]bufferThe RSSI value..
Returns
A detailed result.

Implements BluetoothDispatcher.

◆ getSensor()

Sensor* getSensor ( unsigned int  handle)

Returns the sensor with the passed handle

Returns
The requested sensor or nulltpr if not found.

◆ getSensors()

std::vector<Sensor*> getSensors ( )

Returns the sensors in this device.

Returns
A vector with the sensors

◆ getServices()

std::vector<std::string> getServices ( )
virtual

Get the remote device BLE service list.

Returns
A vector of UUIDs representing the BLE services.

Implements BluetoothDispatcher.

◆ onBluetoothDeviceRecovered()

error::KallistoDetailedResult onBluetoothDeviceRecovered ( kallisto::bluetooth::BluetoothDevice bluetooth_device)

Called by the Core when the device appears in a scan during a link loss.

Parameters
bluetooth_deviceThe new instance of the bluetooth device.
Returns
A detailed result.

◆ readCharacteristic()

error::KallistoDetailedResult readCharacteristic ( std::string  service_uuid,
std::string  characteristic_uuid,
std::vector< unsigned char > &  buffer 
)
virtual

Reads the characteristic with the passed UUID of the service with the passed UUID.

Parameters
[in]service_uuidThe UUID of the service containing the characteristic that should be read.
[in]characteristic_uuidThe UUID of the characteristic that should be read.
[out]bufferThe data read.
Returns
A detailed result.

Implements BluetoothDispatcher.

◆ registerListener()

error::KallistoDetailedResult registerListener ( KallistoEventListener listener)

Registers the passed listener.

Parameters
listenerThe Kallisto listener.
Returns
A detailed result.

◆ registerSensorListener()

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.

Parameters
handleThe sensor handle.
parametersThe map of parameters.
listenerThe sensor listener.
Returns
A detailed result.

◆ stayConnected()

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.

Parameters
enableIf 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.
Returns
A detailed result.

◆ unregisterListener()

error::KallistoDetailedResult unregisterListener ( KallistoEventListener listener)

Unregisters the passed listener.

Parameters
listenerThe Kallisto listener.
Returns
A detailed result.

◆ unregisterSensorListener()

error::KallistoDetailedResult unregisterSensorListener ( Sensor sensor,
SensorEventListener listener 
)

Unregisters the passed sensor listener from the sensor with the passed handle.

Parameters
handleThe sensor handle.
listenerThe sensor listener.
Returns
A detailed result.

◆ writeCharacteristic()

error::KallistoDetailedResult writeCharacteristic ( std::string  service_uuid,
std::string  characteristic_uuid,
std::vector< unsigned char > &  buffer 
)
virtual

Writes the passed data to the characteristic with the passed UUID of the service with the passed UUID.

Parameters
[in]service_uuidThe UUID of the service containing the characteristic that should be written.
[in]characteristic_uuidThe UUID of the characteristic that should be written.
[in]bufferA byte buffer with the data to be written.
Returns
A detailed result.

Implements BluetoothDispatcher.


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