SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / OnTBTClientState.java
1 package com.smartdevicelink.proxy.rpc;\r
2 \r
3 import java.util.Hashtable;\r
4 \r
5 import com.smartdevicelink.proxy.RPCNotification;\r
6 import com.smartdevicelink.proxy.constants.Names;\r
7 import com.smartdevicelink.proxy.rpc.enums.TBTState;\r
8 import com.smartdevicelink.util.DebugTool;\r
9 \r
10 /**\r
11  * <p>Notifies the application of the current TBT client status on the module.</p>\r
12  *\r
13  * <p></p>\r
14  * <b>HMI Status Requirements:</b>\r
15  * <ul>\r
16  * HMILevel: \r
17  * <ul><li>Can be sent with FULL, LIMITED or BACKGROUND</li></ul>\r
18  * AudioStreamingState: \r
19  * <ul><li>Any</li></ul>\r
20  * SystemContext: \r
21  * <ul><li>Any</li></ul>\r
22  * </ul>\r
23  * <p></p>\r
24  * <b>Parameter List:</b>\r
25  * <table  border="1" rules="all">\r
26  * <tr>\r
27  * <th>Name</th>\r
28  * <th>Type</th>\r
29  * <th>Description</th>\r
30  * <th>Applink Ver Available</th>\r
31  * </tr>\r
32  * <tr>\r
33  * <td>state</td>\r
34  * <td>{@linkplain TBTState}</td>\r
35  * <td>Current state of TBT client.</td>\r
36  * <td>SmartDeviceLink 1.0</td>\r
37  * </tr>\r
38  * </table>\r
39  * @since SmartDeviceLink 1.0\r
40  * \r
41  */\r
42 public class OnTBTClientState extends RPCNotification {\r
43         /**\r
44         *Constructs a newly allocated OnTBTClientState object\r
45         */ \r
46     public OnTBTClientState() {\r
47         super("OnTBTClientState");\r
48     }\r
49     /**\r
50      *<p>Constructs a newly allocated OnTBTClientState object indicated by the Hashtable parameter</p>\r
51      *@param hash The Hashtable to use\r
52      */    \r
53     public OnTBTClientState(Hashtable hash) {\r
54         super(hash);\r
55     }\r
56     /**\r
57      * <p>Called to get the current state of TBT client</p>\r
58      * @return {@linkplain TBTState} the current state of TBT client\r
59      */    \r
60     public TBTState getState() {\r
61         Object obj = parameters.get(Names.state);\r
62         if (obj instanceof TBTState) {\r
63                 return (TBTState)obj;\r
64         } else if(obj instanceof String) {\r
65                 TBTState theCode = null;\r
66                 try{\r
67                         theCode = TBTState.valueForString((String) obj);\r
68                 } catch (Exception e) {\r
69                 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.state, e);\r
70             }\r
71                 return theCode;\r
72         }       \r
73         return null;\r
74     }\r
75     /**\r
76      * <p>Called to set the current state of TBT client</p>\r
77      * @param state current state of TBT client\r
78      */    \r
79     public void setState( TBTState state ) {\r
80         if (state != null) {\r
81             parameters.put(Names.state, state );\r
82         } else {\r
83                 parameters.remove(Names.state);\r
84         }\r
85     }\r
86 } // end-class