1 // Copyright 2015 The Weave Authors. All rights reserved. 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> 12 13 namespace weave { 14 15 // Scopes in order of increasing privileges. 16 enum class AuthScope { 17 kNone, 18 kViewer, 19 kUser, 20 kManager, 21 kOwner, 22 }; 23 24 // Type client-device pairing. 25 enum class PairingType { 26 kPinCode, 27 kEmbeddedCode, 28 }; 29 30 struct Settings { 31 // Model specific information. Must be set by ConfigStore::LoadDefaults. 32 std::string firmware_version; 33 std::string oem_name; 34 std::string model_name; 35 std::string model_id; 36 37 // Basic device information. Must be set from ConfigStore::LoadDefaults. 38 std::string name; 39 std::string description; 40 std::string location; 41 42 // OAuth 2.0 related options. Must be set from ConfigStore::LoadDefaults. 43 std::string api_key; 44 std::string client_id; 45 std::string client_secret; 46 47 // Options mirrored into "base" state. 48 // Maximum role for local anonymous user. 49 AuthScope local_anonymous_access_role{AuthScope::kViewer}; 50 // If true, allows local discovery using DNS-SD. 51 bool local_discovery_enabled{true}; 52 // If true, allows local pairing using Privet API. 53 bool local_pairing_enabled{true}; 54 55 // Set of pairing modes supported by device. 56 std::set<PairingType> pairing_modes; 57 58 // Embedded code. Will be used only if pairing_modes contains kEmbeddedCode. 59 std::string embedded_code; 60 61 // Optional cloud information. Can be used for testing or debugging. 62 std::string oauth_url; 63 std::string service_url; 64 std::string xmpp_endpoint; 65 66 // Cloud ID of the registered device. Empty if device is not registered. 67 std::string cloud_id; 68 69 // Local device id. 70 std::string device_id; 71 72 // Internal options to tweak some library functionality. External code should 73 // avoid using them. 74 bool wifi_auto_setup_enabled{true}; 75 std::string test_privet_ssid; 76 }; 77 78 } // namespace weave 79 80 #endif // LIBWEAVE_INCLUDE_WEAVE_SETTINGS_H_ 81