1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DBUS_PEER_DAEMON_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_PEER_DAEMON_MANAGER_CLIENT_H_
12 #include "base/macros.h"
13 #include "base/values.h"
14 #include "chromeos/chromeos_export.h"
15 #include "chromeos/dbus/dbus_client.h"
16 #include "chromeos/dbus/dbus_method_call_status.h"
20 // PeerDaemonManagerClient is used to communicate with the PeerDaemon Manager
21 // service. All methods should be called from the origin thread which
22 // initializes the DBusThreadManager instance.
23 class CHROMEOS_EXPORT PeerDaemonManagerClient
: public DBusClient
{
25 ~PeerDaemonManagerClient() override
;
27 // Factory function, creates a new instance which is owned by the caller.
28 // For normal usage, access the singleton via DBusThreadManager::Get().
29 static PeerDaemonManagerClient
* Create();
31 // Calls StartMonitoring method.
32 // |callback| is called with its |call_status| argument set to
33 // DBUS_METHOD_CALL_SUCCESS if the method call succeeds. Otherwise,
34 // |callback| is called with |call_status| set to DBUS_METHOD_CALL_FAILURE.
35 virtual void StartMonitoring(
36 const std::vector
<std::string
>& requested_technologies
,
37 const base::DictionaryValue
& options
,
38 const StringDBusMethodCallback
& callback
) = 0;
40 // Calls StopMonitoring method.
41 // |callback| is called with its |call_status| argument set to
42 // DBUS_METHOD_CALL_SUCCESS if the method call succeeds. Otherwise,
43 // |callback| is called with |call_status| set to DBUS_METHOD_CALL_FAILURE.
44 virtual void StopMonitoring(const std::string
& monitoring_token
,
45 const VoidDBusMethodCallback
& callback
) = 0;
47 // Calls ExposeService method.
48 // |callback| is called with its |call_status| argument set to
49 // DBUS_METHOD_CALL_SUCCESS if the method call succeeds. Otherwise,
50 // |callback| is called with |call_status| set to DBUS_METHOD_CALL_FAILURE.
51 virtual void ExposeService(
52 const std::string
& service_id
,
53 const std::map
<std::string
, std::string
>& service_info
,
54 const base::DictionaryValue
& options
,
55 const StringDBusMethodCallback
& callback
) = 0;
57 // Calls RemoveExposedService method.
58 // |callback| is called with its |call_status| argument set to
59 // DBUS_METHOD_CALL_SUCCESS if the method call succeeds. Otherwise,
60 // |callback| is called with |call_status| set to DBUS_METHOD_CALL_FAILURE.
61 virtual void RemoveExposedService(const std::string
& service_token
,
62 const VoidDBusMethodCallback
& callback
) = 0;
65 // |callback| is called with its |call_status| argument set to
66 // DBUS_METHOD_CALL_SUCCESS if the method call succeeds. Otherwise,
67 // |callback| is called with |call_status| set to DBUS_METHOD_CALL_FAILURE.
68 virtual void Ping(const StringDBusMethodCallback
& callback
) = 0;
71 // Create() should be used instead.
72 PeerDaemonManagerClient();
75 DISALLOW_COPY_AND_ASSIGN(PeerDaemonManagerClient
);
78 } // namespace chromeos
80 #endif // CHROMEOS_DBUS_PEER_DAEMON_MANAGER_CLIENT_H_