blob: 95fabe465e2187d61e4270680e0bf90428a751a0 [file] [log] [blame]
Roshan Pius3c4e8a32016-10-03 14:53:58 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef WIFI_CHIP_H_
18#define WIFI_CHIP_H_
19
20#include <set>
21
Roshan Pius3c4e8a32016-10-03 14:53:58 -070022#include <android-base/macros.h>
Roshan Pius79a99752016-10-04 13:03:58 -070023#include <android/hardware/wifi/1.0/IWifiChip.h>
Roshan Pius3c4e8a32016-10-03 14:53:58 -070024
Roshan Piusaabe5752016-09-29 09:03:59 -070025#include "wifi_legacy_hal.h"
Roshan Pius3c4e8a32016-10-03 14:53:58 -070026
27namespace android {
28namespace hardware {
29namespace wifi {
Roshan Pius79a99752016-10-04 13:03:58 -070030namespace V1_0 {
31namespace implementation {
Roshan Pius3c4e8a32016-10-03 14:53:58 -070032
Roshan Piusaabe5752016-09-29 09:03:59 -070033/**
34 * HIDL interface object used to control a Wifi HAL chip instance.
35 * Since there is only a single chip instance used today, there is no
36 * identifying handle information stored here.
37 */
Roshan Pius79a99752016-10-04 13:03:58 -070038class WifiChip : public IWifiChip {
Roshan Pius3c4e8a32016-10-03 14:53:58 -070039 public:
Roshan Piusaabe5752016-09-29 09:03:59 -070040 WifiChip(std::weak_ptr<WifiLegacyHal> legacy_hal);
41 // Invalidate this instance once the HAL is stopped.
42 void invalidate();
Roshan Pius3c4e8a32016-10-03 14:53:58 -070043
Roshan Piusaabe5752016-09-29 09:03:59 -070044 // HIDL methods exposed.
Roshan Pius3c4e8a32016-10-03 14:53:58 -070045 Return<void> registerEventCallback(
Roshan Pius79a99752016-10-04 13:03:58 -070046 const sp<IWifiChipEventCallback>& callback) override;
Roshan Pius3c4e8a32016-10-03 14:53:58 -070047 Return<void> getAvailableModes(getAvailableModes_cb cb) override;
Roshan Pius3c4e8a32016-10-03 14:53:58 -070048 Return<void> configureChip(uint32_t mode_id) override;
Roshan Pius3c4e8a32016-10-03 14:53:58 -070049 Return<uint32_t> getMode() override;
Roshan Pius3c4e8a32016-10-03 14:53:58 -070050 Return<void> requestChipDebugInfo() override;
Roshan Pius3c4e8a32016-10-03 14:53:58 -070051 Return<void> requestDriverDebugDump() override;
Roshan Pius3c4e8a32016-10-03 14:53:58 -070052 Return<void> requestFirmwareDebugDump() override;
53
54 private:
Roshan Piusaabe5752016-09-29 09:03:59 -070055 std::weak_ptr<WifiLegacyHal> legacy_hal_;
Roshan Pius79a99752016-10-04 13:03:58 -070056 std::set<sp<IWifiChipEventCallback>> callbacks_;
Roshan Pius3c4e8a32016-10-03 14:53:58 -070057
58 DISALLOW_COPY_AND_ASSIGN(WifiChip);
59};
60
Roshan Pius79a99752016-10-04 13:03:58 -070061} // namespace implementation
62} // namespace V1_0
Roshan Pius3c4e8a32016-10-03 14:53:58 -070063} // namespace wifi
64} // namespace hardware
65} // namespace android
66
67#endif // WIFI_CHIP_H_