public class SubscribeButton extends RPCRequest
Establishes a subscription to button notifications for HMI buttons. Buttons are not necessarily physical buttons, but can also be "soft" buttons on a touch screen, depending on the display in the vehicle. Once subscribed to a particular button, an application will receive both OnButtonEvent and OnButtonPress notifications whenever that button is pressed. The application may also unsubscribe from notifications for a button by invoking the UnsubscribeButton operation
When a button is depressed, an OnButtonEvent notification is sent to the application with a ButtonEventMode of BUTTONDOWN. When that same button is released, an OnButtonEvent notification is sent to the application with a ButtonEventMode of BUTTONUP
When the duration of a button depression (that is, time between depression and release) is less than two seconds, an OnButtonPress notification is sent to the application (at the moment the button is released) with a ButtonPressMode of SHORT. When the duration is two or more seconds, an OnButtonPress notification is sent to the application (at the moment the two seconds have elapsed) with a ButtonPressMode of LONG
The purpose of OnButtonPress notifications is to allow for programmatic detection of long button presses similar to those used to store presets while listening to the radio, for example
When a button is depressed and released, the sequence in which notifications will be sent to the application is as follows:
For short presses:
For long presses:
HMILevel needs to be FULL, LIMITED or BACKGROUND
Parameter List
| Name | Type | Description | Reg. | Notes | Version |
|---|---|---|---|---|---|
| buttonName | ButtonName | Name of the button to subscribe. | Y | SmartDeviceLink 1.0 |
UnsubscribeButton| Modifier and Type | Field and Description |
|---|---|
static String |
KEY_BUTTON_NAME |
onResponseListenerfunction, KEY_CORRELATION_ID, KEY_FUNCTION_NAME, KEY_NOTIFICATION, KEY_PARAMETERS, KEY_REQUEST, KEY_RESPONSE, messageType, parametersKEY_BULK_DATA, KEY_PROTECTED, store| Constructor and Description |
|---|
SubscribeButton()
Constructs a new SubscribeButton object
|
SubscribeButton(ButtonName buttonName)
Constructs a new SubscribeButton object
|
SubscribeButton(Hashtable<String,Object> hash)
Constructs a new SubscribeButton object indicated by the Hashtable
parameter
|
| Modifier and Type | Method and Description |
|---|---|
ButtonName |
getButtonName()
Gets the name of the button to subscribe to
|
SubscribeButton |
setButtonName(ButtonName buttonName)
Sets a name of the button to subscribe to
|
getCorrelationID, getOnRPCResponseListener, setCorrelationID, setOnRPCResponseListenergetBoolean, getDouble, getFloat, getFunctionID, getFunctionName, getInteger, getLong, getMessageType, getObject, getParameters, getString, setFunctionName, setParametersclone, deserializeJSON, equals, format, formatObject, getBulkData, getMessageTypeName, getStore, getStoreValue, getValue, getValueForString, hashCode, hasKey, isPayloadProtected, serializeJSON, serializeJSON, setBulkData, setPayloadProtected, setValuepublic static final String KEY_BUTTON_NAME
public SubscribeButton()
public SubscribeButton(Hashtable<String,Object> hash)
Constructs a new SubscribeButton object indicated by the Hashtable parameter
hash - The Hashtable to usepublic SubscribeButton(@NonNull
ButtonName buttonName)
buttonName - Name of the button to subscribe.public ButtonName getButtonName()
public SubscribeButton setButtonName(@NonNull ButtonName buttonName)
buttonName - a ButtonName value