mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
implemented gatt but removed it from ble_v2_medium. implemented bluez_agent and bluez agent manager for accepting incoming pairing requests
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__internal_platform_implementation_linux_generated_dbus_bluez_agent_server_h__adaptor__H__
|
||||
#define __sdbuscpp__internal_platform_implementation_linux_generated_dbus_bluez_agent_server_h__adaptor__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace bluez {
|
||||
|
||||
class Agent1_adaptor
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.bluez.Agent1";
|
||||
|
||||
protected:
|
||||
Agent1_adaptor(sdbus::IObject& object)
|
||||
: m_object(object)
|
||||
{
|
||||
}
|
||||
|
||||
Agent1_adaptor(const Agent1_adaptor&) = delete;
|
||||
Agent1_adaptor& operator=(const Agent1_adaptor&) = delete;
|
||||
Agent1_adaptor(Agent1_adaptor&&) = delete;
|
||||
Agent1_adaptor& operator=(Agent1_adaptor&&) = delete;
|
||||
|
||||
~Agent1_adaptor() = default;
|
||||
|
||||
void registerAdaptor()
|
||||
{
|
||||
m_object.addVTable( sdbus::registerMethod("Release").implementedAs([this](){ return this->Release(); })
|
||||
, sdbus::registerMethod("RequestPinCode").withInputParamNames("device").withOutputParamNames("pincode").implementedAs([this](const sdbus::ObjectPath& device){ return this->RequestPinCode(device); })
|
||||
, sdbus::registerMethod("DisplayPinCode").withInputParamNames("device", "pincode").implementedAs([this](const sdbus::ObjectPath& device, const std::string& pincode){ return this->DisplayPinCode(device, pincode); })
|
||||
, sdbus::registerMethod("RequestPasskey").withInputParamNames("device").withOutputParamNames("passkey").implementedAs([this](const sdbus::ObjectPath& device){ return this->RequestPasskey(device); })
|
||||
, sdbus::registerMethod("DisplayPasskey").withInputParamNames("device", "passkey", "entered").implementedAs([this](const sdbus::ObjectPath& device, const uint32_t& passkey, const uint16_t& entered){ return this->DisplayPasskey(device, passkey, entered); })
|
||||
, sdbus::registerMethod("RequestConfirmation").withInputParamNames("device", "passkey").implementedAs([this](const sdbus::ObjectPath& device, const uint32_t& passkey){ return this->RequestConfirmation(device, passkey); })
|
||||
, sdbus::registerMethod("RequestAuthorization").withInputParamNames("device").implementedAs([this](const sdbus::ObjectPath& device){ return this->RequestAuthorization(device); })
|
||||
, sdbus::registerMethod("AuthorizeService").withInputParamNames("device", "uuid").implementedAs([this](const sdbus::ObjectPath& device, const std::string& uuid){ return this->AuthorizeService(device, uuid); })
|
||||
, sdbus::registerMethod("Cancel").implementedAs([this](){ return this->Cancel(); })
|
||||
).forInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void Release() = 0;
|
||||
virtual std::string RequestPinCode(const sdbus::ObjectPath& device) = 0;
|
||||
virtual void DisplayPinCode(const sdbus::ObjectPath& device, const std::string& pincode) = 0;
|
||||
virtual uint32_t RequestPasskey(const sdbus::ObjectPath& device) = 0;
|
||||
virtual void DisplayPasskey(const sdbus::ObjectPath& device, const uint32_t& passkey, const uint16_t& entered) = 0;
|
||||
virtual void RequestConfirmation(const sdbus::ObjectPath& device, const uint32_t& passkey) = 0;
|
||||
virtual void RequestAuthorization(const sdbus::ObjectPath& device) = 0;
|
||||
virtual void AuthorizeService(const sdbus::ObjectPath& device, const std::string& uuid) = 0;
|
||||
virtual void Cancel() = 0;
|
||||
|
||||
private:
|
||||
sdbus::IObject& m_object;
|
||||
};
|
||||
|
||||
}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__internal_platform_implementation_linux_generated_dbus_bluez_agentmanager_client_h__proxy__H__
|
||||
#define __sdbuscpp__internal_platform_implementation_linux_generated_dbus_bluez_agentmanager_client_h__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace bluez {
|
||||
|
||||
class AgentManager1_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.bluez.AgentManager1";
|
||||
|
||||
protected:
|
||||
AgentManager1_proxy(sdbus::IProxy& proxy)
|
||||
: m_proxy(proxy)
|
||||
{
|
||||
}
|
||||
|
||||
AgentManager1_proxy(const AgentManager1_proxy&) = delete;
|
||||
AgentManager1_proxy& operator=(const AgentManager1_proxy&) = delete;
|
||||
AgentManager1_proxy(AgentManager1_proxy&&) = delete;
|
||||
AgentManager1_proxy& operator=(AgentManager1_proxy&&) = delete;
|
||||
|
||||
~AgentManager1_proxy() = default;
|
||||
|
||||
void registerProxy()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
void RegisterAgent(const sdbus::ObjectPath& agent, const std::string& capability)
|
||||
{
|
||||
m_proxy.callMethod("RegisterAgent").onInterface(INTERFACE_NAME).withArguments(agent, capability);
|
||||
}
|
||||
|
||||
void UnregisterAgent(const sdbus::ObjectPath& agent)
|
||||
{
|
||||
m_proxy.callMethod("UnregisterAgent").onInterface(INTERFACE_NAME).withArguments(agent);
|
||||
}
|
||||
|
||||
void RequestDefaultAgent(const sdbus::ObjectPath& agent)
|
||||
{
|
||||
m_proxy.callMethod("RequestDefaultAgent").onInterface(INTERFACE_NAME).withArguments(agent);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& m_proxy;
|
||||
};
|
||||
|
||||
}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -3,8 +3,8 @@
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp___home_lasan_Dev_nearby_latest_internal_platform_implementation_linux_generated_dbus_bluez_gatt_manager_client_v2_h__proxy__H__
|
||||
#define __sdbuscpp___home_lasan_Dev_nearby_latest_internal_platform_implementation_linux_generated_dbus_bluez_gatt_manager_client_v2_h__proxy__H__
|
||||
#ifndef __sdbuscpp__internal_platform_implementation_linux_generated_dbus_bluez_gatt_manager_client_h__proxy__H__
|
||||
#define __sdbuscpp__internal_platform_implementation_linux_generated_dbus_bluez_gatt_manager_client_h__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
@@ -35,15 +35,18 @@ protected:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void onRegisterApplicationReply(std::optional<sdbus::Error> error) = 0;
|
||||
virtual void onUnregisterApplicationReply(std::optional<sdbus::Error> error) = 0;
|
||||
|
||||
public:
|
||||
void RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options)
|
||||
sdbus::PendingAsyncCall RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options)
|
||||
{
|
||||
m_proxy.callMethod("RegisterApplication").onInterface(INTERFACE_NAME).withArguments(application, options);
|
||||
return m_proxy.callMethodAsync("RegisterApplication").onInterface(INTERFACE_NAME).withArguments(application, options).uponReplyInvoke([this](std::optional<sdbus::Error> error){ this->onRegisterApplicationReply(std::move(error)); });
|
||||
}
|
||||
|
||||
void UnregisterApplication(const sdbus::ObjectPath& application)
|
||||
sdbus::PendingAsyncCall UnregisterApplication(const sdbus::ObjectPath& application)
|
||||
{
|
||||
m_proxy.callMethod("UnregisterApplication").onInterface(INTERFACE_NAME).withArguments(application);
|
||||
return m_proxy.callMethodAsync("UnregisterApplication").onInterface(INTERFACE_NAME).withArguments(application).uponReplyInvoke([this](std::optional<sdbus::Error> error){ this->onUnregisterApplicationReply(std::move(error)); });
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.bluez.Agent1">
|
||||
<method name="Release"/>
|
||||
|
||||
<method name="RequestPinCode">
|
||||
<arg name="device" type="o" direction="in"/>
|
||||
<arg name="pincode" type="s" direction="out"/>
|
||||
</method>
|
||||
|
||||
<method name="DisplayPinCode">
|
||||
<arg name="device" type="o" direction="in"/>
|
||||
<arg name="pincode" type="s" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="RequestPasskey">
|
||||
<arg name="device" type="o" direction="in"/>
|
||||
<arg name="passkey" type="u" direction="out"/>
|
||||
</method>
|
||||
|
||||
<method name="DisplayPasskey">
|
||||
<arg name="device" type="o" direction="in"/>
|
||||
<arg name="passkey" type="u" direction="in"/>
|
||||
<arg name="entered" type="q" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="RequestConfirmation">
|
||||
<arg name="device" type="o" direction="in"/>
|
||||
<arg name="passkey" type="u" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="RequestAuthorization">
|
||||
<arg name="device" type="o" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="AuthorizeService">
|
||||
<arg name="device" type="o" direction="in"/>
|
||||
<arg name="uuid" type="s" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="Cancel"/>
|
||||
</interface>
|
||||
|
||||
</node>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
|
||||
<interface name="org.bluez.AgentManager1">
|
||||
<method name="RegisterAgent">
|
||||
<arg name="agent" type="o" direction="in"/>
|
||||
<arg name="capability" type="s" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="UnregisterAgent">
|
||||
<arg name="agent" type="o" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="RequestDefaultAgent">
|
||||
<arg name="agent" type="o" direction="in"/>
|
||||
</method>
|
||||
</interface>
|
||||
|
||||
</node>
|
||||
@@ -3,10 +3,12 @@
|
||||
<node>
|
||||
<interface name="org.bluez.GattManager1">
|
||||
<method name="RegisterApplication">
|
||||
<annotation name="org.freedesktop.DBus.Method.Async" value="client" />
|
||||
<arg name="application" type="o" direction="in" />
|
||||
<arg name="options" type="a{sv}" direction="in" />
|
||||
</method>
|
||||
<method name="UnregisterApplication">
|
||||
<annotation name="org.freedesktop.DBus.Method.Async" value="client" />
|
||||
<arg name="application" type="o" direction="in" />
|
||||
</method>
|
||||
</interface>
|
||||
|
||||
Reference in New Issue
Block a user