Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0285] ShowConstantTBT Description Update #1581

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ShowConstantTbt}
* {@link ShowConstantTbt}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss On line 33 I would remove it and change it back to {@link com.smartdevicelink.proxy.rpc.ShowConstantTbt}

The idea is that nothing should be changed in this class.

*/
public class ShowConstantTbtTests extends BaseRpcTests {

Expand Down Expand Up @@ -71,8 +71,8 @@ protected JSONObject getExpectedParameters(int sdlVersion) {
result.put(ShowConstantTbt.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
result.put(ShowConstantTbt.KEY_ETA, TestValues.GENERAL_STRING);
result.put(ShowConstantTbt.KEY_MANEUVER_COMPLETE, true);
result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE, TestValues.GENERAL_DOUBLE);
result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE, TestValues.GENERAL_DOUBLE);
result.put(ShowConstantTbt.KEY_DISTANCE_TO_MANEUVER, TestValues.GENERAL_DOUBLE);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss On line 74 I would rename KEY_DISTANCE_TO_MANEUVER back to its old variable name KEY_MANEUVER_DISTANCE. You can apply this change throughout the class.

result.put(ShowConstantTbt.KEY_DISTANCE_TO_MANEUVER_SCALE, TestValues.GENERAL_DOUBLE);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss On line 75 I would rename KEY_DISTANCE_TO_MANEUVER_SCALE back to its old variable name KEY_MANEUVER_DISTANCE_SCALE. You can apply this change throughout the class.

result.put(ShowConstantTbt.KEY_TEXT1, TestValues.GENERAL_STRING);
result.put(ShowConstantTbt.KEY_TEXT2, TestValues.GENERAL_STRING);
result.put(ShowConstantTbt.KEY_TIME_TO_DESTINATION, TestValues.GENERAL_STRING);
Expand Down Expand Up @@ -156,8 +156,8 @@ public void testJsonConstructor() {
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_ETA), cmd.getEta());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_COMPLETE), cmd.getManeuverComplete());
assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE), cmd.getDistanceToManeuver());
assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE), cmd.getDistanceToManeuverScale());
assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_DISTANCE_TO_MANEUVER), cmd.getDistanceToManeuver());
assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_DISTANCE_TO_MANEUVER_SCALE), cmd.getDistanceToManeuverScale());
assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT1), cmd.getNavigationText1());
assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT2), cmd.getNavigationText2());
assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TIME_TO_DESTINATION), cmd.getTimeToDestination());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse}
* {@link ShowConstantTbtResponse}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss I would delete line 24 and replace it with its old line {@link com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse}

*/
public class ShowConstantTbtResponseTests extends BaseRpcTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.util.SdlDataTypeConverter;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss I would remove this import on line 36 import com.smartdevicelink.util.SdlDataTypeConverter;.

(The idea is to just make the description changes and nothing else)


import java.util.Hashtable;
import java.util.List;
Expand All @@ -55,8 +56,8 @@ public class ShowConstantTbt extends RPCRequest {
public static final String KEY_TEXT2 = "navigationText2";
public static final String KEY_ETA = "eta";
public static final String KEY_TOTAL_DISTANCE = "totalDistance";
public static final String KEY_MANEUVER_DISTANCE = "distanceToManeuver";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss Lines 59-60 and 206-252 are good.

I would revert the other changes, since they are out of scope of the PR.

public static final String KEY_MANEUVER_DISTANCE_SCALE = "distanceToManeuverScale";
public static final String KEY_DISTANCE_TO_MANEUVER = "distanceToManeuver";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss On line 59 I would rename this variable back to its old name KEY_MANEUVER_DISTANCE. You can apply this change throughout the class.

public static final String KEY_DISTANCE_TO_MANEUVER_SCALE = "distanceToManeuverScale";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss On line 60 I would rename this variable back to its old name KEY_MANEUVER_DISTANCE_SCALE. You can apply this change throughout the class.

public static final String KEY_MANEUVER_IMAGE = "turnIcon";
public static final String KEY_NEXT_MANEUVER_IMAGE = "nextTurnIcon";
public static final String KEY_MANEUVER_COMPLETE = "maneuverComplete";
Expand Down Expand Up @@ -203,45 +204,53 @@ public Image getNextTurnIcon() {
}

/**
* Sets a Fraction of distance till next maneuver
* Sets the distanceToManeuver.
*
* @param distanceToManeuver a Double value representing a Fraction of distance till next maneuver
* <p></p>
* <b>Notes: </b>Minvalue=0; Maxvalue=1000000000
* @param distanceToManeuver Distance (in meters) until next maneuver. May be used to calculate progress bar.
* {"num_min_value": 0.0, "num_max_value": 1000000000.0}
* @since SmartDeviceLink 2.0.0
*/
public ShowConstantTbt setDistanceToManeuver(Double distanceToManeuver) {
setParameters(KEY_MANEUVER_DISTANCE, distanceToManeuver);
setParameters(KEY_DISTANCE_TO_MANEUVER, distanceToManeuver);
return this;
}

/**
* Gets a Fraction of distance till next maneuver
* Gets the distanceToManeuver.
*
* @return Double -a Double value representing a Fraction of distance till next maneuver
* @return Float Distance (in meters) until next maneuver. May be used to calculate progress bar.
* {"num_min_value": 0.0, "num_max_value": 1000000000.0}
* @since SmartDeviceLink 2.0.0
*/
public Double getDistanceToManeuver() {
return getDouble(KEY_MANEUVER_DISTANCE);
Object object = getParameters(KEY_DISTANCE_TO_MANEUVER);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss I would delete lines 226 and 227 and replace it with the old code return getDouble(KEY_MANEUVER_DISTANCE);.

return SdlDataTypeConverter.objectToDouble(object);
}

/**
* Sets a Distance till next maneuver (starting from) from previous maneuver
* Sets the distanceToManeuverScale.
*
* @param distanceToManeuverScale a Double value representing a Distance till next maneuver (starting from) from previous maneuver
* <p></p>
* <b>Notes: </b>Minvalue=0; Maxvalue=1000000000
* @param distanceToManeuverScale Distance (in meters) from previous maneuver to next maneuver. May be used to calculate
* progress bar.
* {"num_min_value": 0.0, "num_max_value": 1000000000.0}
* @since SmartDeviceLink 2.0.0
*/
public ShowConstantTbt setDistanceToManeuverScale(Double distanceToManeuverScale) {
setParameters(KEY_MANEUVER_DISTANCE_SCALE, distanceToManeuverScale);
setParameters(KEY_DISTANCE_TO_MANEUVER_SCALE, distanceToManeuverScale);
return this;
}

/**
* Gets a Distance till next maneuver (starting from) from previous maneuver
* Gets the distanceToManeuverScale.
*
* @return Double -a Double value representing a Distance till next maneuver (starting from) from previous maneuver
* @return Float Distance (in meters) from previous maneuver to next maneuver. May be used to calculate
* progress bar.
* {"num_min_value": 0.0, "num_max_value": 1000000000.0}
* @since SmartDeviceLink 2.0.0
*/
public Double getDistanceToManeuverScale() {
return getDouble(KEY_MANEUVER_DISTANCE_SCALE);
Object object = getParameters(KEY_DISTANCE_TO_MANEUVER_SCALE);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss I would delete lines 252-253 and replace it with the old code return getDouble(KEY_MANEUVER_DISTANCE_SCALE);.

return SdlDataTypeConverter.objectToDouble(object);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,27 @@
*/
public class ShowConstantTbtResponse extends RPCResponse {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss I would revert these changes in ShowConstantTbtResponse.java. This PR only deals with the ShowConstantTbtRequest so these changes are out of scope of the PR.


/**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss I would delete the comment block on lines 49-51. The idea is that nothing should be changed in this file.

* Constructs a new ShowConstantTBTResponse object
*/
public ShowConstantTbtResponse() {
super(FunctionID.SHOW_CONSTANT_TBT.toString());
}

/**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss I would delete the comment block on lines 56-60. The idea is that nothing should be changed in this file.

* Constructs a new ShowConstantTBTResponse object indicated by the Hashtable parameter
*
* @param hash The Hashtable to use
*/
public ShowConstantTbtResponse(Hashtable<String, Object> hash) {
super(hash);
}

/**
* Constructs a new ShowConstantTbtResponse object
*
* @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
* @param success whether the request is successfully processed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaBoss I would delete lines 68-69 and bring back the old formatted code.

* @param resultCode additional information about a response returning a failed outcome
*/
public ShowConstantTbtResponse(@NonNull Boolean success, @NonNull Result resultCode) {
this();
Expand Down