Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d02d408 authored by Kai Shi's avatar Kai Shi
Browse files

Add setDtimMultiplier() and its implementation.

Bug: 259554744
Test: compile
Change-Id: Ifda9d857e7dff83c8163503e62081e39952c53d7
parent 8f0958eb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ interface IWifiStaIface {
  void stopBackgroundScan(in int cmdId);
  void stopRssiMonitoring(in int cmdId);
  void stopSendingKeepAlivePackets(in int cmdId);
  void setDtimMultiplier(in int multiplier);
  @Backing(type="int") @VintfStability
  enum StaIfaceCapabilityMask {
    APF = 1,
+16 −0
Original line number Diff line number Diff line
@@ -552,4 +552,20 @@ interface IWifiStaIface {
     *         |WifiStatusCode.ERROR_UNKNOWN|
     */
    void stopSendingKeepAlivePackets(in int cmdId);

    /**
     * Set DTIM multiplier used when the system is in the suspended mode.
     * When STA is in the power saving mode and system is suspended,
     * the wake up interval will be set to:
     *              1) multiplier * DTIM period if multiplier > 0.
     *              2) the driver default value if multiplier <= 0.
     * Some implementations may apply an additional cap to wake up interval in the case of 1).
     *
     * @param multiplier integer DTIM multiplier value to set.
     * @throws ServiceSpecificException with one of the following values:
     *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
     *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
     *         |WifiStatusCode.ERROR_UNKNOWN|
     */
    void setDtimMultiplier(in int multiplier);
}
+10 −0
Original line number Diff line number Diff line
@@ -222,6 +222,11 @@ ndk::ScopedAStatus WifiStaIface::setScanMode(bool in_enable) {
                           &WifiStaIface::setScanModeInternal, in_enable);
}

ndk::ScopedAStatus WifiStaIface::setDtimMultiplier(int32_t in_multiplier) {
    return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
                           &WifiStaIface::setDtimMultiplierInternal, in_multiplier);
}

std::pair<std::string, ndk::ScopedAStatus> WifiStaIface::getNameInternal() {
    return {ifname_, ndk::ScopedAStatus::ok()};
}
@@ -552,6 +557,11 @@ ndk::ScopedAStatus WifiStaIface::setScanModeInternal(bool enable) {
    return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
}

ndk::ScopedAStatus WifiStaIface::setDtimMultiplierInternal(const int multiplier) {
    legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDtimConfig(ifname_, multiplier);
    return createWifiStatusFromLegacyError(legacy_status);
}

}  // namespace wifi
}  // namespace hardware
}  // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ class WifiStaIface : public BnWifiStaIface {
    ndk::ScopedAStatus setMacAddress(const std::array<uint8_t, 6>& in_mac) override;
    ndk::ScopedAStatus getFactoryMacAddress(std::array<uint8_t, 6>* _aidl_return) override;
    ndk::ScopedAStatus setScanMode(bool in_enable) override;
    ndk::ScopedAStatus setDtimMultiplier(int32_t in_multiplier) override;

  private:
    // Corresponding worker functions for the AIDL methods.
@@ -133,6 +134,7 @@ class WifiStaIface : public BnWifiStaIface {
    ndk::ScopedAStatus setMacAddressInternal(const std::array<uint8_t, 6>& mac);
    std::pair<std::array<uint8_t, 6>, ndk::ScopedAStatus> getFactoryMacAddressInternal();
    ndk::ScopedAStatus setScanModeInternal(bool enable);
    ndk::ScopedAStatus setDtimMultiplierInternal(const int multiplier);

    void setWeakPtr(std::weak_ptr<WifiStaIface> ptr);