White toolbar, load optimizations.

This commit is contained in:
Robin Davies
2022-02-07 07:32:09 -05:00
parent d273f30a75
commit 01b6f801e9
28 changed files with 3996 additions and 124 deletions
+28
View File
@@ -0,0 +1,28 @@
#include "bluez_proxy.h"
namespace org { namespace bluez {
using BleDevice_Interfaces = sdbus::ProxyInterfaces<
org::bluez::LEAdvertisingManager1_proxy,
org::bluez::NetworkServer1_proxy,
org::bluez::GattManager1_proxy
>;
class BleDeviceProxy : public BleDevice_Interfaces
{
public:
BleDeviceProxy(std::string destination, std::string path)
: BleDevice_Interfaces(std::move(destination),std::move(path))
{
registerProxy();
}
~BleDeviceProxy()
{
unregisterProxy();
}
};
}}; // namesapce
+276
View File
@@ -0,0 +1,276 @@
<!--
Copyright 2015 Intel Corporation All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
******************************************************************
The introspection XML found in this file is used to generate GDBus
skeleton code that will be used by the IoTivity BlueZ-based GATT
Service (OIC Transport Profile) implementation.
See the GATT and LE Advertisement API documentation in the BlueZ
gatt-api.txt and advertisement-api.txt documents, respectively for
further details.
-->
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node name="/org/pipedald/gatt/service">
<!--
***********************************************
BlueZ GATT Service interface introspection XML.
***********************************************
-->
<interface name="org.bluez.GattService1">
<property name="UUID" type="s" access="read"/>
<property name="Primary" type="b" access="read"/>
<property name="Characteristics" type="ao" access="read"/>
<!--
===========================================================
The "Device" property is only exposed on the client side by
BlueZ itself. It isn't set by the IoTivity server side.
Don't bother generating skeleton code for it.
===========================================================
<property name="Device" type="o" access="read">
</property>
===========================================================
The "Includes" property is not supported as of BlueZ 5.30.
It also isn't used by the IoTivity server side
implementation. Don't bother generating skeleton code for
it.
===========================================================
<property name="Includes" type="ao" access="read"/>
-->
</interface>
<!--
******************************************************
BlueZ GATT Characteristic interface introspection XML.
******************************************************
-->
<interface name="org.bluez.GattCharacteristic1">
<!--
============================================================
None of the OIC GATT characteristics support the "ReadValue"
method. Don't bother generating skeleton code for it.
============================================================
<method name="ReadValue">
<arg name="value" type="ay" direction="out"/>
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</method>
-->
<method name="WriteValue">
<arg name="value" type="ay" direction="in">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</arg>
</method>
<method name="StartNotify"/>
<method name="StopNotify"/>
<property name="UUID" type="s" access="read"/>
<property name="Service" type="o" access="read"/>
<property name="Value" type="ay" access="read">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</property>
<property name="Notifying" type="b" access="read">
</property>
<property name="Flags" type="as" access="read"/>
<property name="Descriptors" type="ao" access="read"/>
</interface>
<!--
**************************************************
BlueZ GATT Descriptor interface introspection XML.
**************************************************
-->
<interface name="org.bluez.GattDescriptor1">
<method name="ReadValue">
<arg name="value" type="ay" direction="out">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</arg>
</method>
<!--
============================================================
None of the OIC GATT descriptors directly supported by
IoTivity support the "WriteValue" method. The OIC Client
Characteristic Configuration Descriptor supports writes, but
that descriptor is handled by BlueZ, not IoTivity, when the
"notify" property is set on a given GATT characteristic.
Don't bother generating skeleton code for it.
============================================================
<method name="WriteValue">
<arg name="value" type="ay" direction="in">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</arg>
</method>
-->
<property name="UUID" type="s" access="read"/>
<property name="Characteristic" type="o" access="read"/>
<property name="Value" type="ay" access="read">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</property>
<property name="Flags" type="as" access="read"/>
</interface>
<!--
***************************************************
BlueZ LE Advertisement interface introspection XML.
***************************************************
-->
<interface name="org.bluez.LEAdvertisement1">
<method name="Release">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<property name="Type" type="s" access="read"/>
<property name="ServiceUUIDs" type="as" access="read"/>
<property name="ManufacturerData" type="a{sv}" access="read"/>
<property name="SolicitUUIDs" type="as" access="read"/>
<property name="ServiceData" type="a{sv}" access="read"/>
<property name="IncludeTxPower" type="b" access="read"/>
</interface>
<!--
**************************************
BlueZ LE instance interfaces.
**************************************
-->
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml" type="s" direction="out"/>
</method>
</interface>
<interface name="org.bluez.Adapter1">
<method name="StartDiscovery"></method>
<method name="SetDiscoveryFilter">
<arg name="properties" type="a{sv}" direction="in"/>
</method>
<method name="StopDiscovery"></method>
<method name="RemoveDevice">
<arg name="device" type="o" direction="in"/>
</method>
<method name="GetDiscoveryFilters">
<arg name="filters" type="as" direction="out"/>
</method>
<property name="Address" type="s" access="read"></property>
<property name="AddressType" type="s" access="read"></property>
<property name="Name" type="s" access="read"></property>
<property name="Alias" type="s" access="readwrite"></property>
<property name="Class" type="u" access="read"></property>
<property name="Powered" type="b" access="readwrite"></property>
<property name="Discoverable" type="b" access="readwrite"></property>
<property name="DiscoverableTimeout" type="u" access="readwrite"></property>
<property name="Pairable" type="b" access="readwrite"></property>
<property name="PairableTimeout" type="u" access="readwrite"></property>
<property name="Discovering" type="b" access="read"></property>
<property name="UUIDs" type="as" access="read"></property>
<property name="Modalias" type="s" access="read"></property>
<property name="Roles" type="as" access="read"></property>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface" type="s" direction="in"/>
<arg name="properties" type="a{sv}" direction="out"/>
</method>
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.bluez.GattManager1">
<method name="RegisterApplication">
<arg name="application" type="o" direction="in"/>
<arg name="options" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterApplication">
<arg name="application" type="o" direction="in"/>
</method>
</interface>
<interface name="org.bluez.LEAdvertisingManager1">
<method name="RegisterAdvertisement">
<arg name="advertisement" type="o" direction="in"/>
<arg name="options" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterAdvertisement">
<arg name="service" type="o" direction="in"/>
</method>
<property name="ActiveInstances" type="y" access="read"></property>
<property name="SupportedInstances" type="y" access="read"></property>
<property name="SupportedIncludes" type="as" access="read"></property>
<property name="SupportedSecondaryChannels" type="as" access="read"></property>
</interface>
<interface name="org.bluez.Media1">
<method name="RegisterEndpoint">
<arg name="endpoint" type="o" direction="in"/>
<arg name="properties" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterEndpoint">
<arg name="endpoint" type="o" direction="in"/>
</method>
<method name="RegisterPlayer">
<arg name="player" type="o" direction="in"/>
<arg name="properties" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterPlayer">
<arg name="player" type="o" direction="in"/>
</method>
<method name="RegisterApplication">
<arg name="application" type="o" direction="in"/>
<arg name="options" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterApplication">
<arg name="application" type="o" direction="in"/>
</method>
</interface>
<interface name="org.bluez.NetworkServer1">
<method name="Register">
<arg name="uuid" type="s" direction="in"/>
<arg name="bridge" type="s" direction="in"/>
</method>
<method name="Unregister">
<arg name="uuid" type="s" direction="in"/>
</method>
</interface>
</node>
+428
View File
@@ -0,0 +1,428 @@
/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp___home_rerdavies_src_pipedal_src_dbus_bluez_adaptor_h__adaptor__H__
#define __sdbuscpp___home_rerdavies_src_pipedal_src_dbus_bluez_adaptor_h__adaptor__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace bluez {
class GattService1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattService1";
protected:
GattService1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerProperty("UUID").onInterface(INTERFACE_NAME).withGetter([this](){ return this->UUID(); });
object_.registerProperty("Primary").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Primary(); });
object_.registerProperty("Characteristics").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Characteristics(); });
}
~GattService1_adaptor() = default;
private:
virtual std::string UUID() = 0;
virtual bool Primary() = 0;
virtual std::vector<sdbus::ObjectPath> Characteristics() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class GattCharacteristic1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattCharacteristic1";
protected:
GattCharacteristic1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("WriteValue").onInterface(INTERFACE_NAME).withInputParamNames("value").implementedAs([this](const std::vector<uint8_t>& value){ return this->WriteValue(value); });
object_.registerMethod("StartNotify").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->StartNotify(); });
object_.registerMethod("StopNotify").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->StopNotify(); });
object_.registerProperty("UUID").onInterface(INTERFACE_NAME).withGetter([this](){ return this->UUID(); });
object_.registerProperty("Service").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Service(); });
object_.registerProperty("Value").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Value(); });
object_.registerProperty("Notifying").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Notifying(); });
object_.registerProperty("Flags").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Flags(); });
object_.registerProperty("Descriptors").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Descriptors(); });
}
~GattCharacteristic1_adaptor() = default;
private:
virtual void WriteValue(const std::vector<uint8_t>& value) = 0;
virtual void StartNotify() = 0;
virtual void StopNotify() = 0;
private:
virtual std::string UUID() = 0;
virtual sdbus::ObjectPath Service() = 0;
virtual std::vector<uint8_t> Value() = 0;
virtual bool Notifying() = 0;
virtual std::vector<std::string> Flags() = 0;
virtual std::vector<sdbus::ObjectPath> Descriptors() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class GattDescriptor1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattDescriptor1";
protected:
GattDescriptor1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("ReadValue").onInterface(INTERFACE_NAME).withOutputParamNames("value").implementedAs([this](){ return this->ReadValue(); });
object_.registerProperty("UUID").onInterface(INTERFACE_NAME).withGetter([this](){ return this->UUID(); });
object_.registerProperty("Characteristic").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Characteristic(); });
object_.registerProperty("Value").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Value(); });
object_.registerProperty("Flags").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Flags(); });
}
~GattDescriptor1_adaptor() = default;
private:
virtual std::vector<uint8_t> ReadValue() = 0;
private:
virtual std::string UUID() = 0;
virtual sdbus::ObjectPath Characteristic() = 0;
virtual std::vector<uint8_t> Value() = 0;
virtual std::vector<std::string> Flags() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class LEAdvertisement1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.LEAdvertisement1";
protected:
LEAdvertisement1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("Release").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->Release(); }).withNoReply();
object_.registerProperty("Type").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Type(); });
object_.registerProperty("ServiceUUIDs").onInterface(INTERFACE_NAME).withGetter([this](){ return this->ServiceUUIDs(); });
object_.registerProperty("ManufacturerData").onInterface(INTERFACE_NAME).withGetter([this](){ return this->ManufacturerData(); });
object_.registerProperty("SolicitUUIDs").onInterface(INTERFACE_NAME).withGetter([this](){ return this->SolicitUUIDs(); });
object_.registerProperty("ServiceData").onInterface(INTERFACE_NAME).withGetter([this](){ return this->ServiceData(); });
object_.registerProperty("IncludeTxPower").onInterface(INTERFACE_NAME).withGetter([this](){ return this->IncludeTxPower(); });
}
~LEAdvertisement1_adaptor() = default;
private:
virtual void Release() = 0;
private:
virtual std::string Type() = 0;
virtual std::vector<std::string> ServiceUUIDs() = 0;
virtual std::map<std::string, sdbus::Variant> ManufacturerData() = 0;
virtual std::vector<std::string> SolicitUUIDs() = 0;
virtual std::map<std::string, sdbus::Variant> ServiceData() = 0;
virtual bool IncludeTxPower() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace freedesktop {
namespace DBus {
class Introspectable_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.DBus.Introspectable";
protected:
Introspectable_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("Introspect").onInterface(INTERFACE_NAME).withOutputParamNames("xml").implementedAs([this](){ return this->Introspect(); });
}
~Introspectable_adaptor() = default;
private:
virtual std::string Introspect() = 0;
private:
sdbus::IObject& object_;
};
}}} // namespaces
namespace org {
namespace bluez {
class Adapter1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.Adapter1";
protected:
Adapter1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("StartDiscovery").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->StartDiscovery(); });
object_.registerMethod("SetDiscoveryFilter").onInterface(INTERFACE_NAME).withInputParamNames("properties").implementedAs([this](const std::map<std::string, sdbus::Variant>& properties){ return this->SetDiscoveryFilter(properties); });
object_.registerMethod("StopDiscovery").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->StopDiscovery(); });
object_.registerMethod("RemoveDevice").onInterface(INTERFACE_NAME).withInputParamNames("device").implementedAs([this](const sdbus::ObjectPath& device){ return this->RemoveDevice(device); });
object_.registerMethod("GetDiscoveryFilters").onInterface(INTERFACE_NAME).withOutputParamNames("filters").implementedAs([this](){ return this->GetDiscoveryFilters(); });
object_.registerProperty("Address").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Address(); });
object_.registerProperty("AddressType").onInterface(INTERFACE_NAME).withGetter([this](){ return this->AddressType(); });
object_.registerProperty("Name").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Name(); });
object_.registerProperty("Alias").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Alias(); }).withSetter([this](const std::string& value){ this->Alias(value); });
object_.registerProperty("Class").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Class(); });
object_.registerProperty("Powered").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Powered(); }).withSetter([this](const bool& value){ this->Powered(value); });
object_.registerProperty("Discoverable").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Discoverable(); }).withSetter([this](const bool& value){ this->Discoverable(value); });
object_.registerProperty("DiscoverableTimeout").onInterface(INTERFACE_NAME).withGetter([this](){ return this->DiscoverableTimeout(); }).withSetter([this](const uint32_t& value){ this->DiscoverableTimeout(value); });
object_.registerProperty("Pairable").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Pairable(); }).withSetter([this](const bool& value){ this->Pairable(value); });
object_.registerProperty("PairableTimeout").onInterface(INTERFACE_NAME).withGetter([this](){ return this->PairableTimeout(); }).withSetter([this](const uint32_t& value){ this->PairableTimeout(value); });
object_.registerProperty("Discovering").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Discovering(); });
object_.registerProperty("UUIDs").onInterface(INTERFACE_NAME).withGetter([this](){ return this->UUIDs(); });
object_.registerProperty("Modalias").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Modalias(); });
object_.registerProperty("Roles").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Roles(); });
}
~Adapter1_adaptor() = default;
private:
virtual void StartDiscovery() = 0;
virtual void SetDiscoveryFilter(const std::map<std::string, sdbus::Variant>& properties) = 0;
virtual void StopDiscovery() = 0;
virtual void RemoveDevice(const sdbus::ObjectPath& device) = 0;
virtual std::vector<std::string> GetDiscoveryFilters() = 0;
private:
virtual std::string Address() = 0;
virtual std::string AddressType() = 0;
virtual std::string Name() = 0;
virtual std::string Alias() = 0;
virtual void Alias(const std::string& value) = 0;
virtual uint32_t Class() = 0;
virtual bool Powered() = 0;
virtual void Powered(const bool& value) = 0;
virtual bool Discoverable() = 0;
virtual void Discoverable(const bool& value) = 0;
virtual uint32_t DiscoverableTimeout() = 0;
virtual void DiscoverableTimeout(const uint32_t& value) = 0;
virtual bool Pairable() = 0;
virtual void Pairable(const bool& value) = 0;
virtual uint32_t PairableTimeout() = 0;
virtual void PairableTimeout(const uint32_t& value) = 0;
virtual bool Discovering() = 0;
virtual std::vector<std::string> UUIDs() = 0;
virtual std::string Modalias() = 0;
virtual std::vector<std::string> Roles() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace freedesktop {
namespace DBus {
class Properties_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.DBus.Properties";
protected:
Properties_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("Get").onInterface(INTERFACE_NAME).withInputParamNames("interface", "name").withOutputParamNames("value").implementedAs([this](const std::string& interface, const std::string& name){ return this->Get(interface, name); });
object_.registerMethod("Set").onInterface(INTERFACE_NAME).withInputParamNames("interface", "name", "value").implementedAs([this](const std::string& interface, const std::string& name, const sdbus::Variant& value){ return this->Set(interface, name, value); });
object_.registerMethod("GetAll").onInterface(INTERFACE_NAME).withInputParamNames("interface").withOutputParamNames("properties").implementedAs([this](const std::string& interface){ return this->GetAll(interface); });
object_.registerSignal("PropertiesChanged").onInterface(INTERFACE_NAME).withParameters<std::string, std::map<std::string, sdbus::Variant>, std::vector<std::string>>("interface", "changed_properties", "invalidated_properties");
}
~Properties_adaptor() = default;
public:
void emitPropertiesChanged(const std::string& interface, const std::map<std::string, sdbus::Variant>& changed_properties, const std::vector<std::string>& invalidated_properties)
{
object_.emitSignal("PropertiesChanged").onInterface(INTERFACE_NAME).withArguments(interface, changed_properties, invalidated_properties);
}
private:
virtual sdbus::Variant Get(const std::string& interface, const std::string& name) = 0;
virtual void Set(const std::string& interface, const std::string& name, const sdbus::Variant& value) = 0;
virtual std::map<std::string, sdbus::Variant> GetAll(const std::string& interface) = 0;
private:
sdbus::IObject& object_;
};
}}} // namespaces
namespace org {
namespace bluez {
class GattManager1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattManager1";
protected:
GattManager1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("RegisterApplication").onInterface(INTERFACE_NAME).withInputParamNames("application", "options").implementedAs([this](const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options){ return this->RegisterApplication(application, options); });
object_.registerMethod("UnregisterApplication").onInterface(INTERFACE_NAME).withInputParamNames("application").implementedAs([this](const sdbus::ObjectPath& application){ return this->UnregisterApplication(application); });
}
~GattManager1_adaptor() = default;
private:
virtual void RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options) = 0;
virtual void UnregisterApplication(const sdbus::ObjectPath& application) = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class LEAdvertisingManager1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.LEAdvertisingManager1";
protected:
LEAdvertisingManager1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("RegisterAdvertisement").onInterface(INTERFACE_NAME).withInputParamNames("advertisement", "options").implementedAs([this](const sdbus::ObjectPath& advertisement, const std::map<std::string, sdbus::Variant>& options){ return this->RegisterAdvertisement(advertisement, options); });
object_.registerMethod("UnregisterAdvertisement").onInterface(INTERFACE_NAME).withInputParamNames("service").implementedAs([this](const sdbus::ObjectPath& service){ return this->UnregisterAdvertisement(service); });
object_.registerProperty("ActiveInstances").onInterface(INTERFACE_NAME).withGetter([this](){ return this->ActiveInstances(); });
object_.registerProperty("SupportedInstances").onInterface(INTERFACE_NAME).withGetter([this](){ return this->SupportedInstances(); });
object_.registerProperty("SupportedIncludes").onInterface(INTERFACE_NAME).withGetter([this](){ return this->SupportedIncludes(); });
object_.registerProperty("SupportedSecondaryChannels").onInterface(INTERFACE_NAME).withGetter([this](){ return this->SupportedSecondaryChannels(); });
}
~LEAdvertisingManager1_adaptor() = default;
private:
virtual void RegisterAdvertisement(const sdbus::ObjectPath& advertisement, const std::map<std::string, sdbus::Variant>& options) = 0;
virtual void UnregisterAdvertisement(const sdbus::ObjectPath& service) = 0;
private:
virtual uint8_t ActiveInstances() = 0;
virtual uint8_t SupportedInstances() = 0;
virtual std::vector<std::string> SupportedIncludes() = 0;
virtual std::vector<std::string> SupportedSecondaryChannels() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class Media1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.Media1";
protected:
Media1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("RegisterEndpoint").onInterface(INTERFACE_NAME).withInputParamNames("endpoint", "properties").implementedAs([this](const sdbus::ObjectPath& endpoint, const std::map<std::string, sdbus::Variant>& properties){ return this->RegisterEndpoint(endpoint, properties); });
object_.registerMethod("UnregisterEndpoint").onInterface(INTERFACE_NAME).withInputParamNames("endpoint").implementedAs([this](const sdbus::ObjectPath& endpoint){ return this->UnregisterEndpoint(endpoint); });
object_.registerMethod("RegisterPlayer").onInterface(INTERFACE_NAME).withInputParamNames("player", "properties").implementedAs([this](const sdbus::ObjectPath& player, const std::map<std::string, sdbus::Variant>& properties){ return this->RegisterPlayer(player, properties); });
object_.registerMethod("UnregisterPlayer").onInterface(INTERFACE_NAME).withInputParamNames("player").implementedAs([this](const sdbus::ObjectPath& player){ return this->UnregisterPlayer(player); });
object_.registerMethod("RegisterApplication").onInterface(INTERFACE_NAME).withInputParamNames("application", "options").implementedAs([this](const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options){ return this->RegisterApplication(application, options); });
object_.registerMethod("UnregisterApplication").onInterface(INTERFACE_NAME).withInputParamNames("application").implementedAs([this](const sdbus::ObjectPath& application){ return this->UnregisterApplication(application); });
}
~Media1_adaptor() = default;
private:
virtual void RegisterEndpoint(const sdbus::ObjectPath& endpoint, const std::map<std::string, sdbus::Variant>& properties) = 0;
virtual void UnregisterEndpoint(const sdbus::ObjectPath& endpoint) = 0;
virtual void RegisterPlayer(const sdbus::ObjectPath& player, const std::map<std::string, sdbus::Variant>& properties) = 0;
virtual void UnregisterPlayer(const sdbus::ObjectPath& player) = 0;
virtual void RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options) = 0;
virtual void UnregisterApplication(const sdbus::ObjectPath& application) = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class NetworkServer1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.NetworkServer1";
protected:
NetworkServer1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("Register").onInterface(INTERFACE_NAME).withInputParamNames("uuid", "bridge").implementedAs([this](const std::string& uuid, const std::string& bridge){ return this->Register(uuid, bridge); });
object_.registerMethod("Unregister").onInterface(INTERFACE_NAME).withInputParamNames("uuid").implementedAs([this](const std::string& uuid){ return this->Unregister(uuid); });
}
~NetworkServer1_adaptor() = default;
private:
virtual void Register(const std::string& uuid, const std::string& bridge) = 0;
virtual void Unregister(const std::string& uuid) = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
#endif
+631
View File
@@ -0,0 +1,631 @@
/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp___home_rerdavies_src_pipedal_src_dbus_bluez_proxy_h__proxy__H__
#define __sdbuscpp___home_rerdavies_src_pipedal_src_dbus_bluez_proxy_h__proxy__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace bluez {
class GattService1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattService1";
protected:
GattService1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~GattService1_proxy() = default;
public:
std::string UUID()
{
return proxy_.getProperty("UUID").onInterface(INTERFACE_NAME);
}
bool Primary()
{
return proxy_.getProperty("Primary").onInterface(INTERFACE_NAME);
}
std::vector<sdbus::ObjectPath> Characteristics()
{
return proxy_.getProperty("Characteristics").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class GattCharacteristic1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattCharacteristic1";
protected:
GattCharacteristic1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~GattCharacteristic1_proxy() = default;
public:
void WriteValue(const std::vector<uint8_t>& value)
{
proxy_.callMethod("WriteValue").onInterface(INTERFACE_NAME).withArguments(value);
}
void StartNotify()
{
proxy_.callMethod("StartNotify").onInterface(INTERFACE_NAME);
}
void StopNotify()
{
proxy_.callMethod("StopNotify").onInterface(INTERFACE_NAME);
}
public:
std::string UUID()
{
return proxy_.getProperty("UUID").onInterface(INTERFACE_NAME);
}
sdbus::ObjectPath Service()
{
return proxy_.getProperty("Service").onInterface(INTERFACE_NAME);
}
std::vector<uint8_t> Value()
{
return proxy_.getProperty("Value").onInterface(INTERFACE_NAME);
}
bool Notifying()
{
return proxy_.getProperty("Notifying").onInterface(INTERFACE_NAME);
}
std::vector<std::string> Flags()
{
return proxy_.getProperty("Flags").onInterface(INTERFACE_NAME);
}
std::vector<sdbus::ObjectPath> Descriptors()
{
return proxy_.getProperty("Descriptors").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class GattDescriptor1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattDescriptor1";
protected:
GattDescriptor1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~GattDescriptor1_proxy() = default;
public:
std::vector<uint8_t> ReadValue()
{
std::vector<uint8_t> result;
proxy_.callMethod("ReadValue").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
public:
std::string UUID()
{
return proxy_.getProperty("UUID").onInterface(INTERFACE_NAME);
}
sdbus::ObjectPath Characteristic()
{
return proxy_.getProperty("Characteristic").onInterface(INTERFACE_NAME);
}
std::vector<uint8_t> Value()
{
return proxy_.getProperty("Value").onInterface(INTERFACE_NAME);
}
std::vector<std::string> Flags()
{
return proxy_.getProperty("Flags").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class LEAdvertisement1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.LEAdvertisement1";
protected:
LEAdvertisement1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~LEAdvertisement1_proxy() = default;
public:
void Release()
{
proxy_.callMethod("Release").onInterface(INTERFACE_NAME).dontExpectReply();
}
public:
std::string Type()
{
return proxy_.getProperty("Type").onInterface(INTERFACE_NAME);
}
std::vector<std::string> ServiceUUIDs()
{
return proxy_.getProperty("ServiceUUIDs").onInterface(INTERFACE_NAME);
}
std::map<std::string, sdbus::Variant> ManufacturerData()
{
return proxy_.getProperty("ManufacturerData").onInterface(INTERFACE_NAME);
}
std::vector<std::string> SolicitUUIDs()
{
return proxy_.getProperty("SolicitUUIDs").onInterface(INTERFACE_NAME);
}
std::map<std::string, sdbus::Variant> ServiceData()
{
return proxy_.getProperty("ServiceData").onInterface(INTERFACE_NAME);
}
bool IncludeTxPower()
{
return proxy_.getProperty("IncludeTxPower").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace freedesktop {
namespace DBus {
class Introspectable_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.DBus.Introspectable";
protected:
Introspectable_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~Introspectable_proxy() = default;
public:
std::string Introspect()
{
std::string result;
proxy_.callMethod("Introspect").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
private:
sdbus::IProxy& proxy_;
};
}}} // namespaces
namespace org {
namespace bluez {
class Adapter1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.Adapter1";
protected:
Adapter1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~Adapter1_proxy() = default;
public:
void StartDiscovery()
{
proxy_.callMethod("StartDiscovery").onInterface(INTERFACE_NAME);
}
void SetDiscoveryFilter(const std::map<std::string, sdbus::Variant>& properties)
{
proxy_.callMethod("SetDiscoveryFilter").onInterface(INTERFACE_NAME).withArguments(properties);
}
void StopDiscovery()
{
proxy_.callMethod("StopDiscovery").onInterface(INTERFACE_NAME);
}
void RemoveDevice(const sdbus::ObjectPath& device)
{
proxy_.callMethod("RemoveDevice").onInterface(INTERFACE_NAME).withArguments(device);
}
std::vector<std::string> GetDiscoveryFilters()
{
std::vector<std::string> result;
proxy_.callMethod("GetDiscoveryFilters").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
public:
std::string Address()
{
return proxy_.getProperty("Address").onInterface(INTERFACE_NAME);
}
std::string AddressType()
{
return proxy_.getProperty("AddressType").onInterface(INTERFACE_NAME);
}
std::string Name()
{
return proxy_.getProperty("Name").onInterface(INTERFACE_NAME);
}
std::string Alias()
{
return proxy_.getProperty("Alias").onInterface(INTERFACE_NAME);
}
void Alias(const std::string& value)
{
proxy_.setProperty("Alias").onInterface(INTERFACE_NAME).toValue(value);
}
uint32_t Class()
{
return proxy_.getProperty("Class").onInterface(INTERFACE_NAME);
}
bool Powered()
{
return proxy_.getProperty("Powered").onInterface(INTERFACE_NAME);
}
void Powered(const bool& value)
{
proxy_.setProperty("Powered").onInterface(INTERFACE_NAME).toValue(value);
}
bool Discoverable()
{
return proxy_.getProperty("Discoverable").onInterface(INTERFACE_NAME);
}
void Discoverable(const bool& value)
{
proxy_.setProperty("Discoverable").onInterface(INTERFACE_NAME).toValue(value);
}
uint32_t DiscoverableTimeout()
{
return proxy_.getProperty("DiscoverableTimeout").onInterface(INTERFACE_NAME);
}
void DiscoverableTimeout(const uint32_t& value)
{
proxy_.setProperty("DiscoverableTimeout").onInterface(INTERFACE_NAME).toValue(value);
}
bool Pairable()
{
return proxy_.getProperty("Pairable").onInterface(INTERFACE_NAME);
}
void Pairable(const bool& value)
{
proxy_.setProperty("Pairable").onInterface(INTERFACE_NAME).toValue(value);
}
uint32_t PairableTimeout()
{
return proxy_.getProperty("PairableTimeout").onInterface(INTERFACE_NAME);
}
void PairableTimeout(const uint32_t& value)
{
proxy_.setProperty("PairableTimeout").onInterface(INTERFACE_NAME).toValue(value);
}
bool Discovering()
{
return proxy_.getProperty("Discovering").onInterface(INTERFACE_NAME);
}
std::vector<std::string> UUIDs()
{
return proxy_.getProperty("UUIDs").onInterface(INTERFACE_NAME);
}
std::string Modalias()
{
return proxy_.getProperty("Modalias").onInterface(INTERFACE_NAME);
}
std::vector<std::string> Roles()
{
return proxy_.getProperty("Roles").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace freedesktop {
namespace DBus {
class Properties_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.DBus.Properties";
protected:
Properties_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
proxy_.uponSignal("PropertiesChanged").onInterface(INTERFACE_NAME).call([this](const std::string& interface, const std::map<std::string, sdbus::Variant>& changed_properties, const std::vector<std::string>& invalidated_properties){ this->onPropertiesChanged(interface, changed_properties, invalidated_properties); });
}
~Properties_proxy() = default;
virtual void onPropertiesChanged(const std::string& interface, const std::map<std::string, sdbus::Variant>& changed_properties, const std::vector<std::string>& invalidated_properties) = 0;
public:
sdbus::Variant Get(const std::string& interface, const std::string& name)
{
sdbus::Variant result;
proxy_.callMethod("Get").onInterface(INTERFACE_NAME).withArguments(interface, name).storeResultsTo(result);
return result;
}
void Set(const std::string& interface, const std::string& name, const sdbus::Variant& value)
{
proxy_.callMethod("Set").onInterface(INTERFACE_NAME).withArguments(interface, name, value);
}
std::map<std::string, sdbus::Variant> GetAll(const std::string& interface)
{
std::map<std::string, sdbus::Variant> result;
proxy_.callMethod("GetAll").onInterface(INTERFACE_NAME).withArguments(interface).storeResultsTo(result);
return result;
}
private:
sdbus::IProxy& proxy_;
};
}}} // namespaces
namespace org {
namespace bluez {
class GattManager1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattManager1";
protected:
GattManager1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~GattManager1_proxy() = default;
public:
void RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options)
{
proxy_.callMethod("RegisterApplication").onInterface(INTERFACE_NAME).withArguments(application, options);
}
void UnregisterApplication(const sdbus::ObjectPath& application)
{
proxy_.callMethod("UnregisterApplication").onInterface(INTERFACE_NAME).withArguments(application);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class LEAdvertisingManager1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.LEAdvertisingManager1";
protected:
LEAdvertisingManager1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~LEAdvertisingManager1_proxy() = default;
public:
void RegisterAdvertisement(const sdbus::ObjectPath& advertisement, const std::map<std::string, sdbus::Variant>& options)
{
proxy_.callMethod("RegisterAdvertisement").onInterface(INTERFACE_NAME).withArguments(advertisement, options);
}
void UnregisterAdvertisement(const sdbus::ObjectPath& service)
{
proxy_.callMethod("UnregisterAdvertisement").onInterface(INTERFACE_NAME).withArguments(service);
}
public:
uint8_t ActiveInstances()
{
return proxy_.getProperty("ActiveInstances").onInterface(INTERFACE_NAME);
}
uint8_t SupportedInstances()
{
return proxy_.getProperty("SupportedInstances").onInterface(INTERFACE_NAME);
}
std::vector<std::string> SupportedIncludes()
{
return proxy_.getProperty("SupportedIncludes").onInterface(INTERFACE_NAME);
}
std::vector<std::string> SupportedSecondaryChannels()
{
return proxy_.getProperty("SupportedSecondaryChannels").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class Media1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.Media1";
protected:
Media1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~Media1_proxy() = default;
public:
void RegisterEndpoint(const sdbus::ObjectPath& endpoint, const std::map<std::string, sdbus::Variant>& properties)
{
proxy_.callMethod("RegisterEndpoint").onInterface(INTERFACE_NAME).withArguments(endpoint, properties);
}
void UnregisterEndpoint(const sdbus::ObjectPath& endpoint)
{
proxy_.callMethod("UnregisterEndpoint").onInterface(INTERFACE_NAME).withArguments(endpoint);
}
void RegisterPlayer(const sdbus::ObjectPath& player, const std::map<std::string, sdbus::Variant>& properties)
{
proxy_.callMethod("RegisterPlayer").onInterface(INTERFACE_NAME).withArguments(player, properties);
}
void UnregisterPlayer(const sdbus::ObjectPath& player)
{
proxy_.callMethod("UnregisterPlayer").onInterface(INTERFACE_NAME).withArguments(player);
}
void RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options)
{
proxy_.callMethod("RegisterApplication").onInterface(INTERFACE_NAME).withArguments(application, options);
}
void UnregisterApplication(const sdbus::ObjectPath& application)
{
proxy_.callMethod("UnregisterApplication").onInterface(INTERFACE_NAME).withArguments(application);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class NetworkServer1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.NetworkServer1";
protected:
NetworkServer1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~NetworkServer1_proxy() = default;
public:
void Register(const std::string& uuid, const std::string& bridge)
{
proxy_.callMethod("Register").onInterface(INTERFACE_NAME).withArguments(uuid, bridge);
}
void Unregister(const std::string& uuid)
{
proxy_.callMethod("Unregister").onInterface(INTERFACE_NAME).withArguments(uuid);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
#endif
+58
View File
@@ -0,0 +1,58 @@
#include "bluez_adaptor.h"
#include "bluez.h"
#include "catch.hpp"
#define TEST_UUID "6b49786f-271d-415d-8e2c-bd5ef8aa6f47"
using TestAdvertisementInterfaces = sdbus::AdaptorInterfaces<org::bluez::LEAdvertisement1_adaptor>;
class TestAdvertisement: public TestAdvertisementInterfaces
{
private:
std::vector<std::string> serviceUuids;
public:
TestAdvertisement(sdbus::IConnection& connection, std::string objectPath)
: TestAdvertisementInterfaces(connection,std::move(objectPath))
{
serviceUuids.push_back(TEST_UUID);
}
private:
virtual void Release() { delete this; }
private:
virtual std::string Type() { return "peripheral"; }
virtual std::vector<std::string> ServiceUUIDs() { return serviceUuids; }
virtual std::map<std::string, sdbus::Variant> ManufacturerData() {
return std::map<std::string, sdbus::Variant>();
};
virtual std::vector<std::string> SolicitUUIDs() {
return std::vector<std::string>();
}
virtual std::map<std::string, sdbus::Variant> ServiceData()
{
return std::map<std::string, sdbus::Variant>();
}
virtual bool IncludeTxPower() {
return false;
}
};
void RunService()
{
const char* SERVICE_NAME="com.twoplay.pipedal.onboarding";
const char* SERVICE_PATH="/com/twoplay/pipedal/onboarding";
auto connector = sdbus::createSystemBusConnection(SERVICE_NAME);
TestAdvertisement testAdvertisement(*connector,SERVICE_PATH);
}
TEST_CASE( "Bluetooth service", "[bluetooth_service]" ) {
org::bluez::BleDeviceProxy device("org.bluez","/org/bluez/hci0");
auto includes = device.SupportedIncludes();
}