Merge "[AWARE] Add service support for SDEA service info"

am: c8b34b1c2c

Change-Id: I433a08ac78cbf565f7c82d70dda0461f4fb2d67d
This commit is contained in:
Etan Cohen 2017-02-21 22:50:03 +00:00 committed by android-build-merger
commit aac3de67d3

View file

@ -917,7 +917,15 @@ bool convertHidlNanPublishRequestToLegacy(
memcpy(legacy_request->service_specific_info,
hidl_request.baseConfigs.serviceSpecificInfo.data(),
legacy_request->service_specific_info_len);
// TODO: b/35193423 add support for extended service specific info
legacy_request->sdea_service_specific_info_len =
hidl_request.baseConfigs.extendedServiceSpecificInfo.size();
if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) {
LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: sdea_service_specific_info_len too large";
return false;
}
memcpy(legacy_request->sdea_service_specific_info,
hidl_request.baseConfigs.extendedServiceSpecificInfo.data(),
legacy_request->sdea_service_specific_info_len);
legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size();
if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) {
LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: rx_match_filter_len too large";
@ -999,7 +1007,16 @@ bool convertHidlNanSubscribeRequestToLegacy(
memcpy(legacy_request->service_specific_info,
hidl_request.baseConfigs.serviceSpecificInfo.data(),
legacy_request->service_specific_info_len);
// TODO: b/35193423 add support for extended service specific info
legacy_request->sdea_service_specific_info_len =
hidl_request.baseConfigs.extendedServiceSpecificInfo.size();
if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) {
LOG(ERROR) <<
"convertHidlNanSubscribeRequestToLegacy: sdea_service_specific_info_len too large";
return false;
}
memcpy(legacy_request->sdea_service_specific_info,
hidl_request.baseConfigs.extendedServiceSpecificInfo.data(),
legacy_request->sdea_service_specific_info_len);
legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size();
if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) {
LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: rx_match_filter_len too large";
@ -1083,13 +1100,22 @@ bool convertHidlNanTransmitFollowupRequestToLegacy(
legacy_hal::NAN_TRANSMIT_IN_DW : legacy_hal::NAN_TRANSMIT_IN_FAW;
legacy_request->service_specific_info_len = hidl_request.serviceSpecificInfo.size();
if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) {
LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: service_specific_info_len too large";
LOG(ERROR) <<
"convertHidlNanTransmitFollowupRequestToLegacy: service_specific_info_len too large";
return false;
}
memcpy(legacy_request->service_specific_info,
hidl_request.serviceSpecificInfo.data(),
legacy_request->service_specific_info_len);
// TODO: b/35193423 add support for extended service specific info
legacy_request->sdea_service_specific_info_len = hidl_request.extendedServiceSpecificInfo.size();
if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) {
LOG(ERROR) <<
"convertHidlNanTransmitFollowupRequestToLegacy: sdea_service_specific_info_len too large";
return false;
}
memcpy(legacy_request->sdea_service_specific_info,
hidl_request.extendedServiceSpecificInfo.data(),
legacy_request->sdea_service_specific_info_len);
legacy_request->recv_indication_cfg = hidl_request.disableFollowupResultIndication ? 0x1 : 0x0;
return true;
@ -1279,8 +1305,8 @@ bool convertLegacyNanCapabilitiesResponseToHidl(
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;
// TODO: b/35193423 add support for extended service specific info
hidl_response->maxExtendedServiceSpecificInfoLen = 0;
hidl_response->maxExtendedServiceSpecificInfoLen =
legacy_response.max_sdea_service_specific_info_len;
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;
@ -1303,7 +1329,9 @@ bool convertLegacyNanMatchIndToHidl(
hidl_ind->addr = hidl_array<uint8_t, 6>(legacy_ind.addr);
hidl_ind->serviceSpecificInfo = std::vector<uint8_t>(legacy_ind.service_specific_info,
legacy_ind.service_specific_info + legacy_ind.service_specific_info_len);
// TODO: b/35193423 add support for extended service specific info
hidl_ind->extendedServiceSpecificInfo = std::vector<uint8_t>(
legacy_ind.sdea_service_specific_info,
legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len);
hidl_ind->matchFilter = std::vector<uint8_t>(legacy_ind.sdf_match_filter,
legacy_ind.sdf_match_filter + legacy_ind.sdf_match_filter_len);
hidl_ind->matchOccuredInBeaconFlag = legacy_ind.match_occured_flag == 1;
@ -1333,6 +1361,9 @@ bool convertLegacyNanFollowupIndToHidl(
hidl_ind->receivedInFaw = legacy_ind.dw_or_faw == 1;
hidl_ind->serviceSpecificInfo = std::vector<uint8_t>(legacy_ind.service_specific_info,
legacy_ind.service_specific_info + legacy_ind.service_specific_info_len);
hidl_ind->extendedServiceSpecificInfo = std::vector<uint8_t>(
legacy_ind.sdea_service_specific_info,
legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len);
return true;
}