1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_widget_AsyncDBus_h
7 #define mozilla_widget_AsyncDBus_h
9 #include "mozilla/GRefPtr.h"
10 #include "mozilla/GUniquePtr.h"
11 #include "mozilla/MozPromise.h"
13 namespace mozilla::widget
{
15 using DBusProxyPromise
= MozPromise
<RefPtr
<GDBusProxy
>, GUniquePtr
<GError
>,
16 /* IsExclusive = */ true>;
18 using DBusCallPromise
= MozPromise
<RefPtr
<GVariant
>, GUniquePtr
<GError
>,
19 /* IsExclusive = */ true>;
21 RefPtr
<DBusProxyPromise
> CreateDBusProxyForBus(
22 GBusType aBusType
, GDBusProxyFlags aFlags
,
23 GDBusInterfaceInfo
* aInterfaceInfo
, const char* aName
,
24 const char* aObjectPath
, const char* aInterfaceName
,
25 GCancellable
* aCancellable
= nullptr);
27 RefPtr
<DBusCallPromise
> DBusProxyCall(GDBusProxy
*, const char* aMethod
,
28 GVariant
* aArgs
, GDBusCallFlags
,
30 GCancellable
* = nullptr);
32 RefPtr
<DBusCallPromise
> DBusProxyCallWithUnixFDList(
33 GDBusProxy
*, const char* aMethod
, GVariant
* aArgs
, GDBusCallFlags
,
34 gint aTimeout
= -1, GUnixFDList
* = nullptr, GCancellable
* = nullptr);
36 } // namespace mozilla::widget