blob: 2ebc4f2618d7d390d5de02f88959ab3eaef51a1e [file] [log] [blame]
Vitaly Buka4615e0d2015-10-14 15:35:12 -07001// Copyright 2015 The Weave Authors. All rights reserved.
Vitaly Buka1e363672015-09-25 14:01:16 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef LIBWEAVE_INCLUDE_WEAVE_SETTINGS_H_
6#define LIBWEAVE_INCLUDE_WEAVE_SETTINGS_H_
7
8#include <set>
9#include <string>
10
11#include <base/time/time.h>
Vitaly Buka1e363672015-09-25 14:01:16 -070012
13namespace weave {
14
Vitaly Bukab624bc42015-09-29 19:13:55 -070015// Scopes in order of increasing privileges.
Luis Hector Chavez83db8f72016-06-01 20:11:15 +000016enum class AuthScope : int32_t {
Vitaly Bukab624bc42015-09-29 19:13:55 -070017 kNone,
18 kViewer,
19 kUser,
Vitaly Buka287346b2015-12-15 14:35:28 -080020 kManager,
Vitaly Bukab624bc42015-09-29 19:13:55 -070021 kOwner,
22};
23
Vitaly Bukac8ba2282015-10-01 17:42:40 -070024// Type client-device pairing.
25enum class PairingType {
26 kPinCode,
27 kEmbeddedCode,
28};
29
Vitaly Buka1e363672015-09-25 14:01:16 -070030struct Settings {
Vitaly Buka8cca9b12015-09-29 14:49:44 -070031 // Model specific information. Must be set by ConfigStore::LoadDefaults.
Vitaly Buka1e363672015-09-25 14:01:16 -070032 std::string firmware_version;
Alex Vakulenko5e67ce22016-04-06 12:11:09 -070033 std::string serial_number;
Vitaly Buka1e363672015-09-25 14:01:16 -070034 std::string oem_name;
35 std::string model_name;
36 std::string model_id;
Vitaly Buka8cca9b12015-09-29 14:49:44 -070037
Vitaly Bukab53b8842015-09-29 15:52:29 -070038 // Basic device information. Must be set from ConfigStore::LoadDefaults.
Vitaly Buka8cca9b12015-09-29 14:49:44 -070039 std::string name;
40 std::string description;
41 std::string location;
42
Vitaly Bukab53b8842015-09-29 15:52:29 -070043 // OAuth 2.0 related options. Must be set from ConfigStore::LoadDefaults.
Vitaly Buka8cca9b12015-09-29 14:49:44 -070044 std::string api_key;
45 std::string client_id;
46 std::string client_secret;
47
Vitaly Bukab53b8842015-09-29 15:52:29 -070048 // Options mirrored into "base" state.
49 // Maximum role for local anonymous user.
Vitaly Bukab624bc42015-09-29 19:13:55 -070050 AuthScope local_anonymous_access_role{AuthScope::kViewer};
Alex Vakulenko5e67ce22016-04-06 12:11:09 -070051 // If true, allows local pairing using Privet API, including mDNS.
52 bool local_access_enabled{true};
Vitaly Bukab53b8842015-09-29 15:52:29 -070053
54 // Set of pairing modes supported by device.
55 std::set<PairingType> pairing_modes;
56
57 // Embedded code. Will be used only if pairing_modes contains kEmbeddedCode.
58 std::string embedded_code;
59
Vitaly Buka8cca9b12015-09-29 14:49:44 -070060 // Optional cloud information. Can be used for testing or debugging.
61 std::string oauth_url;
62 std::string service_url;
Vitaly Buka3b8fbc52016-02-04 15:42:04 -080063 std::string xmpp_endpoint;
Vitaly Buka8cca9b12015-09-29 14:49:44 -070064
Vitaly Buka41a90d62015-09-29 16:58:39 -070065 // Cloud ID of the registered device. Empty if device is not registered.
Vitaly Bukab53b8842015-09-29 15:52:29 -070066 std::string cloud_id;
67
Vitaly Buka78d4f6d2015-12-06 17:38:13 -080068 // Local device id.
69 std::string device_id;
70
Vitaly Buka41a90d62015-09-29 16:58:39 -070071 // Internal options to tweak some library functionality. External code should
72 // avoid using them.
Vitaly Buka03ee8ac2016-02-05 11:40:33 -080073 bool allow_endpoints_override{false};
Vitaly Buka1e363672015-09-25 14:01:16 -070074 bool wifi_auto_setup_enabled{true};
Vitaly Buka41a90d62015-09-29 16:58:39 -070075 std::string test_privet_ssid;
Vitaly Buka1e363672015-09-25 14:01:16 -070076};
77
78} // namespace weave
79
80#endif // LIBWEAVE_INCLUDE_WEAVE_SETTINGS_H_