diff options
author | Nate(Qiang) Jiang <qiangjiang@google.com> | 2022-01-26 07:00:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-01-26 07:00:04 +0000 |
commit | ab62fa679b5a4f5ce21b7ceef4e56f3180b2866a (patch) | |
tree | c32b2c2d7ad8b168f4b141503df041cd6f54184b /wifi/1.6/default/hidl_struct_util.cpp | |
parent | b20697869bb713ef96a8efba34e40e91437f57e8 (diff) | |
parent | 6e13599d959ceb54be47b6da8e2da03de7592222 (diff) |
Merge changes from topics "Aware3.1", "instantFilter"
* changes:
Wifi: Add HAL API and implementation for instant mode filter
Wifi: Add support for Wifi Aware 3.1
Diffstat (limited to 'wifi/1.6/default/hidl_struct_util.cpp')
-rw-r--r-- | wifi/1.6/default/hidl_struct_util.cpp | 302 |
1 files changed, 226 insertions, 76 deletions
diff --git a/wifi/1.6/default/hidl_struct_util.cpp b/wifi/1.6/default/hidl_struct_util.cpp index 2a6b13199b..76341ffd7e 100644 --- a/wifi/1.6/default/hidl_struct_util.cpp +++ b/wifi/1.6/default/hidl_struct_util.cpp @@ -26,7 +26,7 @@ namespace V1_6 { namespace implementation { namespace hidl_struct_util { -using V1_5::NanConfigRequestSupplemental; +using V1_6::NanConfigRequestSupplemental; WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl(legacy_hal::wifi_channel_width type); @@ -433,6 +433,9 @@ uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask) { if (hidl_filter_mask & V1_5::IWifiChip::UsableChannelFilter::CONCURRENCY) { legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; } + if (hidl_filter_mask & V1_6::IWifiChip::UsableChannelFilter::NAN_INSTANT_MODE) { + legacy_filter_mask |= WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE; + } return legacy_filter_mask; } @@ -1363,11 +1366,11 @@ bool convertHidlNanEnableRequestToLegacy(const V1_4::NanEnableRequest& hidl_requ return true; } -bool convertHidlNanEnableRequest_1_4ToLegacy(const V1_4::NanEnableRequest& hidl_request1, +bool convertHidlNanEnableRequest_1_6ToLegacy(const V1_4::NanEnableRequest& hidl_request1, const NanConfigRequestSupplemental& hidl_request2, legacy_hal::NanEnableRequest* legacy_request) { if (!legacy_request) { - LOG(ERROR) << "convertHidlNanEnableRequest_1_4ToLegacy: null legacy_request"; + LOG(ERROR) << "convertHidlNanEnableRequest_1_6ToLegacy: null legacy_request"; return false; } @@ -1377,57 +1380,57 @@ bool convertHidlNanEnableRequest_1_4ToLegacy(const V1_4::NanEnableRequest& hidl_ } legacy_request->config_discovery_beacon_int = 1; - legacy_request->discovery_beacon_interval = hidl_request2.V1_2.discoveryBeaconIntervalMs; + legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs; legacy_request->config_nss = 1; - legacy_request->nss = hidl_request2.V1_2.numberOfSpatialStreamsInDiscovery; + legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery; legacy_request->config_dw_early_termination = 1; legacy_request->enable_dw_termination = - hidl_request2.V1_2.enableDiscoveryWindowEarlyTermination; + hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination; legacy_request->config_enable_ranging = 1; - legacy_request->enable_ranging = hidl_request2.V1_2.enableRanging; - - return true; -} - -bool convertHidlNanEnableRequest_1_5ToLegacy(const V1_4::NanEnableRequest& hidl_request1, - const NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanEnableRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanEnableRequest_1_5ToLegacy: null legacy_request"; - return false; - } - - *legacy_request = {}; - if (!convertHidlNanEnableRequest_1_4ToLegacy(hidl_request1, hidl_request2, legacy_request)) { - return false; - } + legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging; legacy_request->config_enable_instant_mode = 1; - legacy_request->enable_instant_mode = hidl_request2.enableInstantCommunicationMode; + legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode; + legacy_request->config_instant_mode_channel = 1; + legacy_request->instant_mode_channel = hidl_request2.instantModeChannel; return true; } -bool convertHidlNanConfigRequest_1_5ToLegacy(const V1_4::NanConfigRequest& hidl_request1, +bool convertHidlNanConfigRequest_1_6ToLegacy(const V1_4::NanConfigRequest& hidl_request1, const NanConfigRequestSupplemental& hidl_request2, legacy_hal::NanConfigRequest* legacy_request) { if (!legacy_request) { - LOG(ERROR) << "convertHidlNanConfigRequest_1_5ToLegacy: null legacy_request"; + LOG(ERROR) << "convertHidlNanConfigRequest_1_6ToLegacy: null legacy_request"; return false; } *legacy_request = {}; - if (!convertHidlNanConfigRequest_1_4ToLegacy(hidl_request1, hidl_request2, legacy_request)) { + if (!convertHidlNanConfigRequestToLegacy(hidl_request1, legacy_request)) { return false; } + legacy_request->config_discovery_beacon_int = 1; + legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs; + legacy_request->config_nss = 1; + legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery; + legacy_request->config_dw_early_termination = 1; + legacy_request->enable_dw_termination = + hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination; + legacy_request->config_enable_ranging = 1; + legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging; + + return true; + legacy_request->config_enable_instant_mode = 1; - legacy_request->enable_instant_mode = hidl_request2.enableInstantCommunicationMode; + legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode; + legacy_request->config_instant_mode_channel = 1; + legacy_request->instant_mode_channel = hidl_request2.instantModeChannel; return true; } -bool convertHidlNanPublishRequestToLegacy(const NanPublishRequest& hidl_request, +bool convertHidlNanPublishRequestToLegacy(const V1_6::NanPublishRequest& hidl_request, legacy_hal::NanPublishRequest* legacy_request) { if (!legacy_request) { LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: null legacy_request"; @@ -1494,6 +1497,15 @@ bool convertHidlNanPublishRequestToLegacy(const NanPublishRequest& hidl_request, hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; legacy_request->recv_indication_cfg |= 0x8; legacy_request->cipher_type = (unsigned int)hidl_request.baseConfigs.securityConfig.cipherType; + + legacy_request->scid_len = hidl_request.baseConfigs.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, hidl_request.baseConfigs.securityConfig.scid.data(), + legacy_request->scid_len); + if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; legacy_request->key_info.body.pmk_info.pmk_len = @@ -1531,6 +1543,7 @@ bool convertHidlNanPublishRequestToLegacy(const NanPublishRequest& hidl_request, (hidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) ? legacy_hal::NAN_DP_CONFIG_SECURITY : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired ? legacy_hal::NAN_RANGING_ENABLE : legacy_hal::NAN_RANGING_DISABLE; @@ -1554,7 +1567,7 @@ bool convertHidlNanPublishRequestToLegacy(const NanPublishRequest& hidl_request, return true; } -bool convertHidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& hidl_request, +bool convertHidlNanSubscribeRequestToLegacy(const V1_0::NanSubscribeRequest& hidl_request, legacy_hal::NanSubscribeRequest* legacy_request) { if (!legacy_request) { LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: legacy_request is null"; @@ -1835,38 +1848,88 @@ bool convertHidlNanConfigRequestToLegacy(const V1_4::NanConfigRequest& hidl_requ return true; } -bool convertHidlNanConfigRequest_1_4ToLegacy(const V1_4::NanConfigRequest& hidl_request1, - const NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanConfigRequest* legacy_request) { +bool convertHidlNanDataPathInitiatorRequestToLegacy( + const V1_0::NanInitiateDataPathRequest& hidl_request, + legacy_hal::NanDataPathInitiatorRequest* legacy_request) { if (!legacy_request) { - LOG(ERROR) << "convertHidlNanConfigRequest_1_4ToLegacy: legacy_request " - "is null"; + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "legacy_request is null"; return false; } - *legacy_request = {}; - if (!convertHidlNanConfigRequestToLegacy(hidl_request1, legacy_request)) { + + legacy_request->requestor_instance_id = hidl_request.peerId; + memcpy(legacy_request->peer_disc_mac_addr, hidl_request.peerDiscMacAddr.data(), 6); + legacy_request->channel_request_type = + convertHidlNanDataPathChannelCfgToLegacy(hidl_request.channelRequestType); + legacy_request->channel = hidl_request.channel; + if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "ifaceName too long"; return false; } - - legacy_request->config_discovery_beacon_int = 1; - legacy_request->discovery_beacon_interval = hidl_request2.V1_2.discoveryBeaconIntervalMs; - legacy_request->config_nss = 1; - legacy_request->nss = hidl_request2.V1_2.numberOfSpatialStreamsInDiscovery; - legacy_request->config_dw_early_termination = 1; - legacy_request->enable_dw_termination = - hidl_request2.V1_2.enableDiscoveryWindowEarlyTermination; - legacy_request->config_enable_ranging = 1; - legacy_request->enable_ranging = hidl_request2.V1_2.enableRanging; + strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + hidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + hidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); return true; } -bool convertHidlNanDataPathInitiatorRequestToLegacy( - const NanInitiateDataPathRequest& hidl_request, +bool convertHidlNanDataPathInitiatorRequest_1_6ToLegacy( + const V1_6::NanInitiateDataPathRequest& hidl_request, legacy_hal::NanDataPathInitiatorRequest* legacy_request) { if (!legacy_request) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " "legacy_request is null"; return false; } @@ -1878,7 +1941,7 @@ bool convertHidlNanDataPathInitiatorRequestToLegacy( convertHidlNanDataPathChannelCfgToLegacy(hidl_request.channelRequestType); legacy_request->channel = hidl_request.channel; if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " "ifaceName too long"; return false; } @@ -1889,7 +1952,7 @@ bool convertHidlNanDataPathInitiatorRequestToLegacy( : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " "ndp_app_info_len too large"; return false; } @@ -1900,7 +1963,7 @@ bool convertHidlNanDataPathInitiatorRequestToLegacy( legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " "invalid pmk_len"; return false; } @@ -1913,13 +1976,13 @@ bool convertHidlNanDataPathInitiatorRequestToLegacy( hidl_request.securityConfig.passphrase.size(); if (legacy_request->key_info.body.passphrase_info.passphrase_len < NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " "passphrase_len too small"; return false; } if (legacy_request->key_info.body.passphrase_info.passphrase_len > NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " "passphrase_len too large"; return false; } @@ -1929,18 +1992,24 @@ bool convertHidlNanDataPathInitiatorRequestToLegacy( } legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " "service_name_len too large"; return false; } memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), legacy_request->service_name_len); + legacy_request->scid_len = hidl_request.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len); return true; } bool convertHidlNanDataPathIndicationResponseToLegacy( - const NanRespondToDataPathIndicationRequest& hidl_request, + const V1_0::NanRespondToDataPathIndicationRequest& hidl_request, legacy_hal::NanDataPathIndicationResponse* legacy_request) { if (!legacy_request) { LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " @@ -2014,6 +2083,87 @@ bool convertHidlNanDataPathIndicationResponseToLegacy( return true; } +bool convertHidlNanDataPathIndicationResponse_1_6ToLegacy( + const V1_6::NanRespondToDataPathIndicationRequest& hidl_request, + legacy_hal::NanDataPathIndicationResponse* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->rsp_code = hidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT + : legacy_hal::NAN_DP_REQUEST_REJECT; + legacy_request->ndp_instance_id = hidl_request.ndpInstanceId; + if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "ifaceName too long"; + return false; + } + strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + hidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + hidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); + legacy_request->scid_len = hidl_request.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len); + + return true; +} + bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& legacy_response, WifiNanStatus* wifiNanStatus) { if (!wifiNanStatus) { @@ -2028,7 +2178,7 @@ bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& lega } bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilities& legacy_response, - V1_5::NanCapabilities* hidl_response) { + V1_6::NanCapabilities* hidl_response) { if (!hidl_response) { LOG(ERROR) << "convertLegacyNanCapabilitiesResponseToHidl: " "hidl_response is null"; @@ -2036,29 +2186,29 @@ bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilitie } *hidl_response = {}; - hidl_response->V1_0.maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters; - hidl_response->V1_0.maxPublishes = legacy_response.max_publishes; - hidl_response->V1_0.maxSubscribes = legacy_response.max_subscribes; - hidl_response->V1_0.maxServiceNameLen = legacy_response.max_service_name_len; - hidl_response->V1_0.maxMatchFilterLen = legacy_response.max_match_filter_len; - hidl_response->V1_0.maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len; - hidl_response->V1_0.maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len; - hidl_response->V1_0.maxExtendedServiceSpecificInfoLen = + hidl_response->maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters; + hidl_response->maxPublishes = legacy_response.max_publishes; + hidl_response->maxSubscribes = legacy_response.max_subscribes; + hidl_response->maxServiceNameLen = legacy_response.max_service_name_len; + hidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len; + hidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len; + hidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len; + hidl_response->maxExtendedServiceSpecificInfoLen = legacy_response.max_sdea_service_specific_info_len; - hidl_response->V1_0.maxNdiInterfaces = legacy_response.max_ndi_interfaces; - hidl_response->V1_0.maxNdpSessions = legacy_response.max_ndp_sessions; - hidl_response->V1_0.maxAppInfoLen = legacy_response.max_app_info_len; - hidl_response->V1_0.maxQueuedTransmitFollowupMsgs = + hidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces; + hidl_response->maxNdpSessions = legacy_response.max_ndp_sessions; + hidl_response->maxAppInfoLen = legacy_response.max_app_info_len; + hidl_response->maxQueuedTransmitFollowupMsgs = legacy_response.max_queued_transmit_followup_msgs; - hidl_response->V1_0.maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; - hidl_response->V1_0.supportedCipherSuites = legacy_response.cipher_suites_supported; + hidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; + hidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported; hidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; return true; } bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind, - NanMatchInd* hidl_ind) { + V1_6::NanMatchInd* hidl_ind) { if (!hidl_ind) { LOG(ERROR) << "convertLegacyNanMatchIndToHidl: hidl_ind is null"; return false; @@ -2080,14 +2230,14 @@ bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind, hidl_ind->matchOccuredInBeaconFlag = legacy_ind.match_occured_flag == 1; hidl_ind->outOfResourceFlag = legacy_ind.out_of_resource_flag == 1; hidl_ind->rssiValue = legacy_ind.rssi_value; - hidl_ind->peerCipherType = (NanCipherSuiteType)legacy_ind.peer_cipher_type; + hidl_ind->peerCipherType = (V1_6::NanCipherSuiteType)legacy_ind.peer_cipher_type; hidl_ind->peerRequiresSecurityEnabledInNdp = legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; hidl_ind->peerRequiresRanging = legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE; - hidl_ind->rangingMeasurementInCm = legacy_ind.range_info.range_measurement_mm / 10; + hidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm; hidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type; - + hidl_ind->scid = std::vector<uint8_t>(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); return true; } |