All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.smartdevicelink.proxy.rpc.OnButtonPress Maven / Gradle / Ivy

Go to download

The app library component of SDL is meant to run on the end user’s smart-device from within SDL enabled apps, as an embedded app, or connected to the cloud. App libraries allow the apps to connect to SDL enabled head-units and hardware through bluetooth, USB, and TCP for Android, and cloud and embedded apps can connect through web sockets, Java Beans, and other custom transports. Once the library establishes a connection between the smart device and head-unit through the preferred method of transport, the two components are able to communicate using the SDL defined protocol. The app integrating this library project is then able to expose its functionality to the head-unit through text, media, and other interactive elements.

There is a newer version: 5.7.0
Show newest version
/*
 * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following
 * disclaimer in the documentation and/or other materials provided with the
 * distribution.
 *
 * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from this
 * software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package com.smartdevicelink.proxy.rpc;

import androidx.annotation.NonNull;

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.proxy.rpc.enums.ButtonPressMode;

import java.util.Hashtable;

/**
 * 

* Notifies application of button press events for buttons to which the * application is subscribed. SDL supports two button press events defined as * follows: *

*
    *
  • SHORT - Occurs when a button is depressed, then released within two * seconds. The event is considered to occur immediately after the button is * released.
  • *
  • LONG - Occurs when a button is depressed and held for two seconds or * more. The event is considered to occur immediately after the two second * threshold has been crossed, before the button is released
  • *
* HMI Status Requirements: *
    * HMILevel: *
      *
    • The application will receive OnButtonPress notifications for all * subscribed buttons when HMILevel is FULL.
    • *
    • The application will receive OnButtonPress notifications for subscribed * media buttons when HMILevel is LIMITED.
    • *
    • Media buttons include SEEKLEFT, SEEKRIGHT, TUNEUP, TUNEDOWN, and * PRESET_0-PRESET_9.
    • *
    • The application will not receive OnButtonPress notification when HMILevel * is BACKGROUND or NONE.
    • *
    * AudioStreamingState: *
      *
    • Any
    • *
    * SystemContext: *
      *
    • MAIN, VR. In MENU, only PRESET buttons. In VR, pressing any subscribable * button will cancel VR.
    • *
    *
*

* Parameter List: *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
NameTypeDescriptionReqNotesSmartDeviceLink Ver Available
buttonName{@linkplain ButtonName}Name of the button which triggered this eventSmartDeviceLink 1.0
buttonPressMode{@linkplain ButtonPressMode}Indicates whether this is an SHORT or LONG button press event.SmartDeviceLink 1.0
customButtonIDIntegerIf ButtonName is "CUSTOM_BUTTON", this references the integer ID passed * by a custom button. (e.g. softButton ID)NMinvalue=0 Maxvalue=65536SmartDeviceLink 2.0
*

* * @see SubscribeButton * @see UnsubscribeButton * @since SmartDeviceLink 1.0 */ public class OnButtonPress extends RPCNotification { public static final String KEY_BUTTON_PRESS_MODE = "buttonPressMode"; public static final String KEY_BUTTON_NAME = "buttonName"; public static final String KEY_CUSTOM_BUTTON_ID = "customButtonID"; /** * Constructs a newly allocated OnButtonPress object */ public OnButtonPress() { super(FunctionID.ON_BUTTON_PRESS.toString()); } /** *

* Constructs a newly allocated OnButtonPress object indicated by the * Hashtable parameter *

* * @param hash The Hashtable to use */ public OnButtonPress(Hashtable hash) { super(hash); } /** * Constructs a newly allocated OnButtonPress object * * @param buttonName name of the button * @param buttonPressMode indicates whether this is a short or long press */ public OnButtonPress(@NonNull ButtonName buttonName, @NonNull ButtonPressMode buttonPressMode) { this(); setButtonName(buttonName); setButtonPressMode(buttonPressMode); } /** *

Returns an {@linkplain ButtonName} the button's name

* * @return ButtonName Name of the button */ public ButtonName getButtonName() { return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME); } /** *

Set the button's name

* * @param buttonName name of the button */ public OnButtonPress setButtonName(@NonNull ButtonName buttonName) { setParameters(KEY_BUTTON_NAME, buttonName); return this; } /** *

Returns {@linkplain ButtonPressMode}

* * @return ButtonPressMode whether this is a long or short button press event */ public ButtonPressMode getButtonPressMode() { return (ButtonPressMode) getObject(ButtonPressMode.class, KEY_BUTTON_PRESS_MODE); } /** *

Set the button press mode of the event

* * @param buttonPressMode indicates whether this is a short or long press */ public OnButtonPress setButtonPressMode(@NonNull ButtonPressMode buttonPressMode) { setParameters(KEY_BUTTON_PRESS_MODE, buttonPressMode); return this; } /** * Set CustomButtonID of the button * If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID) * * @param customButtonID CustomButtonID of the button */ public OnButtonPress setCustomButtonID(Integer customButtonID) { setParameters(KEY_CUSTOM_BUTTON_ID, customButtonID); return this; } /** * Get CustomButtonID of the button * If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID) * * @return CustomButtonID of the button */ public Integer getCustomButtonID() { return getInteger(KEY_CUSTOM_BUTTON_ID); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy