Initial Ford commit with Core and Proxies
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / PerformInteraction.java
1 //
2 // Copyright (c) 2013 Ford Motor Company
3 //
4 package com.smartdevicelink.proxy.rpc;
5
6 import java.util.Hashtable;
7 import java.util.Vector;
8
9 import com.smartdevicelink.proxy.RPCRequest;
10 import com.smartdevicelink.proxy.constants.Names;
11 import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
12 import com.smartdevicelink.util.DebugTool;
13
14 public class PerformInteraction extends RPCRequest {
15
16     public PerformInteraction() {
17         super("PerformInteraction");
18     }
19     public PerformInteraction(Hashtable hash) {
20         super(hash);
21     }
22     public String getInitialText() {
23         return (String) parameters.get( Names.initialText );
24     }
25     public void setInitialText( String initialText ) {
26         if (initialText != null) {
27             parameters.put(Names.initialText, initialText );
28         }
29     }
30     public Vector<TTSChunk> getInitialPrompt() {
31         if (parameters.get(Names.initialPrompt) instanceof Vector<?>) {
32                 Vector<?> list = (Vector<?>)parameters.get(Names.initialPrompt);
33                 if (list != null && list.size() > 0) {
34                     Object obj = list.get(0);
35                     if (obj instanceof TTSChunk) {
36                         return (Vector<TTSChunk>) list;
37                     } else if (obj instanceof Hashtable) {
38                         Vector<TTSChunk> newList = new Vector<TTSChunk>();
39                         for (Object hashObj : list) {
40                             newList.add(new TTSChunk((Hashtable)hashObj));
41                         }
42                         return newList;
43                     }
44                 }
45         }
46         return null;
47     }
48     public void setInitialPrompt( Vector<TTSChunk> initialPrompt ) {
49         if (initialPrompt != null) {
50             parameters.put(Names.initialPrompt, initialPrompt );
51         }
52     }
53     public InteractionMode getInteractionMode() {
54         Object obj = parameters.get(Names.interactionMode);
55         if (obj instanceof InteractionMode) {
56             return (InteractionMode) obj;
57         } else if (obj instanceof String) {
58             InteractionMode theCode = null;
59             try {
60                 theCode = InteractionMode.valueForString((String) obj);
61             } catch (Exception e) {
62                 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.interactionMode, e);
63             }
64             return theCode;
65         }
66         return null;
67     }
68     public void setInteractionMode( InteractionMode interactionMode ) {
69         if (interactionMode != null) {
70             parameters.put(Names.interactionMode, interactionMode );
71         }
72     }
73     public Vector<Integer> getInteractionChoiceSetIDList() {
74         if(parameters.get(Names.interactionChoiceSetIDList) instanceof Vector<?>){
75                 Vector<?> list = (Vector<?>)parameters.get(Names.interactionChoiceSetIDList);
76                 if(list != null && list.size()>0){
77                         Object obj = list.get(0);
78                         if(obj instanceof Integer){
79                                 return (Vector<Integer>) list;
80                         }
81                 }
82         }
83         return null;
84     }
85     public void setInteractionChoiceSetIDList( Vector<Integer> interactionChoiceSetIDList ) {
86         if (interactionChoiceSetIDList != null) {
87             parameters.put(Names.interactionChoiceSetIDList, interactionChoiceSetIDList );
88         }
89     }
90     public Vector<TTSChunk> getHelpPrompt() {
91         if(parameters.get(Names.helpPrompt) instanceof Vector<?>){
92                 Vector<?> list = (Vector<?>)parameters.get(Names.helpPrompt);
93                 if (list != null && list.size() > 0) {
94                     Object obj = list.get(0);
95                     if (obj instanceof TTSChunk) {
96                         return (Vector<TTSChunk>) list;
97                     } else if (obj instanceof Hashtable) {
98                         Vector<TTSChunk> newList = new Vector<TTSChunk>();
99                         for (Object hashObj : list) {
100                             newList.add(new TTSChunk((Hashtable)hashObj));
101                         }
102                         return newList;
103                     }
104                 }
105         }
106         return null;
107     }
108     public void setHelpPrompt( Vector<TTSChunk> helpPrompt ) {
109         if (helpPrompt != null) {
110             parameters.put(Names.helpPrompt, helpPrompt );
111         }
112     }
113     public Vector<TTSChunk> getTimeoutPrompt() {
114         if (parameters.get(Names.timeoutPrompt) instanceof Vector<?>) {
115                 Vector<?> list = (Vector<?>)parameters.get(Names.timeoutPrompt);
116                 if (list != null && list.size() > 0) {
117                     Object obj = list.get(0);
118                     if (obj instanceof TTSChunk) {
119                         return (Vector<TTSChunk>) list;
120                     } else if (obj instanceof Hashtable) {
121                         Vector<TTSChunk> newList = new Vector<TTSChunk>();
122                         for (Object hashObj : list) {
123                             newList.add(new TTSChunk((Hashtable)hashObj));
124                         }
125                         return newList;
126                     }
127                 }
128         }
129         return null;
130     }
131     public void setTimeoutPrompt( Vector<TTSChunk> timeoutPrompt ) {
132         if (timeoutPrompt != null) {
133             parameters.put(Names.timeoutPrompt, timeoutPrompt );
134         }
135     }
136     public Integer getTimeout() {
137         return (Integer) parameters.get( Names.timeout );
138     }
139     public void setTimeout( Integer timeout ) {
140         if (timeout != null) {
141             parameters.put(Names.timeout, timeout );
142         }
143     }
144 }