1 package com.smartdevicelink.proxy.rpc;
\r
3 import java.util.Hashtable;
\r
5 import com.smartdevicelink.proxy.RPCRequest;
\r
6 import com.smartdevicelink.proxy.constants.Names;
\r
7 import com.smartdevicelink.proxy.rpc.enums.ButtonName;
\r
8 import com.smartdevicelink.util.DebugTool;
\r
11 * Deletes a subscription to button notifications for the specified button. For
\r
12 * more information about button subscriptions, see {@linkplain SubscribeButton}
\r
14 * Application can unsubscribe from a button that is currently being pressed
\r
15 * (i.e. has not yet been released), but app will not get button event
\r
17 * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
\r
20 * @since SmartDeviceLink 1.0
\r
21 * @see SubscribeButton
\r
23 public class UnsubscribeButton extends RPCRequest {
\r
26 * Constructs a new UnsubscribeButton object
\r
28 public UnsubscribeButton() {
\r
29 super("UnsubscribeButton");
\r
32 * Constructs a new UnsubscribeButton object indicated by the Hashtable
\r
37 * The Hashtable to use
\r
39 public UnsubscribeButton(Hashtable hash) {
\r
43 * Gets a name of the button to unsubscribe from
\r
45 * @return ButtonName -an Enumeration value, see <i>
\r
46 * {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
\r
48 public ButtonName getButtonName() {
\r
49 Object obj = parameters.get(Names.buttonName);
\r
50 if (obj instanceof ButtonName) {
\r
51 return (ButtonName) obj;
\r
52 } else if (obj instanceof String) {
\r
53 ButtonName theCode = null;
\r
55 theCode = ButtonName.valueForString((String) obj);
\r
56 } catch (Exception e) {
\r
57 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.buttonName, e);
\r
64 * Sets the name of the button to unsubscribe from
\r
67 * an enum value, see <i>
\r
68 * {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
\r
70 public void setButtonName( ButtonName buttonName ) {
\r
71 if (buttonName != null) {
\r
72 parameters.put(Names.buttonName, buttonName );
\r