diff options
author | Alex Vakulenko <avakulenko@google.com> | 2016-02-24 21:46:58 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-02-24 21:46:58 +0000 |
commit | b23c87ebe202d7fd183d32fedce2ec10084ce713 (patch) | |
tree | 9ef0982100f9f96235e514e9bdb20ea69cab6e47 | |
parent | dd7857cb6dad2890a266b566083e66d9312b1bf3 (diff) | |
parent | 240e401635e226f903bffb234b9982acfdb74253 (diff) | |
download | weaved-b23c87ebe202d7fd183d32fedce2ec10084ce713.tar.gz |
weaved: Remove legacy command and state definitions am: 98b3323fbf
am: 240e401635
* commit '240e401635e226f903bffb234b9982acfdb74253':
weaved: Remove legacy command and state definitions
-rw-r--r-- | Android.mk | 4 | ||||
-rw-r--r-- | buffet/manager.cc | 58 |
2 files changed, 1 insertions, 61 deletions
@@ -89,9 +89,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := weave-daemon-common LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension) LOCAL_CFLAGS := $(buffetCommonCFlags) -# TODO(avakulenko): Remove -Wno-deprecated-declarations when legacy libweave -# APIs are removed (see: b/25917708). -LOCAL_CPPFLAGS := $(buffetCommonCppFlags) -Wno-deprecated-declarations +LOCAL_CPPFLAGS := $(buffetCommonCppFlags) LOCAL_C_INCLUDES := $(buffetCommonCIncludes) LOCAL_SHARED_LIBRARIES := $(buffetSharedLibraries) LOCAL_STATIC_LIBRARIES := weave-common diff --git a/buffet/manager.cc b/buffet/manager.cc index 1323850..cbb1add 100644 --- a/buffet/manager.cc +++ b/buffet/manager.cc @@ -93,61 +93,6 @@ void LoadTraitDefinitions(const BuffetConfig::Options& options, } } -void LoadCommandDefinitions(const BuffetConfig::Options& options, - weave::Device* device) { - auto load_packages = [device](const base::FilePath& root, - const base::FilePath::StringType& pattern) { - base::FilePath dir{root.Append("commands")}; - LOG(INFO) << "Looking for command schemas in " << dir.value(); - base::FileEnumerator enumerator(dir, false, base::FileEnumerator::FILES, - pattern); - for (base::FilePath path = enumerator.Next(); !path.empty(); - path = enumerator.Next()) { - LOG(INFO) << "Loading command schema from " << path.value(); - std::string json; - CHECK(LoadFile(path, &json, nullptr)); - device->AddCommandDefinitionsFromJson(json); - } - }; - load_packages(options.definitions, FILE_PATH_LITERAL("*.json")); - if (!options.test_definitions.empty()) - load_packages(options.test_definitions, FILE_PATH_LITERAL("*test.json")); -} - -void LoadStateDefinitions(const BuffetConfig::Options& options, - weave::Device* device) { - // Load component-specific device state definitions. - base::FilePath dir{options.definitions.Append("states")}; - LOG(INFO) << "Looking for state definitions in " << dir.value(); - base::FileEnumerator enumerator(dir, false, base::FileEnumerator::FILES, - FILE_PATH_LITERAL("*.schema.json")); - std::vector<std::string> result; - for (base::FilePath path = enumerator.Next(); !path.empty(); - path = enumerator.Next()) { - LOG(INFO) << "Loading state definition from " << path.value(); - std::string json; - CHECK(LoadFile(path, &json, nullptr)); - device->AddStateDefinitionsFromJson(json); - } -} - -void LoadStateDefaults(const BuffetConfig::Options& options, - weave::Device* device) { - // Load component-specific device state defaults. - base::FilePath dir{options.definitions.Append("states")}; - LOG(INFO) << "Looking for state defaults in " << dir.value(); - base::FileEnumerator enumerator(dir, false, base::FileEnumerator::FILES, - FILE_PATH_LITERAL("*.defaults.json")); - std::vector<std::string> result; - for (base::FilePath path = enumerator.Next(); !path.empty(); - path = enumerator.Next()) { - LOG(INFO) << "Loading state defaults from " << path.value(); - std::string json; - CHECK(LoadFile(path, &json, nullptr)); - CHECK(device->SetStatePropertiesFromJson(json, nullptr)); - } -} - // Updates the manager's state property if the new value is different from // the current value. In this case also adds the appropriate notification ID // to the array to record the state change for clients. @@ -239,9 +184,6 @@ void Manager::CreateDevice() { shill_client_.get(), bluetooth_client_.get()); LoadTraitDefinitions(options_.config_options, device_.get()); - LoadCommandDefinitions(options_.config_options, device_.get()); - LoadStateDefinitions(options_.config_options, device_.get()); - LoadStateDefaults(options_.config_options, device_.get()); device_->AddSettingsChangedCallback( base::Bind(&Manager::OnConfigChanged, weak_ptr_factory_.GetWeakPtr())); |