OSDN Git Service

Add android.net.wifi.IWificond AIDL
authorChristopher Wiley <wiley@google.com>
Wed, 8 Jun 2016 21:55:36 +0000 (14:55 -0700)
committerChristopher Wiley <wiley@google.com>
Wed, 8 Jun 2016 22:48:09 +0000 (15:48 -0700)
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
aidl/android/net/wifi/IChip.aidl [new file with mode: 0644]
aidl/android/net/wifi/IWificond.aidl [moved from aidl/android/wificond/IServer.aidl with 61% similarity]
main.cpp
server.cpp
server.h

index 6b5f7da..a93572b 100644 (file)
@@ -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 (file)
index 0000000..deebc97
--- /dev/null
@@ -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 {
+
+}
similarity index 61%
rename from aidl/android/wificond/IServer.aidl
rename to aidl/android/net/wifi/IWificond.aidl
index 112f7b4..53fdd89 100644 (file)
  * 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<IBinder> GetChips();
 
-interface IServer {
-  // Retrieve a quick response message from the server.
-  @utf8InCpp String Ping();
 }
index 7c90299..5f4e318 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -29,6 +29,8 @@
 #include <looper_backed_event_loop.h>
 #include <server.h>
 
+using android::net::wifi::IWificond;
+
 namespace {
 
 class ScopedSignalHandler final {
@@ -89,7 +91,7 @@ int main(int argc, char** argv) {
   }
   android::sp<android::IServiceManager> sm = android::defaultServiceManager();
   CHECK_EQ(sm != NULL, true) << "Could not obtain IServiceManager";
-  android::sp<android::wificond::Server> server = new android::wificond::Server();
+  android::sp<android::IBinder> server = new android::wificond::Server();
   sm->addService(android::String16("wificond"), server);
 
   event_dispatcher_->Poll();
index a530e6d..4be217e 100644 (file)
 
 #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<sp<IBinder>>* chips) {
+  // TODO: Enumerate chips and return the ones we know about.
+  chips->clear();
   return binder::Status::ok();
 }
 
-}  // namespace android
 }  // namespace wificond
-
+}  // namespace android
index af2ccc5..94c10f3 100644 (file)
--- a/server.h
+++ b/server.h
  * 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<sp<IBinder>>* chips);
 };
 
-}  // namespace android
 }  // namespace wificond
-
+}  // namespace android