Skip to content

Fix RPC's success code in case of UNSUPPORTED_RESOURCE#1575

Closed
AKalinich-Luxoft wants to merge 3 commits intosmartdevicelink:developfrom
AKalinich-Luxoft:fix/fix_alert_performaudiopassthru_success_result
Closed

Fix RPC's success code in case of UNSUPPORTED_RESOURCE#1575
AKalinich-Luxoft wants to merge 3 commits intosmartdevicelink:developfrom
AKalinich-Luxoft:fix/fix_alert_performaudiopassthru_success_result

Conversation

@AKalinich-Luxoft
Copy link
Contributor

Fixed Alert, AlertManeuver, PerformAudioPassThru success code in case of UNSUPPORTED_RESOURCE. The root cause of problem here is that SDL does not check specific case for this result code for RPC with two or more interfaces and just return wrong success result code.

In this pull request:

  • Added overriden functions PrepareResultForMobileResponse/PrepareResultCodeForResponse
    to cover specific cases for listed RPCs
  • Updated unit test expectations for PerformAudioPassThruRequestTest

Note
Some changes are from PR #1567 and will disappear after rebase.

@AKalinich-Luxoft
Copy link
Contributor Author

*/
bool PrepareResultForMobileResponse(ResponseInfo& out_first,
ResponseInfo& out_second) const;
virtual bool PrepareResultForMobileResponse(ResponseInfo& out_first,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft Please rename parameters like you did in IsResultCodeUnsupported(const ResponseInfo& first_iface_response...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft No requested changes provided

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AByzhynar sorry, wrong commit number. Please see 9e2ce85

* @return resulting code for sending to mobile application.
*/
mobile_apis::Result::eType PrepareResultCodeForResponse(
virtual mobile_apis::Result::eType PrepareResultCodeForResponse(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft Please rename parameters like you did in IsResultCodeUnsupported(const ResponseInfo& first_iface_response...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft No requested changes provided

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AByzhynar sorry, wrong commit number. Please see 9e2ce85

@AKalinich-Luxoft AKalinich-Luxoft force-pushed the fix/fix_alert_performaudiopassthru_success_result branch from 7930ff8 to 596d8b9 Compare May 30, 2017 10:19
@JenkinsSDLOnCloud
Copy link

bool PrepareResultForMobileResponse(ResponseInfo& out_first,
ResponseInfo& out_second) const;
virtual bool PrepareResultForMobileResponse(
ResponseInfo& first_iface_response,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft it is it out parameters please mark them as out parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(first.is_unsupported_resource && second.is_unsupported_resource);
bool IsResultCodeUnsupported(const ResponseInfo& first_iface_response,
const ResponseInfo& second_iface_response) {
return ((first_iface_response.is_ok ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft please split this condition to bool const variables for understanding.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out_second.is_invalid_enum =
hmi_apis::Common_Result::INVALID_ENUM == out_second.result_code;
second_iface_response.is_invalid_enum =
hmi_apis::Common_Result::INVALID_ENUM ==
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft auto style fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LuxoftAKutsan yes, this code was formatted with clang-format-3.6

Fixed AlertManeuver success result in case of UNSUPPORTED_RESOURCE.
The problem was that SDL does not check success result in this
specific case.

In this commit:
- Added check for UNSUPPORTED_RESOURCE case
- All specific checks were moved to
PrepareResultForMobileResponse/PrepareResultCodeForResponse function
- PrepareResultForMobileResponse is currently virtual
Fixed Alert, AlertManeuver, PerformAudioPassThru success code in case
of UNSUPPORTED_RESOURCE. The root cause of problem here is that SDL
does not check specific case for this result code for RPC with two or
more interfaces and just return wrong success result code.

In this commit:
- Added overriden functions PrepareResultForMobileResponse/PrepareResultCodeForResponse
to cover specific cases for listed RPCs
Updated unit test expectations for PerformAudioPassThruRequestTest
@AKalinich-Luxoft AKalinich-Luxoft force-pushed the fix/fix_alert_performaudiopassthru_success_result branch from 596d8b9 to abdf536 Compare May 31, 2017 15:35
@AKalinich-Luxoft
Copy link
Contributor Author

@LuxoftAKutsan please finish you review

@JenkinsSDLOnCloud
Copy link

Can one of the admins verify this patch?

2 similar comments
@JenkinsSDLOnCloud
Copy link

Can one of the admins verify this patch?

@JenkinsSDLOnCloud
Copy link

Can one of the admins verify this patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants