diff options
author | Bertrand SIMONNET <bsimonnet@google.com> | 2016-02-12 13:47:29 -0800 |
---|---|---|
committer | Bertrand SIMONNET <bsimonnet@google.com> | 2016-02-12 15:46:59 -0800 |
commit | b9ff0930ab35fbbba73b9d9c7495bc5b6d43366c (patch) | |
tree | 2ebcb59976ac59fe34f5f19bda1385672427fddc | |
parent | 7f93d026d18ace0471397ef67992d54a6611ad23 (diff) | |
download | peripheralmanager-b9ff0930ab35fbbba73b9d9c7495bc5b6d43366c.tar.gz |
Remove peripheralprovider.
We will use a C only HAL type abstraction for each board, the provider
pattern will not be needed.
Bug: 26189976
Change-Id: I6e5968c7c4f214734b0117e484d362ce229f9fba
-rw-r--r-- | daemon/Android.mk | 1 | ||||
-rw-r--r-- | daemon/main.cc | 11 | ||||
-rw-r--r-- | fake_provider/Android.mk | 39 | ||||
-rw-r--r-- | fake_provider/fake_provider.cc | 69 | ||||
-rw-r--r-- | fake_provider/include/peripheralprovider/fake_provider.h | 40 | ||||
-rw-r--r-- | peripheralprovider/Android.mk | 26 | ||||
-rw-r--r-- | peripheralprovider/include/peripheralprovider/provider_builder.h | 26 | ||||
-rw-r--r-- | peripheralprovider/include/peripheralprovider/provider_interface.h | 53 |
8 files changed, 2 insertions, 263 deletions
diff --git a/daemon/Android.mk b/daemon/Android.mk index 3fc2851..02b4f60 100644 --- a/daemon/Android.mk +++ b/daemon/Android.mk @@ -37,7 +37,6 @@ LOCAL_REQUIRED_MODULES := peripheralman.rc LOCAL_CPP_EXTENSION := .cc LOCAL_CFLAGS := $(peripheralman_CommonCFlags) LOCAL_STATIC_LIBRARIES := \ - libfake_peripheral_provider \ libperipheralman_internal \ libperipheralman_binder \ diff --git a/daemon/main.cc b/daemon/main.cc index 7efa3b3..461f401 100644 --- a/daemon/main.cc +++ b/daemon/main.cc @@ -24,28 +24,21 @@ #include <brillo/flag_helper.h> #include "peripheral_manager.h" -#include "peripheralprovider/provider_builder.h" -#include "peripheralprovider/provider_interface.h" namespace { class PeripheralManagerDaemon : public brillo::Daemon { public: - PeripheralManagerDaemon(peripheralprovider::ProviderInterface* provider) - : provider_(provider){}; + PeripheralManagerDaemon() {}; ~PeripheralManagerDaemon() override = default; private: - std::unique_ptr<peripheralprovider::ProviderInterface> provider_; // brillo::Daemon: int OnInit() override { int result = brillo::Daemon::OnInit(); if (result != EX_OK) return result; - if (!provider_->Init()) { - return EX_OSERR; - } android::BinderWrapper::Create(); if (!binder_watcher_.Init()) @@ -68,5 +61,5 @@ class PeripheralManagerDaemon : public brillo::Daemon { int main(int argc, char *argv[]) { brillo::FlagHelper::Init(argc, argv, "Peripheral management daemon"); logging::InitLogging(logging::LoggingSettings()); - return PeripheralManagerDaemon(peripheralprovider::CreateProvider()).Run(); + return PeripheralManagerDaemon().Run(); } diff --git a/fake_provider/Android.mk b/fake_provider/Android.mk deleted file mode 100644 index e08281e..0000000 --- a/fake_provider/Android.mk +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (C) 2015 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH := $(call my-dir) - -peripheralprovider_CommonCFlags := -Wall -Werror -Wno-unused-parameter -peripheralprovider_CommonCIncludes := \ - $(LOCAL_PATH)/include \ - external/gtest/include \ - -# libfake_peripheral_provider static lib -# ======================================================== - -include $(CLEAR_VARS) -LOCAL_MODULE := libfake_peripheral_provider -LOCAL_CPP_EXTENSION := .cc -LOCAL_CFLAGS := $(peripheralprovider_CommonCFlags) -LOCAL_C_INCLUDES := $(peripheralprovider_CommonCIncludes) -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - $(LOCAL_PATH)/include \ - $(LOCAL_PATH)/../peripheralprovider/include \ - -LOCAL_SRC_FILES := fake_provider.cc -LOCAL_STATIC_LIBRARIES := libperipheral_provider_interface - -include $(BUILD_STATIC_LIBRARY) diff --git a/fake_provider/fake_provider.cc b/fake_provider/fake_provider.cc deleted file mode 100644 index 95b3f0a..0000000 --- a/fake_provider/fake_provider.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <string> -#include <vector> - -#include "peripheralprovider/fake_provider.h" -#include "peripheralprovider/provider_builder.h" - -using peripheralprovider::Status; -using std::string; -using std::vector; - -bool FakeProvider::Init() { - return true; -} - -Status FakeProvider::EnableGPIO(const string& pin_name, string* path) { - return Status::Ok; -} - -Status FakeProvider::ReleaseGPIO(const string& pin_name) { - return Status::Ok; -} - -vector<string> FakeProvider::ListGPIOPins() { - return vector<string>(); -} - -Status FakeProvider::EnableSPI(const string& bus_name, string* path) { - return Status::Ok; -} - -Status FakeProvider::ReleaseSPI(const string& bus_name) { - return Status::Ok; -} - -vector<string> FakeProvider::ListSPIBuses() { - return vector<string>(); -} - -Status FakeProvider::EnableI2C(const string& bus_name, string* path) { - return Status::Ok; -} - -Status FakeProvider::ReleaseI2C(const string& bus_name) { - return Status::Ok; -} - -vector<string> FakeProvider::ListI2CBuses() { - return vector<string>(); -} - -peripheralprovider::ProviderInterface* peripheralprovider::CreateProvider() { - return new FakeProvider(); -} diff --git a/fake_provider/include/peripheralprovider/fake_provider.h b/fake_provider/include/peripheralprovider/fake_provider.h deleted file mode 100644 index 1756b2b..0000000 --- a/fake_provider/include/peripheralprovider/fake_provider.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "peripheralprovider/provider_interface.h" - -class FakeProvider : public peripheralprovider::ProviderInterface { - public: - FakeProvider() = default; - ~FakeProvider() override{}; - - bool Init() override; - - peripheralprovider::Status EnableGPIO(const std::string& pin_name, - std::string* path) override; - peripheralprovider::Status ReleaseGPIO(const std::string& pin_name) override; - std::vector<std::string> ListGPIOPins() override; - - peripheralprovider::Status EnableI2C(const std::string& bus_name, - std::string* path) override; - peripheralprovider::Status ReleaseI2C(const std::string& bus_name) override; - std::vector<std::string> ListI2CBuses() override; - - peripheralprovider::Status EnableSPI(const std::string& bus_name, - std::string* path) override; - peripheralprovider::Status ReleaseSPI(const std::string& bus_name) override; - std::vector<std::string> ListSPIBuses() override; -}; diff --git a/peripheralprovider/Android.mk b/peripheralprovider/Android.mk deleted file mode 100644 index 8818e38..0000000 --- a/peripheralprovider/Android.mk +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (C) 2015 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH := $(call my-dir) - -# peripheralprovider interface static lib. -# ======================================================== - -include $(CLEAR_VARS) -LOCAL_MODULE := libperipheral_provider_interface -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include - -include $(BUILD_STATIC_LIBRARY) diff --git a/peripheralprovider/include/peripheralprovider/provider_builder.h b/peripheralprovider/include/peripheralprovider/provider_builder.h deleted file mode 100644 index 5882e12..0000000 --- a/peripheralprovider/include/peripheralprovider/provider_builder.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef PERIPHERALMANAGER_PERIPHERALPROVIDER_PROVIDER_BUILDER_H_ -#define PERIPHERALMANAGER_PERIPHERALPROVIDER_PROVIDER_BUILDER_H_ - -#include "peripheralprovider/provider_interface.h" - -namespace peripheralprovider { - ProviderInterface* CreateProvider(); -} - -#endif // PERIPHERALMANAGER_PERIPHERALPROVIDER_PROVIDER_BUILDER_H_ diff --git a/peripheralprovider/include/peripheralprovider/provider_interface.h b/peripheralprovider/include/peripheralprovider/provider_interface.h deleted file mode 100644 index 40518ce..0000000 --- a/peripheralprovider/include/peripheralprovider/provider_interface.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef PERIPHERALMANAGER_PERIPHERALPROVIDER_PROVIDER_INTERFACE_H_ -#define PERIPHERALMANAGER_PERIPHERALPROVIDER_PROVIDER_INTERFACE_H_ - -#include <string> -#include <vector> - -namespace peripheralprovider { - -enum Status { - Ok, - UnsupportedOperation, - ConflictingConfiguration -}; - -class ProviderInterface { - public: - virtual ~ProviderInterface() {}; - - virtual bool Init() = 0; - - virtual Status EnableGPIO(const std::string& pin_name, std::string* path) = 0; - virtual Status ReleaseGPIO(const std::string& pin_name) = 0; - - virtual std::vector<std::string> ListGPIOPins() = 0; - - virtual Status EnableI2C(const std::string& bus_name, std::string* path) = 0; - virtual Status ReleaseI2C(const std::string& bus_name) = 0; - virtual std::vector<std::string> ListI2CBuses() = 0; - - virtual Status EnableSPI(const std::string& bus_name, std::string* path) = 0; - virtual Status ReleaseSPI(const std::string& bus_name) = 0; - virtual std::vector<std::string> ListSPIBuses() = 0; -}; - -} // namespace peripheralprovider - -#endif // PERIPHERALMANAGER_PERIPHERALPROVIDER_PROVIDER_INTERFACE_H_ |