diff options
author | Bretty White <geekman3454@protonmail.com> | 2018-05-24 14:16:07 -0400 |
---|---|---|
committer | Bretty White <geekman3454@protonmail.com> | 2018-05-24 14:16:07 -0400 |
commit | bd5b1e410f5f982af412a7201850b6f5951c288e (patch) | |
tree | a7309ad23cd7ae7cca2385182c677d168aad2389 | |
parent | dcba56d87776ef2d371ddad77f47de236301def1 (diff) | |
download | sdl_android-feature/issue_154_brett.tar.gz |
batch 3 of constructorsfeature/issue_154_brett
17 files changed, 257 insertions, 35 deletions
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java index 54ff95033..1187f6687 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java @@ -1,9 +1,12 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Show Response is sent, when Show has been called
@@ -30,4 +33,15 @@ public class ShowResponse extends RPCResponse { public ShowResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a new ShowResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ShowResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
\ No newline at end of file diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java index 4b8722ea5..6aa49ad28 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
@@ -41,12 +43,21 @@ public class SingleTireStatus extends RPCStruct { public SingleTireStatus(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a newly allocated SingleTireStatus object
+ * @param status Describes the volume status of a single tire
+ */
+ public SingleTireStatus(@NonNull ComponentVolumeStatus status){
+ this();
+ setStatus(status);
+ }
/**
* set the volume status of a single tire
* @param status the volume status of a single tire
*/
- public void setStatus(ComponentVolumeStatus status) {
+ public void setStatus(@NonNull ComponentVolumeStatus status) {
setValue(KEY_STATUS, status);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java index 31fb55b1e..df92e22fe 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -110,6 +112,19 @@ public class Slider extends RPCRequest { }
/**
+ * Constructs a new Slider object \
+ * @param numTicks Number of selectable items on a horizontal axis.
+ * @param position Initial position of slider control (cannot exceed numTicks)
+ * @param sliderHeader Text header to display
+ */
+ public Slider(@NonNull Integer numTicks, @NonNull Integer position, @NonNull String sliderHeader){
+ this();
+ setNumTicks(numTicks);
+ setPosition(position);
+ setSliderHeader(sliderHeader);
+ }
+
+ /**
* Sets a number of selectable items on a horizontal axis
*
* @param numTicks
@@ -118,7 +133,7 @@ public class Slider extends RPCRequest { * <p></p>
* <b>Notes: </b>Minvalue=2; Maxvalue=26
*/
- public void setNumTicks(Integer numTicks) {
+ public void setNumTicks(@NonNull Integer numTicks) {
setParameters(KEY_NUM_TICKS, numTicks);
}
@@ -141,7 +156,7 @@ public class Slider extends RPCRequest { * <p></p>
* <b>Notes: </b>Minvalue=1; Maxvalue=26
*/
- public void setPosition(Integer position) {
+ public void setPosition(@NonNull Integer position) {
setParameters(KEY_POSITION, position);
}
@@ -163,7 +178,7 @@ public class Slider extends RPCRequest { * <p></p>
* <b>Notes: </b>Maxlength=500
*/
- public void setSliderHeader(String sliderHeader) {
+ public void setSliderHeader(@NonNull String sliderHeader) {
setParameters(KEY_SLIDER_HEADER, sliderHeader);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java index 8d226d72c..b7f4a08a6 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java @@ -1,7 +1,10 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
@@ -31,6 +34,18 @@ public class SliderResponse extends RPCResponse { public SliderResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a new SliderResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SliderResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
/**
* Sets an Initial position of slider control
* @param sliderPosition
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java index 23e31316d..751729220 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -79,22 +81,32 @@ public class SoftButton extends RPCStruct { public static final String KEY_TEXT = "text";
public static final String KEY_TYPE = "type";
public static final String KEY_IMAGE = "image";
+
+ public SoftButton() { }
+
/**
*
* <p>Constructs a new SoftButton object indicated by the Hashtable
* parameter</p>
- *
- *
- * @param hash
- *
- * The Hashtable to use
+ *
+ * @param hash The Hashtable to use
*/
-
- public SoftButton() { }
- public SoftButton(Hashtable<String, Object> hash) {
+ public SoftButton(Hashtable<String, Object> hash) {
super(hash);
}
- public void setType(SoftButtonType type) {
+
+ /**
+ * Constructs a new SoftButton object
+ * @param type Describes, whether it is text, highlighted text, icon, or dynamic image.
+ * @param softButtonID Value which is returned via OnButtonPress / OnButtonEvent
+ */
+ public SoftButton(@NonNull SoftButtonType type, @NonNull Integer softButtonID){
+ this();
+ setType(type);
+ setSoftButtonID(softButtonID);
+ }
+
+ public void setType(@NonNull SoftButtonType type) {
setValue(KEY_TYPE, type);
}
public SoftButtonType getType() {
@@ -119,7 +131,7 @@ public class SoftButton extends RPCStruct { public Boolean getIsHighlighted() {
return getBoolean(KEY_IS_HIGHLIGHTED);
}
- public void setSoftButtonID(Integer softButtonID) {
+ public void setSoftButtonID(@NonNull Integer softButtonID) {
setValue(KEY_SOFT_BUTTON_ID, softButtonID);
}
public Integer getSoftButtonID() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java index 205dfe74c..9299e1b2b 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -66,12 +68,27 @@ public class SoftButtonCapabilities extends RPCStruct { public SoftButtonCapabilities(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a newly allocated SoftButtonCapabilities object
+ * @param shortPressAvailable The button supports a short press.
+ * @param longPressAvailable The button supports a LONG press
+ * @param upDownAvailable The button supports "button down" and "button up".
+ * @param imageSupported The button supports referencing a static or dynamic image.
+ */
+ public SoftButtonCapabilities(@NonNull Boolean shortPressAvailable, @NonNull Boolean longPressAvailable, @NonNull Boolean upDownAvailable, @NonNull Boolean imageSupported){
+ this();
+ setShortPressAvailable(shortPressAvailable);
+ setLongPressAvailable(longPressAvailable);
+ setUpDownAvailable(upDownAvailable);
+ setImageSupported(imageSupported);
+ }
/**
* set the button supports a short press.
* @param shortPressAvailable whether the button supports a short press.
*/
- public void setShortPressAvailable(Boolean shortPressAvailable) {
+ public void setShortPressAvailable(@NonNull Boolean shortPressAvailable) {
setValue(KEY_SHORT_PRESS_AVAILABLE, shortPressAvailable);
}
@@ -87,7 +104,7 @@ public class SoftButtonCapabilities extends RPCStruct { * set the button supports a LONG press.
* @param longPressAvailable whether the button supports a long press
*/
- public void setLongPressAvailable(Boolean longPressAvailable) {
+ public void setLongPressAvailable(@NonNull Boolean longPressAvailable) {
setValue(KEY_LONG_PRESS_AVAILABLE, longPressAvailable);
}
@@ -103,7 +120,7 @@ public class SoftButtonCapabilities extends RPCStruct { * set the button supports "button down" and "button up".
* @param upDownAvailable the button supports "button down" and "button up".
*/
- public void setUpDownAvailable(Boolean upDownAvailable) {
+ public void setUpDownAvailable(@NonNull Boolean upDownAvailable) {
setValue(KEY_UP_DOWN_AVAILABLE, upDownAvailable);
}
@@ -119,7 +136,7 @@ public class SoftButtonCapabilities extends RPCStruct { * set the button supports referencing a static or dynamic image.
* @param imageSupported whether the button supports referencing a static or dynamic image.
*/
- public void setImageSupported(Boolean imageSupported) {
+ public void setImageSupported(@NonNull Boolean imageSupported) {
setValue(KEY_IMAGE_SUPPORTED, imageSupported);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java index 347960731..8a0b3a380 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -120,12 +122,20 @@ public class Speak extends RPCRequest { * Constructs a new Speak object indicated by the Hashtable parameter
* <p></p>
*
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public Speak(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a new Speak object
+ * @param ttsChunks An array of 1-100 TTSChunk structs which, taken together, specify the phrase to be spoken.
+ */
+ public Speak(@NonNull List<TTSChunk> ttsChunks){
+ this();
+ setTtsChunks(ttsChunks);
+ }
/**
* Gets a List<TTSChunk> representing an array of 1-100 TTSChunk structs
* which, taken together, specify the phrase to be spoken
@@ -152,7 +162,7 @@ public class Speak extends RPCRequest { * <li>Each chunk can be no more than 500 characters</li>
* </ul>
*/
- public void setTtsChunks( List<TTSChunk> ttsChunks ) {
+ public void setTtsChunks( @NonNull List<TTSChunk> ttsChunks ) {
setParameters(KEY_TTS_CHUNKS, ttsChunks);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java index 740d24776..5f78b609b 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java @@ -1,9 +1,12 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Speak Response is sent, when Speak has been called
@@ -30,4 +33,16 @@ public class SpeakResponse extends RPCResponse { public SpeakResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a new SpeakResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SpeakResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
}
\ No newline at end of file diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java index ec515ad46..e047a716b 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -53,6 +55,19 @@ public class StartTime extends RPCStruct { public StartTime(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a newly allocated StartTime object
+ * @param hours The hour
+ * @param minutes The minute
+ * @param seconds The second
+ */
+ public StartTime(@NonNull Integer hours, @NonNull Integer minutes, @NonNull Integer seconds){
+ this();
+ setHours(hours);
+ setMinutes(minutes);
+ setSeconds(seconds);
+ }
/**
* Get the hour. Minvalue="0", maxvalue="59"
* <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
@@ -66,7 +81,7 @@ public class StartTime extends RPCStruct { * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
* @param hours min: 0; max: 59
*/
- public void setHours( Integer hours ) {
+ public void setHours(@NonNull Integer hours ) {
setValue(KEY_HOURS, hours);
}
/**
@@ -80,7 +95,7 @@ public class StartTime extends RPCStruct { * Set the minute. Minvalue="0", maxvalue="59".
* @param minutes min: 0; max: 59
*/
- public void setMinutes( Integer minutes ) {
+ public void setMinutes( @NonNull Integer minutes ) {
setValue(KEY_MINUTES, minutes);
}
/**
@@ -94,7 +109,7 @@ public class StartTime extends RPCStruct { * Set the second. Minvalue="0", maxvalue="59".
* @param seconds min: 0 max: 59
*/
- public void setSeconds( Integer seconds ) {
+ public void setSeconds( @NonNull Integer seconds ) {
setValue(KEY_SECONDS, seconds);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java index 4eedfcb47..80e988e35 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
@@ -88,12 +90,20 @@ public class SubscribeButton extends RPCRequest { * parameter</p>
*
*
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public SubscribeButton(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a new SubscribeButton object
+ * @param buttonName Name of the button to subscribe.
+ */
+ public SubscribeButton(@NonNull ButtonName buttonName){
+ this();
+ setButtonName(buttonName);
+ }
/**
* Gets the name of the button to subscribe to
* @return ButtonName -an enum value, see <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
@@ -105,7 +115,7 @@ public class SubscribeButton extends RPCRequest { * Sets a name of the button to subscribe to
* @param buttonName a <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i> value
*/
- public void setButtonName( ButtonName buttonName ) {
+ public void setButtonName(@NonNull ButtonName buttonName ) {
setParameters(KEY_BUTTON_NAME, buttonName);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java index 81fca78c2..fbed88bbc 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java @@ -1,9 +1,12 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Sub scribeButton Response is sent, when SubscribeButton has been called
@@ -24,10 +27,20 @@ public class SubscribeButtonResponse extends RPCResponse { * parameter</p>
*
*
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public SubscribeButtonResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a new SubscribeButtonResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SubscribeButtonResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
\ No newline at end of file diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java index 3c2a245ee..86f23c69b 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java @@ -1,7 +1,10 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
@@ -48,12 +51,21 @@ public class SubscribeVehicleDataResponse extends RPCResponse { * parameter</p>
*
*
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public SubscribeVehicleDataResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new SubscribeVehicleDataResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SubscribeVehicleDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
/**
* Sets gps
* @param gps
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java index 880a97229..8ca946c5c 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java @@ -1,7 +1,10 @@ package com.smartdevicelink.proxy.rpc; +import android.support.annotation.NonNull; + import com.smartdevicelink.protocol.enums.FunctionID; import com.smartdevicelink.proxy.RPCResponse; +import com.smartdevicelink.proxy.rpc.enums.Result; import java.util.Hashtable; @@ -13,4 +16,15 @@ public class SubscribeWayPointsResponse extends RPCResponse { public SubscribeWayPointsResponse(Hashtable<String, Object> hash) { super(hash); } + + /** + * Constructs a new SubscribeWayPointsResponse object + * @param success whether the request is successfully processed + * @param resultCode whether the request is successfully processed + */ + public SubscribeWayPointsResponse(@NonNull Boolean success, @NonNull Result resultCode) { + this(); + setSuccess(success); + setResultCode(resultCode); + } }
\ No newline at end of file diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java index 386f28b45..6ee294905 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc; +import android.support.annotation.NonNull; + import com.smartdevicelink.proxy.RPCStruct; import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType; @@ -22,6 +24,15 @@ public class SystemCapability extends RPCStruct { super(hash); } + /** + * Create a systemCapability object + * @param systemCapabilityType The type + */ + public SystemCapability(@NonNull SystemCapabilityType systemCapabilityType){ + this(); + setSystemCapabilityType(systemCapabilityType); + } + /** * * @return The SystemCapabilityType that indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist @@ -33,7 +44,7 @@ public class SystemCapability extends RPCStruct { /** * @param value Set the SystemCapabilityType that indicates which type of data should be changed and identifies which data object exists in this struct. */ - public void setSystemCapabilityType(SystemCapabilityType value){ + public void setSystemCapabilityType(@NonNull SystemCapabilityType value){ setValue(KEY_SYSTEM_CAPABILITY_TYPE, value); } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java index 154907419..7c614c447 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
@@ -63,6 +65,15 @@ public class SystemRequest extends RPCRequest { super(hash);
}
+ /**
+ * Constructs a new SystemRequest object
+ * @param requestType The type of system request.
+ */
+ public SystemRequest(@NonNull RequestType requestType){
+ this();
+ setRequestType(requestType);
+ }
+
@SuppressWarnings("unchecked")
public List<String> getLegacyData() {
return (List<String>) getObject(String.class, KEY_DATA);
@@ -84,7 +95,7 @@ public class SystemRequest extends RPCRequest { return (RequestType) getObject(RequestType.class, KEY_REQUEST_TYPE);
}
- public void setRequestType(RequestType requestType) {
+ public void setRequestType(@NonNull RequestType requestType) {
setParameters(KEY_REQUEST_TYPE, requestType);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java index 6fc920f1e..fab8b09ba 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java @@ -1,9 +1,12 @@ package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* System Request Response is sent, when SystemRequest has been called
@@ -18,4 +21,15 @@ public class SystemRequestResponse extends RPCResponse { public SystemRequestResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a new SystemRequestResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SystemRequestResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
\ No newline at end of file diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java index 29fea734f..87513a3cd 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc; +import android.support.annotation.NonNull; + import com.smartdevicelink.proxy.RPCStruct; import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit; import com.smartdevicelink.util.SdlDataTypeConverter; @@ -15,13 +17,24 @@ public class Temperature extends RPCStruct{ super(hash); } + /** + * Create the temperature object + * @param unit Temperature Unit. + * @param value Temperature Value in TemperatureUnit specified unit + */ + public Temperature(@NonNull TemperatureUnit unit, @NonNull Float value){ + this(); + setUnit(unit); + setValue(value); + } + /** * Sets the unit portion of the Temperature class * * @param unit * Temperature Unit. */ - public void setUnit(TemperatureUnit unit) { + public void setUnit(@NonNull TemperatureUnit unit) { setValue(KEY_UNIT, unit); } @@ -50,7 +63,7 @@ public class Temperature extends RPCStruct{ * @param value * Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL. */ - public void setValue(Float value) { + public void setValue(@NonNull Float value) { setValue(KEY_VALUE, value); } } |