/* * 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 #include #include #include "hidl_callback_util.h" #include "wifi_iface_util.h" #include "wifi_legacy_hal.h" namespace android { namespace hardware { namespace wifi { namespace V1_3 { namespace implementation { using namespace android::hardware::wifi::V1_0; /** * HIDL interface object used to control a STA Iface instance. */ class WifiStaIface : public V1_3::IWifiStaIface { public: WifiStaIface(const std::string& ifname, const std::weak_ptr legacy_hal, const std::weak_ptr iface_util); // Refer to |WifiChip::invalidate()|. void invalidate(); bool isValid(); std::set> getEventCallbacks(); std::string getName(); // HIDL methods exposed. Return getName(getName_cb hidl_status_cb) override; Return getType(getType_cb hidl_status_cb) override; Return registerEventCallback( const sp& callback, registerEventCallback_cb hidl_status_cb) override; Return getCapabilities(getCapabilities_cb hidl_status_cb) override; Return getApfPacketFilterCapabilities( getApfPacketFilterCapabilities_cb hidl_status_cb) override; Return installApfPacketFilter( uint32_t cmd_id, const hidl_vec& program, installApfPacketFilter_cb hidl_status_cb) override; Return readApfPacketFilterData( readApfPacketFilterData_cb hidl_status_cb) override; Return getBackgroundScanCapabilities( getBackgroundScanCapabilities_cb hidl_status_cb) override; Return getValidFrequenciesForBand( WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) override; Return startBackgroundScan( uint32_t cmd_id, const StaBackgroundScanParameters& params, startBackgroundScan_cb hidl_status_cb) override; Return stopBackgroundScan( uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) override; Return enableLinkLayerStatsCollection( bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) override; Return disableLinkLayerStatsCollection( disableLinkLayerStatsCollection_cb hidl_status_cb) override; Return getLinkLayerStats( getLinkLayerStats_cb hidl_status_cb) override; Return getLinkLayerStats_1_3( getLinkLayerStats_1_3_cb hidl_status_cb) override; Return startRssiMonitoring( uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi, startRssiMonitoring_cb hidl_status_cb) override; Return stopRssiMonitoring( uint32_t cmd_id, stopRssiMonitoring_cb hidl_status_cb) override; Return getRoamingCapabilities( getRoamingCapabilities_cb hidl_status_cb) override; Return configureRoaming(const StaRoamingConfig& config, configureRoaming_cb hidl_status_cb) override; Return setRoamingState(StaRoamingState state, setRoamingState_cb hidl_status_cb) override; Return enableNdOffload(bool enable, enableNdOffload_cb hidl_status_cb) override; Return startSendingKeepAlivePackets( uint32_t cmd_id, const hidl_vec& ip_packet_data, uint16_t ether_type, const hidl_array& src_address, const hidl_array& dst_address, uint32_t period_in_ms, startSendingKeepAlivePackets_cb hidl_status_cb) override; Return stopSendingKeepAlivePackets( uint32_t cmd_id, stopSendingKeepAlivePackets_cb hidl_status_cb) override; Return setScanningMacOui( const hidl_array& oui, setScanningMacOui_cb hidl_status_cb) override; Return startDebugPacketFateMonitoring( startDebugPacketFateMonitoring_cb hidl_status_cb) override; Return getDebugTxPacketFates( getDebugTxPacketFates_cb hidl_status_cb) override; Return getDebugRxPacketFates( getDebugRxPacketFates_cb hidl_status_cb) override; Return setMacAddress(const hidl_array& mac, setMacAddress_cb hidl_status_cb) override; Return getFactoryMacAddress( getFactoryMacAddress_cb hidl_status_cb) override; private: // Corresponding worker functions for the HIDL methods. std::pair getNameInternal(); std::pair getTypeInternal(); WifiStatus registerEventCallbackInternal( const sp& callback); std::pair getCapabilitiesInternal(); std::pair getApfPacketFilterCapabilitiesInternal(); WifiStatus installApfPacketFilterInternal( uint32_t cmd_id, const std::vector& program); std::pair> readApfPacketFilterDataInternal(); std::pair getBackgroundScanCapabilitiesInternal(); std::pair> getValidFrequenciesForBandInternal(WifiBand band); WifiStatus startBackgroundScanInternal( uint32_t cmd_id, const StaBackgroundScanParameters& params); WifiStatus stopBackgroundScanInternal(uint32_t cmd_id); WifiStatus enableLinkLayerStatsCollectionInternal(bool debug); WifiStatus disableLinkLayerStatsCollectionInternal(); std::pair getLinkLayerStatsInternal(); std::pair getLinkLayerStatsInternal_1_3(); WifiStatus startRssiMonitoringInternal(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi); WifiStatus stopRssiMonitoringInternal(uint32_t cmd_id); std::pair getRoamingCapabilitiesInternal(); WifiStatus configureRoamingInternal(const StaRoamingConfig& config); WifiStatus setRoamingStateInternal(StaRoamingState state); WifiStatus enableNdOffloadInternal(bool enable); WifiStatus startSendingKeepAlivePacketsInternal( uint32_t cmd_id, const std::vector& ip_packet_data, uint16_t ether_type, const std::array& src_address, const std::array& dst_address, uint32_t period_in_ms); WifiStatus stopSendingKeepAlivePacketsInternal(uint32_t cmd_id); WifiStatus setScanningMacOuiInternal(const std::array& oui); WifiStatus startDebugPacketFateMonitoringInternal(); std::pair> getDebugTxPacketFatesInternal(); std::pair> getDebugRxPacketFatesInternal(); WifiStatus setMacAddressInternal(const std::array& mac); std::pair> getFactoryMacAddressInternal(); std::string ifname_; std::weak_ptr legacy_hal_; std::weak_ptr iface_util_; bool is_valid_; hidl_callback_util::HidlCallbackHandler event_cb_handler_; DISALLOW_COPY_AND_ASSIGN(WifiStaIface); }; } // namespace implementation } // namespace V1_3 } // namespace wifi } // namespace hardware } // namespace android #endif // WIFI_STA_IFACE_H_