summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnil Dahiya <anil_dahiya@infosys.com>2019-06-04 20:52:38 +0530
committerAnil Dahiya <anil_dahiya@infosys.com>2019-06-04 20:52:38 +0530
commit551a9b15e6cc6b47156af903d1a6b8b0b4c435c2 (patch)
tree30bb7128e5ed7b8997fddd2fcd25450bab97cdec
parenta1c9407c775b61ae9a0d7f1d921ea379b71e7504 (diff)
downloadsdl_android-551a9b15e6cc6b47156af903d1a6b8b0b4c435c2.tar.gz
Changes for Adding GPS Shift support proposal and updation of test cases.
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java3
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java7
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java3
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java21
6 files changed, 35 insertions, 4 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index 5172e4053..0c75f7744 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -2002,6 +2002,9 @@ public class Validator{
if(item1.getVdop() != item2.getVdop()){
return false;
}
+ if(item1.getShifted() != item2.getShifted()){
+ return false;
+ }
return true;
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
index c9373adfc..01f37774f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
@@ -107,6 +107,7 @@ public class VehicleDataHelper{
public static final Double GPS_ALTITUDE = 768.5;
public static final Double GPS_HEADING = 315.0;
public static final Double GPS_SPEED = 30.5;
+ public static final Boolean GPS_SHIFTED = true;
// belt status
public static final VehicleDataEventStatus BELT_STATUS_DRIVER_DEPLOYED = VehicleDataEventStatus.NO;
@@ -236,6 +237,7 @@ public class VehicleDataHelper{
GPS.setAltitude(GPS_ALTITUDE);
GPS.setHeading(GPS_HEADING);
GPS.setSpeed(GPS_SPEED);
+ GPS.setShifted(GPS_SHIFTED);
//BELT_STATUS set up
BELT_STATUS.setDriverBeltDeployed(BELT_STATUS_DRIVER_DEPLOYED);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
index 1c9e4986b..357e178c0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
@@ -43,6 +43,7 @@ public class GPSDataTests extends TestCase{
msg.setUtcSeconds(Test.GENERAL_INT);
msg.setUtcYear(Test.GENERAL_INT);
msg.setVdop(Test.GENERAL_DOUBLE);
+ msg.setShifted(Test.GENERAL_BOOLEAN);
}
/**
@@ -68,6 +69,7 @@ public class GPSDataTests extends TestCase{
int satellites = msg.getSatellites();
Dimension dimension = msg.getDimension();
CompassDirection direction = msg.getCompassDirection();
+ boolean shifted = msg.getShifted();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, actual);
@@ -88,6 +90,7 @@ public class GPSDataTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_INT, satellites);
assertEquals(Test.MATCH, Test.GENERAL_DIMENSION, dimension);
assertEquals(Test.MATCH, Test.GENERAL_COMPASSDIRECTION, direction);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, shifted);
// Invalid/Null Tests
GPSData msg = new GPSData();
@@ -111,6 +114,7 @@ public class GPSDataTests extends TestCase{
assertNull(Test.NULL, msg.getUtcSeconds());
assertNull(Test.NULL, msg.getUtcYear());
assertNull(Test.NULL, msg.getVdop());
+ assertNull(Test.NULL, msg.getShifted());
}
public void testJson(){
@@ -135,6 +139,7 @@ public class GPSDataTests extends TestCase{
reference.put(GPSData.KEY_SATELLITES, Test.GENERAL_INT);
reference.put(GPSData.KEY_DIMENSION, Test.GENERAL_DIMENSION);
reference.put(GPSData.KEY_COMPASS_DIRECTION, Test.GENERAL_COMPASSDIRECTION);
+ reference.put(GPSData.KEY_SHIFTED, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -148,4 +153,4 @@ public class GPSDataTests extends TestCase{
fail(Test.JSON_FAIL);
}
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
index c4dd2378f..fd9356cb9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
@@ -262,6 +262,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
GPSDataObj.put(GPSData.KEY_ALTITUDE, VehicleDataHelper.GPS_ALTITUDE);
GPSDataObj.put(GPSData.KEY_HEADING, VehicleDataHelper.GPS_HEADING);
GPSDataObj.put(GPSData.KEY_SPEED, VehicleDataHelper.GPS_SPEED);
+ GPSDataObj.put(GPSData.KEY_SHIFTED, VehicleDataHelper.GPS_SHIFTED);
//BELT_STATUS
beltStatusObj.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_DRIVER_DEPLOYED);
@@ -496,4 +497,4 @@ public class OnVehicleDataTests extends BaseRpcTests{
fail(Test.JSON_FAIL);
}
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
index c15ba7693..5bab84145 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
@@ -157,6 +157,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
GPSDataObj.put(GPSData.KEY_ALTITUDE, VehicleDataHelper.GPS_ALTITUDE);
GPSDataObj.put(GPSData.KEY_HEADING, VehicleDataHelper.GPS_HEADING);
GPSDataObj.put(GPSData.KEY_SPEED, VehicleDataHelper.GPS_SPEED);
+ GPSDataObj.put(GPSData.KEY_SHIFTED, VehicleDataHelper.GPS_SHIFTED);
//BELT_STATUS
beltStatusObj.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_DRIVER_DEPLOYED);
@@ -574,4 +575,4 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
e.printStackTrace();
}
}
-} \ No newline at end of file
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
index 40b5af70f..d10c90bf5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
@@ -195,6 +195,7 @@ public class GPSData extends RPCStruct {
public static final String KEY_ALTITUDE = "altitude";
public static final String KEY_HEADING = "heading";
public static final String KEY_SPEED = "speed";
+ public static final String KEY_SHIFTED = "shifted";
/**
* Constructs a newly allocated GPSData object
@@ -521,4 +522,22 @@ public class GPSData extends RPCStruct {
Object object = getValue(KEY_SPEED);
return SdlDataTypeConverter.objectToDouble(object);
}
-}
+
+ /**
+ * Sets the shifted param for GPSData.
+ * @param shifted True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
+ * False, if the GPS data is raw and un-shifted.
+ * If not provided, then value is assumed False.
+ */
+ public void setShifted(Boolean shifted) {
+ setValue(KEY_SHIFTED, shifted);
+ }
+
+ /**
+ * Gets the shifted param for GPSData.
+ * @return Boolean - True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
+ */
+ public Boolean getShifted() {
+ return getBoolean(KEY_SHIFTED);
+ }
+}