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);
211 [[nodiscard]] PropertyChangeSubscriber
uponPropertyChange(std::string_view propertyName);
470 template <
typename Rep,
typename Period>
519 , async_reply_handler asyncReplyCallback
545 , async_reply_handler asyncReplyCallback
546 , uint64_t timeout ) = 0;
572 , async_reply_handler asyncReplyCallback
579 template <
typename Rep,
typename Period>
581 , async_reply_handler asyncReplyCallback
582 ,
const std::chrono::duration<Rep, Period>& timeout );
587 template <
typename Rep,
typename Period>
589 , async_reply_handler asyncReplyCallback
590 ,
const std::chrono::duration<Rep, Period>& timeout
639 template <
typename Rep,
typename Period>
641 ,
const std::chrono::duration<Rep, Period>& timeout
647 template <
typename Rep,
typename Period>
649 ,
const std::chrono::duration<Rep, Period>& timeout
669 ,
const SignalName& signalName
670 , signal_handler signalHandler ) = 0;
689 ,
const SignalName& signalName
690 , signal_handler signalHandler
694 friend MethodInvoker;
695 friend AsyncMethodInvoker;
696 friend SignalSubscriber;
697 friend PropertyChangeSubscriber;
701 ,
const char* signalName
702 , signal_handler signalHandler ) = 0;
704 ,
const char* signalName
705 , signal_handler signalHandler
758 class PendingAsyncCall
761 PendingAsyncCall() =
default;
783 friend internal::Proxy;
784 explicit PendingAsyncCall(std::weak_ptr<void> callInfo);
786 std::weak_ptr<void> callInfo_;
791 template <
typename Rep,
typename Period>
794 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
795 return callMethod(message, microsecs.count());
798 template <
typename Rep,
typename Period>
800 , async_reply_handler asyncReplyCallback
801 ,
const std::chrono::duration<Rep, Period>& timeout )
803 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
804 return callMethodAsync(message, std::move(asyncReplyCallback), microsecs.count());
807 template <
typename Rep,
typename Period>
809 , async_reply_handler asyncReplyCallback
810 ,
const std::chrono::duration<Rep, Period>& timeout
813 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
814 return callMethodAsync(message, std::move(asyncReplyCallback), microsecs.count(), return_slot);
817 template <
typename Rep,
typename Period>
819 ,
const std::chrono::duration<Rep, Period>& timeout
822 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
826 template <
typename Rep,
typename Period>
828 ,
const std::chrono::duration<Rep, Period>& timeout
830 auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
836 return {*
this, methodName};
841 return {*
this, methodName.c_str()};
846 return {*
this, methodName};
851 return {*
this, methodName};
856 return {*
this, methodName.c_str()};
861 return {*
this, methodName};
866 return {*
this, signalName};
871 return {*
this, signalName.c_str()};
876 return {*
this, signalName};
881 return {*
this, std::move(propertyName)};
886 return {*
this, PropertyName{std::string{propertyName}}};
891 return {*
this, propertyName};
896 return {*
this, std::move(propertyName)};
901 return {*
this, propertyName};
906 return {*
this, std::move(propertyName)};
911 return {*
this, propertyName};
916 return {*
this, std::move(propertyName)};
921 return {*
this, propertyName};
926 return {*
this, std::move(propertyName)};
962 , ServiceName destination
987 [[nodiscard]] std::unique_ptr<IProxy>
createProxy( std::unique_ptr<IConnection>&& connection
988 , ServiceName destination
1014 [[nodiscard]] std::unique_ptr<IProxy>
createProxy( std::unique_ptr<IConnection>&& connection
1015 , ServiceName destination
1025 , ServiceName destination
1045 [[nodiscard]] std::unique_ptr<IProxy>
createProxy( ServiceName destination
1066 [[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:291
Definition ConvenienceApiClasses.h:305
Definition ConvenienceApiClasses.h:219
Definition ConvenienceApiClasses.h:264
Definition Awaitable.h:110
Definition IConnection.h:62
PropertyGetter getProperty(const PropertyName &propertyName)
Gets value of a property of the D-Bus object.
Definition IProxy.h:889
AsyncPropertyGetter getPropertyAsync(const PropertyName &propertyName)
Gets value of a property of the D-Bus object asynchronously.
Definition IProxy.h:899
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:934
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.
PropertyChangeSubscriber uponPropertyChange(PropertyName propertyName)
Registers handler for changes of a given property of the D-Bus object.
Definition IProxy.h:879
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:909
MethodInvoker callMethod(const MethodName &methodName)
Calls method on the D-Bus object.
Definition IProxy.h:834
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:849
SignalSubscriber uponSignal(const SignalName &signalName)
Registers signal handler for a given signal of the D-Bus object.
Definition IProxy.h:864
AllPropertiesGetter getAllProperties()
Gets values of all properties of the D-Bus object.
Definition IProxy.h:929
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:919
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:204
Definition ConvenienceApiClasses.h:240
Definition TypeTraits.h:106
Definition TypeTraits.h:90
Definition TypeTraits.h:118
Definition TypeTraits.h:109