From f771ca1e6e0961f7a9296f140f4df0eaea9dcadd Mon Sep 17 00:00:00 2001 From: Christopher Wiley Date: Wed, 8 Jun 2016 14:55:36 -0700 Subject: [PATCH] Add android.net.wifi.IWificond AIDL This is the root object exposed by wificond via Binder as described in the design document. Bug: 29218284 Change-Id: Ia6a21285f974d322f3ed9dd20e865fac4c4b31ac Test: Compiles, unit, integration tests pass. --- Android.mk | 2 +- aidl/android/net/wifi/IChip.aidl | 26 ++++++++++++++++++++++ .../IServer.aidl => net/wifi/IWificond.aidl} | 17 ++++++++++---- main.cpp | 4 +++- server.cpp | 10 ++++----- server.h | 9 ++++---- 6 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 aidl/android/net/wifi/IChip.aidl rename aidl/android/{wificond/IServer.aidl => net/wifi/IWificond.aidl} (61%) diff --git a/Android.mk b/Android.mk index 6b5f7da..a93572b 100644 --- a/Android.mk +++ b/Android.mk @@ -26,8 +26,8 @@ LOCAL_CPPFLAGS := $(wificond_cpp_flags) LOCAL_INIT_RC := wificond.rc LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/aidl LOCAL_SRC_FILES := \ + aidl/android/net/wifi/IWificond.aidl \ main.cpp \ - aidl/android/wificond/IServer.aidl \ server.cpp LOCAL_SHARED_LIBRARIES := \ libbinder \ diff --git a/aidl/android/net/wifi/IChip.aidl b/aidl/android/net/wifi/IChip.aidl new file mode 100644 index 0000000..deebc97 --- /dev/null +++ b/aidl/android/net/wifi/IChip.aidl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2016 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. + */ + +package android.net.wifi; + +// IChip represents a particular chip attached to the host. Generally, +// chips have a set of capabilities which determine the ways they can +// be configured. To use the functionality of a chip, request an interface +// be configured via IChip.Configure*Interface(). Chips may support being +// configured with multiple interfaces at once. +interface IChip { + +} diff --git a/aidl/android/wificond/IServer.aidl b/aidl/android/net/wifi/IWificond.aidl similarity index 61% rename from aidl/android/wificond/IServer.aidl rename to aidl/android/net/wifi/IWificond.aidl index 112f7b4..53fdd89 100644 --- a/aidl/android/wificond/IServer.aidl +++ b/aidl/android/net/wifi/IWificond.aidl @@ -14,9 +14,18 @@ * limitations under the License. */ -package android.wificond; +package android.net.wifi; + +import android.net.wifi.IChip; + +// Service interface that exposes primitives for controlling the WiFi +// subsystems of a host. +interface IWificond { + + // Get a list of chips that export WiFi functionality. + // + // @return list of android.net.wifi.IChip objects representing + // the set of WiFi chips on this device. + List GetChips(); -interface IServer { - // Retrieve a quick response message from the server. - @utf8InCpp String Ping(); } diff --git a/main.cpp b/main.cpp index 7c90299..5f4e318 100644 --- a/main.cpp +++ b/main.cpp @@ -29,6 +29,8 @@ #include #include +using android::net::wifi::IWificond; + namespace { class ScopedSignalHandler final { @@ -89,7 +91,7 @@ int main(int argc, char** argv) { } android::sp sm = android::defaultServiceManager(); CHECK_EQ(sm != NULL, true) << "Could not obtain IServiceManager"; - android::sp server = new android::wificond::Server(); + android::sp server = new android::wificond::Server(); sm->addService(android::String16("wificond"), server); event_dispatcher_->Poll(); diff --git a/server.cpp b/server.cpp index a530e6d..4be217e 100644 --- a/server.cpp +++ b/server.cpp @@ -16,16 +16,14 @@ #include "server.h" -#include "android/wificond/BnServer.h" - namespace android { namespace wificond { -android::binder::Status Server::Ping(::std::string* _aidl_return) { - *_aidl_return = std::string("Pong"); +android::binder::Status Server::GetChips(std::vector>* chips) { + // TODO: Enumerate chips and return the ones we know about. + chips->clear(); return binder::Status::ok(); } -} // namespace android } // namespace wificond - +} // namespace android diff --git a/server.h b/server.h index af2ccc5..94c10f3 100644 --- a/server.h +++ b/server.h @@ -14,16 +14,15 @@ * limitations under the License. */ -#include "android/wificond/BnServer.h" +#include "android/net/wifi/BnWificond.h" namespace android { namespace wificond { -class Server : public BnServer { +class Server : public android::net::wifi::BnWificond { public: - android::binder::Status Ping(::std::string* _aidl_return) override; + android::binder::Status GetChips(std::vector>* chips); }; -} // namespace android } // namespace wificond - +} // namespace android -- 2.11.0