aboutsummaryrefslogtreecommitdiff
path: root/src/privet/wifi_delegate.h
blob: 9bd5157bec45b996a660bb439316d38c4980af25 (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
// Copyright 2015 The Weave 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 LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_
#define LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_

#include <memory>
#include <set>
#include <string>

#include "src/privet/privet_types.h"

namespace weave {
namespace privet {

// Interface to provide WiFi functionality for PrivetHandler.
class WifiDelegate {
 public:
  WifiDelegate() = default;
  virtual ~WifiDelegate() {}

  // Returns status of the WiFi connection.
  virtual const ConnectionState& GetConnectionState() const = 0;

  // Returns status of the last WiFi setup.
  virtual const SetupState& GetSetupState() const = 0;

  // Starts WiFi setup. Device should try to connect to provided SSID and
  // password and store them on success. Result of setup should be available
  // using GetSetupState().
  // Final setup state can be retrieved with GetSetupState().
  virtual bool ConfigureCredentials(const std::string& ssid,
                                    const std::string& password,
                                    ErrorPtr* error) = 0;

  // Returns SSID of the currently configured WiFi network. Empty string, if
  // WiFi has not been configured yet.
  virtual std::string GetCurrentlyConnectedSsid() const = 0;

  // Returns SSID of the WiFi network hosted by this device. Empty if device is
  // not in setup or P2P modes.
  virtual std::string GetHostedSsid() const = 0;

  // Returns list of supported WiFi types. Currently it's just frequencies.
  virtual std::set<WifiType> GetTypes() const = 0;
};

}  // namespace privet
}  // namespace weave

#endif  // LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_