White toolbar, load optimizations.
This commit is contained in:
+40
-6
@@ -4,6 +4,15 @@ cmake_minimum_required(VERSION 3.16.0)
|
||||
|
||||
include(FindPkgConfig)
|
||||
|
||||
|
||||
# apt install libsdbus-c++-dev
|
||||
# apt install libsdbus-c++-bin
|
||||
find_package(sdbus-c++ REQUIRED)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Can't get the pkg_check to work.
|
||||
# pkg_check_modules(LIBNL3 "nl-genl-3")
|
||||
# if(!LIBNL3_FOUND)
|
||||
@@ -54,10 +63,14 @@ endif()
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
set (USE_SANITIZE False)
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
message(STATUS "Debug build")
|
||||
|
||||
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -fsanitize=address -static-libasan -O0 -DDEBUG -Werror" )
|
||||
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -O0 -DDEBUG -Werror" )
|
||||
if (USE_SANITIZE)
|
||||
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-fsanitize=address -static-libasan " )
|
||||
endif()
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
message(STATUS "RelWithgDebInfo build")
|
||||
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -Werror" )
|
||||
@@ -72,7 +85,20 @@ endif()
|
||||
|
||||
message (STATUS "Cxx flags: ${CMAKE_CXX_FLAGS}" )
|
||||
|
||||
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_BIND_GLOBAL_PLACEHOLDERS)
|
||||
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_BIND_GLOBAL_PLACEHOLDERS -DONBOARDING)
|
||||
|
||||
# build Bluez dbus proxies
|
||||
# requires apt install libsdbus-c++-bin
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_SOURCE_DIR}/src/dbus/bluez_proxy.h ${PROJECT_SOURCE_DIR}/src/dbus/bluez_adaptor.h
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/src/dbus/bluez.xml
|
||||
COMMAND sdbus-c++-xml2cpp ${PROJECT_SOURCE_DIR}/src/dbus/bluez.xml
|
||||
--proxy=${PROJECT_SOURCE_DIR}/src/dbus/bluez_proxy.h
|
||||
--adaptor=${PROJECT_SOURCE_DIR}/src/dbus/bluez_adaptor.h
|
||||
|
||||
COMMENT "Generating D-Bus bindings for bluez"
|
||||
)
|
||||
|
||||
|
||||
set (PIPEDAL_SOURCES
|
||||
SysExec.cpp SysExec.hpp
|
||||
@@ -101,7 +127,6 @@ set (PIPEDAL_SOURCES
|
||||
Worker.hpp Worker.cpp
|
||||
OptionsFeature.hpp OptionsFeature.cpp
|
||||
VuUpdate.hpp VuUpdate.cpp
|
||||
asan_options.cpp
|
||||
Units.hpp Units.cpp
|
||||
RingBuffer.hpp
|
||||
PiPedalConfiguration.hpp PiPedalConfiguration.cpp
|
||||
@@ -119,12 +144,15 @@ set (PIPEDAL_SOURCES
|
||||
WifiChannels.cpp
|
||||
RegDb.cpp RegDb.hpp
|
||||
PiPedalAlsa.hpp PiPedalAlsa.cpp
|
||||
InheritPriorityMutex.hpp InheritPriorityMutex.cpp
|
||||
)
|
||||
|
||||
configure_file(config.hpp.in config.hpp)
|
||||
|
||||
#################################
|
||||
add_executable(pipedald ${PIPEDAL_SOURCES} main.cpp
|
||||
add_executable(pipedald ${PIPEDAL_SOURCES}
|
||||
asan_options.cpp # disable leak checking for sanitize=address.
|
||||
main.cpp
|
||||
)
|
||||
|
||||
include_directories( ${pipedald_SOURCE_DIR}/. ../build/src)
|
||||
@@ -138,18 +166,24 @@ target_include_directories(pipedald PRIVATE
|
||||
)
|
||||
|
||||
target_link_libraries(pipedald PRIVATE pthread atomic stdc++fs asound
|
||||
${LILV_0_LIBRARIES} ${JACK_LIBRARIES} ${LIBNL3_LIBRARIES} systemd
|
||||
${LILV_0_LIBRARIES} ${JACK_LIBRARIES} ${LIBNL3_LIBRARIES} systemd SDBusCpp::sdbus-c++
|
||||
)
|
||||
|
||||
#################################
|
||||
add_executable(pipedaltest ${PIPEDAL_SOURCES} testMain.cpp
|
||||
dbus/bluez_proxy.h dbus/bluez_adaptor.h
|
||||
dbus/bluez_test.cpp
|
||||
jsonTest.cpp
|
||||
WifiChannelsTest.cpp
|
||||
PiPedalAlsaTest.cpp
|
||||
|
||||
Lv2HostLeakTest.cpp
|
||||
|
||||
|
||||
SystemConfigFile.hpp SystemConfigFile.cpp
|
||||
SystemConfigFileTest.cpp
|
||||
BeastServerTest.cpp
|
||||
MemDebug.cpp
|
||||
)
|
||||
|
||||
configure_file(config.hpp.in config.hpp)
|
||||
@@ -164,7 +198,7 @@ target_include_directories(pipedaltest PRIVATE
|
||||
)
|
||||
|
||||
target_link_libraries(pipedaltest PRIVATE pthread atomic stdc++fs asound
|
||||
${LILV_0_LIBRARIES} ${JACK_LIBRARIES} ${LIBNL3_LIBRARIES} systemd
|
||||
${LILV_0_LIBRARIES} ${JACK_LIBRARIES} ${LIBNL3_LIBRARIES} systemd SDBusCpp::sdbus-c++
|
||||
)
|
||||
|
||||
#################################
|
||||
|
||||
@@ -302,6 +302,11 @@ void InstallJackService()
|
||||
// sysExec(USERMOD_BIN " -a -G " JACK_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
|
||||
sysExec(USERMOD_BIN " -a -G" AUDIO_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
|
||||
|
||||
// If ONBOARDING, add to bluetooth group.
|
||||
#ifdef ONBOARDING
|
||||
sysExec(USERMOD_BIN " -a -G bluetooth " JACK_SERVICE_ACCOUNT_NAME);
|
||||
#endif
|
||||
|
||||
// deploy the systemd service file
|
||||
std::map<std::string, std::string> map; // nothing to customize.
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#include "InheritPriorityMutex.hpp"
|
||||
|
||||
|
||||
using namespace pipedal;
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
inherit_priority_recursive_mutex::inherit_priority_recursive_mutex()
|
||||
{
|
||||
#ifdef __linux__ // (I think windows mutexes have priority inheritance alread)
|
||||
|
||||
// Recreate the raw mutex with priory inheritance.
|
||||
::pthread_mutex_destroy(native_handle());
|
||||
::pthread_mutexattr_t attr;
|
||||
::pthread_mutexattr_init(&attr);
|
||||
::pthread_mutexattr_setprotocol(&attr,PTHREAD_PRIO_INHERIT);
|
||||
::pthread_mutex_init(native_handle(),&attr);
|
||||
::pthread_mutexattr_destroy(&attr);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2021 Robin Davies
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
// this software and associated documentation files (the "Software"), to deal in
|
||||
// the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
// the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace pipedal {
|
||||
using namespace std;
|
||||
|
||||
class inherit_priority_recursive_mutex: public recursive_mutex {
|
||||
public:
|
||||
inherit_priority_recursive_mutex();
|
||||
};
|
||||
}; // namespace
|
||||
+3
-2
@@ -44,6 +44,7 @@ using namespace pipedal;
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include "Lv2EventBufferWriter.hpp"
|
||||
#include "InheritPriorityMutex.hpp"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sched.h>
|
||||
@@ -115,7 +116,7 @@ class JackHostImpl : public JackHost
|
||||
{
|
||||
private:
|
||||
|
||||
std::recursive_mutex mutex;
|
||||
inherit_priority_recursive_mutex mutex;
|
||||
int64_t overrunGracePeriodSamples = 0;
|
||||
|
||||
IJackHostCallbacks *pNotifyCallbacks = nullptr;
|
||||
@@ -1388,7 +1389,7 @@ private:
|
||||
std::vector<RestartThread *> restartThreads;
|
||||
|
||||
public:
|
||||
std::recursive_mutex restart_mutex;
|
||||
inherit_priority_recursive_mutex restart_mutex;
|
||||
virtual void UpdateServerConfiguration(const JackServerSettings &jackServerSettings,
|
||||
std::function<void(bool success, const std::string &errorMessage)> onComplete)
|
||||
{
|
||||
|
||||
+97
-88
@@ -93,6 +93,52 @@ namespace pipedal
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Lv2Host::LilvUris::Initialize(LilvWorld*pWorld)
|
||||
{
|
||||
rdfsComment = lilv_new_uri(pWorld, Lv2Host::RDFS_COMMENT_URI);
|
||||
logarithic_uri = lilv_new_uri(pWorld, LV2_PORT_LOGARITHMIC);
|
||||
display_priority_uri = lilv_new_uri(pWorld, LV2_PORT_DISPLAY_PRIORITY);
|
||||
range_steps_uri = lilv_new_uri(pWorld, LV2_PORT_RANGE_STEPS);
|
||||
integer_property_uri = lilv_new_uri(pWorld, LV2_INTEGER);
|
||||
enumeration_property_uri = lilv_new_uri(pWorld, LV2_ENUMERATION);
|
||||
toggle_property_uri = lilv_new_uri(pWorld, LV2_CORE__toggled);
|
||||
not_on_gui_property_uri = lilv_new_uri(pWorld, LV2_PORT_PROPS__notOnGUI);
|
||||
midiEventNode = lilv_new_uri(pWorld, LV2_MIDI_EVENT);
|
||||
designationNode = lilv_new_uri(pWorld, LV2_DESIGNATION);
|
||||
portGroupUri = lilv_new_uri(pWorld, LV2_PORT_GROUPS__group);
|
||||
unitsUri = lilv_new_uri(pWorld, LV2_UNITS__unit);
|
||||
bufferType_uri = lilv_new_uri(pWorld, LV2_ATOM__bufferType);
|
||||
pset_Preset = lilv_new_uri(pWorld, LV2_PRESETS__Preset);
|
||||
rdfs_label = lilv_new_uri(pWorld, LILV_NS_RDFS "label");
|
||||
symbolUri = lilv_new_uri(pWorld, LV2_CORE__symbol);
|
||||
nameUri = lilv_new_uri(pWorld, LV2_CORE__name);
|
||||
|
||||
}
|
||||
|
||||
void Lv2Host::LilvUris::Free()
|
||||
{
|
||||
rdfsComment.Free();
|
||||
logarithic_uri.Free();
|
||||
display_priority_uri.Free();
|
||||
range_steps_uri.Free();
|
||||
integer_property_uri.Free();
|
||||
enumeration_property_uri.Free();
|
||||
toggle_property_uri.Free();
|
||||
not_on_gui_property_uri.Free();
|
||||
midiEventNode.Free();
|
||||
designationNode.Free();
|
||||
portGroupUri.Free();
|
||||
unitsUri.Free();
|
||||
bufferType_uri.Free();
|
||||
pset_Preset.Free();
|
||||
rdfs_label.Free();
|
||||
symbolUri.Free();
|
||||
nameUri.Free();
|
||||
|
||||
}
|
||||
|
||||
static std::string nodeAsString(const LilvNode *node)
|
||||
{
|
||||
if (node == nullptr)
|
||||
@@ -134,11 +180,11 @@ static float nodeAsFloat(const LilvNode *node, float default_ = 0)
|
||||
return default_;
|
||||
}
|
||||
|
||||
class NodeAutoFree
|
||||
class NodeAutoFree: public LilvNodePtr
|
||||
{
|
||||
LilvNode *node = nullptr;
|
||||
|
||||
|
||||
// const LilvNode* returns must not be freed, by convention.
|
||||
private:
|
||||
NodeAutoFree(const LilvNode *node)
|
||||
{
|
||||
}
|
||||
@@ -146,25 +192,10 @@ class NodeAutoFree
|
||||
public:
|
||||
NodeAutoFree()
|
||||
{
|
||||
this->node = nullptr;
|
||||
}
|
||||
NodeAutoFree(LilvNode *node)
|
||||
:LilvNodePtr(node)
|
||||
{
|
||||
this->node = node;
|
||||
}
|
||||
operator const LilvNode *()
|
||||
{
|
||||
return this->node;
|
||||
}
|
||||
|
||||
LilvNode **operator&()
|
||||
{
|
||||
return &(this->node);
|
||||
}
|
||||
|
||||
operator bool()
|
||||
{
|
||||
return this->node != nullptr;
|
||||
}
|
||||
|
||||
float as_float(float defaultValue = 0)
|
||||
@@ -194,11 +225,6 @@ public:
|
||||
|
||||
~NodeAutoFree()
|
||||
{
|
||||
if (this->node != nullptr)
|
||||
{
|
||||
lilv_free(this->node);
|
||||
this->node = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -235,6 +261,7 @@ void Lv2Host::OnConfigurationChanged(const JackConfiguration &configuration, con
|
||||
Lv2Host::~Lv2Host()
|
||||
{
|
||||
delete[] lv2Features;
|
||||
lilvUris.Free();
|
||||
free_world();
|
||||
delete urids;
|
||||
}
|
||||
@@ -290,21 +317,21 @@ std::shared_ptr<Lv2PluginClass> Lv2Host::GetPluginClass(const LilvPluginClass *p
|
||||
std::shared_ptr<Lv2PluginClass> Lv2Host::MakePluginClass(const LilvPluginClass *pClass)
|
||||
{
|
||||
std::string uri = nodeAsString(lilv_plugin_class_get_uri(pClass));
|
||||
|
||||
std::shared_ptr<Lv2PluginClass> pResult = this->classesMap[uri];
|
||||
if (!pResult)
|
||||
auto t = this->classesMap.find(uri);
|
||||
if (t != classesMap.end())
|
||||
{
|
||||
const LilvNode *parentNode = lilv_plugin_class_get_parent_uri(pClass);
|
||||
std::string parent_uri = nodeAsString(parentNode);
|
||||
|
||||
std::string name = nodeAsString(lilv_plugin_class_get_label(pClass));
|
||||
|
||||
std::shared_ptr<Lv2PluginClass> result = std::make_shared<Lv2PluginClass>(
|
||||
name.c_str(), uri.c_str(), parent_uri.c_str());
|
||||
|
||||
classesMap[uri] = std::move(result);
|
||||
return t->second;
|
||||
}
|
||||
return pResult;
|
||||
const LilvNode *parentNode = lilv_plugin_class_get_parent_uri(pClass);
|
||||
std::string parent_uri = nodeAsString(parentNode);
|
||||
|
||||
std::string name = nodeAsString(lilv_plugin_class_get_label(pClass));
|
||||
|
||||
std::shared_ptr<Lv2PluginClass> result = std::make_shared<Lv2PluginClass>(
|
||||
name.c_str(), uri.c_str(), parent_uri.c_str());
|
||||
|
||||
classesMap[uri] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
void Lv2Host::LoadPluginClassesFromLilv()
|
||||
@@ -352,6 +379,7 @@ void Lv2Host::Load(const char *lv2Path)
|
||||
pWorld = lilv_world_new();
|
||||
lilv_world_load_all(pWorld);
|
||||
|
||||
lilvUris.Initialize(pWorld);
|
||||
|
||||
const LilvPlugins *plugins = lilv_world_get_all_plugins(pWorld);
|
||||
|
||||
@@ -465,14 +493,13 @@ static std::vector<std::string> nodeAsStringArray(const LilvNodes *nodes)
|
||||
return result;
|
||||
}
|
||||
|
||||
static const char *RDFS_COMMENT_URI = "http://www.w3.org/2000/01/rdf-schema#"
|
||||
const char *Lv2Host::RDFS_COMMENT_URI = "http://www.w3.org/2000/01/rdf-schema#"
|
||||
"comment";
|
||||
|
||||
static LilvNode *get_comment(LilvWorld *pWorld, const std::string &uri)
|
||||
LilvNode *Lv2Host::get_comment(const std::string &uri)
|
||||
{
|
||||
NodeAutoFree uriNode = lilv_new_uri(pWorld, uri.c_str());
|
||||
NodeAutoFree rdfsComment = lilv_new_uri(pWorld, RDFS_COMMENT_URI);
|
||||
LilvNode *result = lilv_world_get(pWorld, uriNode, rdfsComment, nullptr);
|
||||
LilvNode *result = lilv_world_get(pWorld, uriNode, lilvUris.rdfsComment, nullptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -509,7 +536,7 @@ Lv2PluginInfo::Lv2PluginInfo(Lv2Host *lv2Host, const LilvPlugin *pPlugin)
|
||||
NodesAutoFree extensions = lilv_plugin_get_extension_data(pPlugin);
|
||||
this->extensions_ = nodeAsStringArray(extensions);
|
||||
|
||||
NodeAutoFree comment = get_comment(lv2Host->pWorld, this->uri_);
|
||||
NodeAutoFree comment = lv2Host->get_comment(this->uri_);
|
||||
this->comment_ = nodeAsString(comment);
|
||||
|
||||
uint32_t ports = lilv_plugin_get_num_ports(pPlugin);
|
||||
@@ -521,7 +548,7 @@ Lv2PluginInfo::Lv2PluginInfo(Lv2Host *lv2Host, const LilvPlugin *pPlugin)
|
||||
{
|
||||
const LilvPort *pPort = lilv_plugin_get_port_by_index(pPlugin, i);
|
||||
|
||||
std::shared_ptr<Lv2PortInfo> portInfo{new Lv2PortInfo(lv2Host, pPlugin, pPort)};
|
||||
std::shared_ptr<Lv2PortInfo> portInfo = std::make_shared<Lv2PortInfo>(lv2Host, pPlugin, pPort);
|
||||
if (!portInfo->is_valid())
|
||||
{
|
||||
isValid = false;
|
||||
@@ -550,6 +577,7 @@ Lv2PluginInfo::Lv2PluginInfo(Lv2Host *lv2Host, const LilvPlugin *pPlugin)
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(ports_.begin(), ports_.end(), ports_sort_compare);
|
||||
this->is_valid_ = isValid;
|
||||
}
|
||||
@@ -602,16 +630,16 @@ static bool scale_points_sort_compare(const Lv2ScalePoint &v1, const Lv2ScalePoi
|
||||
{
|
||||
return v1.value() < v2.value();
|
||||
}
|
||||
Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvPort *pPort)
|
||||
Lv2PortInfo::Lv2PortInfo(Lv2Host *host, const LilvPlugin *plugin, const LilvPort *pPort)
|
||||
{
|
||||
auto pWorld = plugins->pWorld;
|
||||
auto pWorld = host->pWorld;
|
||||
index_ = lilv_port_get_index(plugin, pPort);
|
||||
symbol_ = nodeAsString(lilv_port_get_symbol(plugin, pPort));
|
||||
|
||||
NodeAutoFree name = lilv_port_get_name(plugin, pPort);
|
||||
name_ = nodeAsString(name);
|
||||
|
||||
classes_ = plugins->GetPluginPortClass(plugin, pPort);
|
||||
classes_ = host->GetPluginPortClass(plugin, pPort);
|
||||
|
||||
NodeAutoFree minNode, maxNode, defaultNode;
|
||||
min_value_ = 0;
|
||||
@@ -635,11 +663,9 @@ Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvP
|
||||
if (default_value_ < min_value_)
|
||||
default_value_ = min_value_;
|
||||
|
||||
NodeAutoFree logarithic_uri = lilv_new_uri(pWorld, LV2_PORT_LOGARITHMIC);
|
||||
this->is_logarithmic_ = lilv_port_has_property(plugin, pPort, logarithic_uri);
|
||||
this->is_logarithmic_ = lilv_port_has_property(plugin, pPort, host->lilvUris.logarithic_uri);
|
||||
|
||||
NodeAutoFree display_priority_uri = lilv_new_uri(pWorld, LV2_PORT_DISPLAY_PRIORITY);
|
||||
NodesAutoFree priority_nodes = lilv_port_get_value(plugin, pPort, display_priority_uri);
|
||||
NodesAutoFree priority_nodes = lilv_port_get_value(plugin, pPort, host->lilvUris.display_priority_uri);
|
||||
|
||||
this->display_priority_ = -1;
|
||||
if (priority_nodes)
|
||||
@@ -651,8 +677,7 @@ Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvP
|
||||
}
|
||||
}
|
||||
|
||||
NodeAutoFree range_steps_uri = lilv_new_uri(pWorld, LV2_PORT_RANGE_STEPS);
|
||||
NodesAutoFree range_steps_nodes = lilv_port_get_value(plugin, pPort, range_steps_uri);
|
||||
NodesAutoFree range_steps_nodes = lilv_port_get_value(plugin, pPort, host->lilvUris.range_steps_uri);
|
||||
this->range_steps_ = 0;
|
||||
if (range_steps_nodes)
|
||||
{
|
||||
@@ -662,17 +687,13 @@ Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvP
|
||||
this->range_steps_ = lilv_node_as_int(range_steps_node);
|
||||
}
|
||||
}
|
||||
NodeAutoFree integer_property_uri = lilv_new_uri(pWorld, LV2_INTEGER);
|
||||
this->integer_property_ = lilv_port_has_property(plugin, pPort, integer_property_uri);
|
||||
this->integer_property_ = lilv_port_has_property(plugin, pPort, host->lilvUris.integer_property_uri);
|
||||
|
||||
NodeAutoFree enumeration_property_uri = lilv_new_uri(pWorld, LV2_ENUMERATION);
|
||||
this->enumeration_property_ = lilv_port_has_property(plugin, pPort, enumeration_property_uri);
|
||||
this->enumeration_property_ = lilv_port_has_property(plugin, pPort, host->lilvUris.enumeration_property_uri);
|
||||
|
||||
NodeAutoFree toggle_property_uri = lilv_new_uri(pWorld, LV2_CORE__toggled);
|
||||
this->toggled_property_ = lilv_port_has_property(plugin, pPort, toggle_property_uri);
|
||||
this->toggled_property_ = lilv_port_has_property(plugin, pPort, host->lilvUris.toggle_property_uri);
|
||||
|
||||
NodeAutoFree not_on_gui_property_uri = lilv_new_uri(pWorld, LV2_PORT_PROPS__notOnGUI);
|
||||
this->not_on_gui_ = lilv_port_has_property(plugin, pPort, not_on_gui_property_uri);
|
||||
this->not_on_gui_ = lilv_port_has_property(plugin, pPort, host->lilvUris.not_on_gui_property_uri);
|
||||
|
||||
LilvScalePoints *pScalePoints = lilv_port_get_scale_points(plugin, pPort);
|
||||
LILV_FOREACH(scale_points, iSP, pScalePoints)
|
||||
@@ -688,32 +709,27 @@ Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvP
|
||||
|
||||
std::sort(scale_points_.begin(), scale_points_.end(), scale_points_sort_compare);
|
||||
|
||||
is_input_ = is_a(plugins, LV2_INPUT_PORT);
|
||||
is_output_ = is_a(plugins, LV2_OUTPUT_PORT);
|
||||
is_input_ = is_a(host, LV2_INPUT_PORT);
|
||||
is_output_ = is_a(host, LV2_OUTPUT_PORT);
|
||||
|
||||
is_control_port_ = is_a(plugins, LV2_CORE__ControlPort);
|
||||
is_audio_port_ = is_a(plugins, LV2_CORE__AudioPort);
|
||||
is_atom_port_ = is_a(plugins, LV2_ATOM_PORT);
|
||||
is_cv_port_ = is_a(plugins, LV2_CORE__CVPort);
|
||||
is_control_port_ = is_a(host, LV2_CORE__ControlPort);
|
||||
is_audio_port_ = is_a(host, LV2_CORE__AudioPort);
|
||||
is_atom_port_ = is_a(host, LV2_ATOM_PORT);
|
||||
is_cv_port_ = is_a(host, LV2_CORE__CVPort);
|
||||
|
||||
NodeAutoFree midiEventNode = lilv_new_uri(plugins->pWorld, LV2_MIDI_EVENT);
|
||||
supports_midi_ = lilv_port_supports_event(plugin, pPort, midiEventNode);
|
||||
supports_midi_ = lilv_port_supports_event(plugin, pPort, host->lilvUris.midiEventNode);
|
||||
|
||||
NodeAutoFree designationNode = lilv_new_uri(plugins->pWorld, LV2_DESIGNATION);
|
||||
NodeAutoFree designationValue = lilv_port_get(plugin, pPort, designationNode);
|
||||
NodeAutoFree designationValue = lilv_port_get(plugin, pPort, host->lilvUris.designationNode);
|
||||
designation_ = nodeAsString(designationValue);
|
||||
|
||||
NodeAutoFree portGroupUri = lilv_new_uri(plugins->pWorld, LV2_PORT_GROUPS__group);
|
||||
NodeAutoFree portGroup_value = lilv_port_get(plugin, pPort, portGroupUri);
|
||||
NodeAutoFree portGroup_value = lilv_port_get(plugin, pPort, host->lilvUris.portGroupUri);
|
||||
port_group_ = nodeAsString(portGroup_value);
|
||||
|
||||
NodeAutoFree unitsUri = lilv_new_uri(plugins->pWorld, LV2_UNITS__unit);
|
||||
NodeAutoFree unitsValueUri = lilv_port_get(plugin, pPort, unitsUri);
|
||||
NodeAutoFree unitsValueUri = lilv_port_get(plugin, pPort, host->lilvUris.unitsUri);
|
||||
this->units_ = UriToUnits(nodeAsString(unitsValueUri));
|
||||
|
||||
|
||||
NodeAutoFree bufferType_uri = lilv_new_uri(pWorld, LV2_ATOM__bufferType);
|
||||
NodeAutoFree bufferType = lilv_port_get(plugin, pPort, bufferType_uri);
|
||||
NodeAutoFree bufferType = lilv_port_get(plugin, pPort, host->lilvUris.bufferType_uri);
|
||||
|
||||
this->buffer_type_ = "";
|
||||
if (bufferType)
|
||||
@@ -920,11 +936,8 @@ std::vector<ControlValue> Lv2Host::LoadPluginPreset(PedalBoardItem*pedalBoardIte
|
||||
throw PiPedalStateException("No such plugin.");
|
||||
}
|
||||
|
||||
NodeAutoFree pset_Preset = lilv_new_uri(pWorld, LV2_PRESETS__Preset);
|
||||
NodeAutoFree rdfs_label = lilv_new_uri(pWorld, LILV_NS_RDFS "label");
|
||||
|
||||
|
||||
LilvNodes* presets = lilv_plugin_get_related(plugin, pset_Preset);
|
||||
LilvNodes* presets = lilv_plugin_get_related(plugin, lilvUris.pset_Preset);
|
||||
LILV_FOREACH(nodes, i, presets) {
|
||||
const LilvNode* preset = lilv_nodes_get(presets, i);
|
||||
lilv_world_load_resource(pWorld, preset);
|
||||
@@ -980,17 +993,15 @@ std::vector<Lv2PluginPreset> Lv2Host::GetPluginPresets(const std::string &plugin
|
||||
throw PiPedalStateException("No such plugin.");
|
||||
}
|
||||
|
||||
NodeAutoFree pset_Preset = lilv_new_uri(pWorld, LV2_PRESETS__Preset);
|
||||
NodeAutoFree rdfs_label = lilv_new_uri(pWorld, LILV_NS_RDFS "label");
|
||||
|
||||
|
||||
LilvNodes* presets = lilv_plugin_get_related(plugin, pset_Preset);
|
||||
LilvNodes* presets = lilv_plugin_get_related(plugin, lilvUris.pset_Preset);
|
||||
LILV_FOREACH(nodes, i, presets) {
|
||||
const LilvNode* preset = lilv_nodes_get(presets, i);
|
||||
lilv_world_load_resource(pWorld, preset);
|
||||
|
||||
LilvNodes* labels = lilv_world_find_nodes(
|
||||
pWorld, preset, rdfs_label, NULL);
|
||||
pWorld, preset, lilvUris.rdfs_label, NULL);
|
||||
if (labels) {
|
||||
const LilvNode* label = lilv_nodes_get_first(labels);
|
||||
std::string presetName = nodeAsString(label);
|
||||
@@ -1035,13 +1046,11 @@ Lv2PortGroup::Lv2PortGroup(Lv2Host *lv2Host, const std::string &groupUri)
|
||||
{
|
||||
LilvWorld *pWorld = lv2Host->pWorld;
|
||||
|
||||
NodeAutoFree symbolUri = lilv_new_uri(pWorld, LV2_CORE__symbol);
|
||||
NodeAutoFree nameUri = lilv_new_uri(pWorld, LV2_CORE__name);
|
||||
this->uri_ = groupUri;
|
||||
NodeAutoFree uri = lilv_new_uri(pWorld, groupUri.c_str());
|
||||
LilvNode *symbolNode = lilv_world_get(pWorld, uri, symbolUri, nullptr);
|
||||
LilvNode *symbolNode = lilv_world_get(pWorld, uri, lv2Host->lilvUris.symbolUri, nullptr);
|
||||
symbol_ = nodeAsString(symbolNode);
|
||||
LilvNode *nameNode = lilv_world_get(pWorld, uri, nameUri, nullptr);
|
||||
LilvNode *nameNode = lilv_world_get(pWorld, uri, lv2Host->lilvUris.nameUri, nullptr);
|
||||
name_ = nodeAsString(nameNode);
|
||||
}
|
||||
|
||||
|
||||
+67
-1
@@ -100,6 +100,13 @@ private:
|
||||
this->parent_ = parent.get();
|
||||
}
|
||||
void add_child(std::shared_ptr<Lv2PluginClass> &child) {
|
||||
for (size_t i = 0; i < children_.size(); ++i)
|
||||
{
|
||||
if (children_[i]->uri_ == child->uri_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
children_.push_back(child);
|
||||
}
|
||||
public:
|
||||
@@ -180,9 +187,10 @@ enum class Lv2BufferType {
|
||||
};
|
||||
|
||||
class Lv2PortInfo {
|
||||
public:
|
||||
Lv2PortInfo(Lv2Host*lv2Host,const LilvPlugin*pPlugin,const LilvPort *pPort);
|
||||
private:
|
||||
friend class Lv2PluginInfo;
|
||||
Lv2PortInfo(Lv2Host*lv2Host,const LilvPlugin*pPlugin,const LilvPort *pPort);
|
||||
|
||||
uint32_t index_;
|
||||
std::string symbol_;
|
||||
@@ -536,8 +544,66 @@ public:
|
||||
virtual Lv2Effect*CreateEffect(const PedalBoardItem &pedalBoard) = 0;
|
||||
};
|
||||
|
||||
|
||||
class LilvNodePtr {
|
||||
protected:
|
||||
LilvNode *node = nullptr;
|
||||
LilvNodePtr(const LilvNodePtr&) {}; // no copy.
|
||||
LilvNodePtr(const LilvNode*) {}; // const LilvNodes are owned by lilv by convention.
|
||||
public:
|
||||
LilvNodePtr() { }
|
||||
LilvNodePtr(LilvNode*node) { this->node = node; }
|
||||
~LilvNodePtr() { Free(); }
|
||||
void Free() { if (node != nullptr) lilv_node_free(node); node = nullptr;}
|
||||
|
||||
operator const LilvNode *()
|
||||
{
|
||||
return this->node;
|
||||
}
|
||||
|
||||
LilvNode **operator&()
|
||||
{
|
||||
return &(this->node);
|
||||
}
|
||||
operator bool()
|
||||
{
|
||||
return this->node != nullptr;
|
||||
}
|
||||
LilvNodePtr&operator=(LilvNode*node) { Free(); this->node = node; return *this;}
|
||||
};
|
||||
|
||||
class Lv2Host: private IHost {
|
||||
private:
|
||||
static const char *RDFS_COMMENT_URI;
|
||||
class LilvUris {
|
||||
public:
|
||||
void Initialize(LilvWorld*pWorld);
|
||||
void Free();
|
||||
|
||||
LilvNodePtr rdfsComment;
|
||||
LilvNodePtr logarithic_uri;
|
||||
LilvNodePtr display_priority_uri;
|
||||
LilvNodePtr range_steps_uri;
|
||||
LilvNodePtr integer_property_uri;
|
||||
LilvNodePtr enumeration_property_uri;
|
||||
LilvNodePtr toggle_property_uri;
|
||||
LilvNodePtr not_on_gui_property_uri;
|
||||
LilvNodePtr midiEventNode;
|
||||
LilvNodePtr designationNode;
|
||||
LilvNodePtr portGroupUri;
|
||||
LilvNodePtr unitsUri;
|
||||
LilvNodePtr bufferType_uri;
|
||||
LilvNodePtr pset_Preset;
|
||||
LilvNodePtr rdfs_label;
|
||||
LilvNodePtr symbolUri;
|
||||
LilvNodePtr nameUri;
|
||||
|
||||
};
|
||||
LilvUris lilvUris;
|
||||
|
||||
LilvNode *get_comment(const std::string &uri);
|
||||
|
||||
|
||||
size_t maxBufferSize = 1024;
|
||||
size_t maxAtomBufferSize = 16*1024;
|
||||
bool hasMidiInputChannel;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2021 Robin Davies
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
// this software and associated documentation files (the "Software"), to deal in
|
||||
// the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
// the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include "pch.h"
|
||||
#include "catch.hpp"
|
||||
#include <sstream>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include "Lv2Host.hpp"
|
||||
|
||||
using namespace pipedal;
|
||||
|
||||
|
||||
TEST_CASE( "Lv2Host memory leak", "[lv2host_leak]" ) {
|
||||
|
||||
Lv2Host host;
|
||||
|
||||
host.Load("/usr/lib/lv2:/usr/local/lib/lv2:/usr/modep/lv2");
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "stdlib.h"
|
||||
#include <mutex>
|
||||
#ifdef DEBUG
|
||||
|
||||
|
||||
static std::mutex memMutex;
|
||||
|
||||
struct MemStats {
|
||||
size_t allocated = 0;
|
||||
size_t allocations = 0;
|
||||
};
|
||||
|
||||
MemStats memStats;
|
||||
|
||||
void *operator new(size_t size)
|
||||
{
|
||||
{
|
||||
std::lock_guard lock(memMutex);
|
||||
memStats.allocated += size;
|
||||
memStats.allocations++;
|
||||
}
|
||||
|
||||
char *p = (char*)malloc(size+8);
|
||||
((size_t*)p)[0] = size;
|
||||
return p+8;
|
||||
}
|
||||
|
||||
void operator delete(void*mem)
|
||||
{
|
||||
char *p = ((char*)mem);
|
||||
size_t size = *(size_t*)(p-8);
|
||||
|
||||
{
|
||||
std::lock_guard lock(memMutex);
|
||||
memStats.allocated -= size;
|
||||
memStats.allocations--;
|
||||
}
|
||||
|
||||
|
||||
free(p-8);
|
||||
}
|
||||
|
||||
void* operator new[](size_t size)
|
||||
{
|
||||
{
|
||||
std::lock_guard lock(memMutex);
|
||||
memStats.allocated += size;
|
||||
memStats.allocations++;
|
||||
}
|
||||
|
||||
char *p = (char*)malloc(size+8);
|
||||
((size_t*)p)[0] = size;
|
||||
return p+8;
|
||||
}
|
||||
|
||||
void operator delete[](void*mem)
|
||||
{
|
||||
char *p = ((char*)mem);
|
||||
size_t size = *(size_t*)(p-8);
|
||||
{
|
||||
std::lock_guard lock(memMutex);
|
||||
memStats.allocated -= size;
|
||||
memStats.allocations--;
|
||||
}
|
||||
|
||||
free(p-8);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -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
|
||||
@@ -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>
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user