From 5443a9fc9b7e7f334cd298aea19741290ad55555 Mon Sep 17 00:00:00 2001 From: Mitchell Wills Date: Thu, 18 Aug 2016 11:44:58 -0700 Subject: [PATCH] Initial pieces of WiFi HAL interface definition Test: make -j48 android.hardware.wifi@1.0 android.hardware.wifi@1.0-java Bug: 31350762 Change-Id: I1b598be397e08165fc9fd607888e064b139e8007 --- wifi/1.0/Android.mk | 241 ++++++++++++++++++++++++++++ wifi/1.0/IWifi.hal | 73 +++++++++ wifi/1.0/IWifiChip.hal | 165 +++++++++++++++++++ wifi/1.0/IWifiChipEventCallback.hal | 68 ++++++++ wifi/1.0/IWifiEventCallback.hal | 48 ++++++ wifi/1.0/types.hal | 46 ++++++ 6 files changed, 641 insertions(+) create mode 100644 wifi/1.0/Android.mk create mode 100644 wifi/1.0/IWifi.hal create mode 100644 wifi/1.0/IWifiChip.hal create mode 100644 wifi/1.0/IWifiChipEventCallback.hal create mode 100644 wifi/1.0/IWifiEventCallback.hal create mode 100644 wifi/1.0/types.hal diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk new file mode 100644 index 0000000000..7d32820435 --- /dev/null +++ b/wifi/1.0/Android.mk @@ -0,0 +1,241 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE := android.hardware.wifi@1.0 +LOCAL_MODULE_CLASS := SHARED_LIBRARIES + +intermediates := $(local-generated-sources-dir) + +HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) + +# +# Build types.hal +# +GEN := $(intermediates)/android/hardware/wifi/1.0/types.cpp +$(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) \ + -Lc++ -randroid.hardware:hardware/interfaces \ + android.hardware.wifi@1.0::types + +$(GEN): $(LOCAL_PATH)/types.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build IWifi.hal +# +GEN := $(intermediates)/android/hardware/wifi/1.0/WifiAll.cpp +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifi.hal +$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChip.hal +$(GEN): $(LOCAL_PATH)/IWifiChip.hal +$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal +$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Lc++ -randroid.hardware:hardware/interfaces \ + android.hardware.wifi@1.0::IWifi + +$(GEN): $(LOCAL_PATH)/IWifi.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build IWifiChip.hal +# +GEN := $(intermediates)/android/hardware/wifi/1.0/WifiChipAll.cpp +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal +$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal +$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.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) \ + -Lc++ -randroid.hardware:hardware/interfaces \ + android.hardware.wifi@1.0::IWifiChip + +$(GEN): $(LOCAL_PATH)/IWifiChip.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build IWifiChipEventCallback.hal +# +GEN := $(intermediates)/android/hardware/wifi/1.0/WifiChipEventCallbackAll.cpp +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChipEventCallback.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) \ + -Lc++ -randroid.hardware:hardware/interfaces \ + android.hardware.wifi@1.0::IWifiChipEventCallback + +$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build IWifiEventCallback.hal +# +GEN := $(intermediates)/android/hardware/wifi/1.0/WifiEventCallbackAll.cpp +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(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) \ + -Lc++ -randroid.hardware:hardware/interfaces \ + android.hardware.wifi@1.0::IWifiEventCallback + +$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates) +LOCAL_SHARED_LIBRARIES := \ + libhidl \ + libhwbinder \ + libutils \ + libcutils \ + +LOCAL_MULTILIB := both +include $(BUILD_SHARED_LIBRARY) + +################################################################################ + +include $(CLEAR_VARS) +LOCAL_MODULE := android.hardware.wifi@1.0-java +LOCAL_MODULE_CLASS := JAVA_LIBRARIES + +intermediates := $(local-generated-sources-dir) + +HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) + +# +# Build types.hal (CommandFailureReason) +# +GEN := $(intermediates)/android/hardware/wifi/1.0/CommandFailureReason.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.CommandFailureReason + +$(GEN): $(LOCAL_PATH)/types.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build types.hal (FailureReason) +# +GEN := $(intermediates)/android/hardware/wifi/1.0/FailureReason.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.FailureReason + +$(GEN): $(LOCAL_PATH)/types.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build IWifi.hal +# +GEN := $(intermediates)/android/hardware/wifi/1.0/IWifi.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifi.hal +$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChip.hal +$(GEN): $(LOCAL_PATH)/IWifiChip.hal +$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal +$(GEN): $(LOCAL_PATH)/IWifiEventCallback.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::IWifi + +$(GEN): $(LOCAL_PATH)/IWifi.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)/IWifiChipEventCallback.hal +$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.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::IWifiChip + +$(GEN): $(LOCAL_PATH)/IWifiChip.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build IWifiChipEventCallback.hal +# +GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiChipEventCallback.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChipEventCallback.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::IWifiChipEventCallback + +$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build IWifiEventCallback.hal +# +GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiEventCallback.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(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) \ + -Ljava -randroid.hardware:hardware/interfaces \ + android.hardware.wifi@1.0::IWifiEventCallback + +$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) +include $(BUILD_JAVA_LIBRARY) diff --git a/wifi/1.0/IWifi.hal b/wifi/1.0/IWifi.hal new file mode 100644 index 0000000000..1feeb2a9f4 --- /dev/null +++ b/wifi/1.0/IWifi.hal @@ -0,0 +1,73 @@ +/* + * 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 IWifiChip; +import IWifiEventCallback; + +/** + * This is the root of the HAL module and is the interface returned when + * loading an implementation of the Wi-Fi HAL. There must be at most one + * module loaded in the system. + */ +interface IWifi { + /** + * Requests notifications of significant events for the HAL. Multiple calls to + * this must register multiple callbacks each of which must receive all + * events. IWifiEventCallback registration must be independent of the state + * of the rest of the HAL and must persist though stops/starts. + */ + @entry + @callflow(next={"*"}) + oneway registerEventCallback(IWifiEventCallback callback); + + /** + * Get the current state of the HAL. + */ + isStarted() generates (bool started); + + /** + * Perform any setup that is required to make use of the module. If the module + * is already started then this must be a noop. The onStart callback must be + * called when the setup completes or if the HAL is already started. If the + * setup fails then onStartFailure must be called. + */ + @entry + @callflow(next={"registerEventCallback", "start", "stop", "getChip"}) + oneway start(); + + /** + * Tear down any state, ongoing commands, etc. If the module is already + * stopped then this must be a noop. If the HAL is already stopped or it + * succeeds then onStop must be called. If the teardown fails onFailure must + * be called. After calling this all IWifiChip objects will be considered + * invalid. + * + * Calling stop then start is a valid way of resetting state in the HAL, + * driver, firmware. + */ + @exit + @callflow(next={"registerEventCallback", "start", "stop"}) + oneway stop(); + + // TODO(b/30570663) return vec instead + /** + * Get the configurable chip on the device. + */ + @callflow(next={"*"}) + getChip() generates (IWifiChip chip); +}; diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal new file mode 100644 index 0000000000..f5fe7a9e82 --- /dev/null +++ b/wifi/1.0/IWifiChip.hal @@ -0,0 +1,165 @@ +/* + * 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 IWifiChipEventCallback; + +/** + * Interface that represents a chip that must be configured as a single unit. + * The HAL/driver/firmware will be responsible for determining which phy is used + * to perform operations like NAN, RTT, etc. + */ +interface IWifiChip { + enum InterfaceType : 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 ChipInterfaceCombination. See + * ChipInterfaceCombination for examples. + */ + struct ChipInterfaceCombinationLimit { + vec types; // Each InterfaceType may occur at most once + uint32_t maxIfaces; + }; + + /** + * Set of interfaces that can operate concurrently when in a given mode. See + * ChipMode below. + * + * For example: + * [{STA} <= 2] + * At most two STA interfaces are supported + * [], [STA], [STA+STA] + * + * [{STA} <= 1, {NAN} <= 1, {AP} <= 1] + * Any combination of STA, NAN, AP + * [], [STA], [NAN], [AP], [STA+NAN], [STA+AP], [NAN+AP], [STA+NAN+AP] + * + * [{STA} <= 1, {NAN,P2P} <= 1] + * Optionally a STA and either NAN or P2P + * [], [STA], [STA+NAN], [STA+P2P], [NAN], [P2P] + * Not included [NAN+P2P], [STA+NAN+P2P] + * + * [{STA} <= 1, {STA,NAN} <= 1] + * Optionally a STA and either a second STA or a NAN + * [], [STA], [STA+NAN], [STA+STA], [NAN] + * Not included [STA+STA+NAN] + */ + struct ChipInterfaceCombination { + vec limits; + }; + + /** + * A mode that the chip can be put in. A mode defines a set of constraints on + * the interfaces that can exist while in that mode. Modes define a unit of + * configuration where all interfaces must be torn down to switch to a + * different mode. Some HALs may only have a single mode, but an example where + * multiple modes would be required is if a chip has different firmwares with + * different capabilities. + * + * When in a mode, it must be possible to perform any combination of creating + * and removing interfaces as long as at least one of the + * ChipInterfaceCombinations is satisfied. This means that if a chip has two + * available combinations, [{STA} <= 1] and [{AP} <= 1] then it is expected + * that exactly one STA interface or one AP interface can be created, but it + * is not expected that both a STA and AP interface could be created. If it + * was then there would be a single available combination + * [{STA} <=1, {AP} <= 1]. + * + * When switching between two available combinations it is expected that + * interfaces only supported by the initial combination will be removed until + * the target combination is also satisfied. At that point new interfaces + * satisfying only the target combination can be added (meaning the initial + * combination limits will no longer satisfied). The addition of these new + * interfaces should not impact the existence of interfaces that satisfy both + * combinations. + * + * For example, a chip with available combinations: + * [{STA} <= 2, {NAN} <=1] and [{STA} <=1, {NAN} <= 1, {AP} <= 1}] + * If the chip currently has 3 interfaces STA, STA and NAN and wants to add an + * AP interface in place of one of the STAs then first one of the STA + * interfaces must be removed and then the AP interface can be created after + * the STA had been torn down. During this process the remaining STA and NAN + * interfaces should not be removed/recreated. + * + * If a chip does not support this kind of reconfiguration in this mode then + * the combinations should be separated into two separate modes. Before + * switching modes all interfaces will be torn down, the mode switch will be + * enacted and when it completes the new interfaces will be brought up. + */ + struct ChipMode { + /** + * Id that can be used to put the chip in this mode. + */ + ChipModeId id; + + /** + * A list of the possible interface combinations that the chip can have + * while in this mode. + */ + vec availableCombinations; + }; + + /** + * Requests notifications of significant events on this chip. Multiple calls + * to this will register multiple callbacks each of which will receive all + * events. + */ + oneway registerEventCallback(IWifiChipEventCallback callback); + + /** + * Get the set of operation modes that the chip supports. + */ + getAvailableModes() generates (vec modes); + + /** + * Reconfigure the Chip. Will trigger onChipReconfigured. + * + * @param modeId The mode that the chip should switch to, corresponding to the + * id property of the target ChipMode. + */ + oneway configureChip(ChipModeId modeId); + + /** + * Get the current mode that the chip is in. + */ + getMode() generates (ChipModeId modeId); + + /** + * Request information about the chip. Will trigger onChipDebugInfoAvailable. + */ + oneway requestChipDebugInfo(); + + /** + * Request vendor debug info from the driver. Will trigger + * onDriverDebugDumpAvailable. + */ + oneway requestDriverDebugDump(); + + /** + * Request vendor debug info from the firmware. Will trigger + * onFirmwareDebugDumpAvailable. + */ + oneway requestFirmwareDebugDump(); +}; diff --git a/wifi/1.0/IWifiChipEventCallback.hal b/wifi/1.0/IWifiChipEventCallback.hal new file mode 100644 index 0000000000..79f6d2a764 --- /dev/null +++ b/wifi/1.0/IWifiChipEventCallback.hal @@ -0,0 +1,68 @@ +/* + * 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 IWifiChipEventCallback { + /** + * Callback indicating that the chip has been reconfigured successfully. At + * this point the interfaces available in the mode must be able to be + * configured. When this is called any previous interface indexes will be + * considered invalid. + * + * @param modeId The mode that the chip switched to, corresponding to the id + * property of the target ChipMode. + */ + oneway onChipReconfigured(ChipModeId modeId); + + /** + * If this happens then the chips is now in an undefined state and + * configureChip must be called again. Any interface indexes will be + * assumed to be invalid. + * + * @param modeId The mode that the chip failed switched to, corresponding to + * the id property of the target ChipMode. + */ + oneway onChipReconfigureFailure(ChipModeId modeId, FailureReason reason); + + /** + * Information about the version of the driver and firmware running this chip. + * + * This information is vendor specific and does not need to take any + * particular format. It will be dumped as part of the bug report. + */ + struct ChipDebugInfo { + string driverDescription; + string firmwareDescription; + }; + + /** + * Callback with debug information about this chip + */ + oneway onChipDebugInfoAvailable(ChipDebugInfo info); + + /** + * Callback with a vendor specific debug blob from the driver. + * This blob will be dumped as part of the bug report. + */ + oneway onDriverDebugDumpAvailable(vec blob); + + /** + * Callback with a vendor specific debug blob from the driver. + * This blob will be dumped as part of the bug report. + */ + oneway onFirmwareDebugDumpAvailable(vec blob); +}; diff --git a/wifi/1.0/IWifiEventCallback.hal b/wifi/1.0/IWifiEventCallback.hal new file mode 100644 index 0000000000..84025cec9f --- /dev/null +++ b/wifi/1.0/IWifiEventCallback.hal @@ -0,0 +1,48 @@ +/* + * 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 IWifiEventCallback { + /** + * Called in response to a call to start indicating that the operation + * completed. After this callback the HAL must be fully operational. + */ + oneway onStart(); + + /** + * Called in response to a call to start indicating that the operation + * failed. After this callback the HAL will be considered stopped. Another + * call to start will attempt to reinitialize the HAL; however, there is a + * chance it may fail again. + */ + oneway onStartFailure(FailureReason reason); + + /** + * Called in response to a call to stop indicating that the operation + * completed. When this event is received all IWifiChip objects retrieved + * after the last call to start will be considered invalid. + */ + oneway onStop(); + + /** + * Called when the Wi-Fi system failed in a way that caused it be disabled. + * Calling start again must restart Wi-Fi as if stop then start was called + * (full state reset). When this event is received all IWifiChip objects + * retrieved after the last call to start will be considered invalid. + */ + oneway onFailure(FailureReason reason); +}; diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal new file mode 100644 index 0000000000..49849eaab7 --- /dev/null +++ b/wifi/1.0/types.hal @@ -0,0 +1,46 @@ +/* + * 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; + +enum CommandFailureReason : uint32_t { + UNKNOWN, + DUPLICATE_COMMAND_ID, + NOT_SUPPORTED, + NOT_AVAILABLE, + INVALID_ARGS, + DRIVER_ERROR_OTHER, + FIRMWARE_ERROR_OTHER, + SCAN_INVALID_CHANNEL +}; + +/** + * Generic structure to return information about a failure. + */ +struct FailureReason { + CommandFailureReason reason; + + /** + * A vendor specific error message from the vendor to provide more + * information beyond the reason code. + */ + string description; +}; + +/** + * An identifier for a mode that the chip can be put in. + */ +typedef uint32_t ChipModeId;