27#ifndef SDBUS_CXX_IPROXY_H_
28#define SDBUS_CXX_IPROXY_H_
94 [[nodiscard]] MethodInvoker
callMethod(
const MethodName& methodName);
99 [[nodiscard]] MethodInvoker
callMethod(
const std::string& methodName);
104 [[nodiscard]] MethodInvoker
callMethod(
const char* methodName);
129 [[nodiscard]] AsyncMethodInvoker
callMethodAsync(
const MethodName& methodName);
134 [[nodiscard]] AsyncMethodInvoker
callMethodAsync(
const std::string& methodName);
139 [[nodiscard]] AsyncMethodInvoker
callMethodAsync(
const char* methodName);
165 [[nodiscard]] SignalSubscriber
uponSignal(
const SignalName& signalName);
170 [[nodiscard]] SignalSubscriber
uponSignal(
const std::string& signalName);
175 [[nodiscard]] SignalSubscriber
uponSignal(
const char* signalName);
434 template <
typename Rep,
typename Period>
483 , async_reply_handler asyncReplyCallback
509 , async_reply_handler asyncReplyCallback
510 , uint64_t timeout ) = 0;
536 , async_reply_handler asyncReplyCallback
543 template <
typename Rep,
typename Period>
545 , async_reply_handler asyncReplyCallback
546 ,
const std::chrono::duration<Rep, Period>& timeout );
551 template <
typename Rep,
typename Period>
553 , async_reply_handler asyncReplyCallback
554 ,
const std::chrono::duration<Rep, Period>& timeout
603 template <
typename Rep,
typename Period>
605 ,
const std::chrono::duration<Rep, Period>& timeout
649 template <
typename Rep,
typename Period>
651 ,
const std::chrono::duration<Rep, Period>& timeout
671 ,
const SignalName& signalName
672 , signal_handler signalHandler ) = 0;
691 ,
const SignalName& signalName
692 , signal_handler signalHandler
696 friend MethodInvoker;
697 friend AsyncMethodInvoker;
698 friend SignalSubscriber;
702 ,
const char* signalName
703 , signal_handler signalHandler ) = 0;
705 ,
const char* signalName
706 , signal_handler signalHandler
720 class PendingAsyncCall
723 PendingAsyncCall() =
default;
745 friend internal::Proxy;
746 explicit PendingAsyncCall(std::weak_ptr<void> callInfo);
748 std::weak_ptr<void> callInfo_;
753 template <
typename Rep,
typename Period>
756 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
757 return callMethod(message, microsecs.count());
760 template <
typename Rep,
typename Period>
762 , async_reply_handler asyncReplyCallback
763 ,
const std::chrono::duration<Rep, Period>& timeout )
765 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
766 return callMethodAsync(message, std::move(asyncReplyCallback), microsecs.count());
769 template <
typename Rep,
typename Period>
771 , async_reply_handler asyncReplyCallback
772 ,
const std::chrono::duration<Rep, Period>& timeout
775 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
776 return callMethodAsync(message, std::move(asyncReplyCallback), microsecs.count(), return_slot);
779 template <
typename Rep,
typename Period>
781 ,
const std::chrono::duration<Rep, Period>& timeout
784 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
788 template <
typename Rep,
typename Period>
790 ,
const std::chrono::duration<Rep, Period>& timeout
792 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
798 return {*
this, methodName};
803 return {*
this, methodName.c_str()};
808 return {*
this, methodName};
813 return {*
this, methodName};
818 return {*
this, methodName.c_str()};
823 return {*
this, methodName};
828 return {*
this, signalName};
833 return {*
this, signalName.c_str()};
838 return {*
this, signalName};
843 return {*
this, propertyName};
848 return {*
this, std::move(propertyName)};
853 return {*
this, propertyName};
858 return {*
this, std::move(propertyName)};
863 return {*
this, propertyName};
868 return {*
this, std::move(propertyName)};
873 return {*
this, propertyName};
878 return {*
this, std::move(propertyName)};
914 , ServiceName destination
939 [[nodiscard]] std::unique_ptr<IProxy>
createProxy( std::unique_ptr<IConnection>&& connection
940 , ServiceName destination
966 [[nodiscard]] std::unique_ptr<IProxy>
createProxy( std::unique_ptr<IConnection>&& connection
967 , ServiceName destination
977 , ServiceName destination
997 [[nodiscard]] std::unique_ptr<IProxy>
createProxy( ServiceName destination
1018 [[nodiscard]] std::unique_ptr<IProxy>
createProxy( ServiceName destination
std::unique_ptr< IProxy > createProxy(IConnection &connection, ServiceName destination, ObjectPath objectPath)
Creates a proxy object for a specific remote D-Bus object.
std::unique_ptr< IProxy > createLightWeightProxy(std::unique_ptr< IConnection > &&connection, ServiceName destination, ObjectPath objectPath)
Creates a light-weight proxy object for a specific remote D-Bus object.
Definition ConvenienceApiClasses.h:256
Definition ConvenienceApiClasses.h:270
Definition ConvenienceApiClasses.h:193
Definition ConvenienceApiClasses.h:233
Definition Awaitable.h:110
Definition IConnection.h:61
PropertyGetter getProperty(const PropertyName &propertyName)
Gets value of a property of the D-Bus object.
Definition IProxy.h:841
AsyncPropertyGetter getPropertyAsync(const PropertyName &propertyName)
Gets value of a property of the D-Bus object asynchronously.
Definition IProxy.h:851
virtual std::future< MethodReply > callMethodAsync(const MethodCall &message, with_future_t)=0
Calls method on the D-Bus object asynchronously.
virtual PendingAsyncCall callMethodAsync(const MethodCall &message, async_reply_handler asyncReplyCallback, uint64_t timeout)=0
Calls method on the D-Bus object asynchronously, with custom timeout.
virtual MethodReply callMethod(const MethodCall &message)=0
Calls method on the remote D-Bus object.
AsyncAllPropertiesGetter getAllPropertiesAsync()
Gets values of all properties of the D-Bus object asynchronously.
Definition IProxy.h:886
virtual void registerSignalHandler(const InterfaceName &interfaceName, const SignalName &signalName, signal_handler signalHandler)=0
Registers a handler for the desired signal emitted by the D-Bus object.
virtual Awaitable< MethodReply > callMethodAsync(const MethodCall &message, uint64_t timeout, with_awaitable_t)=0
Calls method on the D-Bus object asynchronously, with custom timeout.
virtual Slot callMethodAsync(const MethodCall &message, async_reply_handler asyncReplyCallback, return_slot_t)=0
Calls method on the D-Bus object asynchronously.
PropertySetter setProperty(const PropertyName &propertyName)
Sets value of a property of the D-Bus object.
Definition IProxy.h:861
MethodInvoker callMethod(const MethodName &methodName)
Calls method on the D-Bus object.
Definition IProxy.h:796
virtual Message getCurrentlyProcessedMessage() const =0
Provides access to the currently processed D-Bus message.
virtual MethodCall createMethodCall(const InterfaceName &interfaceName, const MethodName &methodName) const =0
Creates a method call message.
virtual void unregister()=0
Unregisters proxy's signal handlers and stops receiving replies to pending async calls.
virtual Awaitable< MethodReply > callMethodAsync(const MethodCall &message, with_awaitable_t)=0
Calls method on the D-Bus object asynchronously.
virtual MethodReply callMethod(const MethodCall &message, uint64_t timeout)=0
Calls method on the remote D-Bus object.
virtual sdbus::IConnection & getConnection() const =0
Provides D-Bus connection used by the proxy.
virtual std::future< MethodReply > callMethodAsync(const MethodCall &message, uint64_t timeout, with_future_t)=0
Calls method on the D-Bus object asynchronously, with custom timeout.
virtual Slot registerSignalHandler(const InterfaceName &interfaceName, const SignalName &signalName, signal_handler signalHandler, return_slot_t)=0
Registers a handler for the desired signal emitted by the D-Bus object.
virtual Slot callMethodAsync(const MethodCall &message, async_reply_handler asyncReplyCallback, uint64_t timeout, return_slot_t)=0
Calls method on the D-Bus object asynchronously, with custom timeout.
virtual const ObjectPath & getObjectPath() const =0
Returns object path of the underlying DBus object.
AsyncMethodInvoker callMethodAsync(const MethodName &methodName)
Calls method on the D-Bus object asynchronously.
Definition IProxy.h:811
SignalSubscriber uponSignal(const SignalName &signalName)
Registers signal handler for a given signal of the D-Bus object.
Definition IProxy.h:826
AllPropertiesGetter getAllProperties()
Gets values of all properties of the D-Bus object.
Definition IProxy.h:881
virtual PendingAsyncCall callMethodAsync(const MethodCall &message, async_reply_handler asyncReplyCallback)=0
Calls method on the D-Bus object asynchronously.
AsyncPropertySetter setPropertyAsync(const PropertyName &propertyName)
Sets value of a property of the D-Bus object asynchronously.
Definition IProxy.h:871
void cancel()
Cancels the delivery of the pending asynchronous call result.
bool isPending() const
Answers whether the asynchronous call is still pending.
Definition ConvenienceApiClasses.h:178
Definition ConvenienceApiClasses.h:213
Definition TypeTraits.h:101
Definition TypeTraits.h:88
Definition TypeTraits.h:113
Definition TypeTraits.h:104