Kallisto Linux API
Library for interacting with Kallisto devices
KallistoCoreImpl Class Reference
Inheritance diagram for KallistoCoreImpl:
Collaboration diagram for KallistoCoreImpl:

Public Member Functions

 KallistoCoreImpl (kallisto::bluetooth::BluetoothScannerConfiguration &scanner_configuration, kallisto::bluetooth::BluetoothScannerFilter &scanner_filter)
 
 ~KallistoCoreImpl ()
 
 KallistoCoreImpl (KallistoCoreImpl const &)=delete
 
 KallistoCoreImpl (KallistoCoreImpl &&)=delete
 
void operator= (KallistoCoreImpl const &)=delete
 
void operator= (KallistoCoreImpl &&)=delete
 
error::KallistoDetailedResult registerBluetoothAdapterEventListener (bluetooth::BluetoothAdapterEventListener &listener)
 
error::KallistoDetailedResult unregisterBluetoothAdapterEventListener (bluetooth::BluetoothAdapterEventListener &listener)
 
error::KallistoDetailedResult setScannerConfiguration (bluetooth::BluetoothScannerConfiguration &configuration)
 
const bluetooth::BluetoothScannerConfigurationgetScannerConfiguration ()
 
error::KallistoDetailedResult setScannerFilter (bluetooth::BluetoothScannerFilter &filter)
 
const bluetooth::BluetoothScannerFiltergetScannerFilter ()
 
error::KallistoDetailedResult registerBluetoothScanEventListener (bluetooth::BluetoothScanEventListener &listener)
 
error::KallistoDetailedResult unregisterBluetoothScanEventListener (bluetooth::BluetoothScanEventListener &listener)
 
std::vector< hardware::KallistoImpl * > getDevices ()
 
error::KallistoDetailedResult registerListener (hardware::KallistoEventListener &listener, hardware::Kallisto &kallisto)
 
error::KallistoDetailedResult unregisterListener (hardware::KallistoEventListener &listener, hardware::Kallisto &kallisto)
 
error::KallistoDetailedResult stayConnected (hardware::Kallisto &kallisto, bool enable)
 
error::KallistoDetailedResult registerSensorListener (hardware::SensorEventListener &listener, hardware::Sensor &sensor, std::map< std::string, const void *> parameters)
 
error::KallistoDetailedResult unregisterSensorListener (hardware::SensorEventListener &listener, hardware::Sensor &sensor)
 
void onAdapterConnected (bluetooth::BluetoothAdapter &adapter)
 
void onAdapterDisconnected (bluetooth::BluetoothAdapter &adapter)
 
void onAdapterEnabled (bluetooth::BluetoothAdapter &adapter)
 
void onAdapterEnableFailed (bluetooth::BluetoothAdapter &adapter, bluetooth::BluetoothAdapter::Listener::Error error)
 
void onAdapterDisabled (bluetooth::BluetoothAdapter &adapter)
 
void sendAdapterEvent (AdapterEventType type)
 
void onScanStart ()
 
void onScanStartFailed ()
 
void onScanStop (std::vector< kallisto::bluetooth::BluetoothDevice *> devices_found)
 
void onScan (bluetooth::BluetoothDevice &device, const bluetooth::BluetoothAdapter::ScanListener::ScanRecord record)
 
void sendScanEvent (ScanEventType type, hardware::Kallisto &device, const bluetooth::BluetoothAdapter::ScanListener::ScanRecord record)
 
void onLinkLoss (std::chrono::nanoseconds timestamp, hardware::Kallisto &device)
 
void onLinkRecovered (std::chrono::nanoseconds timestamp, hardware::Kallisto &device)
 
void onLinkRemoved (std::chrono::nanoseconds, hardware::Kallisto &device)
 
void sendKallistoEvent (KallistoEventType type)
 

Additional Inherited Members

- Static Public Member Functions inherited from KallistoCore
static KallistoCoregetInstance ()
 
static SystemManagergetSystemManagerInstance ()
 
static KallistoManagergetKallistoManagerInstance ()
 
static SensorManagergetSensorManagerInstance ()
 
static error::KallistoDetailedResult init (kallisto::log::LoggerConfiguration &logger_configuration, kallisto::bluetooth::BluetoothScannerConfiguration &scanner_configuration, kallisto::bluetooth::BluetoothScannerFilter &scanner_filter)
 
static error::KallistoDetailedResult init ()
 
- Protected Member Functions inherited from KallistoCore
 KallistoCore ()
 
virtual ~KallistoCore ()
 
 KallistoCore (KallistoCore const &)=delete
 
 KallistoCore (KallistoCore &&)=delete
 
void operator= (KallistoCore const &)=delete
 
void operator= (KallistoCore &&)=delete
 
- Static Protected Attributes inherited from KallistoCore
static KallistoCores_instance
 
static SystemManagers_system_manager_instance
 
static KallistoManagers_kallisto_manager_instance
 
static SensorManagers_sensor_manager_instance
 

Constructor & Destructor Documentation

◆ KallistoCoreImpl() [1/2]

◆ ~KallistoCoreImpl()

Destructor.

◆ KallistoCoreImpl() [2/2]

KallistoCoreImpl ( KallistoCoreImpl const &  )
delete

Remove copy and move.

Member Function Documentation

◆ getDevices()

std::vector<hardware::KallistoImpl*> getDevices ( )

Get the current device list.

Returns
A list with the available devices.

◆ getScannerConfiguration()

const bluetooth::BluetoothScannerConfiguration* getScannerConfiguration ( )

Get the current scanner configuration.

Returns
The current scanner configuration or nullptr if the scanner is not available.

◆ getScannerFilter()

const bluetooth::BluetoothScannerFilter* getScannerFilter ( )

Get the current scanner filter.

Returns
The current filter configuration or nullptr if the scanner is not available.

◆ onAdapterConnected()

void onAdapterConnected ( bluetooth::BluetoothAdapter adapter)
virtual

Called when a new Bluetooth adapter is connected.

Parameters
adapterThe new adapter.

Implements BluetoothAdapterManager::Listener.

◆ onAdapterDisabled()

void onAdapterDisabled ( bluetooth::BluetoothAdapter adapter)
virtual

Called when a Bluetooth adapter is disconnected.

Parameters
adapterThe disconnected adapter.

Implements BluetoothAdapter::Listener.

◆ onAdapterDisconnected()

void onAdapterDisconnected ( bluetooth::BluetoothAdapter adapter)
virtual

Called when a Bluetooth adapter is disconnected.

Parameters
adapterThe disconnected adapter.

Implements BluetoothAdapterManager::Listener.

◆ onAdapterEnabled()

void onAdapterEnabled ( bluetooth::BluetoothAdapter adapter)
virtual

Called when a new Bluetooth adapter is connected.

Parameters
adapterThe new adapter.

Implements BluetoothAdapter::Listener.

◆ onAdapterEnableFailed()

void onAdapterEnableFailed ( bluetooth::BluetoothAdapter adapter,
bluetooth::BluetoothAdapter::Listener::Error  error 
)
virtual

Called when a new Bluetooth adapter is connected.

Parameters
adapterThe new adapter.

Implements BluetoothAdapter::Listener.

◆ onLinkLoss()

void onLinkLoss ( std::chrono::nanoseconds  timestamp,
hardware::Kallisto device 
)
virtual

Called when the connection to a device under use is lost.

Parameters
timestampThe time at which the event happened in nanoseconds since the epoch.
deviceThe device that generated the event.

Reimplemented from KallistoEventListener.

◆ onLinkRecovered()

void onLinkRecovered ( std::chrono::nanoseconds  timestamp,
hardware::Kallisto device 
)
virtual

Called when the connection to a device under use is recovered.

Parameters
timestampThe time at which the event happened in nanoseconds since the epoch.
deviceThe device that generated the event.

Reimplemented from KallistoEventListener.

◆ onLinkRemoved()

void onLinkRemoved ( std::chrono::nanoseconds  ,
hardware::Kallisto device 
)
virtual

Called when there is a timeout while waiting for connection recovery.

Parameters
timestampThe time at which the event happened in nanoseconds since the epoch.
deviceThe device that generated the event.

Implements KallistoEventListener.

◆ onScan()

void onScan ( bluetooth::BluetoothDevice device,
const bluetooth::BluetoothAdapter::ScanListener::ScanRecord  record 
)
virtual

Called when advertisement is received.

Parameters
deviceBluetooth device.
recordThe scan data record.

Implements BluetoothAdapter::ScanListener.

◆ onScanStart()

void onScanStart ( )
virtual

Called when a scan is started.

Implements BluetoothAdapter::ScanListener.

◆ onScanStartFailed()

void onScanStartFailed ( )
virtual

Called when a scan start fails.

Implements BluetoothAdapter::ScanListener.

◆ onScanStop()

void onScanStop ( std::vector< kallisto::bluetooth::BluetoothDevice *>  devices_found)
virtual

Called when a scan is stopped.

Parameters
devices_foundList of devices found during the scan.
Note
We have 3 states when this callback is called: 1 - Scanning normally. Will check if any Kallisto disappeared; 2 - Stopped current scan because a scan for Link Loss started; 3 - Stopped current scan because a scan for Link Loss ended and we should resume last scanning state

Implements BluetoothAdapter::ScanListener.

◆ registerBluetoothAdapterEventListener()

error::KallistoDetailedResult registerBluetoothAdapterEventListener ( bluetooth::BluetoothAdapterEventListener listener)

Registers a listener.

Parameters
listenerA listener to receive bluetooth adapter events.
Returns
A detailed result.

◆ registerBluetoothScanEventListener()

error::KallistoDetailedResult registerBluetoothScanEventListener ( bluetooth::BluetoothScanEventListener listener)

Registers a listener.

Parameters
listenerA listener to receive bluetooth scan events.
Returns
A detailed result.

◆ registerListener()

error::KallistoDetailedResult registerListener ( hardware::KallistoEventListener listener,
hardware::Kallisto kallisto 
)

Registers a listener for the passed Kallisto.

Parameters
listenerA listener to receive Kallisto events.
kallistoThe Kallisto to register to.
Returns
A detailed result.

◆ registerSensorListener()

error::KallistoDetailedResult registerSensorListener ( hardware::SensorEventListener listener,
hardware::Sensor sensor,
std::map< std::string, const void *>  parameters 
)

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.

◆ sendAdapterEvent()

void sendAdapterEvent ( AdapterEventType  type)

Dispatch an adapter event to registered listeners.

Parameters
typeThe event type. Defines the callback to be called.

◆ sendKallistoEvent()

void sendKallistoEvent ( KallistoEventType  type)

Dispatch an Kallisto event to registered listeners.

Parameters
typeThe event type. Defines the callback to be called.

◆ sendScanEvent()

void sendScanEvent ( ScanEventType  type,
hardware::Kallisto device,
const bluetooth::BluetoothAdapter::ScanListener::ScanRecord  record 
)

Dispatch an scan event to registered listeners.

Parameters
typeThe event type. Defines the callback to be called.
deviceThe device that generated the event
recordScan record

◆ setScannerConfiguration()

error::KallistoDetailedResult setScannerConfiguration ( bluetooth::BluetoothScannerConfiguration configuration)

Updates the scanner configuration.

Parameters
listenerA scanner configuration.
Returns
A detailed result.

◆ setScannerFilter()

Updates the scanner filter.

Parameters
listenerA scanner filter.
Returns
A detailed result.

◆ stayConnected()

error::KallistoDetailedResult stayConnected ( hardware::Kallisto kallisto,
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
kallistoThe Kallisto to stay connected with.
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.

◆ unregisterBluetoothAdapterEventListener()

error::KallistoDetailedResult unregisterBluetoothAdapterEventListener ( bluetooth::BluetoothAdapterEventListener listener)

Unregisters a previously registered listener.

Parameters
listenerThe listener registered.
Returns
A detailed result.

◆ unregisterBluetoothScanEventListener()

error::KallistoDetailedResult unregisterBluetoothScanEventListener ( bluetooth::BluetoothScanEventListener listener)

Unregisters a previously registered listener.

Parameters
listenerThe listener registered.
Returns
A detailed result.

◆ unregisterListener()

error::KallistoDetailedResult unregisterListener ( hardware::KallistoEventListener listener,
hardware::Kallisto kallisto 
)

Unregisters the listener for the passed Kallisto.

Parameters
listenerA listener to receive Kallisto events.
kallistoThe Kallisto to register to.
Returns
A detailed result.

◆ unregisterSensorListener()

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

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

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

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