refactor: use sd-bus API to get current message

This commit is contained in:
Stanislav Angelovic
2024-04-24 20:20:29 +02:00
committed by Stanislav Angelovič
parent c6afa26541
commit 9412940d1e
18 changed files with 125 additions and 99 deletions
+3 -3
View File
@@ -122,7 +122,7 @@ uint32_t TestAdaptor::doOperation(const uint32_t& param)
{
std::this_thread::sleep_for(std::chrono::milliseconds(param));
m_methodCallMsg = getObject().getCurrentlyProcessedMessage();
m_methodCallMsg = std::make_unique<const Message>(getObject().getCurrentlyProcessedMessage());
m_methodCallMemberName = m_methodCallMsg->getMemberName();
return param;
@@ -130,7 +130,7 @@ uint32_t TestAdaptor::doOperation(const uint32_t& param)
void TestAdaptor::doOperationAsync(sdbus::Result<uint32_t>&& result, uint32_t param)
{
m_methodCallMsg = getObject().getCurrentlyProcessedMessage();
m_methodCallMsg = std::make_unique<const Message>(getObject().getCurrentlyProcessedMessage());
m_methodCallMemberName = m_methodCallMsg->getMemberName();
if (param == 0)
@@ -234,7 +234,7 @@ bool TestAdaptor::blocking()
void TestAdaptor::blocking(const bool& value)
{
m_propertySetMsg = getObject().getCurrentlyProcessedMessage();
m_propertySetMsg = std::make_unique<const Message>(getObject().getCurrentlyProcessedMessage());
m_propertySetSender = m_propertySetMsg->getSender();
m_blocking = value;
+3 -2
View File
@@ -33,6 +33,7 @@
#include <chrono>
#include <atomic>
#include <utility>
#include <memory>
namespace sdbus { namespace test {
@@ -103,9 +104,9 @@ public: // for tests
mutable double m_multiplyResult{};
mutable std::atomic<bool> m_wasThrowErrorCalled{false};
const Message* m_methodCallMsg{};
std::unique_ptr<const Message> m_methodCallMsg;
std::string m_methodCallMemberName;
const Message* m_propertySetMsg{};
std::unique_ptr<const Message> m_propertySetMsg;
std::string m_propertySetSender;
};
+1 -1
View File
@@ -61,7 +61,7 @@ TestProxy::~TestProxy()
void TestProxy::onSimpleSignal()
{
m_signalMsg = getProxy().getCurrentlyProcessedMessage();
m_signalMsg = std::make_unique<sdbus::Message>(getProxy().getCurrentlyProcessedMessage());
m_signalMemberName = m_signalMsg->getMemberName();
m_gotSimpleSignal = true;
+2 -1
View File
@@ -33,6 +33,7 @@
#include <chrono>
#include <atomic>
#include <future>
#include <memory>
namespace sdbus { namespace test {
@@ -118,7 +119,7 @@ public: // for tests
std::function<void(uint32_t res, const sdbus::Error* err)> m_DoOperationClientSideAsyncReplyHandler;
std::function<void(const std::string&, const std::map<std::string, sdbus::Variant>&, const std::vector<std::string>&)> m_onPropertiesChangedHandler;
const Message* m_signalMsg{};
std::unique_ptr<const Message> m_signalMsg;
std::string m_signalMemberName;
};