summaryrefslogtreecommitdiff
path: root/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
blob: 3e1637e2251c018cb12f90f4b037523427db5694 (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
145
146
147
148
package com.smartdevicelink.proxy.rpc;

import android.support.annotation.NonNull;

import com.smartdevicelink.proxy.RPCStruct;

import java.util.Hashtable;

/**
 * Specifies the version number of the SDL V4 interface. This is used by both the application and SDL to declare what interface version each is using.
 * <p><b> Parameter List</b></p>
 * <table border="1" rules="all">
 * 		<tr>
 * 			<th>Name</th>
 * 			<th>Type</th>
 * 			<th>Description</th>
 * 			<th>SmartDeviceLink Ver. Available</th>
 * 		</tr>
 * 		<tr>
 * 			<td>majorVersion</td>
 * 			<td>Integer</td>
 * 			<td>
 * 					<ul>
 * 					<li>minvalue="1"</li>
 * 				    <li>maxvalue="10"</li>
 *					</ul>
 *			</td>
 * 			<td>SmartDeviceLink 1.0</td>
 * 		</tr>
 * 		<tr>
 * 			<td>minorVersion</td>
 * 			<td>Integer</td>
 * 			<td>
 * 					<ul>
 * 					<li>minvalue="0"</li>
 * 				    <li>maxvalue="1000"</li>
 *					</ul>
 *			</td>
 * 			<td>SmartDeviceLink 1.0</td>
 * 		</tr>
 * </table> 
 * @since SmartDeviceLink 1.0
 */
public class SdlMsgVersion extends RPCStruct {
	public static final String KEY_MAJOR_VERSION = "majorVersion";
	public static final String KEY_MINOR_VERSION = "minorVersion";
	public static final String KEY_PATCH_VERSION = "patchVersion";

	/**
	 * Constructs a newly allocated SdlMsgVersion object
	 */
	public SdlMsgVersion() { }
    /**
     * Constructs a newly allocated SdlMsgVersion object indicated by the Hashtable parameter
     * @param hash The Hashtable to use
     */    
	public SdlMsgVersion(Hashtable<String, Object> hash) {
        super(hash);
    }
    /**
     * Get major version
     * 					<ul>
     * 					<li>minvalue="1"</li>
     * 				    <li>maxvalue="10"</li>
     *					</ul>
     * @return the major version
     */
    /**
     * Constructs a newly allocated SdlMsgVersion object
     * @param majorVersion minvalue="1" and maxvalue="10"
     * @param minorVersion min: 0; max: 1000
     */
    public SdlMsgVersion(@NonNull Integer majorVersion, @NonNull Integer minorVersion) {
        this();
        setMajorVersion(majorVersion);
        setMinorVersion(minorVersion);

    }

    @Override
    public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams) {
        if(getPatchVersion() == null){
            setPatchVersion(0);
        }
        super.format(rpcVersion,formatParams);
    }

    public Integer getMajorVersion() {
        return getInteger( KEY_MAJOR_VERSION );
    }
    /**
     * Set major version
     * 					<ul>
     * 					<li>minvalue="1"</li>
     * 				    <li>maxvalue="10"</li>
     *					</ul>
     * @param majorVersion minvalue="1" and maxvalue="10" 
     */    
    public void setMajorVersion( @NonNull Integer majorVersion ) {
        setValue(KEY_MAJOR_VERSION, majorVersion);
    }
    /**
     * Get minor version
     * 					<ul>
     * 					<li>minvalue="0"</li>
     * 				    <li>maxvalue="1000"</li>
     *					</ul>
     * @return the minor version
     */    
    public Integer getMinorVersion() {
        return getInteger( KEY_MINOR_VERSION );
    }
    /**
     * Set minor version
     * 					<ul>
     * 					<li>minvalue="0"</li>
     * 				    <li>maxvalue="1000"</li>
     *					</ul>
     * @param minorVersion min: 0; max: 1000
     */
    public void setMinorVersion( @NonNull Integer minorVersion ) {
        setValue(KEY_MINOR_VERSION, minorVersion);
    }

    /**
     * Get patch version
     * 					<ul>
     * 					<li>minvalue="0"</li>
     * 				    <li>maxvalue="1000"</li>
     *					</ul>
     * @return the patch version
     */
    public Integer getPatchVersion() {
        return getInteger( KEY_PATCH_VERSION );
    }
    /**
     * Set patch version
     * 					<ul>
     * 					<li>minvalue="0"</li>
     * 				    <li>maxvalue="1000"</li>
     *					</ul>
     * @param patchVersion min: 0; max: 1000
     */
    public void setPatchVersion( Integer patchVersion ) {
        setValue(KEY_PATCH_VERSION, patchVersion);
    }

}