aboutsummaryrefslogtreecommitdiff
path: root/include/weave/settings.h
blob: 2ebc4f2618d7d390d5de02f88959ab3eaef51a1e (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// 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_INCLUDE_WEAVE_SETTINGS_H_
#define LIBWEAVE_INCLUDE_WEAVE_SETTINGS_H_

#include <set>
#include <string>

#include <base/time/time.h>

namespace weave {

// Scopes in order of increasing privileges.
enum class AuthScope : int32_t {
  kNone,
  kViewer,
  kUser,
  kManager,
  kOwner,
};

// Type client-device pairing.
enum class PairingType {
  kPinCode,
  kEmbeddedCode,
};

struct Settings {
  // Model specific information. Must be set by ConfigStore::LoadDefaults.
  std::string firmware_version;
  std::string serial_number;
  std::string oem_name;
  std::string model_name;
  std::string model_id;

  // Basic device information. Must be set from ConfigStore::LoadDefaults.
  std::string name;
  std::string description;
  std::string location;

  // OAuth 2.0 related options. Must be set from ConfigStore::LoadDefaults.
  std::string api_key;
  std::string client_id;
  std::string client_secret;

  // Options mirrored into "base" state.
  // Maximum role for local anonymous user.
  AuthScope local_anonymous_access_role{AuthScope::kViewer};
  // If true, allows local pairing using Privet API, including mDNS.
  bool local_access_enabled{true};

  // Set of pairing modes supported by device.
  std::set<PairingType> pairing_modes;

  // Embedded code. Will be used only if pairing_modes contains kEmbeddedCode.
  std::string embedded_code;

  // Optional cloud information. Can be used for testing or debugging.
  std::string oauth_url;
  std::string service_url;
  std::string xmpp_endpoint;

  // Cloud ID of the registered device. Empty if device is not registered.
  std::string cloud_id;

  // Local device id.
  std::string device_id;

  // Internal options to tweak some library functionality. External code should
  // avoid using them.
  bool allow_endpoints_override{false};
  bool wifi_auto_setup_enabled{true};
  std::string test_privet_ssid;
};

}  // namespace weave

#endif  // LIBWEAVE_INCLUDE_WEAVE_SETTINGS_H_