Vitaly Buka | 4615e0d | 2015-10-14 15:35:12 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Weave Authors. All rights reserved. |
Vitaly Buka | 1e36367 | 2015-09-25 14:01:16 -0700 | [diff] [blame] | 2 | // 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 Buka | 1e36367 | 2015-09-25 14:01:16 -0700 | [diff] [blame] | 12 | |
| 13 | namespace weave { |
| 14 | |
Vitaly Buka | b624bc4 | 2015-09-29 19:13:55 -0700 | [diff] [blame] | 15 | // Scopes in order of increasing privileges. |
Luis Hector Chavez | 83db8f7 | 2016-06-01 20:11:15 +0000 | [diff] [blame] | 16 | enum class AuthScope : int32_t { |
Vitaly Buka | b624bc4 | 2015-09-29 19:13:55 -0700 | [diff] [blame] | 17 | kNone, |
| 18 | kViewer, |
| 19 | kUser, |
Vitaly Buka | 287346b | 2015-12-15 14:35:28 -0800 | [diff] [blame] | 20 | kManager, |
Vitaly Buka | b624bc4 | 2015-09-29 19:13:55 -0700 | [diff] [blame] | 21 | kOwner, |
| 22 | }; |
| 23 | |
Vitaly Buka | c8ba228 | 2015-10-01 17:42:40 -0700 | [diff] [blame] | 24 | // Type client-device pairing. |
| 25 | enum class PairingType { |
| 26 | kPinCode, |
| 27 | kEmbeddedCode, |
| 28 | }; |
| 29 | |
Vitaly Buka | 1e36367 | 2015-09-25 14:01:16 -0700 | [diff] [blame] | 30 | struct Settings { |
Vitaly Buka | 8cca9b1 | 2015-09-29 14:49:44 -0700 | [diff] [blame] | 31 | // Model specific information. Must be set by ConfigStore::LoadDefaults. |
Vitaly Buka | 1e36367 | 2015-09-25 14:01:16 -0700 | [diff] [blame] | 32 | std::string firmware_version; |
Alex Vakulenko | 5e67ce2 | 2016-04-06 12:11:09 -0700 | [diff] [blame] | 33 | std::string serial_number; |
Vitaly Buka | 1e36367 | 2015-09-25 14:01:16 -0700 | [diff] [blame] | 34 | std::string oem_name; |
| 35 | std::string model_name; |
| 36 | std::string model_id; |
Vitaly Buka | 8cca9b1 | 2015-09-29 14:49:44 -0700 | [diff] [blame] | 37 | |
Vitaly Buka | b53b884 | 2015-09-29 15:52:29 -0700 | [diff] [blame] | 38 | // Basic device information. Must be set from ConfigStore::LoadDefaults. |
Vitaly Buka | 8cca9b1 | 2015-09-29 14:49:44 -0700 | [diff] [blame] | 39 | std::string name; |
| 40 | std::string description; |
| 41 | std::string location; |
| 42 | |
Vitaly Buka | b53b884 | 2015-09-29 15:52:29 -0700 | [diff] [blame] | 43 | // OAuth 2.0 related options. Must be set from ConfigStore::LoadDefaults. |
Vitaly Buka | 8cca9b1 | 2015-09-29 14:49:44 -0700 | [diff] [blame] | 44 | std::string api_key; |
| 45 | std::string client_id; |
| 46 | std::string client_secret; |
| 47 | |
Vitaly Buka | b53b884 | 2015-09-29 15:52:29 -0700 | [diff] [blame] | 48 | // Options mirrored into "base" state. |
| 49 | // Maximum role for local anonymous user. |
Vitaly Buka | b624bc4 | 2015-09-29 19:13:55 -0700 | [diff] [blame] | 50 | AuthScope local_anonymous_access_role{AuthScope::kViewer}; |
Alex Vakulenko | 5e67ce2 | 2016-04-06 12:11:09 -0700 | [diff] [blame] | 51 | // If true, allows local pairing using Privet API, including mDNS. |
| 52 | bool local_access_enabled{true}; |
Vitaly Buka | b53b884 | 2015-09-29 15:52:29 -0700 | [diff] [blame] | 53 | |
| 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 Buka | 8cca9b1 | 2015-09-29 14:49:44 -0700 | [diff] [blame] | 60 | // Optional cloud information. Can be used for testing or debugging. |
| 61 | std::string oauth_url; |
| 62 | std::string service_url; |
Vitaly Buka | 3b8fbc5 | 2016-02-04 15:42:04 -0800 | [diff] [blame] | 63 | std::string xmpp_endpoint; |
Vitaly Buka | 8cca9b1 | 2015-09-29 14:49:44 -0700 | [diff] [blame] | 64 | |
Vitaly Buka | 41a90d6 | 2015-09-29 16:58:39 -0700 | [diff] [blame] | 65 | // Cloud ID of the registered device. Empty if device is not registered. |
Vitaly Buka | b53b884 | 2015-09-29 15:52:29 -0700 | [diff] [blame] | 66 | std::string cloud_id; |
| 67 | |
Vitaly Buka | 78d4f6d | 2015-12-06 17:38:13 -0800 | [diff] [blame] | 68 | // Local device id. |
| 69 | std::string device_id; |
| 70 | |
Vitaly Buka | 41a90d6 | 2015-09-29 16:58:39 -0700 | [diff] [blame] | 71 | // Internal options to tweak some library functionality. External code should |
| 72 | // avoid using them. |
Vitaly Buka | 03ee8ac | 2016-02-05 11:40:33 -0800 | [diff] [blame] | 73 | bool allow_endpoints_override{false}; |
Vitaly Buka | 1e36367 | 2015-09-25 14:01:16 -0700 | [diff] [blame] | 74 | bool wifi_auto_setup_enabled{true}; |
Vitaly Buka | 41a90d6 | 2015-09-29 16:58:39 -0700 | [diff] [blame] | 75 | std::string test_privet_ssid; |
Vitaly Buka | 1e36367 | 2015-09-25 14:01:16 -0700 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | } // namespace weave |
| 79 | |
| 80 | #endif // LIBWEAVE_INCLUDE_WEAVE_SETTINGS_H_ |