summaryrefslogtreecommitdiff
path: root/SDL_Android/SmartDeviceLinkProxyAndroid/src/com/smartdevicelink/proxy/rpc/PerformInteraction.java
blob: c382e3c6569f0c5622dcaea85f17d2856a497413 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//
// Copyright (c) 2013 Ford Motor Company
//
package com.smartdevicelink.proxy.rpc;

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

import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.constants.Names;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.util.DebugTool;

public class PerformInteraction extends RPCRequest {

    public PerformInteraction() {
        super("PerformInteraction");
    }
    public PerformInteraction(Hashtable hash) {
        super(hash);
    }
    public String getInitialText() {
        return (String) parameters.get( Names.initialText );
    }
    public void setInitialText( String initialText ) {
        if (initialText != null) {
            parameters.put(Names.initialText, initialText );
        }
    }
    public Vector<TTSChunk> getInitialPrompt() {
        if (parameters.get(Names.initialPrompt) instanceof Vector<?>) {
	    	Vector<?> list = (Vector<?>)parameters.get(Names.initialPrompt);
	        if (list != null && list.size() > 0) {
	            Object obj = list.get(0);
	            if (obj instanceof TTSChunk) {
	                return (Vector<TTSChunk>) list;
	            } else if (obj instanceof Hashtable) {
	                Vector<TTSChunk> newList = new Vector<TTSChunk>();
	                for (Object hashObj : list) {
	                    newList.add(new TTSChunk((Hashtable)hashObj));
	                }
	                return newList;
	            }
	        }
        }
        return null;
    }
    public void setInitialPrompt( Vector<TTSChunk> initialPrompt ) {
        if (initialPrompt != null) {
            parameters.put(Names.initialPrompt, initialPrompt );
        }
    }
    public InteractionMode getInteractionMode() {
        Object obj = parameters.get(Names.interactionMode);
        if (obj instanceof InteractionMode) {
            return (InteractionMode) obj;
        } else if (obj instanceof String) {
            InteractionMode theCode = null;
            try {
                theCode = InteractionMode.valueForString((String) obj);
            } catch (Exception e) {
            	DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.interactionMode, e);
            }
            return theCode;
        }
        return null;
    }
    public void setInteractionMode( InteractionMode interactionMode ) {
        if (interactionMode != null) {
            parameters.put(Names.interactionMode, interactionMode );
        }
    }
    public Vector<Integer> getInteractionChoiceSetIDList() {
    	if(parameters.get(Names.interactionChoiceSetIDList) instanceof Vector<?>){
    		Vector<?> list = (Vector<?>)parameters.get(Names.interactionChoiceSetIDList);
    		if(list != null && list.size()>0){
        		Object obj = list.get(0);
        		if(obj instanceof Integer){
        			return (Vector<Integer>) list;
        		}
    		}
    	}
        return null;
    }
    public void setInteractionChoiceSetIDList( Vector<Integer> interactionChoiceSetIDList ) {
        if (interactionChoiceSetIDList != null) {
            parameters.put(Names.interactionChoiceSetIDList, interactionChoiceSetIDList );
        }
    }
    public Vector<TTSChunk> getHelpPrompt() {
        if(parameters.get(Names.helpPrompt) instanceof Vector<?>){
	    	Vector<?> list = (Vector<?>)parameters.get(Names.helpPrompt);
	        if (list != null && list.size() > 0) {
	            Object obj = list.get(0);
	            if (obj instanceof TTSChunk) {
	                return (Vector<TTSChunk>) list;
	            } else if (obj instanceof Hashtable) {
	                Vector<TTSChunk> newList = new Vector<TTSChunk>();
	                for (Object hashObj : list) {
	                    newList.add(new TTSChunk((Hashtable)hashObj));
	                }
	                return newList;
	            }
	        }
        }
        return null;
    }
    public void setHelpPrompt( Vector<TTSChunk> helpPrompt ) {
        if (helpPrompt != null) {
            parameters.put(Names.helpPrompt, helpPrompt );
        }
    }
    public Vector<TTSChunk> getTimeoutPrompt() {
        if (parameters.get(Names.timeoutPrompt) instanceof Vector<?>) {
	    	Vector<?> list = (Vector<?>)parameters.get(Names.timeoutPrompt);
	        if (list != null && list.size() > 0) {
	            Object obj = list.get(0);
	            if (obj instanceof TTSChunk) {
	                return (Vector<TTSChunk>) list;
	            } else if (obj instanceof Hashtable) {
	                Vector<TTSChunk> newList = new Vector<TTSChunk>();
	                for (Object hashObj : list) {
	                    newList.add(new TTSChunk((Hashtable)hashObj));
	                }
	                return newList;
	            }
	        }
        }
        return null;
    }
    public void setTimeoutPrompt( Vector<TTSChunk> timeoutPrompt ) {
        if (timeoutPrompt != null) {
            parameters.put(Names.timeoutPrompt, timeoutPrompt );
        }
    }
    public Integer getTimeout() {
        return (Integer) parameters.get( Names.timeout );
    }
    public void setTimeout( Integer timeout ) {
        if (timeout != null) {
            parameters.put(Names.timeout, timeout );
        }
    }
}