From c3ac938d038f399d459b965e15c757ac6bdeb37b Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 23 May 2018 10:47:27 -0400 Subject: Add the support annotations library --- sdl_android/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdl_android/build.gradle b/sdl_android/build.gradle index 7904206a9..21a9b2669 100644 --- a/sdl_android/build.gradle +++ b/sdl_android/build.gradle @@ -42,7 +42,8 @@ dependencies { }) testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.9.0' - + implementation 'com.android.support:support-annotations:27.1.1' + } buildscript { -- cgit v1.2.1 From 736161411997c6425c1935ec2ab9c451bbec6940 Mon Sep 17 00:00:00 2001 From: Bretty White Date: Thu, 24 May 2018 10:34:49 -0400 Subject: batch 1 --- .../proxy/rpc/UnsubscribeButton.java | 30 ++++++++++++++-------- .../proxy/rpc/UnsubscribeButtonResponse.java | 17 ++++++++++-- .../proxy/rpc/UnsubscribeVehicleDataResponse.java | 22 +++++++++++++--- .../proxy/rpc/UnsubscribeWayPointsResponse.java | 14 ++++++++++ .../proxy/rpc/UpdateTurnListResponse.java | 14 ++++++++++ .../proxy/rpc/VehicleDataResult.java | 26 ++++++++++++++----- .../proxy/rpc/VideoStreamingFormat.java | 14 +++++++--- .../com/smartdevicelink/proxy/rpc/VrHelpItem.java | 27 ++++++++++++++----- 8 files changed, 130 insertions(+), 34 deletions(-) diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java index 521800426..53a4e9162 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.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; @@ -63,29 +65,35 @@ public class UnsubscribeButton extends RPCRequest { * parameter *

* - * @param hash - * The Hashtable to use - */ + * @param hash The Hashtable to use + */ public UnsubscribeButton(Hashtable hash) { super(hash); } + + /** + * Constructs a new UnsubscribeButton object + * @param buttonName Name of the button to unsubscribe. + */ + public UnsubscribeButton(@NonNull ButtonName buttonName){ + this(); + setButtonName(buttonName); + } + /** * Gets a name of the button to unsubscribe from * - * @return ButtonName -an Enumeration value, see - * {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName} - */ + * @return ButtonName -an Enumeration value, see {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName} + */ public ButtonName getButtonName() { return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME); } /** * Sets the name of the button to unsubscribe from * - * @param buttonName - * an enum value, see - * {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName} - */ - public void setButtonName( ButtonName buttonName ) { + * @param buttonName an enum value, see {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName} + */ + public void setButtonName(@NonNull ButtonName buttonName ) { setParameters(KEY_BUTTON_NAME, buttonName); } } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java index 7efc00955..5d6bd8579 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.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; /** * Unsubscribe Button Response is sent, when UnsubscribeButton has been called @@ -24,10 +27,20 @@ public class UnsubscribeButtonResponse extends RPCResponse { * parameter *

* - * @param hash - * The Hashtable to use + * @param hash The Hashtable to use */ public UnsubscribeButtonResponse(Hashtable hash) { super(hash); } + + /** + * Constructs a new UnsubscribeButtonResponse object + * @param success whether the request is successfully processed + * @param resultCode whether the request is successfully processed + */ + public UnsubscribeButtonResponse(@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/UnsubscribeVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java index af3c94444..bba857522 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.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; import com.smartdevicelink.util.DebugTool; import static android.provider.Contacts.SettingsColumns.KEY; @@ -42,9 +45,20 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse { /** * Constructs a new UnsubscribeVehicleDataResponse object */ - public UnsubscribeVehicleDataResponse() { - super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString()); - } + public UnsubscribeVehicleDataResponse() { + super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString()); + } + + /** + * Constructs a new UnsubscribeVehicleDataResponse object + * @param success whether the request is successfully processed + * @param resultCode whether the request is successfully processed + */ + public UnsubscribeVehicleDataResponse(@NonNull Boolean success, @NonNull Result resultCode) { + this(); + setSuccess(success); + setResultCode(resultCode); + } /** * Constructs a new UnsubscribeVehicleDataResponse object indicated by the Hashtable @@ -135,7 +149,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse { } /** * Sets Fuel Level State - * @param fuelLevel_State + * @param fuelLevelState */ public void setFuelLevelState(VehicleDataResult fuelLevelState) { setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState); diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java index 8804892aa..b7feef73e 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.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 UnsubscribeWayPointsResponse extends RPCResponse { public UnsubscribeWayPointsResponse(Hashtable hash) { super(hash); } + + /** + * Constructs a new UnsubscribeWayPointsResponse object + * @param success whether the request is successfully processed + * @param resultCode whether the request is successfully processed + */ + public UnsubscribeWayPointsResponse(@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/UpdateTurnListResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java index add51c5a5..5b0fbabf7 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.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; /** * Update Turn List Response is sent, when UpdateTurnList has been called @@ -23,4 +26,15 @@ public class UpdateTurnListResponse extends RPCResponse{ super(hash); } + /** + * Constructs a new UpdateTurnListResponse object + * @param success whether the request is successfully processed + * @param resultCode whether the request is successfully processed + */ + public UpdateTurnListResponse(@NonNull Boolean success, @NonNull Result resultCode) { + this(); + setSuccess(success); + setResultCode(resultCode); + } + } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java index c0965cd39..10860deab 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc; +import android.support.annotation.NonNull; + import java.util.Hashtable; import com.smartdevicelink.proxy.RPCStruct; @@ -41,28 +43,38 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataType; public class VehicleDataResult extends RPCStruct { public static final String KEY_DATA_TYPE = "dataType"; public static final String KEY_RESULT_CODE = "resultCode"; + + public VehicleDataResult() { } /** *

* Constructs a new VehicleDataResult object indicated by the Hashtable * parameter *

* - * @param hash - * - *

The Hashtable to use

+ * @param hash the Hashtable to use */ - - public VehicleDataResult() { } public VehicleDataResult(Hashtable hash) { super(hash); } - public void setDataType(VehicleDataType dataType) { + + /** + * Individual published data request result. + * @param dataType Defined published data element type. + * @param resultCode Published data result code. + */ + public VehicleDataResult(@NonNull VehicleDataType dataType, @NonNull VehicleDataResultCode resultCode){ + this(); + setDataType(dataType); + setResultCode(resultCode); + } + + public void setDataType(@NonNull VehicleDataType dataType) { setValue(KEY_DATA_TYPE, dataType); } public VehicleDataType getDataType() { return (VehicleDataType) getObject(VehicleDataType.class, KEY_DATA_TYPE); } - public void setResultCode(VehicleDataResultCode resultCode) { + public void setResultCode(@NonNull VehicleDataResultCode resultCode) { setValue(KEY_RESULT_CODE, resultCode); } public VehicleDataResultCode getResultCode() { diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java index 8f88b3ea8..be4d1888c 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.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.VideoStreamingCodec; import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol; @@ -17,12 +19,18 @@ public class VideoStreamingFormat extends RPCStruct { public VideoStreamingFormat(){} public VideoStreamingFormat(Hashtable hash){super(hash);} - public VideoStreamingFormat(VideoStreamingCodec codec,VideoStreamingProtocol protocol){ + /** + * Create the VideoStreamingFormat object + * @param codec The codec used + * @param protocol The protocol used + */ + public VideoStreamingFormat(@NonNull VideoStreamingCodec codec, @NonNull VideoStreamingProtocol protocol){ + this(); setCodec(codec); setProtocol(protocol); } - public void setProtocol(VideoStreamingProtocol protocol){ + public void setProtocol(@NonNull VideoStreamingProtocol protocol){ setValue(KEY_PROTOCOL, protocol); } @@ -30,7 +38,7 @@ public class VideoStreamingFormat extends RPCStruct { return (VideoStreamingProtocol) getObject(VideoStreamingProtocol.class, KEY_PROTOCOL); } - public void setCodec(VideoStreamingCodec codec){ + public void setCodec(@NonNull VideoStreamingCodec codec){ setValue(KEY_CODEC, codec); } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java index 00474cd06..10eb6b0be 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc; +import android.support.annotation.NonNull; + import java.util.Hashtable; import com.smartdevicelink.proxy.RPCStruct; @@ -49,22 +51,33 @@ public class VrHelpItem extends RPCStruct { public static final String KEY_POSITION = "position"; public static final String KEY_TEXT = "text"; public static final String KEY_IMAGE = "image"; + + public VrHelpItem() { } /** *

* Constructs a new VrHelpItem object indicated by the Hashtable * parameter *

* - * @param hash - *

- * The Hashtable to use + * @param hash -The Hashtable to use */ - - public VrHelpItem() { } public VrHelpItem(Hashtable hash) { super(hash); } - public void setText(String text) { + + /** + * VR help items i.e. the text strings to be displayed, and when pronounced + * by the user the recognition of any of which must trigger the corresponding VR command. + * @param text Text to display for VR Help item + * @param position Position to display item in VR Help list + */ + public VrHelpItem(@NonNull String text, @NonNull Integer position){ + this(); + setText(text); + setPosition(position); + } + + public void setText(@NonNull String text) { setValue(KEY_TEXT, text); } public String getText() { @@ -77,7 +90,7 @@ public class VrHelpItem extends RPCStruct { public Image getImage() { return (Image) getObject(Image.class, KEY_IMAGE); } - public void setPosition(Integer position) { + public void setPosition(@NonNull Integer position) { setValue(KEY_POSITION, position); } public Integer getPosition() { -- cgit v1.2.1 From dcba56d87776ef2d371ddad77f47de236301def1 Mon Sep 17 00:00:00 2001 From: Bretty White Date: Thu, 24 May 2018 13:32:42 -0400 Subject: batch 2 of constructors --- .../com/smartdevicelink/proxy/rpc/TTSChunk.java | 19 ++++++-- .../com/smartdevicelink/proxy/rpc/TextField.java | 26 ++++++++--- .../com/smartdevicelink/proxy/rpc/TireStatus.java | 52 +++++++++++++++------- .../com/smartdevicelink/proxy/rpc/TouchCoord.java | 29 ++++++++---- .../com/smartdevicelink/proxy/rpc/TouchEvent.java | 26 ++++++++--- .../proxy/rpc/TouchEventCapabilities.java | 21 +++++++-- .../proxy/rpc/UnregisterAppInterfaceResponse.java | 14 ++++++ 7 files changed, 145 insertions(+), 42 deletions(-) diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java index d98bb8a5c..a1e26d6b2 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.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.SpeechCapabilities; @@ -51,10 +53,21 @@ public class TTSChunk extends RPCStruct { public TTSChunk(Hashtable hash) { super(hash); } + + /** + * Constructs a newly allocated TTSChunk object + * @param text Text to be spoken, or a phoneme specification, or the name of a pre-recorded sound. The contents of this field are indicated by the "type" field. + * @param type Indicates the type of information in the "text" field (e.g. phrase to be spoken, phoneme specification, name of pre-recorded sound). + */ + public TTSChunk(@NonNull String text, @NonNull SpeechCapabilities type){ + this(); + setText(text); + setType(type); + } /** * Get text to be spoken, or a phoneme specification, or the name of a pre-recorded sound. The contents of this field are indicated by the "type" field. * @return text to be spoken, or a phoneme specification, or the name of a pre-recorded sound - */ + */ public String getText() { return getString( KEY_TEXT ); } @@ -62,7 +75,7 @@ public class TTSChunk extends RPCStruct { * Set the text to be spoken, or a phoneme specification, or the name of a pre-recorded sound. The contents of this field are indicated by the "type" field. * @param text to be spoken, or a phoneme specification, or the name of a pre-recorded sound. */ - public void setText( String text ) { + public void setText(@NonNull String text ) { setValue(KEY_TEXT, text); } /** @@ -76,7 +89,7 @@ public class TTSChunk extends RPCStruct { * Set the type of information in the "text" field (e.g. phrase to be spoken, phoneme specification, name of pre-recorded sound). * @param type the type of information in the "text" field */ - public void setType( SpeechCapabilities type ) { + public void setType(@NonNull SpeechCapabilities type ) { setValue(KEY_TYPE, type); } } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java index 28e283e9f..7f745186b 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc; +import android.support.annotation.NonNull; + import java.util.Hashtable; import com.smartdevicelink.proxy.RPCStruct; @@ -61,7 +63,7 @@ import static com.smartdevicelink.proxy.rpc.TireStatus.KEY_INNER_RIGHT_REAR; * @see PerformInteraction * @see ScrollableMessage * @see PerformAudioPassThru - * @see ShowConstantTBT + * @see ShowConstantTbt * */ public class TextField extends RPCStruct { @@ -80,6 +82,20 @@ public class TextField extends RPCStruct { public TextField(Hashtable hash) { super(hash); } + /** + * Constructs a newly allocated TextField object + * @param name Enumeration identifying the field. + * @param characterSet The character set that is supported in this field. + * @param width The number of characters in one row of this field. + * @param rows The number of rows for this text field. + */ + public TextField(@NonNull TextFieldName name, @NonNull CharacterSet characterSet, @NonNull Integer width, @NonNull Integer rows){ + this(); + setName(name); + setCharacterSet(characterSet); + setWidth(width); + setRows(rows); + } /** * Get the enumeration identifying the field. * @return the name of TextField @@ -91,7 +107,7 @@ public class TextField extends RPCStruct { * Set the enumeration identifying the field. * @param name the name of TextField */ - public void setName( TextFieldName name ) { + public void setName(@NonNull TextFieldName name ) { setValue(KEY_NAME, name); } /** @@ -105,7 +121,7 @@ public class TextField extends RPCStruct { * Set the character set that is supported in this field. * @param characterSet - the character set */ - public void setCharacterSet( CharacterSet characterSet ) { + public void setCharacterSet(@NonNull CharacterSet characterSet ) { setValue(KEY_CHARACTER_SET, characterSet); } /** @@ -127,7 +143,7 @@ public class TextField extends RPCStruct { * * @param width the number of characters in one row of this field */ - public void setWidth( Integer width ) { + public void setWidth(@NonNull Integer width ) { setValue(KEY_WIDTH, width); } /** @@ -141,7 +157,7 @@ public class TextField extends RPCStruct { public Integer getRows() { return getInteger( KEY_ROWS ); } - public void setRows( Integer rows ) { + public void setRows(@NonNull Integer rows ) { setValue(KEY_ROWS, rows); } } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java index 4b2169215..4a5e95625 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.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.VehicleDataNotificationStatus; import com.smartdevicelink.proxy.rpc.enums.WarningLightStatus; @@ -79,61 +81,81 @@ public class TireStatus extends RPCStruct { public static final String KEY_INNER_LEFT_REAR = "innerLeftRear"; public static final String KEY_INNER_RIGHT_REAR = "innerRightRear"; public static final String KEY_RIGHT_REAR = "rightRear"; + + public TireStatus() { } + /** *

Constructs a new TireStatus object indicated by the Hashtable parameter

- * - * - * @param hash - *

- * The Hashtable to use

+ * + * @param hash The Hashtable to use */ - - public TireStatus() { } - public TireStatus(Hashtable hash) { + public TireStatus(Hashtable hash) { super(hash); } - public void setPressureTellTale(WarningLightStatus pressureTellTale) { + + /** + * Constructs a new TireStatus object + * @param pressureTellTale Status of the Tire Pressure TellTale + * @param leftFront The status of the left front tire. + * @param rightFront The status of the right front tire. + * @param leftRear The status of the left rear tire. + * @param rightRear The status of the right rear tire + * @param innerLeftRear The status of the inner left rear tire. + * @param innerRightRear The status of the inner right rear tire. + */ + public TireStatus(@NonNull WarningLightStatus pressureTellTale, @NonNull SingleTireStatus leftFront, @NonNull SingleTireStatus rightFront, @NonNull SingleTireStatus leftRear, @NonNull SingleTireStatus rightRear, @NonNull SingleTireStatus innerLeftRear, @NonNull SingleTireStatus innerRightRear){ + this(); + setPressureTellTale(pressureTellTale); + setLeftFront(leftFront); + setRightFront(rightFront); + setLeftRear(leftRear); + setRightRear(rightRear); + setInnerLeftRear(innerLeftRear); + setInnerRightRear(innerRightRear); + } + + public void setPressureTellTale(@NonNull WarningLightStatus pressureTellTale) { setValue(KEY_PRESSURE_TELL_TALE, pressureTellTale); } public WarningLightStatus getPressureTellTale() { return (WarningLightStatus) getObject(WarningLightStatus.class, KEY_PRESSURE_TELL_TALE); } - public void setLeftFront(SingleTireStatus leftFront) { + public void setLeftFront(@NonNull SingleTireStatus leftFront) { setValue(KEY_LEFT_FRONT, leftFront); } @SuppressWarnings("unchecked") public SingleTireStatus getLeftFront() { return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_LEFT_FRONT); } - public void setRightFront(SingleTireStatus rightFront) { + public void setRightFront(@NonNull SingleTireStatus rightFront) { setValue(KEY_RIGHT_FRONT, rightFront); } @SuppressWarnings("unchecked") public SingleTireStatus getRightFront() { return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_RIGHT_FRONT); } - public void setLeftRear(SingleTireStatus leftRear) { + public void setLeftRear(@NonNull SingleTireStatus leftRear) { setValue(KEY_LEFT_REAR, leftRear); } @SuppressWarnings("unchecked") public SingleTireStatus getLeftRear() { return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_LEFT_REAR); } - public void setRightRear(SingleTireStatus rightRear) { + public void setRightRear(@NonNull SingleTireStatus rightRear) { setValue(KEY_RIGHT_REAR, rightRear); } @SuppressWarnings("unchecked") public SingleTireStatus getRightRear() { return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_RIGHT_REAR); } - public void setInnerLeftRear(SingleTireStatus innerLeftRear) { + public void setInnerLeftRear(@NonNull SingleTireStatus innerLeftRear) { setValue(KEY_INNER_LEFT_REAR, innerLeftRear); } @SuppressWarnings("unchecked") public SingleTireStatus getInnerLeftRear() { return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_INNER_LEFT_REAR); } - public void setInnerRightRear(SingleTireStatus innerRightRear) { + public void setInnerRightRear(@NonNull SingleTireStatus innerRightRear) { setValue(KEY_INNER_RIGHT_REAR, innerRightRear); } @SuppressWarnings("unchecked") diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java index 2c0a1a260..b14dcfaec 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc; +import android.support.annotation.NonNull; + import com.smartdevicelink.proxy.RPCStruct; import java.util.Hashtable; @@ -45,21 +47,30 @@ import java.util.Hashtable; public class TouchCoord extends RPCStruct { public static final String KEY_X = "x"; public static final String KEY_Y = "y"; + public TouchCoord() {} + /** *

Constructs a new TouchCoord object indicated by the Hashtable parameter

- * - * - * @param hash - *

- * The Hashtable to use

- */ - + * + * @param hash The Hashtable to use + */ public TouchCoord(Hashtable hash) { super(hash); } + + /** + * Constructs a new TouchCoord object + * @param x The x coordinate of the touch. + * @param y The y coordinate of the touch. + */ + public TouchCoord(@NonNull Integer x, @NonNull Integer y){ + this(); + setX(x); + setY(y); + } - public void setX(Integer x) { + public void setX(@NonNull Integer x) { setValue(KEY_X, x); } @@ -67,7 +78,7 @@ public class TouchCoord extends RPCStruct { return getInteger(KEY_X); } - public void setY(Integer y) { + public void setY(@NonNull Integer y) { setValue(KEY_Y, y); } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java index f99b0a8e2..0abb75062 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc; +import android.support.annotation.NonNull; + import com.smartdevicelink.proxy.RPCStruct; import java.util.ArrayList; @@ -64,16 +66,26 @@ public class TouchEvent extends RPCStruct { /** *

Constructs a new TouchEvent object indicated by the Hashtable parameter

* - * - * @param hash - *

- * The Hashtable to use

+ * @param hash The Hashtable to use */ public TouchEvent(Hashtable hash) { super(hash); } + + /** + * Constructs a new TouchEvent object + * @param id A touch's unique identifier. + * @param ts The time that the touch was recorded. + * @param c The coordinates of the screen area where the touch event occurred. + */ + public TouchEvent(@NonNull Integer id, @NonNull List ts, @NonNull List c){ + this(); + setId(id); + setTimestamps(ts); + setTouchCoordinates(c); + } - public void setId(Integer id) { + public void setId(@NonNull Integer id) { setValue(KEY_ID, id); } @@ -113,7 +125,7 @@ public class TouchEvent extends RPCStruct { return null; } - public void setTimestamps(List ts){ + public void setTimestamps(@NonNull List ts){ setValue(KEY_TS, ts); } @@ -151,7 +163,7 @@ public class TouchEvent extends RPCStruct { setTouchCoordinates(c); } - public void setTouchCoordinates( List c ) { + public void setTouchCoordinates(@NonNull List c ) { setValue(KEY_C, c); } } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java index 668c81e0d..c8c441158 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.rpc; +import android.support.annotation.NonNull; + import com.smartdevicelink.proxy.RPCStruct; import java.util.Hashtable; @@ -52,8 +54,21 @@ public class TouchEventCapabilities extends RPCStruct { public TouchEventCapabilities(Hashtable hash) { super(hash); } + + /** + * Types of screen touch events available in screen area. + * @param pressAvailable if press is available + * @param multiTouchAvailable if multi touch is available + * @param doublePressAvailable if double press is available + */ + public TouchEventCapabilities(@NonNull Boolean pressAvailable, @NonNull Boolean multiTouchAvailable, @NonNull Boolean doublePressAvailable){ + this(); + setPressAvailable(pressAvailable); + setMultiTouchAvailable(multiTouchAvailable); + setDoublePressAvailable(doublePressAvailable); + } - public void setPressAvailable(Boolean pressAvailable) { + public void setPressAvailable(@NonNull Boolean pressAvailable) { setValue(KEY_PRESS_AVAILABLE, pressAvailable); } @@ -61,7 +76,7 @@ public class TouchEventCapabilities extends RPCStruct { return getBoolean(KEY_PRESS_AVAILABLE); } - public void setMultiTouchAvailable(Boolean multiTouchAvailable) { + public void setMultiTouchAvailable(@NonNull Boolean multiTouchAvailable) { setValue(KEY_MULTI_TOUCH_AVAILABLE, multiTouchAvailable); } @@ -69,7 +84,7 @@ public class TouchEventCapabilities extends RPCStruct { return getBoolean(KEY_MULTI_TOUCH_AVAILABLE); } - public void setDoublePressAvailable(Boolean doublePressAvailable) { + public void setDoublePressAvailable(@NonNull Boolean doublePressAvailable) { setValue(KEY_DOUBLE_PRESS_AVAILABLE, doublePressAvailable); } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java index d77bf3b39..4660dc24e 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.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; /** * Unregister AppInterface Response is sent, when UnregisterAppInterface has been called @@ -30,4 +33,15 @@ public class UnregisterAppInterfaceResponse extends RPCResponse { public UnregisterAppInterfaceResponse(Hashtable hash) { super(hash); } + + /** + * Constructs a new UnregisterAppInterfaceResponse object + * @param success whether the request is successfully processed + * @param resultCode whether the request is successfully processed + */ + public UnregisterAppInterfaceResponse(@NonNull Boolean success, @NonNull Result resultCode) { + this(); + setSuccess(success); + setResultCode(resultCode); + } } \ No newline at end of file -- cgit v1.2.1 From bd5b1e410f5f982af412a7201850b6f5951c288e Mon Sep 17 00:00:00 2001 From: Bretty White Date: Thu, 24 May 2018 14:16:07 -0400 Subject: batch 3 of constructors --- .../smartdevicelink/proxy/rpc/ShowResponse.java | 14 ++++++++++ .../proxy/rpc/SingleTireStatus.java | 13 ++++++++- .../java/com/smartdevicelink/proxy/rpc/Slider.java | 21 ++++++++++++-- .../smartdevicelink/proxy/rpc/SliderResponse.java | 15 ++++++++++ .../com/smartdevicelink/proxy/rpc/SoftButton.java | 32 +++++++++++++++------- .../proxy/rpc/SoftButtonCapabilities.java | 25 ++++++++++++++--- .../java/com/smartdevicelink/proxy/rpc/Speak.java | 16 +++++++++-- .../smartdevicelink/proxy/rpc/SpeakResponse.java | 15 ++++++++++ .../com/smartdevicelink/proxy/rpc/StartTime.java | 21 ++++++++++++-- .../smartdevicelink/proxy/rpc/SubscribeButton.java | 16 +++++++++-- .../proxy/rpc/SubscribeButtonResponse.java | 17 ++++++++++-- .../proxy/rpc/SubscribeVehicleDataResponse.java | 16 +++++++++-- .../proxy/rpc/SubscribeWayPointsResponse.java | 14 ++++++++++ .../proxy/rpc/SystemCapability.java | 13 ++++++++- .../smartdevicelink/proxy/rpc/SystemRequest.java | 13 ++++++++- .../proxy/rpc/SystemRequestResponse.java | 14 ++++++++++ .../com/smartdevicelink/proxy/rpc/Temperature.java | 17 ++++++++++-- 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 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 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; @@ -109,6 +111,19 @@ public class Slider extends RPCRequest { super(hash); } + /** + * 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 * @@ -118,7 +133,7 @@ public class Slider extends RPCRequest { *

* Notes: 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 { *

* Notes: 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 { *

* Notes: 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 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() { } + /** * *

Constructs a new SoftButton object indicated by the Hashtable * parameter

- * - * - * @param hash - * - * The Hashtable to use + * + * @param hash The Hashtable to use */ - - public SoftButton() { } - public SoftButton(Hashtable hash) { + public SoftButton(Hashtable 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 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 *

* - * @param hash - * The Hashtable to use + * @param hash The Hashtable to use */ public Speak(Hashtable 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 ttsChunks){ + this(); + setTtsChunks(ttsChunks); + } /** * Gets a List 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 { *
  • Each chunk can be no more than 500 characters
  • * */ - public void setTtsChunks( List ttsChunks ) { + public void setTtsChunks( @NonNull List 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 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 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" *

    Note:

    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 { *

    Note:

    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

    * * - * @param hash - * The Hashtable to use + * @param hash The Hashtable to use */ public SubscribeButton(Hashtable 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 {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName} @@ -105,7 +115,7 @@ public class SubscribeButton extends RPCRequest { * Sets a name of the button to subscribe to * @param buttonName a {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName} 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

    * * - * @param hash - * The Hashtable to use + * @param hash The Hashtable to use */ public SubscribeButtonResponse(Hashtable 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

    * * - * @param hash - * The Hashtable to use + * @param hash The Hashtable to use */ public SubscribeVehicleDataResponse(Hashtable 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 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 getLegacyData() { return (List) 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 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); } } -- cgit v1.2.1