Add HAL service implementation for configureMscs
and disableMscs.
Implementation is based on
wpas_ctrl_iface_configure_mscs.
Bug: 318008418
Test: atest VtsHalWifiSupplicantStaIfaceTargetTest
Change-Id: I1ab30ffeefcfd9e988dbf01d6ad7080798cc588e
diff --git a/wpa_supplicant/aidl/sta_iface.cpp b/wpa_supplicant/aidl/sta_iface.cpp
index 99968df..bd196c1 100644
--- a/wpa_supplicant/aidl/sta_iface.cpp
+++ b/wpa_supplicant/aidl/sta_iface.cpp
@@ -2442,10 +2442,45 @@
}
::ndk::ScopedAStatus StaIface::configureMscsInternal(const MscsParams& params) {
+ struct wpa_supplicant *wpa_s = retrieveIfacePtr();
+ struct robust_av_data *robust_av = &wpa_s->robust_av;
+ os_memset(robust_av, 0, sizeof(struct robust_av_data));
+
+ if (params.upLimit < 0 || params.upLimit > 7) {
+ wpa_printf(MSG_ERROR, "Invalid MSCS params - upLimit=%d", params.upLimit);
+ return createStatus(SupplicantStatusCode::FAILURE_ARGS_INVALID);
+ }
+ if (params.streamTimeoutUs < 0 || params.streamTimeoutUs > 60000000 /* 60 sec */) {
+ wpa_printf(MSG_ERROR, "Invalid MSCS params - streamTimeoutUs=%d", params.streamTimeoutUs);
+ return createStatus(SupplicantStatusCode::FAILURE_ARGS_INVALID);
+ }
+
+ robust_av->request_type = SCS_REQ_ADD;
+ robust_av->up_bitmap = params.upBitmap;
+ robust_av->up_limit = params.upLimit;
+ robust_av->stream_timeout = params.streamTimeoutUs;
+ robust_av->frame_classifier[0] = params.frameClassifierMask; // single type-4 frame classifier mask
+ robust_av->frame_classifier_len = 1;
+
+ int status = wpas_send_mscs_req(wpa_s);
+ wpa_printf(MSG_INFO, "MSCS add request status: %d", status);
+
+ // Mark config as invalid to avoid retransmitting automatically.
+ robust_av->valid_config = false;
return ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus StaIface::disableMscsInternal() {
+ struct wpa_supplicant *wpa_s = retrieveIfacePtr();
+ struct robust_av_data *robust_av = &wpa_s->robust_av;
+ os_memset(robust_av, 0, sizeof(struct robust_av_data));
+
+ robust_av->request_type = SCS_REQ_REMOVE;
+ robust_av->valid_config = false;
+
+ int status = wpas_send_mscs_req(wpa_s);
+ wpa_printf(MSG_INFO, "MSCS remove request status: %d", status);
+
return ndk::ScopedAStatus::ok();
}