Merge "Added test for overloading."
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index 07e17ef..59ad2c5 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -7,16 +7,28 @@
srcs: [
"types.hal",
"IWifi.hal",
+ "IWifiApIface.hal",
"IWifiChip.hal",
"IWifiChipEventCallback.hal",
"IWifiEventCallback.hal",
+ "IWifiIface.hal",
+ "IWifiNanIface.hal",
+ "IWifiP2pIface.hal",
+ "IWifiRttController.hal",
+ "IWifiStaIface.hal",
],
out: [
"android/hardware/wifi/1.0/types.cpp",
"android/hardware/wifi/1.0/WifiAll.cpp",
+ "android/hardware/wifi/1.0/WifiApIfaceAll.cpp",
"android/hardware/wifi/1.0/WifiChipAll.cpp",
"android/hardware/wifi/1.0/WifiChipEventCallbackAll.cpp",
"android/hardware/wifi/1.0/WifiEventCallbackAll.cpp",
+ "android/hardware/wifi/1.0/WifiIfaceAll.cpp",
+ "android/hardware/wifi/1.0/WifiNanIfaceAll.cpp",
+ "android/hardware/wifi/1.0/WifiP2pIfaceAll.cpp",
+ "android/hardware/wifi/1.0/WifiRttControllerAll.cpp",
+ "android/hardware/wifi/1.0/WifiStaIfaceAll.cpp",
],
}
@@ -27,9 +39,15 @@
srcs: [
"types.hal",
"IWifi.hal",
+ "IWifiApIface.hal",
"IWifiChip.hal",
"IWifiChipEventCallback.hal",
"IWifiEventCallback.hal",
+ "IWifiIface.hal",
+ "IWifiNanIface.hal",
+ "IWifiP2pIface.hal",
+ "IWifiRttController.hal",
+ "IWifiStaIface.hal",
],
out: [
"android/hardware/wifi/1.0/types.h",
@@ -38,6 +56,11 @@
"android/hardware/wifi/1.0/BnWifi.h",
"android/hardware/wifi/1.0/BpWifi.h",
"android/hardware/wifi/1.0/BsWifi.h",
+ "android/hardware/wifi/1.0/IWifiApIface.h",
+ "android/hardware/wifi/1.0/IHwWifiApIface.h",
+ "android/hardware/wifi/1.0/BnWifiApIface.h",
+ "android/hardware/wifi/1.0/BpWifiApIface.h",
+ "android/hardware/wifi/1.0/BsWifiApIface.h",
"android/hardware/wifi/1.0/IWifiChip.h",
"android/hardware/wifi/1.0/IHwWifiChip.h",
"android/hardware/wifi/1.0/BnWifiChip.h",
@@ -53,6 +76,31 @@
"android/hardware/wifi/1.0/BnWifiEventCallback.h",
"android/hardware/wifi/1.0/BpWifiEventCallback.h",
"android/hardware/wifi/1.0/BsWifiEventCallback.h",
+ "android/hardware/wifi/1.0/IWifiIface.h",
+ "android/hardware/wifi/1.0/IHwWifiIface.h",
+ "android/hardware/wifi/1.0/BnWifiIface.h",
+ "android/hardware/wifi/1.0/BpWifiIface.h",
+ "android/hardware/wifi/1.0/BsWifiIface.h",
+ "android/hardware/wifi/1.0/IWifiNanIface.h",
+ "android/hardware/wifi/1.0/IHwWifiNanIface.h",
+ "android/hardware/wifi/1.0/BnWifiNanIface.h",
+ "android/hardware/wifi/1.0/BpWifiNanIface.h",
+ "android/hardware/wifi/1.0/BsWifiNanIface.h",
+ "android/hardware/wifi/1.0/IWifiP2pIface.h",
+ "android/hardware/wifi/1.0/IHwWifiP2pIface.h",
+ "android/hardware/wifi/1.0/BnWifiP2pIface.h",
+ "android/hardware/wifi/1.0/BpWifiP2pIface.h",
+ "android/hardware/wifi/1.0/BsWifiP2pIface.h",
+ "android/hardware/wifi/1.0/IWifiRttController.h",
+ "android/hardware/wifi/1.0/IHwWifiRttController.h",
+ "android/hardware/wifi/1.0/BnWifiRttController.h",
+ "android/hardware/wifi/1.0/BpWifiRttController.h",
+ "android/hardware/wifi/1.0/BsWifiRttController.h",
+ "android/hardware/wifi/1.0/IWifiStaIface.h",
+ "android/hardware/wifi/1.0/IHwWifiStaIface.h",
+ "android/hardware/wifi/1.0/BnWifiStaIface.h",
+ "android/hardware/wifi/1.0/BpWifiStaIface.h",
+ "android/hardware/wifi/1.0/BsWifiStaIface.h",
],
}
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index e211ca8..58c487b 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -47,6 +47,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (IfaceType)
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IfaceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::types.IfaceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifi.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifi.java
@@ -57,6 +74,8 @@
$(GEN): $(LOCAL_PATH)/IWifiChip.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
@@ -68,14 +87,45 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build IWifiApIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiApIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiApIface
+
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifiChip.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiChip.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
@@ -125,6 +175,101 @@
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiIface
+
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiNanIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiNanIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiNanIface
+
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiP2pIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiP2pIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiP2pIface
+
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiRttController.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiRttController.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiRttController
+
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiStaIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiStaIface
+
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_JAVA_LIBRARY)
@@ -173,6 +318,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (IfaceType)
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IfaceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::types.IfaceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifi.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifi.java
@@ -183,6 +345,8 @@
$(GEN): $(LOCAL_PATH)/IWifiChip.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
@@ -194,14 +358,45 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build IWifiApIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiApIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiApIface
+
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifiChip.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiChip.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
@@ -251,6 +446,101 @@
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiIface
+
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiNanIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiNanIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiNanIface
+
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiP2pIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiP2pIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiP2pIface
+
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiRttController.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiRttController.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiRttController
+
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiStaIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiStaIface
+
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/wifi/1.0/IWifi.hal b/wifi/1.0/IWifi.hal
index d1311f5..9e09348 100644
--- a/wifi/1.0/IWifi.hal
+++ b/wifi/1.0/IWifi.hal
@@ -70,10 +70,22 @@
@callflow(next={"registerEventCallback", "start", "stop"})
oneway stop();
- // TODO(b/30570663) return vec<IWifiChip> instead
/**
- * Get the configurable chip on the device.
+ * Retrieve the list of all chip Id's on the device.
+ * The corresponding |IWifiChip| object for any chip can be
+ * retrieved using |getChip| method.
+ *
+ * @return chipIds List of all chip Id's on the device.
*/
@callflow(next={"*"})
- getChip() generates (IWifiChip chip);
+ getChipIds() generates (vec<ChipId> chipIds);
+
+ /**
+ * Gets a HIDL interface object for the chip corresponding to the
+ * provided chipId.
+ *
+ * @return chip HIDL interface object representing the chip.
+ */
+ @callflow(next={"*"})
+ getChip(ChipId chipId) generates (IWifiChip chip);
};
diff --git a/wifi/1.0/IWifiApIface.hal b/wifi/1.0/IWifiApIface.hal
new file mode 100644
index 0000000..6bc3580
--- /dev/null
+++ b/wifi/1.0/IWifiApIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 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.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single AP iface.
+ */
+interface IWifiApIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal
index 7a41ddf..cd4b219 100644
--- a/wifi/1.0/IWifiChip.hal
+++ b/wifi/1.0/IWifiChip.hal
@@ -17,6 +17,12 @@
package android.hardware.wifi@1.0;
import IWifiChipEventCallback;
+import IWifiIface;
+import IWifiApIface;
+import IWifiNanIface;
+import IWifiP2pIface;
+import IWifiStaIface;
+import IWifiRttController;
/**
* Interface that represents a chip that must be configured as a single unit.
@@ -24,15 +30,6 @@
* to perform operations like NAN, RTT, etc.
*/
interface IWifiChip {
- enum IfaceType : uint32_t {
- STA, AP, P2P,
- /**
- * NAN control interface. Datapath support may be queried and created
- * through this interface.
- */
- NAN,
- };
-
/**
* Set of interface types with the maximum number of interfaces that can have
* one of the specified type for a given ChipIfaceCombination. See
@@ -122,6 +119,13 @@
};
/**
+ * Get the id assigned to this chip.
+ *
+ * @return id Assigned chip Id.
+ */
+ getId() generates (ChipId id);
+
+ /**
* Requests notifications of significant events on this chip. Multiple calls
* to this will register multiple callbacks each of which will receive all
* events.
@@ -176,4 +180,142 @@
* success, or |IWifiChipEventCallback.onFirmwareDebugDumpFailure| on failure.
*/
oneway requestFirmwareDebugDump();
+
+ /**
+ * Create an AP iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the AP type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createApIface() generates (IWifiApIface iface);
+
+ /**
+ * List all the AP iface names configured on the chip.
+ * The corresponding |IWifiApIface| object for any iface are
+ * retrieved using |getApIface| method.
+ *
+ * @return ifnames List of all AP iface names on the chip.
+ */
+ getApIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the AP Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getApIface(string ifname) generates (IWifiApIface iface);
+
+ /**
+ * Create a NAN iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the NAN type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createNanIface() generates (IWifiNanIface iface);
+
+ /**
+ * List all the NAN iface names configured on the chip.
+ * The corresponding |IWifiNanIface| object for any iface are
+ * retrieved using |getNanIface| method.
+ *
+ * @return ifnames List of all NAN iface names on the chip.
+ */
+ getNanIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the NAN Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getNanIface(string ifname) generates (IWifiNanIface iface);
+
+ /**
+ * Create a P2P iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the P2P type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createP2pIface() generates (IWifiP2pIface iface);
+
+ /**
+ * List all the P2P iface names configured on the chip.
+ * The corresponding |IWifiP2pIface| object for any iface are
+ * retrieved using |getP2pIface| method.
+ *
+ * @return ifnames List of all P2P iface names on the chip.
+ */
+ getP2pIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the P2P Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getP2pIface(string ifname) generates (IWifiP2pIface iface);
+
+ /**
+ * Create an STA iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the STA type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createStaIface() generates (IWifiStaIface iface);
+
+ /**
+ * List all the STA iface names configured on the chip.
+ * The corresponding |IWifiStaIface| object for any iface are
+ * retrieved using |getStaIface| method.
+ *
+ * @return ifnames List of all STA iface names on the chip.
+ */
+ getStaIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the STA Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getStaIface(string ifname) generates (IWifiStaIface iface);
+
+ /**
+ * Create a RTTController instance.
+ *
+ * RTT controller can be either:
+ * a) Bound to a specific iface by passing in the corresponding |IWifiIface|
+ * object in |iface| param, OR
+ * b) Let the implementation decide the iface to use for RTT operations by
+ * passing null in |iface| param.
+ *
+ * @param boundIface HIDL interface object representing the iface if
+ * the responder must be bound to a specific iface, null otherwise.
+ */
+ createRttController(IWifiIface boundIface) generates (IWifiRttController rtt);
};
diff --git a/wifi/1.0/IWifiIface.hal b/wifi/1.0/IWifiIface.hal
new file mode 100644
index 0000000..f4150e7
--- /dev/null
+++ b/wifi/1.0/IWifiIface.hal
@@ -0,0 +1,36 @@
+/*
+ * Copyright 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.hardware.wifi@1.0;
+
+/**
+ * Interface used to represent a single iface.
+ */
+interface IWifiIface {
+ /**
+ * Get the type of this iface.
+ *
+ * @return type One of the supported iface types.
+ */
+ getType() generates (IfaceType type);
+
+ /**
+ * Get the name of this iface.
+ *
+ * @return name Name of the iface.
+ */
+ getName() generates (string name);
+};
diff --git a/wifi/1.0/IWifiNanIface.hal b/wifi/1.0/IWifiNanIface.hal
new file mode 100644
index 0000000..dade94c
--- /dev/null
+++ b/wifi/1.0/IWifiNanIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 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.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single NAN iface.
+ */
+interface IWifiNanIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiP2pIface.hal b/wifi/1.0/IWifiP2pIface.hal
new file mode 100644
index 0000000..243748f
--- /dev/null
+++ b/wifi/1.0/IWifiP2pIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 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.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single NAN iface.
+ */
+interface IWifiP2pIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiRttController.hal b/wifi/1.0/IWifiRttController.hal
new file mode 100644
index 0000000..d735da7
--- /dev/null
+++ b/wifi/1.0/IWifiRttController.hal
@@ -0,0 +1,32 @@
+/*
+ * Copyright 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.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to perform RTT operations.
+ */
+interface IWifiRttController {
+ /**
+ * Get the iface on which the RTT operations will be performed.
+ *
+ * @return boundIface HIDL interface object representing the iface if bound
+ * to a specific iface, null otherwise
+ */
+ getBoundIface() generates (IWifiIface boundIface);
+};
diff --git a/wifi/1.0/IWifiStaIface.hal b/wifi/1.0/IWifiStaIface.hal
new file mode 100644
index 0000000..5234c71
--- /dev/null
+++ b/wifi/1.0/IWifiStaIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 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.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single STA iface.
+ */
+interface IWifiStaIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/default/Android.mk b/wifi/1.0/default/Android.mk
index 07865a5..3fd5fba 100644
--- a/wifi/1.0/default/Android.mk
+++ b/wifi/1.0/default/Android.mk
@@ -19,9 +19,14 @@
LOCAL_CPPFLAGS := -std=c++11 -Wall -Wno-unused-parameter -Werror -Wextra
LOCAL_SRC_FILES := \
failure_reason_util.cpp \
- wifi_chip.cpp \
wifi.cpp \
- wifi_legacy_hal.cpp
+ wifi_ap_iface.cpp \
+ wifi_chip.cpp \
+ wifi_legacy_hal.cpp \
+ wifi_nan_iface.cpp \
+ wifi_p2p_iface.cpp \
+ wifi_rtt_controller.cpp \
+ wifi_sta_iface.cpp
LOCAL_SHARED_LIBRARIES := \
android.hardware.wifi@1.0 \
libbase \
diff --git a/wifi/1.0/default/wifi.cpp b/wifi/1.0/default/wifi.cpp
index d5b69b8..ff2eb4c 100644
--- a/wifi/1.0/default/wifi.cpp
+++ b/wifi/1.0/default/wifi.cpp
@@ -21,6 +21,11 @@
#include "failure_reason_util.h"
#include "wifi_chip.h"
+namespace {
+// Chip ID to use for the only supported chip.
+static constexpr android::hardware::wifi::V1_0::ChipId kChipId = 0;
+} // namespace
+
namespace android {
namespace hardware {
namespace wifi {
@@ -33,7 +38,7 @@
Return<void> Wifi::registerEventCallback(
const sp<IWifiEventCallback>& callback) {
// TODO(b/31632518): remove the callback when the client is destroyed
- callbacks_.insert(callback);
+ callbacks_.emplace_back(callback);
return Void();
}
@@ -67,7 +72,7 @@
}
// Create the chip instance once the HAL is started.
- chip_ = new WifiChip(legacy_hal_);
+ chip_ = new WifiChip(kChipId, legacy_hal_);
run_state_ = RunState::STARTED;
for (const auto& callback : callbacks_) {
callback->onStart();
@@ -108,8 +113,23 @@
return Void();
}
-Return<void> Wifi::getChip(getChip_cb cb) {
- cb(chip_);
+Return<void> Wifi::getChipIds(getChipIds_cb cb) {
+ std::vector<ChipId> chip_ids;
+ if (chip_.get()) {
+ chip_ids.emplace_back(kChipId);
+ }
+ hidl_vec<ChipId> hidl_data;
+ hidl_data.setToExternal(chip_ids.data(), chip_ids.size());
+ cb(hidl_data);
+ return Void();
+}
+
+Return<void> Wifi::getChip(ChipId chip_id, getChip_cb cb) {
+ if (chip_.get() && chip_id == kChipId) {
+ cb(chip_);
+ } else {
+ cb(nullptr);
+ }
return Void();
}
diff --git a/wifi/1.0/default/wifi.h b/wifi/1.0/default/wifi.h
index e6cf1ac..55ba12b 100644
--- a/wifi/1.0/default/wifi.h
+++ b/wifi/1.0/default/wifi.h
@@ -18,7 +18,6 @@
#define WIFI_H_
#include <functional>
-#include <set>
#include <android-base/macros.h>
#include <android/hardware/wifi/1.0/IWifi.h>
@@ -46,7 +45,8 @@
Return<bool> isStarted() override;
Return<void> start() override;
Return<void> stop() override;
- Return<void> getChip(getChip_cb cb) override;
+ Return<void> getChipIds(getChipIds_cb cb) override;
+ Return<void> getChip(ChipId chip_id, getChip_cb cb) override;
private:
enum class RunState { STOPPED, STARTED, STOPPING };
@@ -55,7 +55,7 @@
// and shared with all the child HIDL interface objects.
std::shared_ptr<WifiLegacyHal> legacy_hal_;
RunState run_state_;
- std::set<sp<IWifiEventCallback>> callbacks_;
+ std::vector<sp<IWifiEventCallback>> callbacks_;
sp<WifiChip> chip_;
DISALLOW_COPY_AND_ASSIGN(Wifi);
diff --git a/wifi/1.0/default/wifi_ap_iface.cpp b/wifi/1.0/default/wifi_ap_iface.cpp
new file mode 100644
index 0000000..aded04d
--- /dev/null
+++ b/wifi/1.0/default/wifi_ap_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+#include "wifi_ap_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiApIface::WifiApIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiApIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiApIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiApIface::getType() {
+ return IfaceType::AP;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_ap_iface.h b/wifi/1.0/default/wifi_ap_iface.h
new file mode 100644
index 0000000..b95a3d8
--- /dev/null
+++ b/wifi/1.0/default/wifi_ap_iface.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#ifndef WIFI_AP_IFACE_H_
+#define WIFI_AP_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiApIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a AP Iface instance.
+ */
+class WifiApIface : public IWifiApIface {
+ public:
+ WifiApIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiApIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_AP_IFACE_H_
diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp
index df321e2..4dd020b 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.0/default/wifi_chip.cpp
@@ -20,31 +20,64 @@
#include "failure_reason_util.h"
+namespace {
+using android::sp;
+using android::hardware::hidl_vec;
+using android::hardware::hidl_string;
+
+hidl_vec<hidl_string> createHidlVecOfIfaceNames(const std::string& ifname) {
+ std::vector<hidl_string> ifnames;
+ if (!ifname.empty()) {
+ hidl_string hidl_ifname;
+ hidl_ifname = ifname.c_str();
+ ifnames.emplace_back(hidl_ifname);
+ }
+ hidl_vec<hidl_string> hidl_ifnames;
+ hidl_ifnames.setToExternal(ifnames.data(), ifnames.size());
+ return hidl_ifnames;
+}
+
+template <typename Iface>
+void invalidateAndClear(sp<Iface>& iface) {
+ if (iface.get()) {
+ iface->invalidate();
+ iface.clear();
+ }
+}
+} // namepsace
+
namespace android {
namespace hardware {
namespace wifi {
namespace V1_0 {
namespace implementation {
-WifiChip::WifiChip(std::weak_ptr<WifiLegacyHal> legacy_hal)
- : legacy_hal_(legacy_hal) {}
+WifiChip::WifiChip(ChipId chip_id,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : chip_id_(chip_id), legacy_hal_(legacy_hal), is_valid_(true) {}
void WifiChip::invalidate() {
+ invalidateAndRemoveAllIfaces();
legacy_hal_.reset();
callbacks_.clear();
+ is_valid_ = false;
+}
+
+Return<ChipId> WifiChip::getId() {
+ return chip_id_;
}
Return<void> WifiChip::registerEventCallback(
const sp<IWifiChipEventCallback>& callback) {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
// TODO(b/31632518): remove the callback when the client is destroyed
- callbacks_.insert(callback);
+ callbacks_.emplace_back(callback);
return Void();
}
Return<void> WifiChip::getAvailableModes(getAvailableModes_cb cb) {
- if (!legacy_hal_.lock()) {
+ if (!is_valid_) {
cb(hidl_vec<ChipMode>());
return Void();
} else {
@@ -54,38 +87,50 @@
}
Return<void> WifiChip::configureChip(uint32_t /*mode_id*/) {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
+
+ invalidateAndRemoveAllIfaces();
// TODO add implementation
return Void();
}
Return<uint32_t> WifiChip::getMode() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return 0;
// TODO add implementation
return 0;
}
Return<void> WifiChip::requestChipDebugInfo() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
IWifiChipEventCallback::ChipDebugInfo result;
std::pair<wifi_error, std::string> ret =
- legacy_hal_.lock()->getWlanDriverVersion();
+ legacy_hal_.lock()->getDriverVersion();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver version: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(
+ ret.first, " failed to get driver version");
+ for (const auto& callback : callbacks_) {
+ callback->onChipDebugInfoFailure(reason);
+ }
return Void();
}
result.driverDescription = ret.second.c_str();
- ret = legacy_hal_.lock()->getWlanFirmwareVersion();
+ ret = legacy_hal_.lock()->getFirmwareVersion();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware version: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(
+ ret.first, " failed to get firmware version");
+ for (const auto& callback : callbacks_) {
+ callback->onChipDebugInfoFailure(reason);
+ }
return Void();
}
result.firmwareDescription = ret.second.c_str();
@@ -97,14 +142,18 @@
}
Return<void> WifiChip::requestDriverDebugDump() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
std::pair<wifi_error, std::vector<char>> ret =
- legacy_hal_.lock()->requestWlanDriverMemoryDump();
+ legacy_hal_.lock()->requestDriverMemoryDump();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver debug dump: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(ret.first, "");
+ for (const auto& callback : callbacks_) {
+ callback->onDriverDebugDumpFailure(reason);
+ }
return Void();
}
@@ -119,14 +168,18 @@
}
Return<void> WifiChip::requestFirmwareDebugDump() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
std::pair<wifi_error, std::vector<char>> ret =
- legacy_hal_.lock()->requestWlanFirmwareMemoryDump();
+ legacy_hal_.lock()->requestFirmwareMemoryDump();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware debug dump: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(ret.first, "");
+ for (const auto& callback : callbacks_) {
+ callback->onFirmwareDebugDumpFailure(reason);
+ }
return Void();
}
@@ -140,6 +193,203 @@
return Void();
}
+Return<void> WifiChip::createApIface(createApIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getApIfaceName();
+ ap_iface_ = new WifiApIface(ifname, legacy_hal_);
+ cb(ap_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getApIfaceNames(getApIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (ap_iface_.get()) {
+ ifname = legacy_hal_.lock()->getApIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getApIface(const hidl_string& ifname, getApIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (ap_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getApIfaceName())) {
+ cb(ap_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createNanIface(createNanIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getNanIfaceName();
+ nan_iface_ = new WifiNanIface(ifname, legacy_hal_);
+ cb(nan_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getNanIfaceNames(getNanIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (nan_iface_.get()) {
+ ifname = legacy_hal_.lock()->getNanIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getNanIface(const hidl_string& ifname,
+ getNanIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (nan_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getNanIfaceName())) {
+ cb(nan_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createP2pIface(createP2pIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getP2pIfaceName();
+ p2p_iface_ = new WifiP2pIface(ifname, legacy_hal_);
+ cb(p2p_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getP2pIfaceNames(getP2pIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (p2p_iface_.get()) {
+ ifname = legacy_hal_.lock()->getP2pIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getP2pIface(const hidl_string& ifname,
+ getP2pIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (p2p_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getP2pIfaceName())) {
+ cb(p2p_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createStaIface(createStaIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getStaIfaceName();
+ sta_iface_ = new WifiStaIface(ifname, legacy_hal_);
+ cb(sta_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getStaIfaceNames(getStaIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (sta_iface_.get()) {
+ ifname = legacy_hal_.lock()->getStaIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getStaIface(const hidl_string& ifname,
+ getStaIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (sta_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getStaIfaceName())) {
+ cb(sta_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createRttController(const sp<IWifiIface>& bound_iface,
+ createRttController_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ sp<WifiRttController> rtt = new WifiRttController(bound_iface, legacy_hal_);
+ rtt_controllers_.emplace_back(rtt);
+ cb(rtt);
+ return Void();
+}
+
+void WifiChip::invalidateAndRemoveAllIfaces() {
+ invalidateAndClear(ap_iface_);
+ invalidateAndClear(nan_iface_);
+ invalidateAndClear(p2p_iface_);
+ invalidateAndClear(sta_iface_);
+ // Since all the ifaces are invalid now, all RTT controller objects
+ // using those ifaces also need to be invalidated.
+ for (const auto& rtt : rtt_controllers_) {
+ rtt->invalidate();
+ }
+ rtt_controllers_.clear();
+}
+
} // namespace implementation
} // namespace V1_0
} // namespace wifi
diff --git a/wifi/1.0/default/wifi_chip.h b/wifi/1.0/default/wifi_chip.h
index 95fabe4..94ffa63 100644
--- a/wifi/1.0/default/wifi_chip.h
+++ b/wifi/1.0/default/wifi_chip.h
@@ -17,12 +17,17 @@
#ifndef WIFI_CHIP_H_
#define WIFI_CHIP_H_
-#include <set>
+#include <map>
#include <android-base/macros.h>
#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include "wifi_ap_iface.h"
#include "wifi_legacy_hal.h"
+#include "wifi_nan_iface.h"
+#include "wifi_p2p_iface.h"
+#include "wifi_rtt_controller.h"
+#include "wifi_sta_iface.h"
namespace android {
namespace hardware {
@@ -37,11 +42,24 @@
*/
class WifiChip : public IWifiChip {
public:
- WifiChip(std::weak_ptr<WifiLegacyHal> legacy_hal);
- // Invalidate this instance once the HAL is stopped.
+ WifiChip(ChipId chip_id, const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // HIDL does not provide a built-in mechanism to let the server invalidate
+ // a HIDL interface object after creation. If any client process holds onto
+ // a reference to the object in their context, any method calls on that
+ // reference will continue to be directed to the server.
+ //
+ // However Wifi HAL needs to control the lifetime of these objects. So, add
+ // a public |invalidate| method to |WifiChip| and it's child objects. This
+ // will be used to mark an object invalid when either:
+ // a) Wifi HAL is stopped, or
+ // b) Wifi Chip is reconfigured.
+ //
+ // All HIDL method implementations should check if the object is still marked
+ // valid before processing them.
void invalidate();
// HIDL methods exposed.
+ Return<ChipId> getId() override;
Return<void> registerEventCallback(
const sp<IWifiChipEventCallback>& callback) override;
Return<void> getAvailableModes(getAvailableModes_cb cb) override;
@@ -50,10 +68,36 @@
Return<void> requestChipDebugInfo() override;
Return<void> requestDriverDebugDump() override;
Return<void> requestFirmwareDebugDump() override;
+ Return<void> createApIface(createApIface_cb cb) override;
+ Return<void> getApIfaceNames(getApIfaceNames_cb cb) override;
+ Return<void> getApIface(const hidl_string& ifname, getApIface_cb cb) override;
+ Return<void> createNanIface(createNanIface_cb cb) override;
+ Return<void> getNanIfaceNames(getNanIfaceNames_cb cb) override;
+ Return<void> getNanIface(const hidl_string& ifname,
+ getNanIface_cb cb) override;
+ Return<void> createP2pIface(createP2pIface_cb cb) override;
+ Return<void> getP2pIfaceNames(getP2pIfaceNames_cb cb) override;
+ Return<void> getP2pIface(const hidl_string& ifname,
+ getP2pIface_cb cb) override;
+ Return<void> createStaIface(createStaIface_cb cb) override;
+ Return<void> getStaIfaceNames(getStaIfaceNames_cb cb) override;
+ Return<void> getStaIface(const hidl_string& ifname,
+ getStaIface_cb cb) override;
+ Return<void> createRttController(const sp<IWifiIface>& bound_iface,
+ createRttController_cb cb) override;
private:
+ void invalidateAndRemoveAllIfaces();
+
+ ChipId chip_id_;
std::weak_ptr<WifiLegacyHal> legacy_hal_;
- std::set<sp<IWifiChipEventCallback>> callbacks_;
+ std::vector<sp<IWifiChipEventCallback>> callbacks_;
+ sp<WifiApIface> ap_iface_;
+ sp<WifiNanIface> nan_iface_;
+ sp<WifiP2pIface> p2p_iface_;
+ sp<WifiStaIface> sta_iface_;
+ std::vector<sp<WifiRttController>> rtt_controllers_;
+ bool is_valid_;
DISALLOW_COPY_AND_ASSIGN(WifiChip);
};
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index a6df996..553a058 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -25,12 +25,6 @@
#include <wifi_system/interface_tool.h>
namespace {
-std::string getWlanInterfaceName() {
- char buffer[PROPERTY_VALUE_MAX];
- property_get("wifi.interface", buffer, "wlan0");
- return buffer;
-}
-
// Legacy HAL functions accept "C" style function pointers, so use global
// functions to pass to the legacy HAL function and store the corresponding
// std::function methods to be invoked.
@@ -120,7 +114,31 @@
return WIFI_SUCCESS;
}
-std::pair<wifi_error, std::string> WifiLegacyHal::getWlanDriverVersion() {
+std::string WifiLegacyHal::getApIfaceName() {
+ // Fake name. This interface does not exist in legacy HAL
+ // API's.
+ return "ap0";
+}
+
+std::string WifiLegacyHal::getNanIfaceName() {
+ // Fake name. This interface does not exist in legacy HAL
+ // API's.
+ return "nan0";
+}
+
+std::string WifiLegacyHal::getP2pIfaceName() {
+ std::array<char, PROPERTY_VALUE_MAX> buffer;
+ property_get("wifi.direct.interface", buffer.data(), "p2p0");
+ return buffer.data();
+}
+
+std::string WifiLegacyHal::getStaIfaceName() {
+ std::array<char, PROPERTY_VALUE_MAX> buffer;
+ property_get("wifi.interface", buffer.data(), "wlan0");
+ return buffer.data();
+}
+
+std::pair<wifi_error, std::string> WifiLegacyHal::getDriverVersion() {
std::array<char, kMaxVersionStringLength> buffer;
buffer.fill(0);
wifi_error status = global_func_table_.wifi_get_driver_version(
@@ -128,7 +146,7 @@
return std::make_pair(status, buffer.data());
}
-std::pair<wifi_error, std::string> WifiLegacyHal::getWlanFirmwareVersion() {
+std::pair<wifi_error, std::string> WifiLegacyHal::getFirmwareVersion() {
std::array<char, kMaxVersionStringLength> buffer;
buffer.fill(0);
wifi_error status = global_func_table_.wifi_get_firmware_version(
@@ -137,7 +155,7 @@
}
std::pair<wifi_error, std::vector<char>>
-WifiLegacyHal::requestWlanDriverMemoryDump() {
+WifiLegacyHal::requestDriverMemoryDump() {
std::vector<char> driver_dump;
on_driver_memory_dump_internal_callback = [&driver_dump](char* buffer,
int buffer_size) {
@@ -150,7 +168,7 @@
}
std::pair<wifi_error, std::vector<char>>
-WifiLegacyHal::requestWlanFirmwareMemoryDump() {
+WifiLegacyHal::requestFirmwareMemoryDump() {
std::vector<char> firmware_dump;
on_firmware_memory_dump_internal_callback = [&firmware_dump](
char* buffer, int buffer_size) {
@@ -163,8 +181,7 @@
}
wifi_error WifiLegacyHal::retrieveWlanInterfaceHandle() {
- const std::string& ifname_to_find = getWlanInterfaceName();
-
+ const std::string& ifname_to_find = getStaIfaceName();
wifi_interface_handle* iface_handles = nullptr;
int num_iface_handles = 0;
wifi_error status = global_func_table_.wifi_get_ifaces(
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h
index f691b9b..3585975 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.0/default/wifi_legacy_hal.h
@@ -35,15 +35,21 @@
class WifiLegacyHal {
public:
WifiLegacyHal();
+ // Names to use for the different types of iface.
+ std::string getApIfaceName();
+ std::string getNanIfaceName();
+ std::string getP2pIfaceName();
+ std::string getStaIfaceName();
+
// Initialize the legacy HAL and start the event looper thread.
wifi_error start();
// Deinitialize the legacy HAL and stop the event looper thread.
wifi_error stop(const std::function<void()>& on_complete_callback);
// Wrappers for all the functions in the legacy HAL function table.
- std::pair<wifi_error, std::string> getWlanDriverVersion();
- std::pair<wifi_error, std::string> getWlanFirmwareVersion();
- std::pair<wifi_error, std::vector<char>> requestWlanDriverMemoryDump();
- std::pair<wifi_error, std::vector<char>> requestWlanFirmwareMemoryDump();
+ std::pair<wifi_error, std::string> getDriverVersion();
+ std::pair<wifi_error, std::string> getFirmwareVersion();
+ std::pair<wifi_error, std::vector<char>> requestDriverMemoryDump();
+ std::pair<wifi_error, std::vector<char>> requestFirmwareMemoryDump();
private:
static const uint32_t kMaxVersionStringLength;
diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.0/default/wifi_nan_iface.cpp
new file mode 100644
index 0000000..3c7ae4b
--- /dev/null
+++ b/wifi/1.0/default/wifi_nan_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+#include "wifi_nan_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiNanIface::WifiNanIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiNanIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiNanIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiNanIface::getType() {
+ return IfaceType::NAN;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_nan_iface.h b/wifi/1.0/default/wifi_nan_iface.h
new file mode 100644
index 0000000..93e2e77
--- /dev/null
+++ b/wifi/1.0/default/wifi_nan_iface.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#ifndef WIFI_NAN_IFACE_H_
+#define WIFI_NAN_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiNanIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a NAN Iface instance.
+ */
+class WifiNanIface : public IWifiNanIface {
+ public:
+ WifiNanIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiNanIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_NAN_IFACE_H_
diff --git a/wifi/1.0/default/wifi_p2p_iface.cpp b/wifi/1.0/default/wifi_p2p_iface.cpp
new file mode 100644
index 0000000..349a158
--- /dev/null
+++ b/wifi/1.0/default/wifi_p2p_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+#include "wifi_p2p_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiP2pIface::WifiP2pIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiP2pIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiP2pIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiP2pIface::getType() {
+ return IfaceType::P2P;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_p2p_iface.h b/wifi/1.0/default/wifi_p2p_iface.h
new file mode 100644
index 0000000..d70415d
--- /dev/null
+++ b/wifi/1.0/default/wifi_p2p_iface.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#ifndef WIFI_P2P_IFACE_H_
+#define WIFI_P2P_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiP2pIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a P2P Iface instance.
+ */
+class WifiP2pIface : public IWifiP2pIface {
+ public:
+ WifiP2pIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiP2pIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_P2P_IFACE_H_
diff --git a/wifi/1.0/default/wifi_rtt_controller.cpp b/wifi/1.0/default/wifi_rtt_controller.cpp
new file mode 100644
index 0000000..e2df1a8
--- /dev/null
+++ b/wifi/1.0/default/wifi_rtt_controller.cpp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+#include "wifi_rtt_controller.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiRttController::WifiRttController(
+ const sp<IWifiIface>& bound_iface,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiRttController::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiRttController::getBoundIface(getBoundIface_cb cb) {
+ cb(bound_iface_);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_rtt_controller.h b/wifi/1.0/default/wifi_rtt_controller.h
new file mode 100644
index 0000000..8d78b93
--- /dev/null
+++ b/wifi/1.0/default/wifi_rtt_controller.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#ifndef WIFI_RTT_CONTROLLER_H_
+#define WIFI_RTT_CONTROLLER_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiIface.h>
+#include <android/hardware/wifi/1.0/IWifiRttController.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control all RTT operations.
+ */
+class WifiRttController : public IWifiRttController {
+ public:
+ WifiRttController(const sp<IWifiIface>& bound_iface,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getBoundIface(getBoundIface_cb cb) override;
+
+ private:
+ sp<IWifiIface> bound_iface_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiRttController);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_RTT_CONTROLLER_H_
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.0/default/wifi_sta_iface.cpp
new file mode 100644
index 0000000..225cec4
--- /dev/null
+++ b/wifi/1.0/default/wifi_sta_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+#include "wifi_sta_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiStaIface::WifiStaIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiStaIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiStaIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiStaIface::getType() {
+ return IfaceType::STA;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_sta_iface.h b/wifi/1.0/default/wifi_sta_iface.h
new file mode 100644
index 0000000..fc5efec
--- /dev/null
+++ b/wifi/1.0/default/wifi_sta_iface.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#ifndef WIFI_STA_IFACE_H_
+#define WIFI_STA_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiStaIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a STA Iface instance.
+ */
+class WifiStaIface : public IWifiStaIface {
+ public:
+ WifiStaIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiStaIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_STA_IFACE_H_
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 49849ea..d9abaef 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -16,6 +16,9 @@
package android.hardware.wifi@1.0;
+/**
+ * List of failure reasons returned.
+ */
enum CommandFailureReason : uint32_t {
UNKNOWN,
DUPLICATE_COMMAND_ID,
@@ -41,6 +44,25 @@
};
/**
+ * List of Iface types supported.
+ */
+enum IfaceType : uint32_t {
+ STA,
+ AP,
+ P2P,
+ /**
+ * NAN control interface. Datapath support may be queried and created
+ * through this interface.
+ */
+ NAN,
+};
+
+/**
+ * An identifier assigned to every chip on the device.
+ */
+typedef uint32_t ChipId;
+
+/**
* An identifier for a mode that the chip can be put in.
*/
typedef uint32_t ChipModeId;