1.文件路径

/hardware/interfaces/wifi/1.0/IWifi.hal

/** 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| object registration must be independent of the* state of the rest of the HAL and must persist though stops/starts. These* objects must be deleted when the corresponding client process is dead.** @param callback An instance of the |IWifiEventCallback| HIDL interface*        object.* @return status WifiStatus of the operation.*         Possible status codes:*         |WifiStatusCode.SUCCESS|,*         |WifiStatusCode.UNKNOWN|*/@entry@callflow(next={"*"})registerEventCallback(IWifiEventCallback callback)generates (WifiStatus status);/*** Get the current state of the HAL.** @return started true if started, false otherwise.*/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.* Must trigger |IWifiEventCallback.onStart| on success.** @return status WifiStatus of the operation.*         Possible status codes:*         |WifiStatusCode.SUCCESS|,*         |WifiStatusCode.NOT_AVAILABLE|,*         |WifiStatusCode.UNKNOWN|*/@entry@callflow(next={"registerEventCallback", "start", "stop", "getChip"})start() generates (WifiStatus status);/*** 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. After calling this all IWifiChip* objects will be considered invalid.* Must trigger |IWifiEventCallback.onStop| on success.* Must trigger |IWifiEventCallback.onFailure| on failure.** Calling stop then start is a valid way of resetting state in the HAL,* driver, firmware.** @return status WifiStatus of the operation.*         Possible status codes:*         |WifiStatusCode.SUCCESS|,*         |WifiStatusCode.NOT_STARTED|,*         |WifiStatusCode.UNKNOWN|*/@exit@callflow(next={"registerEventCallback", "start", "stop"})stop() generates (WifiStatus status);/*** 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 status WifiStatus of the operation.*         Possible status codes:*         |WifiStatusCode.SUCCESS|,*         |WifiStatusCode.NOT_STARTED|,*         |WifiStatusCode.UNKNOWN|* @return chipIds List of all chip Id's on the device.*/@callflow(next={"*"})getChipIds() generates (WifiStatus status, vec<ChipId> chipIds);/*** Gets a HIDL interface object for the chip corresponding to the* provided chipId.** @return status WifiStatus of the operation.*         Possible status codes:*         |WifiStatusCode.SUCCESS|,*         |WifiStatusCode.NOT_STARTED|,*         |WifiStatusCode.UNKNOWN|* @return chip HIDL interface object representing the chip.*/@callflow(next={"*"})getChip(ChipId chipId) generates (WifiStatus status, IWifiChip chip);
};

看起来也挺简单的,就是定义了一些未实现的接口,和接口定义差不多。

2.对应Android.bp文件

// This file is autogenerated by hidl-gen. Do not edit manually.filegroup {name: "android.hardware.wifi@1.0_hal",srcs: ["types.hal","IWifi.hal","IWifiApIface.hal","IWifiChip.hal","IWifiChipEventCallback.hal","IWifiEventCallback.hal","IWifiIface.hal","IWifiNanIface.hal","IWifiNanIfaceEventCallback.hal","IWifiP2pIface.hal","IWifiRttController.hal","IWifiRttControllerEventCallback.hal","IWifiStaIface.hal","IWifiStaIfaceEventCallback.hal",],
}genrule {name: "android.hardware.wifi@1.0_genc++",tools: ["hidl-gen"],cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.0",srcs: [":android.hardware.wifi@1.0_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/WifiNanIfaceEventCallbackAll.cpp","android/hardware/wifi/1.0/WifiP2pIfaceAll.cpp","android/hardware/wifi/1.0/WifiRttControllerAll.cpp","android/hardware/wifi/1.0/WifiRttControllerEventCallbackAll.cpp","android/hardware/wifi/1.0/WifiStaIfaceAll.cpp","android/hardware/wifi/1.0/WifiStaIfaceEventCallbackAll.cpp",],
}genrule {name: "android.hardware.wifi@1.0_genc++_headers",tools: ["hidl-gen"],cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.0",srcs: [":android.hardware.wifi@1.0_hal",],out: ["android/hardware/wifi/1.0/types.h","android/hardware/wifi/1.0/hwtypes.h","android/hardware/wifi/1.0/IWifi.h","android/hardware/wifi/1.0/IHwWifi.h","android/hardware/wifi/1.0/BnHwWifi.h","android/hardware/wifi/1.0/BpHwWifi.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/BnHwWifiApIface.h","android/hardware/wifi/1.0/BpHwWifiApIface.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/BnHwWifiChip.h","android/hardware/wifi/1.0/BpHwWifiChip.h","android/hardware/wifi/1.0/BsWifiChip.h","android/hardware/wifi/1.0/IWifiChipEventCallback.h","android/hardware/wifi/1.0/IHwWifiChipEventCallback.h","android/hardware/wifi/1.0/BnHwWifiChipEventCallback.h","android/hardware/wifi/1.0/BpHwWifiChipEventCallback.h","android/hardware/wifi/1.0/BsWifiChipEventCallback.h","android/hardware/wifi/1.0/IWifiEventCallback.h","android/hardware/wifi/1.0/IHwWifiEventCallback.h","android/hardware/wifi/1.0/BnHwWifiEventCallback.h","android/hardware/wifi/1.0/BpHwWifiEventCallback.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/BnHwWifiIface.h","android/hardware/wifi/1.0/BpHwWifiIface.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/BnHwWifiNanIface.h","android/hardware/wifi/1.0/BpHwWifiNanIface.h","android/hardware/wifi/1.0/BsWifiNanIface.h","android/hardware/wifi/1.0/IWifiNanIfaceEventCallback.h","android/hardware/wifi/1.0/IHwWifiNanIfaceEventCallback.h","android/hardware/wifi/1.0/BnHwWifiNanIfaceEventCallback.h","android/hardware/wifi/1.0/BpHwWifiNanIfaceEventCallback.h","android/hardware/wifi/1.0/BsWifiNanIfaceEventCallback.h","android/hardware/wifi/1.0/IWifiP2pIface.h","android/hardware/wifi/1.0/IHwWifiP2pIface.h","android/hardware/wifi/1.0/BnHwWifiP2pIface.h","android/hardware/wifi/1.0/BpHwWifiP2pIface.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/BnHwWifiRttController.h","android/hardware/wifi/1.0/BpHwWifiRttController.h","android/hardware/wifi/1.0/BsWifiRttController.h","android/hardware/wifi/1.0/IWifiRttControllerEventCallback.h","android/hardware/wifi/1.0/IHwWifiRttControllerEventCallback.h","android/hardware/wifi/1.0/BnHwWifiRttControllerEventCallback.h","android/hardware/wifi/1.0/BpHwWifiRttControllerEventCallback.h","android/hardware/wifi/1.0/BsWifiRttControllerEventCallback.h","android/hardware/wifi/1.0/IWifiStaIface.h","android/hardware/wifi/1.0/IHwWifiStaIface.h","android/hardware/wifi/1.0/BnHwWifiStaIface.h","android/hardware/wifi/1.0/BpHwWifiStaIface.h","android/hardware/wifi/1.0/BsWifiStaIface.h","android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h","android/hardware/wifi/1.0/IHwWifiStaIfaceEventCallback.h","android/hardware/wifi/1.0/BnHwWifiStaIfaceEventCallback.h","android/hardware/wifi/1.0/BpHwWifiStaIfaceEventCallback.h","android/hardware/wifi/1.0/BsWifiStaIfaceEventCallback.h",],
}cc_library {name: "android.hardware.wifi@1.0",defaults: ["hidl-module-defaults"],generated_sources: ["android.hardware.wifi@1.0_genc++"],generated_headers: ["android.hardware.wifi@1.0_genc++_headers"],export_generated_headers: ["android.hardware.wifi@1.0_genc++_headers"],vendor_available: true,vndk: {enabled: true,},shared_libs: ["libhidlbase","libhidltransport","libhwbinder","liblog","libutils","libcutils",],export_shared_lib_headers: ["libhidlbase","libhidltransport","libhwbinder","libutils",],
}

简单地看下这个Android.bp文件:

filegroup-"android.hardware.wifi@1.0_hal":包含了该目录下所有的hal文件

genrule-"android.hardware.wifi@1.0_genc++":使用上面的filegroup作为src编译出对应的cpp文件

genrule-"android.hardware.wifi@1.0_genc++_headers":使用上面的filegroup作为src编译出对应的.h文件

之后下面的抬头“android.hardware.wifi@1.0”经常看到,调用到wifi hal的都会声明到这个。

cc_library {name: "android.hardware.wifi@1.0",defaults: ["hidl-module-defaults"],generated_sources: ["android.hardware.wifi@1.0_genc++"],generated_headers: ["android.hardware.wifi@1.0_genc++_headers"],export_generated_headers: ["android.hardware.wifi@1.0_genc++_headers"],vendor_available: true,vndk: {enabled: true,},shared_libs: ["libhidlbase","libhidltransport","libhwbinder","liblog","libutils","libcutils",],export_shared_lib_headers: ["libhidlbase","libhidltransport","libhwbinder","libutils",],
}

2.1 hidl-gen

注意到Android.bp文件中有如下命令是可以生成对应资源的,试一试。

cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.0"

先期准备

1)source build/envsetup.sh2)lunch3)make hidl-gen -j4//[100% 460/460] Install: out/host/linux-x86/bin/hidl-gen

2.1.1 生成c++-sources

cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.0"

2.1.2 生成c++-headers

cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.0"

2.1.3 生成Android.bp

cmd: "$(location hidl-gen) -o $(genDir) -Landroidbp -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.0"

生成的Android.bp文件是和之前一摸一样的。

2.1.4 生成Android.mk

2.1.5 生成androidbp-impl

hidl-gen -o ./test_hidl_wifi/ -Landroidbp-impl -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.0

cc_library_shared {name: "android.hardware.wifi@1.0-impl",relative_install_path: "hw",proprietary: true,srcs: ["Wifi.cpp","WifiApIface.cpp","WifiChip.cpp","WifiChipEventCallback.cpp","WifiEventCallback.cpp","WifiIface.cpp","WifiNanIface.cpp","WifiNanIfaceEventCallback.cpp","WifiP2pIface.cpp","WifiRttController.cpp","WifiRttControllerEventCallback.cpp","WifiStaIface.cpp","WifiStaIfaceEventCallback.cpp",],shared_libs: ["libhidlbase","libhidltransport","libutils","android.hardware.wifi@1.0",],
}

2.1.6 生成c++-impl

生成HIDL的默认实现。

看下Wifi.h和Wifi.cpp

#ifndef ANDROID_HARDWARE_WIFI_V1_0_WIFI_H
#define ANDROID_HARDWARE_WIFI_V1_0_WIFI_H#include <android/hardware/wifi/1.0/IWifi.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>namespace android {
namespace hardware {
namespace wifi {
namespace V1_0 {
namespace implementation {using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;struct Wifi : public IWifi {// Methods from IWifi follow.Return<void> registerEventCallback(const sp<IWifiEventCallback>& callback, registerEventCallback_cb _hidl_cb) override;Return<bool> isStarted() override;Return<void> start(start_cb _hidl_cb) override;Return<void> stop(stop_cb _hidl_cb) override;Return<void> getChipIds(getChipIds_cb _hidl_cb) override;Return<void> getChip(uint32_t chipId, getChip_cb _hidl_cb) override;// Methods from ::android::hidl::base::V1_0::IBase follow.};// FIXME: most likely delete, this is only for passthrough implementations
// extern "C" IWifi* HIDL_FETCH_IWifi(const char* name);}  // namespace implementation
}  // namespace V1_0
}  // namespace wifi
}  // namespace hardware
}  // namespace android#endif  // ANDROID_HARDWARE_WIFI_V1_0_WIFI_H
#include "Wifi.h"namespace android {
namespace hardware {
namespace wifi {
namespace V1_0 {
namespace implementation {// Methods from IWifi follow.
Return<void> Wifi::registerEventCallback(const sp<IWifiEventCallback>& callback, registerEventCallback_cb _hidl_cb) {// TODO implementreturn Void();
}Return<bool> Wifi::isStarted() {// TODO implementreturn bool {};
}Return<void> Wifi::start(start_cb _hidl_cb) {// TODO implementreturn Void();
}Return<void> Wifi::stop(stop_cb _hidl_cb) {// TODO implementreturn Void();
}Return<void> Wifi::getChipIds(getChipIds_cb _hidl_cb) {// TODO implementreturn Void();
}Return<void> Wifi::getChip(uint32_t chipId, getChip_cb _hidl_cb) {// TODO implementreturn Void();
}// Methods from ::android::hidl::base::V1_0::IBase follow.//IWifi* HIDL_FETCH_IWifi(const char* /* name */) {
//    return new Wifi();
//}}  // namespace implementation
}  // namespace V1_0
}  // namespace wifi
}  // namespace hardware
}  // namespace android

都是空实现,结合hidl是framework和vendor的桥梁,所以实现应该是由vendor实现的?1.1的wifi hal版本中有默认的实现。

/** 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 <android-base/logging.h>#include "hidl_return_util.h"
#include "wifi.h"
#include "wifi_status_util.h"namespace {
// Chip ID to use for the only supported chip.
static constexpr android::hardware::wifi::V1_0::ChipId kChipId = 0;
}  // namespacenamespace android {
namespace hardware {
namespace wifi {
namespace V1_1 {
namespace implementation {
using hidl_return_util::validateAndCall;
using hidl_return_util::validateAndCallWithLock;Wifi::Wifi(): legacy_hal_(new legacy_hal::WifiLegacyHal()),mode_controller_(new mode_controller::WifiModeController()),run_state_(RunState::STOPPED) {}bool Wifi::isValid() {// This object is always valid.return true;
}Return<void> Wifi::registerEventCallback(const sp<IWifiEventCallback>& event_callback,registerEventCallback_cb hidl_status_cb) {return validateAndCall(this,WifiStatusCode::ERROR_UNKNOWN,&Wifi::registerEventCallbackInternal,hidl_status_cb,event_callback);
}Return<bool> Wifi::isStarted() {return run_state_ != RunState::STOPPED;
}Return<void> Wifi::start(start_cb hidl_status_cb) {return validateAndCall(this,WifiStatusCode::ERROR_UNKNOWN,&Wifi::startInternal,hidl_status_cb);
}Return<void> Wifi::stop(stop_cb hidl_status_cb) {return validateAndCallWithLock(this, WifiStatusCode::ERROR_UNKNOWN,&Wifi::stopInternal, hidl_status_cb);
}Return<void> Wifi::getChipIds(getChipIds_cb hidl_status_cb) {return validateAndCall(this,WifiStatusCode::ERROR_UNKNOWN,&Wifi::getChipIdsInternal,hidl_status_cb);
}Return<void> Wifi::getChip(ChipId chip_id, getChip_cb hidl_status_cb) {return validateAndCall(this,WifiStatusCode::ERROR_UNKNOWN,&Wifi::getChipInternal,hidl_status_cb,chip_id);
}WifiStatus Wifi::registerEventCallbackInternal(const sp<IWifiEventCallback>& event_callback) {if (!event_cb_handler_.addCallback(event_callback)) {return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);}return createWifiStatus(WifiStatusCode::SUCCESS);
}WifiStatus Wifi::startInternal() {if (run_state_ == RunState::STARTED) {return createWifiStatus(WifiStatusCode::SUCCESS);} else if (run_state_ == RunState::STOPPING) {return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE,"HAL is stopping");}WifiStatus wifi_status = initializeLegacyHal();if (wifi_status.code == WifiStatusCode::SUCCESS) {// Create the chip instance once the HAL is started.chip_ = new WifiChip(kChipId, legacy_hal_, mode_controller_);run_state_ = RunState::STARTED;for (const auto& callback : event_cb_handler_.getCallbacks()) {if (!callback->onStart().isOk()) {LOG(ERROR) << "Failed to invoke onStart callback";};}LOG(INFO) << "Wifi HAL started";} else {for (const auto& callback : event_cb_handler_.getCallbacks()) {if (!callback->onFailure(wifi_status).isOk()) {LOG(ERROR) << "Failed to invoke onFailure callback";}}LOG(ERROR) << "Wifi HAL start failed";}return wifi_status;
}WifiStatus Wifi::stopInternal(/* NONNULL */ std::unique_lock<std::recursive_mutex>* lock) {if (run_state_ == RunState::STOPPED) {return createWifiStatus(WifiStatusCode::SUCCESS);} else if (run_state_ == RunState::STOPPING) {return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE,"HAL is stopping");}// Clear the chip object and its child objects since the HAL is now// stopped.if (chip_.get()) {chip_->invalidate();chip_.clear();}WifiStatus wifi_status = stopLegacyHalAndDeinitializeModeController(lock);if (wifi_status.code == WifiStatusCode::SUCCESS) {for (const auto& callback : event_cb_handler_.getCallbacks()) {if (!callback->onStop().isOk()) {LOG(ERROR) << "Failed to invoke onStop callback";};}LOG(INFO) << "Wifi HAL stopped";} else {for (const auto& callback : event_cb_handler_.getCallbacks()) {if (!callback->onFailure(wifi_status).isOk()) {LOG(ERROR) << "Failed to invoke onFailure callback";}}LOG(ERROR) << "Wifi HAL stop failed";}return wifi_status;
}std::pair<WifiStatus, std::vector<ChipId>> Wifi::getChipIdsInternal() {std::vector<ChipId> chip_ids;if (chip_.get()) {chip_ids.emplace_back(kChipId);}return {createWifiStatus(WifiStatusCode::SUCCESS), std::move(chip_ids)};
}std::pair<WifiStatus, sp<IWifiChip>> Wifi::getChipInternal(ChipId chip_id) {if (!chip_.get()) {return {createWifiStatus(WifiStatusCode::ERROR_NOT_STARTED), nullptr};}if (chip_id != kChipId) {return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};}return {createWifiStatus(WifiStatusCode::SUCCESS), chip_};
}WifiStatus Wifi::initializeLegacyHal() {legacy_hal::wifi_error legacy_status = legacy_hal_->initialize();if (legacy_status != legacy_hal::WIFI_SUCCESS) {LOG(ERROR) << "Failed to initialize legacy HAL: "<< legacyErrorToString(legacy_status);return createWifiStatusFromLegacyError(legacy_status);}return createWifiStatus(WifiStatusCode::SUCCESS);
}WifiStatus Wifi::stopLegacyHalAndDeinitializeModeController(/* NONNULL */ std::unique_lock<std::recursive_mutex>* lock) {run_state_ = RunState::STOPPING;legacy_hal::wifi_error legacy_status =legacy_hal_->stop(lock, [&]() { run_state_ = RunState::STOPPED; });if (legacy_status != legacy_hal::WIFI_SUCCESS) {LOG(ERROR) << "Failed to stop legacy HAL: "<< legacyErrorToString(legacy_status);return createWifiStatusFromLegacyError(legacy_status);}if (!mode_controller_->deinitialize()) {LOG(ERROR) << "Failed to deinitialize firmware mode controller";return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);}return createWifiStatus(WifiStatusCode::SUCCESS);
}
}  // namespace implementation
}  // namespace V1_1
}  // namespace wifi
}  // namespace hardware
}  // namespace android

2.1.7 生成hash

/aosp/android_aosp/hardware/interfaces$ vim current.txt

默认与WiFi相关的hash如下所示:

b9be36719a8ad534000a51ea07be91be94c405bf1e038ae825acf65087ffd378 android.hardware.wifi@1.0::IWifi
ee0224ee18813506d9d6f13d8c8e4679f053c290a443a52a7c52a5d3c852262b android.hardware.wifi@1.0::IWifiApIface
f3eecc489deb4c74892f59eb7adb769063bd5c354ac132b626a5f42b363d36bc android.hardware.wifi@1.0::IWifiChip
a1b988377645a58e5e2542ca2bad4e17c21a4a389213d05de2f0e32d57b7d339 android.hardware.wifi@1.0::IWifiChipEventCallback
5ed6760ce77e84bc6c49d1acb3f7d8117c9176b3f06514bc44ad3af84c80dcfe android.hardware.wifi@1.0::IWifiEventCallback
6b9ad43a5efbe6ca214f751e22ce43cf5cd4d5d5f2cba80f24ccd3755a72401c android.hardware.wifi@1.0::IWifiIface
ba5aa74f1ba714f0093864227923492808795bda6199c4ea0891322d27f8c931 android.hardware.wifi@1.0::IWifiNanIface
325c94f3e1a565b56bbc74faddbd0ba7cb824f263dccf9dfff2daf62b86ed774 android.hardware.wifi@1.0::IWifiNanIfaceEventCallback
c2c3f0372b41780fb6dfe83c022296806c2024d7046682fd201de5aa9b791c7a android.hardware.wifi@1.0::IWifiP2pIface
766e9765f5c9c759b2a763c2288353fb5deff3389c2cc28f81d79c939704ce8b android.hardware.wifi@1.0::IWifiRttController
72ab6f3e120cbf07aa6f8e87ca89112bdeb36b7fbb96bce5af3712323ab8b8e6 android.hardware.wifi@1.0::IWifiRttControllerEventCallback
3b8093d39ef1e10e43c5538afbf5ff6e39b8d8168ebbe1998d993e89e25f14a5 android.hardware.wifi@1.0::IWifiStaIface
7fbfc551c3e23c8b4398c3e16e452b516457e6921424a53474cbf373ca306fa9 android.hardware.wifi@1.0::IWifiStaIfaceEventCallback
e20d5132d6d23e072c15de065b5e2aa13ff965031246a2c82581732bae56bf6d android.hardware.wifi@1.0::types
f7e55c08187d8c855068a1ee3d0c8daeee7570292d96509c21a8756d4f5cfb9b android.hardware.wifi.supplicant@1.0::ISupplicant
56b5c7267cb3d3337f44eb8b0b38ff4c6260dcc70e07687fcab94b1ccea8d159 android.hardware.wifi.supplicant@1.0::ISupplicantCallback
35ba7bcdf18f24a866a7e5429548f06768bb20a257f75b10a397c4d825ef8438 android.hardware.wifi.supplicant@1.0::ISupplicantIface
cda01008c06922fa37c1213e9bb831a109b3174532805616fb7161edc403866f android.hardware.wifi.supplicant@1.0::ISupplicantNetwork
4907410338c5e8dbeec4b5edc2608ea323f5561945f8810af81810c47b019184 android.hardware.wifi.supplicant@1.0::ISupplicantP2pIface
8b63f5efa2e3be3a7cb8a428760d82285a4ab79bcbdea6ef90aa547555e582d4 android.hardware.wifi.supplicant@1.0::ISupplicantP2pIfaceCallback
56128f74560571b6777d59453f35c6b35693ee377e2a23c807708906928f09de android.hardware.wifi.supplicant@1.0::ISupplicantP2pNetwork
2067c22197bca9743dab66a6f561a8a8375c67b4f76aed05f776839499bd4c8f android.hardware.wifi.supplicant@1.0::ISupplicantP2pNetworkCallback
7752e1de93aaf5fed37011c219ac247069f6af320b0810daa98510584a10e7b4 android.hardware.wifi.supplicant@1.0::ISupplicantStaIface
d781c8d7e7b3fe5cca8cf6e1d8806e770982ae5358c7816ed51b0f0ec272e70d android.hardware.wifi.supplicant@1.0::ISupplicantStaIfaceCallback
b12ef0bdd8a4d247a8a6e960b227ed32383f2b0241f55d67fcea6eff6a6737fa android.hardware.wifi.supplicant@1.0::ISupplicantStaNetwork
d8f0877ae1d321c1d884c7631dfe36cab0ec8a4b2863d4b687f85d3549a63bcc android.hardware.wifi.supplicant@1.0::ISupplicantStaNetworkCallback
fe3c3c2f572b72f15f8594c538b0577bd5c28722c31879cfe6231330cddb6747 android.hardware.wifi.supplicant@1.0::types

试下如何生成:

对比下hidl-gen生成的和原来的IWifi是否一样:

原来:

b9be36719a8ad534000a51ea07be91be94c405bf1e038ae825acf65087ffd378 android.hardware.wifi@1.0::IWifi

现在:

b9be36719a8ad534000a51ea07be91be94c405bf1e038ae825acf65087ffd378 android.hardware.wifi@1.0::IWifi

啊哈,一样的,没毛病。

也可以加::制定具体hidl接口生成hash

3. 注册服务

1.1/default/service.cpp

/** 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 <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#include <utils/Looper.h>
#include <utils/StrongPointer.h>#include "wifi.h"using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;int main(int /*argc*/, char** argv) {android::base::InitLogging(argv,android::base::LogdLogger(android::base::SYSTEM));LOG(INFO) << "Wifi Hal is booting up...";configureRpcThreadpool(1, true /* callerWillJoin */);// Setup hwbinder serviceandroid::sp<android::hardware::wifi::V1_1::IWifi> service =new android::hardware::wifi::V1_1::implementation::Wifi();CHECK_EQ(service->registerAsService(), android::NO_ERROR)<< "Failed to register wifi HAL";joinRpcThreadpool();LOG(INFO) << "Wifi Hal is terminating...";return 0;
}

(八十一)探索hidl-gen使用及IWifi.hal 实现相关推荐

  1. 孤荷凌寒自学python第八十一天学习爬取图片1

    孤荷凌寒自学python第八十一天学习爬取图片1 (完整学习过程屏幕记录视频地址在文末) 通过前面十天的学习,我已经基本了解了通过requests模块来与网站服务器进行交互的方法,也知道了Beauti ...

  2. 《老子》第八十一章 信言不美,美言不信

    第八十一章 信言不美,美言不信 信言不美[1],美言不信[2].善者不辩[3],辩者不善[4].知者不博[5],博者不知[6].圣人无积[7],既以为人己愈有[8],既以与人己愈多[9].天之道,利而 ...

  3. 八十一、Python | Leetcode 二叉树系列(下篇)

    @Author:Runsen @Date:2020/7/6 人生最重要的不是所站的位置,而是内心所朝的方向.只要我在每篇博文中写得自己体会,修炼身心:在每天的不断重复学习中,耐住寂寞,练就真功,不畏艰 ...

  4. 那些读博的女生,怎样通过“九九八十一关”?

    博士.女博士--常常成为新闻报道的主角.但现在,"博士光环"之外,越来越多的人开始了解博士真实的生态,包括延迟毕业时的焦虑,择业就业时的迷惘. 都说读博很苦,女博士们究竟是怎样通过 ...

  5. JavaScript学习(八十一)—将多维数组转化为一维数组

    JavaScript学习(八十一)-将多维数组转化为一维数组

  6. 第三百八十一节,Django+Xadmin打造上线标准的在线教育平台—xadmin全局配置

    第三百八十一节,Django+Xadmin打造上线标准的在线教育平台-xadmin全局配置 1.xadmin主题设置 要使用xadmin主题,需要在一个app下的adminx.py后台注册文件里,写一 ...

  7. DockOne微信分享(八十一):唯品会数据库备份恢复容器化项目实践经验总结

    本文讲的是DockOne微信分享(八十一):唯品会数据库备份恢复容器化项目实践经验总结[编者的话]本文分享了唯品会数据库Docker的异地容灾项目实践经验,项目中针对用户数据库的异地恢复场景的需求进行 ...

  8. 从西天取经的九九八十一难来看Java设计模式:模板方法模式

    模板方法模式 示例 模板方法模式 定义 意图 主要解决问题 适用场景 优缺点 西天取经的九九八十一难 示例 当我们设计一个类时,我们能明确它对外提供的某个方法的内部执行步骤, 但一些步骤,不同的子类有 ...

  9. 1790: 九九八十一

    题目描述 西天經萬卷,東土遣高僧. 山下頑猴烈,鷹澗降飛龍. 高老收八戒,沙河白馬驚. 妖魔俱若渴,此路怎安寧. 九九何多苦,經途難寸行. 終歸劫歷盡,塵世也成空. 唐僧师徒领了如来佛祖法旨,西天取经 ...

最新文章

  1. 妙用QTP F1帮助功能
  2. TYVJ1415 差分约束
  3. 通过maven命令将源代码编译成jar到本地仓库
  4. 老平台已死,整理个文档留下做纪念
  5. nyoj117求逆序数 并归排序法
  6. ping 监控网络延时
  7. 中国顶级互联网公司的技术组织架构调整预示着什么?【强烈推荐行业人士阅读】
  8. F - GCD or MIN(数论)
  9. 源三:聊聊注册中心在蚂蚁集团的降本提效之路
  10. c语言node类型_高阶宏的妙用技法,C语言宏你所不知道的聪明技巧
  11. Git:查看所有远程分支以及同步远程代码
  12. 震惊!99%的网络工程师都不知道的组播问题
  13. jquery插件 validation表单的验证的应用的一个例子
  14. arm板上简单运行main.cpp
  15. 对JavaWeb项目中WEB-INF目录的理解
  16. 基于BERT做中文文本分类(情感分析)
  17. 【问题处理】Word修改页边距后,目录没有右对齐
  18. 威佐夫博弈 poj 1067
  19. 工程伦理(2021春)第二章课后习题答案
  20. 离线状态下配置深度学习服务器-在ubuntu16.04 上安装python,pip以及包

热门文章

  1. 中国大学moocpython答案查询_中国大学MOOC(慕课)_Python编程基础_mooc题库答案查询...
  2. Unity3D|Animation:动画位置与对象位置不一致如何改正
  3. 利用阿里云容器镜像服务下载gcr.io镜像
  4. 帆软日期格式转换_自定义函数把阳历转换成阴历
  5. vue 全屏背景图片 别看其他的了看我这篇就解决了!
  6. 基于STM32cubemx的stm32f107vct6代码生成教程,实验一led闪烁
  7. 小M哥安卓5期视频教程(基础+就业)
  8. 【Datawhale组队学习】机器学习数学基础 - 一元函数微分学的几何应用【Task 04】
  9. 第14节 三个败家子(14)——在辉煌中走向深渊
  10. \t\t最近两周访问来源统计