forked from Kistler-Group/sdbus-cpp
Poll tests
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -50,6 +50,20 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
int32_t doSignalEmission() override
|
||||
{
|
||||
static int32_t counter = 0;
|
||||
emitSimpleSignal();
|
||||
printf("First simple signal thrown\n");
|
||||
counter++;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
//emitSimpleSignal();
|
||||
//printf("Second simple signal thrown\n");
|
||||
counter++;
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
||||
void noArgNoReturn() const
|
||||
{
|
||||
}
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
#include "proxy-glue.h"
|
||||
#include <atomic>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#define gettid() syscall(SYS_gettid)
|
||||
|
||||
class TestingProxy : public sdbus::ProxyInterfaces< ::testing_proxy
|
||||
, sdbus::Peer_proxy
|
||||
, sdbus::Introspectable_proxy
|
||||
@@ -57,6 +61,7 @@ protected:
|
||||
void onSimpleSignal() override
|
||||
{
|
||||
m_gotSimpleSignal = true;
|
||||
printf("Thread %d: Got simple signal\n", gettid());
|
||||
}
|
||||
|
||||
void onSignalWithMap(const std::map<int32_t, std::string>& m) override
|
||||
|
||||
@@ -59,6 +59,8 @@ protected:
|
||||
{
|
||||
object_.setInterfaceFlags(INTERFACE_NAME).markAsDeprecated().withPropertyUpdateBehavior(sdbus::Flags::EMITS_NO_SIGNAL);
|
||||
|
||||
object_.registerMethod("doSignalEmission").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->doSignalEmission(); });
|
||||
|
||||
object_.registerMethod("noArgNoReturn").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->noArgNoReturn(); });
|
||||
object_.registerMethod("getInt").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->getInt(); });
|
||||
object_.registerMethod("getTuple").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->getTuple(); });
|
||||
@@ -150,6 +152,7 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
virtual int32_t doSignalEmission() = 0;
|
||||
virtual void noArgNoReturn() const = 0;
|
||||
virtual int32_t getInt() const = 0;
|
||||
virtual std::tuple<uint32_t, std::string> getTuple() const = 0;
|
||||
|
||||
@@ -56,6 +56,14 @@ protected:
|
||||
virtual void onDoOperationReply(uint32_t returnValue, const sdbus::Error* error) = 0;
|
||||
|
||||
public:
|
||||
int32_t doSignalEmission()
|
||||
{
|
||||
int32_t result;
|
||||
object_.callMethod("doSignalEmission").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
//object_.callMethodAsync("doSignalEmission").onInterface(INTERFACE_NAME).uponReplyInvoke([this](const sdbus::Error* error, int32_t returnValue){ printf("Async reply handler\n"); });
|
||||
return result;
|
||||
}
|
||||
|
||||
void noArgNoReturn()
|
||||
{
|
||||
object_.callMethod("noArgNoReturn").onInterface(INTERFACE_NAME);
|
||||
|
||||
Reference in New Issue
Block a user