summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/privet_daemon_client.h
blob: 070a17659bf437083b7b6a80bfbcf1ebd2bba2a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_DBUS_PRIVET_DAEMON_CLIENT_H_
#define CHROMEOS_DBUS_PRIVET_DAEMON_CLIENT_H_

#include <string>

#include "base/callback_forward.h"
#include "base/macros.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/dbus/dbus_client.h"

// TODO(jamescook): The DBus interface is still being defined by the privetd
// team. Move to third_party/cros_system_api/dbus/service_constants.h when the
// interface is finalized.
namespace privetd {
const char kPrivetdInterface[] = "org.chromium.privetd";
const char kPrivetdServicePath[] = "/org/chromium/privetd";
const char kPrivetdServiceName[] = "org.chromium.privetd";

// Signals.
const char kSetupStatusChangedSignal[] = "SetupStatusChanged";

// Setup status values.
const char kSetupCompleted[] = "completed";
}  // namespace privetd

namespace chromeos {

// PrivetDaemonClient is used to communicate with privetd for Wi-Fi
// bootstrapping and setup. The most common user for this code would be an
// embedded Chrome OS Core device.
class CHROMEOS_EXPORT PrivetDaemonClient : public DBusClient {
 public:
  ~PrivetDaemonClient() override;

  // Called with setup status.
  using GetSetupStatusCallback =
      base::Callback<void(const std::string& status)>;

  // Asynchronously gets the current setup status. The setup status strings can
  // be found in third_party/cros_system_api/dbus/service_constants.h.
  virtual void GetSetupStatus(const GetSetupStatusCallback& callback) = 0;

  // Creates a new instance and returns ownership.
  static PrivetDaemonClient* Create();

 protected:
  // Create() should be used instead.
  PrivetDaemonClient();

 private:
  DISALLOW_COPY_AND_ASSIGN(PrivetDaemonClient);
};

}  // namespace chromeos

#endif  // CHROMEOS_DBUS_PRIVET_DAEMON_CLIENT_H_