AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::bluetoothImplementations::blueZ::DBusConnection Class Reference

#include <DBusConnection.h>

Public Member Functions

 ~DBusConnection ()
 
unsigned int subscribeToSignal (const char *serviceName, const char *interfaceName, const char *member, const char *firstArgumentFilter, GDBusSignalCallback callback, gpointer userData)
 
GDBusConnection * getGDBusConnection ()
 
void close ()
 

Static Public Member Functions

static std::unique_ptr< DBusConnectioncreate (GBusType connectionType=G_BUS_TYPE_SYSTEM)
 

Detailed Description

A wrapper around DBus connection object.

Constructor & Destructor Documentation

◆ ~DBusConnection()

alexaClientSDK::bluetoothImplementations::blueZ::DBusConnection::~DBusConnection ( )

Destructor.

Member Function Documentation

◆ close()

void alexaClientSDK::bluetoothImplementations::blueZ::DBusConnection::close ( )

Closes the connection. All the subscriptions are closed automatically.

◆ create()

static std::unique_ptr<DBusConnection> alexaClientSDK::bluetoothImplementations::blueZ::DBusConnection::create ( GBusType  connectionType = G_BUS_TYPE_SYSTEM)
static

Connects to DBus and returns a new instance of DBusConnection.

Parameters
connectionTypeA GBusType of the connection.
Returns
A pointer to DBusConnection instance or nullptr in case of error.

◆ getGDBusConnection()

GDBusConnection* alexaClientSDK::bluetoothImplementations::blueZ::DBusConnection::getGDBusConnection ( )

Get GDBusConnection pointer

Returns
A pointer to GDBusConnection.

◆ subscribeToSignal()

unsigned int alexaClientSDK::bluetoothImplementations::blueZ::DBusConnection::subscribeToSignal ( const char *  serviceName,
const char *  interfaceName,
const char *  member,
const char *  firstArgumentFilter,
GDBusSignalCallback  callback,
gpointer  userData 
)

Subscribes a callback to DBus signal

Parameters
serviceNameDBus service name. E.g.: "org.bluez"
interfaceNameName of the DBus interface to listen to. E.g.: "org.freedesktop.DBus.ObjectManager"
memberName of the interface member (event name). E.g.: "InterfacesAdded"
firstArgumentFilterA string to filter the first argument of the event callback with. Null if no filter applied. For BlueZ the first argument could contain the ObjectPath of the object that is being added/removed or changed.
callbackCallback to be called by DBus
userDataA pointer to be passed to a callback
Returns
id of the callback created or 0 on error.
Remarks
DBusConnection internally keeps list of all subscriptions made. They all will be closed in the destructor. For most of the cases we don't need the unsubscribing in runtime, so this is left undone now.

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

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0