summaryrefslogtreecommitdiff
path: root/SDL_Android/SmartDeviceLinkProxyAndroid/src/com/smartdevicelink/proxy/rpc/UpdateTurnList.java
blob: 77c0005f823202c8b2cb549db50795e862bb4188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package com.smartdevicelink.proxy.rpc;

import java.util.Hashtable;
import java.util.Vector;

import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.constants.Names;

/**
 * Updates the list of next maneuvers, which can be requested by the user
 * pressing the softbutton "Turns" on the Navigation base screen. Three
 * softbuttons are predefined by the system: Up, Down, Close
 * <p>
 * Function Group: Navigation
 * <p>
 * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
 * <p>
 * 
 * @since SmartDeviceLink 2.0
 * @see ShowConstantTBT
 */
public class UpdateTurnList extends RPCRequest {

	/**
	 * Constructs a new UpdateTurnList object
	 */
    public UpdateTurnList() {
        super("UpdateTurnList");
    }

	/**
	 * Constructs a new UpdateTurnList object indicated by the Hashtable
	 * parameter
	 * <p>
	 * 
	 * @param hash
	 *            The Hashtable to use
	 */
    public UpdateTurnList(Hashtable hash) {
        super(hash);
    }

	/**
	 * Sets a list of turns to be shown to the user
	 * 
	 * @param turnList
	 *            a Vector<Turn> value representing a list of turns to be shown
	 *            to the user
	 *            <p>
	 *            <b>Notes: </b>Minsize=1; Maxsize=100
	 */
    public void setTurnList(Vector<Turn> turnList) {
        if (turnList != null) {
            parameters.put(Names.turnList, turnList);
        } else {
        	parameters.remove(Names.turnList);
        }
    }

	/**
	 * Gets a list of turns to be shown to the user
	 * 
	 * @return Vector<Turn> -a Vector value representing a list of turns
	 */
    public Vector<Turn> getTurnList() {
        if (parameters.get(Names.turnList) instanceof Vector<?>) {
	    	Vector<?> list = (Vector<?>)parameters.get(Names.turnList);
	        if (list != null && list.size() > 0) {
	            Object obj = list.get(0);
	            if (obj instanceof Turn) {
	                return (Vector<Turn>) list;
	            } else if (obj instanceof Hashtable) {
	                Vector<Turn> newList = new Vector<Turn>();
	                for (Object hashObj : list) {
	                    newList.add(new Turn((Hashtable)hashObj));
	                }
	                return newList;
	            }
	        }
        }
        return null;
    }

	/**
	 * Sets soft buttons in the screen. If omitted on supported displays,
	 * app-defined SoftButton will be left blank
	 * <p>
	 * <b>Notes: </b>Minsize=0; Maxsize=1
	 * 
	 * @param softButtons a Vector value
	 */
    public void setSoftButtons(Vector<SoftButton> softButtons) {
        if (softButtons != null) {
            parameters.put(Names.softButtons, softButtons);
        } else {
        	parameters.remove(Names.softButtons);
        }
    }

	/**
	 * Gets soft buttons in the screen
	 * @return Vector -a Vector<SoftButton> value
	 */
    public Vector<SoftButton> getSoftButtons() {
        if (parameters.get(Names.softButtons) instanceof Vector<?>) {
	    	Vector<?> list = (Vector<?>)parameters.get(Names.softButtons);
	        if (list != null && list.size() > 0) {
	            Object obj = list.get(0);
	            if (obj instanceof SoftButton) {
	                return (Vector<SoftButton>) list;
	            } else if (obj instanceof Hashtable) {
	                Vector<SoftButton> newList = new Vector<SoftButton>();
	                for (Object hashObj : list) {
	                    newList.add(new SoftButton((Hashtable)hashObj));
	                }
	                return newList;
	            }
	        }
        }
        return null;
    }
}