|
| 1 | + |
| 2 | +# Avoid Custom button subscription in case HMI incompatibility |
| 3 | + |
| 4 | +* Proposal: [SDL-NNNN](NNNN-Avoid_custom_button_subscription_when_HMI_does_not_support.md) |
| 5 | +* Author: [Getmanets Irina](https://github.com/GetmanetsIrina) |
| 6 | +* Status: **Awaiting review** |
| 7 | +* Impacted Platforms: [Core] |
| 8 | + |
| 9 | +## Introduction |
| 10 | + |
| 11 | +In case HMI does not support `CUSTOM_BUTTON`, SDL should not try to subscribe an application to it. |
| 12 | + |
| 13 | +## Motivation |
| 14 | + |
| 15 | +SDL does not check hmi_capabilities before subscription to `CUSTOM_BUTTON`, so it tries to subscribe each registered application to `CUSTOM_BUTTON` even if it is unsupported by HMI. |
| 16 | + |
| 17 | +SDL should check hmi_capabilities and subscribe application to `CUSTOM_BUTTON` if it is **supported by HMI only**. |
| 18 | + |
| 19 | +## Proposed solution |
| 20 | + |
| 21 | +SDL should check hmi_capabilities for `CUSTOM_BUTTON` by the start and save support state for `CUSTOM_BUTTON` internally. |
| 22 | +On the app registration, SDL should check the saved support state for `CUSTOM_BUTTON`. |
| 23 | + |
| 24 | +In case `CUSTOM_BUTTON` is supported by hmi_capabilities: |
| 25 | +SDL should send `Buttons.SubscribeButtons(CUSTOM_BUTTON)` to HMI and wait for a response. |
| 26 | + |
| 27 | + |
| 28 | +In case `CUSTOM_BUTTON` is not supported by hmi_capabilities: |
| 29 | +SDL should **not** send `Buttons.SubscribeButtons(CUSTOM_BUTTON)` to HMI. |
| 30 | + |
| 31 | +If HMI supports `CUSTOM_BUTTON`, it should be in the `Buttons[capabilities]` section of `hmi_capabilities.json`: |
| 32 | + |
| 33 | +``` |
| 34 | +"Buttons": { |
| 35 | + "capabilities": [ |
| 36 | + ..., |
| 37 | + { |
| 38 | + "name": "CUSTOM_BUTTON", |
| 39 | + "shortPressAvailable": true, |
| 40 | + "longPressAvailable": true, |
| 41 | + "upDownAvailable": true |
| 42 | + } |
| 43 | + ] |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | +If HMI supports `CUSTOM_BUTTON`, response to `Buttons.GetCapabilities` should contain following structure: |
| 49 | + |
| 50 | +``` |
| 51 | +"capabilities": [ |
| 52 | + ..., |
| 53 | + { |
| 54 | + "name": "CUSTOM_BUTTON", |
| 55 | + "shortPressAvailable": true, |
| 56 | + "longPressAvailable": true, |
| 57 | + "upDownAvailable": true |
| 58 | + } |
| 59 | + ] |
| 60 | +``` |
| 61 | + |
| 62 | + |
| 63 | +`Buttons.GetCapabilities` request has higher priority than `hmi_capabilities.json`. |
| 64 | + |
| 65 | +## Potential downsides |
| 66 | + |
| 67 | +N/A |
| 68 | + |
| 69 | +## Impact on existing code |
| 70 | + |
| 71 | +SDL core will need to be updated. |
| 72 | + |
| 73 | +## Alternatives considered |
| 74 | + |
| 75 | +N/A |
0 commit comments