Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
JavaSE Documentation
SubscribeButton

Class SubscribeButton

Hierarchy

java.lang.Object
     com.smartdevicelink.proxy.RPCStruct
         com.smartdevicelink.proxy.RPCMessage
             com.smartdevicelink.proxy.RPCRequest

Package
com.smartdevicelink.proxy.rpc

Overview

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:

  • OnButtonEvent (ButtonEventMode = BUTTONDOWN)
  • OnButtonEvent (ButtonEventMode = BUTTONUP)
  • OnButtonPress (ButtonPressMode = SHORT)

For long presses:

  • OnButtonEvent (ButtonEventMode = BUTTONDOWN)
  • OnButtonEvent (ButtonEventMode = BUTTONUP)
  • OnButtonPress (ButtonPressMode = LONG)

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

Fields

KEY_BUTTON_NAME

public static final java.lang.String KEY_BUTTON_NAME
Constant Value
"buttonName"

Inherited Fields

From Class Fields
com.smartdevicelink.proxy.RPCRequest onResponseListener
com.smartdevicelink.proxy.RPCMessage KEY_REQUEST, KEY_RESPONSE, KEY_NOTIFICATION, KEY_FUNCTION_NAME, KEY_PARAMETERS, KEY_CORRELATION_ID, messageType, parameters, function
com.smartdevicelink.proxy.RPCStruct KEY_BULK_DATA, KEY_PROTECTED, store

Constructors

SubscribeButton()

Constructs a new SubscribeButton object

public SubscribeButton()

SubscribeButton( java.util.Hashtable<java.lang.String, java.lang.Object> hash )

Constructs a new SubscribeButton object indicated by the Hashtable parameter

public SubscribeButton(java.util.Hashtable<java.lang.String, java.lang.Object> hash)

Constructor Parameters

hash
The Hashtable to use

SubscribeButton( ButtonName buttonName )

Constructs a new SubscribeButton object

public SubscribeButton(ButtonName buttonName)

Constructor Parameters

buttonName
Name of the button to subscribe.

Methods

getButtonName()

Gets the name of the button to subscribe to

public com.smartdevicelink.proxy.rpc.enums.ButtonName getButtonName()

setButtonName( ButtonName buttonName )

Sets a name of the button to subscribe to

public com.smartdevicelink.proxy.rpc.SubscribeButton setButtonName(ButtonName buttonName)

Method Parameters

buttonName
a {@linkplain ButtonName} value

Inherited Methods

From Class Methods
com.smartdevicelink.proxy.RPCRequest getCorrelationID, setCorrelationID, setOnRPCResponseListener, getOnRPCResponseListener
com.smartdevicelink.proxy.RPCMessage getFunctionID, getFunctionName, setFunctionName, getMessageType, setParameters, getParameters, getObject, getString, getInteger, getFloat, getDouble, getBoolean, getLong
com.smartdevicelink.proxy.RPCStruct getStoreValue, getStore, deserializeJSON, serializeJSON, serializeJSON, format, getBulkData, setBulkData, setPayloadProtected, isPayloadProtected, getMessageTypeName, hasKey, setValue, getValue, getObject, formatObject, getValueForString, getString, getInteger, getDouble, getFloat, getBoolean, getLong, clone, equals, hashCode
java.lang.Object getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize
View on GitHub.com
Previous Section Next Section