summaryrefslogtreecommitdiff
path: root/sdl_android
diff options
context:
space:
mode:
authorBilal Alsharifi <599206+bilal-alsharifi@users.noreply.github.com>2019-03-01 14:30:37 -0500
committerGitHub <noreply@github.com>2019-03-01 14:30:37 -0500
commite59b00f4443f7d3e90c86bae562cde3decd95127 (patch)
tree3bce93fb9ae41eb67df9b9de8b6b098cc9b0cf91 /sdl_android
parent7acb07521d9fdd2829bd3d8a4087a55ddfa6a435 (diff)
parent56377c76a5dedffdd9a01f605725d17da73ef8e2 (diff)
downloadsdl_android-e59b00f4443f7d3e90c86bae562cde3decd95127.tar.gz
Merge pull request #971 from smartdevicelink/feature/app_services_base
App Services - Base, Media, Weather, and Navigation
Diffstat (limited to 'sdl_android')
-rw-r--r--sdl_android/build.gradle2
-rw-r--r--sdl_android/src/androidTest/assets/json/GetAppServiceData.json20
-rw-r--r--sdl_android/src/androidTest/assets/json/GetFile.json23
-rw-r--r--sdl_android/src/androidTest/assets/json/GetSystemCapability.json3
-rw-r--r--sdl_android/src/androidTest/assets/json/PerformAppServiceInteraction.json19
-rw-r--r--sdl_android/src/androidTest/assets/json/PublishAppService.json48
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java7
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java38
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java154
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java672
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java43
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java3
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java86
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java118
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java148
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java107
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java121
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java30
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java134
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java143
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java64
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java18
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java112
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java184
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java142
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java84
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java75
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java71
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java77
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java92
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java95
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java84
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java6
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java107
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java132
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java6
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java128
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java107
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java85
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java118
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java101
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java103
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java35
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java42
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java146
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java1
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java1
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java8
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java5
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java464
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java201
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java7
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceCapability.java69
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceData.java108
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceManifest.java189
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceRecord.java108
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java54
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceData.java82
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceDataResponse.java51
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetFile.java127
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetFileResponse.java112
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java24
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java264
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceManifest.java15
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationInstruction.java169
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceData.java189
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceManifest.java37
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnAppServiceData.java48
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemCapabilityUpdated.java48
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteraction.java101
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteractionResponse.java56
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java60
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppServiceResponse.java54
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java9
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherAlert.java121
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherData.java350
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceData.java133
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceManifest.java103
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppServiceType.java28
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Direction.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaType.java23
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationAction.java31
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationJunction.java58
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ServiceUpdateReason.java49
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java27
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCRequestListener.java19
89 files changed, 7726 insertions, 247 deletions
diff --git a/sdl_android/build.gradle b/sdl_android/build.gradle
index da605fe69..1334854a4 100644
--- a/sdl_android/build.gradle
+++ b/sdl_android/build.gradle
@@ -14,9 +14,11 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ multiDexEnabled true
}
debug {
testCoverageEnabled = true
+ multiDexEnabled true
}
}
compileOptions {
diff --git a/sdl_android/src/androidTest/assets/json/GetAppServiceData.json b/sdl_android/src/androidTest/assets/json/GetAppServiceData.json
new file mode 100644
index 000000000..6e4e9a2e2
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/GetAppServiceData.json
@@ -0,0 +1,20 @@
+{
+ "request":{
+ "name":"GetAppServiceData",
+ "correlationID":53,
+ "parameters":{
+ "subscribe":true,
+ "serviceType":"MEDIA"
+ }
+ },
+ "response":{
+ "name":"GetAppServiceDataResponse",
+ "correlationID":53,
+ "parameters":{
+ "serviceData": {
+ "serviceId": "test",
+ "serviceType": "MEDIA"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/GetFile.json b/sdl_android/src/androidTest/assets/json/GetFile.json
new file mode 100644
index 000000000..422bb4ee6
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/GetFile.json
@@ -0,0 +1,23 @@
+{
+ "request":{
+ "name":"GetFile",
+ "correlationID":1,
+ "parameters":{
+ "fileName":"test",
+ "appServiceId": "test",
+ "fileType":"GRAPHIC_JPEG",
+ "offset": 100,
+ "length": 100
+ }
+ },
+ "response":{
+ "name":"GetFileResponse",
+ "correlationID":1,
+ "parameters":{
+ "fileType":"GRAPHIC_JPEG",
+ "offset": 100,
+ "length": 100,
+ "crc": 1234
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/GetSystemCapability.json b/sdl_android/src/androidTest/assets/json/GetSystemCapability.json
index c96bf6013..5869df406 100644
--- a/sdl_android/src/androidTest/assets/json/GetSystemCapability.json
+++ b/sdl_android/src/androidTest/assets/json/GetSystemCapability.json
@@ -3,7 +3,8 @@
"name":"GetSystemCapability",
"correlationID":203,
"parameters":{
- "systemCapabilityType":"NAVIGATION"
+ "systemCapabilityType":"NAVIGATION",
+ "subscribe": true
}
},
"response":{
diff --git a/sdl_android/src/androidTest/assets/json/PerformAppServiceInteraction.json b/sdl_android/src/androidTest/assets/json/PerformAppServiceInteraction.json
new file mode 100644
index 000000000..e16bc880f
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/PerformAppServiceInteraction.json
@@ -0,0 +1,19 @@
+{
+ "request":{
+ "name":"PerformAppServiceInteraction",
+ "correlationID":55,
+ "parameters":{
+ "serviceUri": "test",
+ "appServiceId": "test",
+ "originApp": "test",
+ "requestServiceActive": true
+ }
+ },
+ "response":{
+ "name":"PerformAppServiceInteractionResponse",
+ "correlationID":55,
+ "parameters":{
+ "serviceSpecificResult": "test"
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/PublishAppService.json b/sdl_android/src/androidTest/assets/json/PublishAppService.json
new file mode 100644
index 000000000..464d5d830
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/PublishAppService.json
@@ -0,0 +1,48 @@
+{
+ "request":{
+ "name":"PublishAppService",
+ "correlationID":52,
+ "parameters":{
+ "appServiceManifest":{
+ "allowAppConsumers":true,
+ "serviceIcon": "test",
+ "rpcSpecVersion":{
+ "majorVersion":5,
+ "minorVersion":1,
+ "patchVersion":0},
+ "serviceName":"Mobile_MEDIA",
+ "serviceType":"MEDIA",
+ "uriPrefix": "test",
+ "uriScheme": {},
+ "handledRPCs":["ButtonPress"]
+ }
+ }
+ },
+ "response":{
+ "name":"PublishAppServiceResponse",
+ "correlationID":52,
+ "parameters":{
+ "appServiceRecord": {
+ "serviceID": "test",
+ "serviceManifest": {
+ "allowAppConsumers": true,
+ "rpcSpecVersion": {
+ "majorVersion": 5,
+ "minorVersion": 1,
+ "patchVersion": 0
+ },
+ "serviceName": "Mobile_MEDIA",
+ "serviceType": "MEDIA",
+ "serviceIcon": "test",
+ "uriPrefix": "test",
+ "uriScheme": {},
+ "handledRPCs": [
+ "ButtonPress"
+ ]
+ },
+ "servicePublished": true,
+ "serviceActive":true
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
index 2aa42517f..b1a1df0ed 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
@@ -6,10 +6,13 @@ import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.SdlProxyBase;
+import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleData;
+import com.smartdevicelink.proxy.rpc.OnAppServiceData;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
@@ -303,7 +306,7 @@ public class SdlManagerTests extends AndroidTestCase2 {
}
};
try {
- doAnswer(answer).when(sdlProxyBase).sendRPCRequest(any(RPCRequest.class));
+ doAnswer(answer).when(sdlProxyBase).sendRPC(any(RPCMessage.class));
} catch (SdlException e) {
e.printStackTrace();
}
@@ -360,7 +363,7 @@ public class SdlManagerTests extends AndroidTestCase2 {
// Test send RPC requests
- List<RPCRequest> rpcsList = Arrays.asList(new GetVehicleData(), new Show());
+ List<RPCMessage> rpcsList = Arrays.asList(new GetVehicleData(), new Show(), new OnAppServiceData(), new GetAppServiceDataResponse());
OnMultipleRequestListener onMultipleRequestListener = new OnMultipleRequestListener() {
@Override
public void onUpdate(int remainingRequests) { }
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
index 35ce94192..ce302e5d6 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
@@ -7,7 +7,10 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
public final class JsonUtils {
@@ -115,6 +118,41 @@ public final class JsonUtils {
return null;
}
+
+ public static List<AppServiceType> readAppServiceTypeListFromJsonObject(JSONObject json, String key){
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if(jsonArray != null){
+ int len = jsonArray.length();
+ List<AppServiceType> result = new ArrayList<>(len);
+ for(int i=0; i<len; i++){
+ try {
+ AppServiceType serviceType = (AppServiceType) jsonArray.get(i);
+ result.add(serviceType);
+ } catch (JSONException e) {}
+ }
+ return result;
+ }
+
+ return null;
+ }
+
+ public static List<AppServiceCapability> readAppServiceCapabilityListFromJsonObject(JSONObject json, String key){
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+ if(jsonArray != null){
+ int len = jsonArray.length();
+ List<AppServiceCapability> result = new ArrayList<>(len);
+ for(int i=0; i<len; i++){
+ try {
+ AppServiceCapability serviceCapability = (AppServiceCapability) jsonArray.getJSONArray(0).get(i);
+ result.add(serviceCapability);
+ } catch (JSONException e) {}
+ }
+ return result;
+ }
+
+ return null;
+ }
public static List<Integer> readIntegerListFromJsonObject(JSONObject json, String key){
JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
index 853dc02cc..cc8842aea 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -4,7 +4,13 @@ import android.graphics.Color;
import android.util.Log;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.TTSChunkFactory;
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.AppServiceData;
+import com.smartdevicelink.proxy.rpc.AppServiceManifest;
+import com.smartdevicelink.proxy.rpc.AppServiceRecord;
+import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
import com.smartdevicelink.proxy.rpc.AudioControlCapabilities;
import com.smartdevicelink.proxy.rpc.AudioControlData;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
@@ -15,6 +21,7 @@ import com.smartdevicelink.proxy.rpc.ClimateControlData;
import com.smartdevicelink.proxy.rpc.CloudAppProperties;
import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.proxy.rpc.DIDResult;
+import com.smartdevicelink.proxy.rpc.DateTime;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
import com.smartdevicelink.proxy.rpc.EqualizerSettings;
@@ -34,10 +41,15 @@ import com.smartdevicelink.proxy.rpc.LightState;
import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.MassageCushionFirmness;
import com.smartdevicelink.proxy.rpc.MassageModeData;
+import com.smartdevicelink.proxy.rpc.MediaServiceData;
+import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
+import com.smartdevicelink.proxy.rpc.NavigationInstruction;
+import com.smartdevicelink.proxy.rpc.NavigationServiceData;
+import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
@@ -74,9 +86,14 @@ import com.smartdevicelink.proxy.rpc.VehicleType;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.VrHelpItem;
+import com.smartdevicelink.proxy.rpc.WeatherAlert;
+import com.smartdevicelink.proxy.rpc.WeatherData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
+import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
import com.smartdevicelink.proxy.rpc.enums.AudioStreamingIndicator;
import com.smartdevicelink.proxy.rpc.enums.AudioStreamingState;
import com.smartdevicelink.proxy.rpc.enums.AudioType;
@@ -91,6 +108,7 @@ import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.DeviceLevelStatus;
import com.smartdevicelink.proxy.rpc.enums.Dimension;
+import com.smartdevicelink.proxy.rpc.enums.Direction;
import com.smartdevicelink.proxy.rpc.enums.DisplayMode;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.DistanceUnit;
@@ -121,8 +139,11 @@ import com.smartdevicelink.proxy.rpc.enums.MassageCushion;
import com.smartdevicelink.proxy.rpc.enums.MassageMode;
import com.smartdevicelink.proxy.rpc.enums.MassageZone;
import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
+import com.smartdevicelink.proxy.rpc.enums.MediaType;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.proxy.rpc.enums.NavigationAction;
+import com.smartdevicelink.proxy.rpc.enums.NavigationJunction;
import com.smartdevicelink.proxy.rpc.enums.PowerModeQualificationStatus;
import com.smartdevicelink.proxy.rpc.enums.PowerModeStatus;
import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech;
@@ -133,6 +154,7 @@ import com.smartdevicelink.proxy.rpc.enums.RequestType;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import com.smartdevicelink.proxy.rpc.enums.SeatMemoryActionType;
+import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.SupportedSeat;
@@ -304,10 +326,31 @@ public class Test {
public static final AudioStreamingIndicator GENERAL_AUDIO_STREAMING_INDICATOR = AudioStreamingIndicator.PLAY;
public static final String GENERAL_APP_ID = "123e4567e8";
public static final String GENERAL_FULL_APP_ID = "123e4567-e89b-12d3-a456-426655440000";
- public static final Version GENERAL_VERSION = new Version("4.0.0");
- public static final HybridAppPreference GENERAL_HYBRID_APP_PREFERENCE = HybridAppPreference.CLOUD;
+ public static final HybridAppPreference GENERAL_HYBRID_APP_PREFERENCE = HybridAppPreference.CLOUD;
public static final CloudAppProperties GENERAL_CLOUD_APP_PROPERTIES = new CloudAppProperties();
-
+ public static final AppServiceType GENERAL_APP_SERVICE_TYPE = AppServiceType.MEDIA;
+ public static final List<Integer> GENERAL_FUNCTION_ID_LIST = Arrays.asList(FunctionID.GET_VEHICLE_DATA.getId(), FunctionID.SEND_HAPTIC_DATA.getId());
+ public static final AppServiceManifest GENERAL_APP_SERVICE_MANIFEST = new AppServiceManifest();
+ public static final MediaServiceManifest GENERAL_MEDIA_SERVICE_MANIFEST = new MediaServiceManifest();
+ public static final WeatherServiceManifest GENERAL_WEATHER_SERVICE_MANIFEST = new WeatherServiceManifest();
+ public static final NavigationServiceManifest GENERAL_NAVIGATION_SERVICE_MANIFEST = new NavigationServiceManifest();
+ public static final AppServiceRecord GENERAL_APP_SERVICE_RECORD = new AppServiceRecord();
+ public static final AppServiceCapability GENERAL_APP_SERVICE_CAPABILITY = new AppServiceCapability();
+ public static final AppServicesCapabilities GENERAL_APP_SERVICE_CAPABILITIES = new AppServicesCapabilities();
+ public static final ServiceUpdateReason GENERAL_SERVICE_UPDATE_REASON = ServiceUpdateReason.MANIFEST_UPDATE;
+ public static final DateTime GENERAL_DATETIME = new DateTime();
+ public static final WeatherData GENERAL_WEATHERDATA = new WeatherData();
+ public static final WeatherAlert GENERAL_WEATHERALERT = new WeatherAlert();
+ public static final MediaType GENERAL_MEDIATYPE = MediaType.MUSIC;
+ public static final MediaServiceData GENERAL_MEDIASERVICE_DATA = new MediaServiceData();
+ public static final WeatherServiceData GENERAL_WEATHERSERVICE_DATA = new WeatherServiceData();
+ public static final NavigationServiceData GENERAL_NAVIGATIONSERVICE_DATA = new NavigationServiceData();
+ public static final AppServiceData GENERAL_APPSERVICE_DATA = new AppServiceData();
+ public static final NavigationAction GENERAL_NAVIGATION_ACTION = NavigationAction.STAY;
+ public static final NavigationJunction GENERAL_NAVIGATION_JUNCTION = NavigationJunction.BIFURCATION;
+ public static final Direction GENERAL_DIRECTION = Direction.RIGHT;
+ public static final NavigationInstruction GENERAL_NAVIGATION_INSTRUCTION = new NavigationInstruction();
+ public static final Version GENERAL_VERSION = new Version("4.0.0");
public static final ModuleType GENERAL_MODULETYPE = ModuleType.CLIMATE;
public static final Temperature GENERAL_TEMPERATURE = new Temperature();
public static final TemperatureUnit GENERAL_TEMPERATUREUNIT = TemperatureUnit.CELSIUS;
@@ -389,6 +432,12 @@ public class Test {
public static final List<LightState> GENERAL_LIGHTSTATE_LIST = new ArrayList<LightState>(1);
public static final List<AudioControlCapabilities> GENERAL_AUDIOCONTROLCAPABILITIES_LIST = new ArrayList<AudioControlCapabilities>(1);
public static final List<ModuleData> GENERAL_MODULEDATA_LIST = Collections.singletonList(GENERAL_MODULEDATA);
+ public static final List<AppServiceType> GENERAL_APPSERVICETYPE_LIST = Arrays.asList(AppServiceType.MEDIA, AppServiceType.NAVIGATION);
+ public static final List<AppServiceCapability> GENERAL_APPSERVICECAPABILITY_LIST = Arrays.asList(GENERAL_APP_SERVICE_CAPABILITY);
+ public static final List<WeatherData> GENERAL_WEATHERDATA_LIST = Arrays.asList(GENERAL_WEATHERDATA);
+ public static final List<WeatherAlert> GENERAL_WEATHERALERT_LIST = Arrays.asList(GENERAL_WEATHERALERT);
+ public static final List<NavigationInstruction> GENERAL_NAVIGATION_INSTRUCTION_LIST = Arrays.asList(GENERAL_NAVIGATION_INSTRUCTION);
+
public static final JSONArray JSON_TURNS = new JSONArray();
public static final JSONArray JSON_CHOICES = new JSONArray();
@@ -848,7 +897,6 @@ public class Test {
GENERAL_LOCKSCREENCONFIG.setBackgroundColor(Color.BLUE);
GENERAL_LOCKSCREENCONFIG.setEnabled(true);
GENERAL_LOCKSCREENCONFIG.setCustomView(R.layout.activity_sdllock_screen);
-
GENERAL_CLOUD_APP_PROPERTIES.setAppName(GENERAL_STRING);
GENERAL_CLOUD_APP_PROPERTIES.setAppID(GENERAL_STRING);
GENERAL_CLOUD_APP_PROPERTIES.setEnabled(GENERAL_BOOLEAN);
@@ -856,6 +904,104 @@ public class Test {
GENERAL_CLOUD_APP_PROPERTIES.setCloudTransportType(GENERAL_STRING);
GENERAL_CLOUD_APP_PROPERTIES.setHybridAppPreference(GENERAL_HYBRID_APP_PREFERENCE);
GENERAL_CLOUD_APP_PROPERTIES.setEndpoint(GENERAL_STRING);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setWeatherForLocationSupported(GENERAL_BOOLEAN);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setCurrentForecastSupported(GENERAL_BOOLEAN);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setMaxMultidayForecastAmount(GENERAL_INTEGER);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setMaxMinutelyForecastAmount(GENERAL_INTEGER);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setMaxHourlyForecastAmount(GENERAL_INTEGER);
+
+ GENERAL_APP_SERVICE_MANIFEST.setWeatherServiceManifest(GENERAL_WEATHER_SERVICE_MANIFEST);
+ GENERAL_APP_SERVICE_MANIFEST.setServiceName(GENERAL_STRING);
+ GENERAL_APP_SERVICE_MANIFEST.setServiceIcon(GENERAL_IMAGE);
+ GENERAL_APP_SERVICE_MANIFEST.setRpcSpecVersion(GENERAL_SDLMSGVERSION);
+ GENERAL_APP_SERVICE_MANIFEST.setMediaServiceManifest(GENERAL_MEDIA_SERVICE_MANIFEST);
+ GENERAL_APP_SERVICE_MANIFEST.setHandledRpcs(GENERAL_FUNCTION_ID_LIST);
+ GENERAL_APP_SERVICE_MANIFEST.setAllowAppConsumers(GENERAL_BOOLEAN);
+ GENERAL_APP_SERVICE_MANIFEST.setServiceType(GENERAL_STRING);
+
+ GENERAL_NAVIGATION_SERVICE_MANIFEST.setAcceptsWayPoints(GENERAL_BOOLEAN);
+
+ GENERAL_APP_SERVICE_RECORD.setServiceId(GENERAL_STRING);
+ GENERAL_APP_SERVICE_RECORD.setServiceManifest(GENERAL_APP_SERVICE_MANIFEST);
+ GENERAL_APP_SERVICE_RECORD.setServiceActive(GENERAL_BOOLEAN);
+ GENERAL_APP_SERVICE_RECORD.setServicePublished(GENERAL_BOOLEAN);
+
+ GENERAL_APP_SERVICE_CAPABILITY.setUpdatedAppServiceRecord(GENERAL_APP_SERVICE_RECORD);
+ GENERAL_APP_SERVICE_CAPABILITY.setUpdateReason(GENERAL_SERVICE_UPDATE_REASON);
+
+ GENERAL_APP_SERVICE_CAPABILITIES.setAppServices(GENERAL_APPSERVICECAPABILITY_LIST);
+
+ GENERAL_DATETIME.setDay(Test.GENERAL_INT);
+ GENERAL_DATETIME.setHour(Test.GENERAL_INT);
+ GENERAL_DATETIME.setMilliSecond(Test.GENERAL_INT);
+ GENERAL_DATETIME.setMinute(Test.GENERAL_INT);
+ GENERAL_DATETIME.setMonth(Test.GENERAL_INT);
+ GENERAL_DATETIME.setSecond(Test.GENERAL_INT);
+ GENERAL_DATETIME.setTzHour(Test.GENERAL_INT);
+ GENERAL_DATETIME.setTzMinute(Test.GENERAL_INT);
+ GENERAL_DATETIME.setYear(Test.GENERAL_INT);
+
+ GENERAL_WEATHERDATA.setCurrentTemperature(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setTemperatureHigh(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setTemperatureLow(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setApparentTemperature(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setWeatherSummary(GENERAL_STRING);
+ GENERAL_WEATHERDATA.setTime(GENERAL_DATETIME);
+ GENERAL_WEATHERDATA.setHumidity(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setCloudCover(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setMoonPhase(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setWindBearing(GENERAL_INTEGER);
+ GENERAL_WEATHERDATA.setWindGust(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setWindSpeed(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setNearestStormBearing(GENERAL_INTEGER);
+ GENERAL_WEATHERDATA.setNearestStormDistance(GENERAL_INTEGER);
+ GENERAL_WEATHERDATA.setPrecipAccumulation(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setPrecipIntensity(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setPrecipProbability(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setPrecipType(GENERAL_STRING);
+ GENERAL_WEATHERDATA.setVisibility(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setWeatherIconImageName(GENERAL_STRING);
+
+ GENERAL_WEATHERALERT.setTitle(GENERAL_STRING);
+ GENERAL_WEATHERALERT.setSummary(GENERAL_STRING);
+ GENERAL_WEATHERALERT.setExpires(GENERAL_DATETIME);
+ GENERAL_WEATHERALERT.setRegions(GENERAL_STRING_LIST);
+ GENERAL_WEATHERALERT.setSeverity(GENERAL_STRING);
+ GENERAL_WEATHERALERT.setTimeIssued(GENERAL_DATETIME);
+
+ GENERAL_WEATHERSERVICE_DATA.setLocation(GENERAL_LOCATIONDETAILS);
+ GENERAL_WEATHERSERVICE_DATA.setCurrentForecast(GENERAL_WEATHERDATA);
+ GENERAL_WEATHERSERVICE_DATA.setMinuteForecast(GENERAL_WEATHERDATA_LIST);
+ GENERAL_WEATHERSERVICE_DATA.setHourlyForecast(GENERAL_WEATHERDATA_LIST);
+ GENERAL_WEATHERSERVICE_DATA.setMultidayForecast(GENERAL_WEATHERDATA_LIST);
+ GENERAL_WEATHERSERVICE_DATA.setAlerts(GENERAL_WEATHERALERT_LIST);
+
+ GENERAL_MEDIASERVICE_DATA.setMediaType(GENERAL_MEDIATYPE);
+ GENERAL_MEDIASERVICE_DATA.setMediaTitle(GENERAL_STRING);
+ GENERAL_MEDIASERVICE_DATA.setMediaArtist(GENERAL_STRING);
+ GENERAL_MEDIASERVICE_DATA.setMediaAlbum(GENERAL_STRING);
+ GENERAL_MEDIASERVICE_DATA.setPlaylistName(GENERAL_STRING);
+ GENERAL_MEDIASERVICE_DATA.setIsExplicit(GENERAL_BOOLEAN);
+ GENERAL_MEDIASERVICE_DATA.setTrackPlaybackProgress(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setTrackPlaybackDuration(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setQueuePlaybackProgress(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setQueuePlaybackDuration(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setQueueCurrentTrackNumber(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setQueueTotalTrackCount(GENERAL_INTEGER);
+
+ GENERAL_APPSERVICE_DATA.setServiceType(GENERAL_STRING);
+ GENERAL_APPSERVICE_DATA.setServiceId(GENERAL_STRING);
+ GENERAL_APPSERVICE_DATA.setWeatherServiceData(GENERAL_WEATHERSERVICE_DATA);
+ GENERAL_APPSERVICE_DATA.setMediaServiceData(GENERAL_MEDIASERVICE_DATA);
+
+ GENERAL_NAVIGATION_INSTRUCTION.setLocationDetails(GENERAL_LOCATIONDETAILS);
+ GENERAL_NAVIGATION_INSTRUCTION.setAction(GENERAL_NAVIGATION_ACTION);
+ GENERAL_NAVIGATION_INSTRUCTION.setEta(GENERAL_DATETIME);
+ GENERAL_NAVIGATION_INSTRUCTION.setBearing(GENERAL_INTEGER);
+ GENERAL_NAVIGATION_INSTRUCTION.setJunctionType(GENERAL_NAVIGATION_JUNCTION);
+ GENERAL_NAVIGATION_INSTRUCTION.setDrivingSide(GENERAL_DIRECTION);
+ GENERAL_NAVIGATION_INSTRUCTION.setDetails(GENERAL_STRING);
+ GENERAL_NAVIGATION_INSTRUCTION.setImage(GENERAL_IMAGE);
try {
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index b0bdd8008..595793049 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -1,14 +1,15 @@
package com.smartdevicelink.test;
-import java.util.Iterator;
-import java.util.List;
-
import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.protocol.enums.FrameData;
import com.smartdevicelink.protocol.enums.FrameDataControlFrameType;
import com.smartdevicelink.protocol.enums.FrameType;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.rpc.AirbagStatus;
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.AppServiceManifest;
+import com.smartdevicelink.proxy.rpc.AppServiceRecord;
+import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
import com.smartdevicelink.proxy.rpc.AudioControlCapabilities;
import com.smartdevicelink.proxy.rpc.AudioControlData;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
@@ -21,6 +22,7 @@ import com.smartdevicelink.proxy.rpc.ClimateControlData;
import com.smartdevicelink.proxy.rpc.ClusterModeStatus;
import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.proxy.rpc.DIDResult;
+import com.smartdevicelink.proxy.rpc.DateTime;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DeviceStatus;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
@@ -43,12 +45,18 @@ import com.smartdevicelink.proxy.rpc.LightCapabilities;
import com.smartdevicelink.proxy.rpc.LightControlCapabilities;
import com.smartdevicelink.proxy.rpc.LightControlData;
import com.smartdevicelink.proxy.rpc.LightState;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.MassageCushionFirmness;
import com.smartdevicelink.proxy.rpc.MassageModeData;
+import com.smartdevicelink.proxy.rpc.MediaServiceData;
+import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.proxy.rpc.MyKey;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
+import com.smartdevicelink.proxy.rpc.NavigationInstruction;
+import com.smartdevicelink.proxy.rpc.NavigationServiceData;
+import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
@@ -85,6 +93,11 @@ import com.smartdevicelink.proxy.rpc.VehicleType;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.VrHelpItem;
+import com.smartdevicelink.proxy.rpc.WeatherAlert;
+import com.smartdevicelink.proxy.rpc.WeatherData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
+import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
@@ -92,6 +105,9 @@ import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
+import java.util.Iterator;
+import java.util.List;
+
public class Validator{
// TODO: This class could be (mostly) eliminated if all RPC classes implement their own .equals() and .hashCode() methods.
@@ -495,6 +511,236 @@ public class Validator{
return true;
}
+ public static boolean validateAppServiceTypeList(List<AppServiceType> list1, List<AppServiceType> list2){
+ if(list1 == null){
+ return ( list2 == null );
+ }
+ if(list2 == null){
+ return ( list1 == null );
+ }
+
+ Iterator<AppServiceType> iterator1 = list1.iterator();
+ Iterator<AppServiceType> iterator2 = list2.iterator();
+
+ while(iterator1.hasNext() && iterator2.hasNext()){
+ AppServiceType chunk1 = iterator1.next();
+ AppServiceType chunk2 = iterator2.next();
+
+ if(chunk1 != chunk2){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceCapabilities(AppServicesCapabilities params1, AppServicesCapabilities params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!validateAppServiceCapabilityList(params1.getAppServices(), params2.getAppServices())){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceCapabilityList(List<AppServiceCapability> list1, List<AppServiceCapability> list2){
+ if(list1 == null){
+ return ( list2 == null );
+ }
+ if(list2 == null){
+ return ( list1 == null );
+ }
+
+ Iterator<AppServiceCapability> iterator1 = list1.iterator();
+ Iterator<AppServiceCapability> iterator2 = list2.iterator();
+
+ while(iterator1.hasNext() && iterator2.hasNext()){
+ AppServiceCapability chunk1 = iterator1.next();
+ AppServiceCapability chunk2 = iterator2.next();
+
+ if(!validateAppServiceRecord(chunk1.getUpdatedAppServiceRecord(), chunk2.getUpdatedAppServiceRecord())){
+ return false;
+ }
+
+ if (!chunk1.getUpdateReason().equals(chunk2.getUpdateReason())){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateMediaServiceManifest(MediaServiceManifest params1, MediaServiceManifest params2){
+ if(params1 == null){
+ return ( params2 == null );
+ }
+ if(params2 == null){
+ return ( params1 == null );
+ }
+
+ return true;
+ }
+
+ public static boolean validateNavigationServiceManifest(NavigationServiceManifest params1, NavigationServiceManifest params2){
+ if(params1 == null){
+ return ( params2 == null );
+ }
+ if(params2 == null){
+ return ( params1 == null );
+ }
+
+ if (!params1.getAcceptsWayPoints().equals(params2.getAcceptsWayPoints())){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceRecord(AppServiceRecord params1, AppServiceRecord params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!params1.getServiceActive().equals(params2.getServiceActive())){
+ return false;
+ }
+
+ if (!params1.getServicePublished().equals(params2.getServicePublished())){
+ return false;
+ }
+
+ if (!params1.getServiceId().equals(params2.getServiceId())){
+ return false;
+ }
+
+ if (!validateAppServiceManifest(params1.getServiceManifest(), params2.getServiceManifest())){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceManifest(AppServiceManifest params1, AppServiceManifest params2){
+ if(params1 == null){
+ return ( params2 == null );
+ }
+ if(params2 == null){
+ return ( params1 == null );
+ }
+
+ if (!params1.getAllowAppConsumers().equals(params2.getAllowAppConsumers())){
+ return false;
+ }
+
+ if (!validateImage(params1.getServiceIcon(), params2.getServiceIcon())){
+ return false;
+ }
+
+ if (!params1.getServiceName().equals(params2.getServiceName())){
+ return false;
+ }
+
+ if (!params1.getServiceType().equals(params2.getServiceType())){
+ return false;
+ }
+
+ if (!validateSdlMsgVersion(params1.getRpcSpecVersion(),params2.getRpcSpecVersion())){
+ return false;
+ }
+
+ if (!validateMediaServiceManifest(params1.getMediaServiceManifest(), params2.getMediaServiceManifest())) {
+ return false;
+ }
+
+ if (!validateWeatherServiceManifest(params1.getWeatherServiceManifest(), params2.getWeatherServiceManifest())){
+ return false;
+ }
+
+ if (!validateIntegerList(params1.getHandledRpcs(), params2.getHandledRpcs())){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherServiceManifest(WeatherServiceManifest params1, WeatherServiceManifest params2){
+ if(params1 == null){
+ return ( params2 == null );
+ }
+ if(params2 == null){
+ return ( params1 == null );
+ }
+
+ if (!params1.getMaxHourlyForecastAmount().equals(params2.getMaxHourlyForecastAmount())){
+ return false;
+ }
+
+ if (!params1.getMaxMinutelyForecastAmount().equals(params2.getMaxMinutelyForecastAmount())){
+ return false;
+ }
+
+ if (!params1.getMaxMultidayForecastAmount().equals(params2.getMaxMultidayForecastAmount())){
+ return false;
+ }
+
+ if (params1.getCurrentForecastSupported()!=params2.getCurrentForecastSupported()){
+ return false;
+ }
+
+ if (params1.getWeatherForLocationSupported()!=params2.getWeatherForLocationSupported()){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateLocationDetails(LocationDetails params1, LocationDetails params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!params1.getAddressLines().equals(params2.getAddressLines())) {
+ return false;
+ }
+
+ if (!validateCoordinate(params1.getCoordinate(), params2.getCoordinate())) {
+ return false;
+ }
+
+ if (!params1.getLocationDescription().equals(params2.getLocationDescription())) {
+ return false;
+ }
+
+ if (!params1.getPhoneNumber().equals(params2.getPhoneNumber())) {
+ return false;
+ }
+
+ if (!validateImage(params1.getLocationImage(), params2.getLocationImage())) {
+ return false;
+ }
+
+ if (!params1.getLocationName().equals(params2.getLocationName())) {
+ return false;
+ }
+
+ if (!validateOasisAddress(params1.getSearchAddress(), params2.getSearchAddress())) {
+ return false;
+ }
+ return true;
+ }
+
public static boolean validateChoice(Choice choice1, Choice choice2){
if(choice1 == null){
return ( choice2 == null );
@@ -1217,6 +1463,7 @@ public class Validator{
return ( item1 == null );
}
+
if(item1.getCharacterSet() != item2.getCharacterSet()){
return false;
}
@@ -1274,6 +1521,425 @@ public class Validator{
return true;
}
+ public static boolean validateWeatherDataList(List<WeatherData> item1Array, List<WeatherData> item2Array) {
+ if(item1Array.size() != item2Array.size()){
+ return false;
+ }
+
+ for(int i = 0; i < item1Array.size(); i++){
+ if(!validateWeatherData(item1Array.get(i), item2Array.get(i))){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateWeatherData(WeatherData item1, WeatherData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateTemperature(item1.getCurrentTemperature(), item2.getCurrentTemperature())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getTemperatureHigh(), item2.getTemperatureHigh())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getTemperatureLow(), item2.getTemperatureLow())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getApparentTemperature(), item2.getApparentTemperature())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getApparentTemperatureHigh(), item2.getApparentTemperatureHigh())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getApparentTemperatureLow(), item2.getApparentTemperatureLow())) {
+ return false;
+ }
+
+ if (!item1.getWeatherSummary().equals(item2.getWeatherSummary())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getTime(), item2.getTime())) {
+ return false;
+ }
+
+ if (!item1.getHumidity().equals(item2.getHumidity())) {
+ return false;
+ }
+
+ if (!item1.getCloudCover().equals(item2.getCloudCover())) {
+ return false;
+ }
+
+ if (!item1.getMoonPhase().equals(item2.getMoonPhase())) {
+ return false;
+ }
+
+ if (!item1.getWindBearing().equals(item2.getWindBearing())) {
+ return false;
+ }
+
+ if (!item1.getWindGust().equals(item2.getWindGust())) {
+ return false;
+ }
+
+ if (!item1.getWindSpeed().equals(item2.getWindSpeed())) {
+ return false;
+ }
+
+ if (!item1.getNearestStormBearing().equals(item2.getNearestStormBearing())) {
+ return false;
+ }
+
+ if (!item1.getNearestStormDistance().equals(item2.getNearestStormDistance())) {
+ return false;
+ }
+
+ if (!item1.getPrecipAccumulation().equals(item2.getPrecipAccumulation())) {
+ return false;
+ }
+
+ if (!item1.getPrecipIntensity().equals(item2.getPrecipIntensity())) {
+ return false;
+ }
+
+ if (!item1.getPrecipProbability().equals(item2.getPrecipProbability())) {
+ return false;
+ }
+
+ if (!item1.getPrecipType().equals(item2.getPrecipType())) {
+ return false;
+ }
+
+ if (!item1.getVisibility().equals(item2.getVisibility())) {
+ return false;
+ }
+
+ if (!item1.getWeatherIconImageName().equals(item2.getWeatherIconImageName())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherAlertList(List<WeatherAlert> item1Array, List<WeatherAlert> item2Array) {
+ if(item1Array.size() != item2Array.size()){
+ return false;
+ }
+
+ for(int i = 0; i < item1Array.size(); i++){
+ if(!validateWeatherAlert(item1Array.get(i), item2Array.get(i))){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateNavigationInstructionList(List<NavigationInstruction> item1Array, List<NavigationInstruction> item2Array) {
+ if (item1Array == null && item2Array == null){
+ return true;
+ }
+
+ if (item1Array == null || item2Array == null){
+ return false;
+ }
+
+ if(item1Array.size() != item2Array.size()){
+ return false;
+ }
+
+ for(int i = 0; i < item1Array.size(); i++){
+ if(!validateNavigationInstruction(item1Array.get(i), item2Array.get(i))){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateNavigationInstruction(NavigationInstruction item1, NavigationInstruction item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateLocationDetails(item1.getLocationDetails(),item2.getLocationDetails())) {
+ return false;
+ }
+
+ if (!item1.getAction().equals(item2.getAction())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getEta(),item2.getEta())) {
+ return false;
+ }
+
+ if (!item1.getBearing().equals(item2.getBearing())) {
+ return false;
+ }
+
+ if (!item1.getJunctionType().equals(item2.getJunctionType())) {
+ return false;
+ }
+
+ if (!item1.getDrivingSide().equals(item2.getDrivingSide())) {
+ return false;
+ }
+
+ if (!item1.getDetails().equals(item2.getDetails())) {
+ return false;
+ }
+
+ if (!validateImage(item1.getImage(),item2.getImage())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateMediaServiceData(MediaServiceData item1, MediaServiceData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!item1.getMediaType().equals(item2.getMediaType())) {
+ return false;
+ }
+
+ if (!item1.getMediaTitle().equals(item2.getMediaTitle())) {
+ return false;
+ }
+
+ if (!item1.getMediaArtist().equals(item2.getMediaArtist())) {
+ return false;
+ }
+
+ if (!item1.getMediaAlbum().equals(item2.getMediaAlbum())) {
+ return false;
+ }
+
+ if (!item1.getPlaylistName().equals(item2.getPlaylistName())) {
+ return false;
+ }
+
+ if (!item1.getIsExplicit().equals(item2.getIsExplicit())) {
+ return false;
+ }
+
+ if (!item1.getTrackPlaybackProgress().equals(item2.getTrackPlaybackProgress())) {
+ return false;
+ }
+
+ if (!item1.getTrackPlaybackDuration().equals(item2.getTrackPlaybackDuration())) {
+ return false;
+ }
+
+ if (!item1.getQueuePlaybackProgress().equals(item2.getQueuePlaybackProgress())) {
+ return false;
+ }
+
+ if (!item1.getQueueCurrentTrackNumber().equals(item2.getQueueCurrentTrackNumber())) {
+ return false;
+ }
+
+ if (!item1.getQueuePlaybackDuration().equals(item2.getQueuePlaybackDuration())) {
+ return false;
+ }
+
+ if (!item1.getQueueTotalTrackCount().equals(item2.getQueueTotalTrackCount())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherServiceData(WeatherServiceData item1, WeatherServiceData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateLocationDetails(item1.getLocation(), item2.getLocation())) {
+ return false;
+ }
+
+ if (!validateWeatherData(item1.getCurrentForecast(), item2.getCurrentForecast())) {
+ return false;
+ }
+
+ if (!validateWeatherDataList(item1.getHourlyForecast(), item2.getHourlyForecast())) {
+ return false;
+ }
+
+ if (!validateWeatherDataList(item1.getMinuteForecast(), item2.getMinuteForecast())) {
+ return false;
+ }
+
+ if (!validateWeatherDataList(item1.getMultidayForecast(), item2.getMultidayForecast())) {
+ return false;
+ }
+
+ if (!validateWeatherAlertList(item1.getAlerts(), item2.getAlerts())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateNavigationServiceData(NavigationServiceData item1, NavigationServiceData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateDateTime(item1.getTimeStamp(), item2.getTimeStamp())) {
+ return false;
+ }
+
+ if (!validateLocationDetails(item1.getOrigin(), item2.getOrigin())) {
+ return false;
+ }
+
+ if (!validateLocationDetails(item1.getDestination(), item2.getDestination())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getDestinationETA(), item2.getDestinationETA())) {
+ return false;
+ }
+
+ if (!validateNavigationInstructionList(item1.getInstructions(), item2.getInstructions())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getNextInstructionETA(), item2.getNextInstructionETA())) {
+ return false;
+ }
+
+ if (item1.getNextInstructionDistance() != null && item2.getNextInstructionDistance() != null && !item1.getNextInstructionDistance().equals(item2.getNextInstructionDistance())) {
+ return false;
+ }
+
+ if (item1.getNextInstructionDistanceScale() != null && item2.getNextInstructionDistanceScale() != null && !item1.getNextInstructionDistanceScale().equals(item2.getNextInstructionDistanceScale())) {
+ return false;
+ }
+
+ if (item1.getPrompt() != null && item1.getPrompt() != null && !item1.getPrompt().equals(item2.getPrompt())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherAlert(WeatherAlert item1, WeatherAlert item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateDateTime(item1.getExpires(), item2.getExpires())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getTimeIssued(), item2.getTimeIssued())) {
+ return false;
+ }
+
+ if (!item1.getTitle().equals(item2.getTitle())) {
+ return false;
+ }
+
+ if (!item1.getSummary().equals(item2.getSummary())) {
+ return false;
+ }
+
+ if (!item1.getSeverity().equals(item2.getSeverity())) {
+ return false;
+ }
+
+ if (!validateStringList(item1.getRegions(), item2.getRegions())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateDateTime(DateTime item1, DateTime item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if(item1.getDay() != item2.getDay()){
+ return false;
+ }
+
+ if(item1.getHour() != item2.getHour()){
+ return false;
+ }
+
+ if(item1.getMilliSecond() != item2.getMilliSecond()){
+ return false;
+ }
+
+ if(item1.getMinute() != item2.getMinute()){
+ return false;
+ }
+
+ if(item1.getMonth() != item2.getMonth()){
+ return false;
+ }
+
+ if(item1.getSecond() != item2.getSecond()){
+ return false;
+ }
+
+ if(item1.getTzHour() != item2.getTzHour()){
+ return false;
+ }
+
+ if(item1.getTzMinute() != item2.getTzMinute()){
+ return false;
+ }
+
+ if(item1.getYear() != item2.getYear()){
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateGpsData(GPSData item1, GPSData item2){
if(item1 == null){
return ( item2 == null );
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
index 3797c648b..da48c692d 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
@@ -31,13 +31,16 @@ import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
+import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
+import com.smartdevicelink.proxy.rpc.GetFileResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
import com.smartdevicelink.proxy.rpc.ListFilesResponse;
+import com.smartdevicelink.proxy.rpc.OnAppServiceData;
import com.smartdevicelink.proxy.rpc.OnAudioPassThru;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
@@ -52,13 +55,17 @@ import com.smartdevicelink.proxy.rpc.OnLockScreenStatus;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
import com.smartdevicelink.proxy.rpc.OnRCStatus;
import com.smartdevicelink.proxy.rpc.OnStreamRPC;
+import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.OnTBTClientState;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.OnVehicleData;
import com.smartdevicelink.proxy.rpc.OnWayPointChange;
+import com.smartdevicelink.proxy.rpc.PerformAppServiceInteraction;
+import com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse;
import com.smartdevicelink.proxy.rpc.PerformAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
+import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
@@ -658,9 +665,39 @@ public class SdlProxyBaseTests extends AndroidTestCase2 {
}
- @Override
- public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
+ @Override
+ public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
- }
+ }
+
+ @Override
+ public void onPublishAppServiceResponse(PublishAppServiceResponse response) {
+
+ }
+
+ @Override
+ public void onGetAppServiceDataResponse(GetAppServiceDataResponse response) {
+
+ }
+
+ @Override
+ public void onGetFileResponse(GetFileResponse response) {
+
+ }
+
+ @Override
+ public void onPerformAppServiceInteractionResponse(PerformAppServiceInteractionResponse response) {
+
+ }
+
+ @Override
+ public void onOnAppServiceData(OnAppServiceData notification) {
+
+ }
+
+ @Override
+ public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification) {
+
+ }
}
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
index 91bd19d34..91fbf6dde 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
@@ -173,6 +173,9 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
public void sendRPCRequest(RPCRequest message) {}
@Override
+ public void sendRPC(RPCRequest message) {}
+
+ @Override
public void sendRequests(List<? extends RPCRequest> rpcs, OnMultipleRequestListener listener) {
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
new file mode 100644
index 000000000..6bd5fe01e
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
@@ -0,0 +1,86 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.AppServiceRecord;
+import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServiceCapability}
+ */
+public class AppServiceCapabilityTest extends TestCase {
+
+ private AppServiceCapability msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new AppServiceCapability();
+ msg.setUpdatedAppServiceRecord(Test.GENERAL_APP_SERVICE_RECORD);
+ msg.setUpdateReason(Test.GENERAL_SERVICE_UPDATE_REASON);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ AppServiceRecord serviceRecord = msg.getUpdatedAppServiceRecord();
+ ServiceUpdateReason updateReason = msg.getUpdateReason();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, serviceRecord, Test.GENERAL_APP_SERVICE_RECORD);
+ assertEquals(Test.MATCH, updateReason, Test.GENERAL_SERVICE_UPDATE_REASON);
+
+ // Invalid/Null Tests
+ AppServiceCapability msg = new AppServiceCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getUpdatedAppServiceRecord());
+ assertNull(Test.NULL, msg.getUpdateReason());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new AppServiceCapability(Test.GENERAL_APP_SERVICE_RECORD);
+ AppServiceRecord serviceRecord = msg.getUpdatedAppServiceRecord();
+ assertEquals(Test.MATCH, serviceRecord, Test.GENERAL_APP_SERVICE_RECORD);
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(AppServiceCapability.KEY_UPDATE_REASON, Test.GENERAL_SERVICE_UPDATE_REASON);
+ reference.put(AppServiceCapability.KEY_UPDATED_APP_SERVICE_RECORD, Test.GENERAL_APP_SERVICE_RECORD);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(AppServiceCapability.KEY_UPDATED_APP_SERVICE_RECORD)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateAppServiceRecord(Test.GENERAL_APP_SERVICE_RECORD, new AppServiceRecord(hashTest)));
+ } else{
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
new file mode 100644
index 000000000..9fec35631
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
@@ -0,0 +1,118 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.AppServiceData;
+import com.smartdevicelink.proxy.rpc.MediaServiceData;
+import com.smartdevicelink.proxy.rpc.NavigationServiceData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceData;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServiceData}
+ */
+public class AppServiceDataTests extends TestCase {
+
+ private AppServiceData msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new AppServiceData();
+ msg.setServiceType(Test.GENERAL_STRING);
+ msg.setServiceId(Test.GENERAL_STRING);
+ msg.setMediaServiceData(Test.GENERAL_MEDIASERVICE_DATA);
+ msg.setWeatherServiceData(Test.GENERAL_WEATHERSERVICE_DATA);
+ msg.setNavigationServiceData(Test.GENERAL_NAVIGATIONSERVICE_DATA);
+
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String appServiceType = msg.getServiceType();
+ String serviceId = msg.getServiceId();
+ MediaServiceData mediaServiceData = msg.getMediaServiceData();
+ WeatherServiceData weatherServiceData = msg.getWeatherServiceData();
+ NavigationServiceData navigationServiceData = msg.getNavigationServiceData();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_STRING, appServiceType);
+ assertEquals(Test.GENERAL_STRING, serviceId);
+ assertEquals(Test.GENERAL_MEDIASERVICE_DATA, mediaServiceData);
+ assertEquals(Test.GENERAL_WEATHERSERVICE_DATA, weatherServiceData);
+ assertEquals(Test.GENERAL_NAVIGATIONSERVICE_DATA, navigationServiceData);
+
+ // Invalid/Null Tests
+ AppServiceData msg = new AppServiceData();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getServiceType());
+ assertNull(Test.NULL, msg.getServiceId());
+ assertNull(Test.NULL, msg.getMediaServiceData());
+ assertNull(Test.NULL, msg.getWeatherServiceData());
+ assertNull(Test.NULL, msg.getNavigationServiceData());
+
+ }
+
+ public void testRequiredParamsConstructor(){
+
+ msg = new AppServiceData(Test.GENERAL_STRING, Test.GENERAL_STRING);
+ String appServiceType = msg.getServiceType();
+ String serviceId = msg.getServiceId();
+ assertEquals(Test.GENERAL_STRING, appServiceType);
+ assertEquals(Test.GENERAL_STRING, serviceId);
+
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(AppServiceData.KEY_SERVICE_TYPE, Test.GENERAL_STRING);
+ reference.put(AppServiceData.KEY_SERVICE_ID, Test.GENERAL_STRING);
+ reference.put(AppServiceData.KEY_MEDIA_SERVICE_DATA, Test.GENERAL_MEDIASERVICE_DATA);
+ reference.put(AppServiceData.KEY_WEATHER_SERVICE_DATA, Test.GENERAL_WEATHERSERVICE_DATA);
+ reference.put(AppServiceData.KEY_NAVIGATION_SERVICE_DATA, Test.GENERAL_NAVIGATIONSERVICE_DATA);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if (key.equals(AppServiceData.KEY_MEDIA_SERVICE_DATA)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateMediaServiceData(Test.GENERAL_MEDIASERVICE_DATA, new MediaServiceData(hashTest)));
+ } else if (key.equals(AppServiceData.KEY_WEATHER_SERVICE_DATA)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateWeatherServiceData(Test.GENERAL_WEATHERSERVICE_DATA, new WeatherServiceData(hashTest)));
+ } else if (key.equals(AppServiceData.KEY_NAVIGATION_SERVICE_DATA)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateNavigationServiceData(Test.GENERAL_NAVIGATIONSERVICE_DATA, new NavigationServiceData(hashTest)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
new file mode 100644
index 000000000..99bd5b716
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
@@ -0,0 +1,148 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.AppServiceManifest;
+import com.smartdevicelink.proxy.rpc.Image;
+import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
+import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServiceManifest}
+ */
+public class AppServiceManifestTests extends TestCase {
+
+ private AppServiceManifest msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new AppServiceManifest();
+ msg.setServiceType(Test.GENERAL_STRING);
+ msg.setAllowAppConsumers(Test.GENERAL_BOOLEAN);
+ msg.setHandledRpcs(Test.GENERAL_FUNCTION_ID_LIST);
+ msg.setMediaServiceManifest(Test.GENERAL_MEDIA_SERVICE_MANIFEST);
+ msg.setRpcSpecVersion(Test.GENERAL_SDLMSGVERSION);
+ msg.setServiceIcon(Test.GENERAL_IMAGE);
+ msg.setServiceName(Test.GENERAL_STRING);
+ msg.setWeatherServiceManifest(Test.GENERAL_WEATHER_SERVICE_MANIFEST);
+ msg.setNavigationServiceManifest(Test.GENERAL_NAVIGATION_SERVICE_MANIFEST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Image serviceIcon = msg.getServiceIcon();
+ String serviceName = msg.getServiceName();
+ String appServiceType = msg.getServiceType();
+ boolean allowAppConsumers = msg.getAllowAppConsumers();
+ SdlMsgVersion version = msg.getRpcSpecVersion();
+ List<Integer> handledRPCs = msg.getHandledRpcs();
+ WeatherServiceManifest weatherServiceManifestTest = msg.getWeatherServiceManifest();
+ MediaServiceManifest mediaServiceManifestTest = msg.getMediaServiceManifest();
+ NavigationServiceManifest navigationServiceManifest = msg.getNavigationServiceManifest();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_BOOLEAN, allowAppConsumers);
+ assertEquals(Test.GENERAL_IMAGE, serviceIcon);
+ assertEquals(Test.GENERAL_STRING, serviceName);
+ assertEquals(Test.GENERAL_STRING, appServiceType);
+ assertEquals(Test.GENERAL_SDLMSGVERSION, version);
+ assertEquals(Test.MATCH, Test.GENERAL_FUNCTION_ID_LIST, handledRPCs);
+ assertEquals(Test.GENERAL_WEATHER_SERVICE_MANIFEST, weatherServiceManifestTest);
+ assertEquals(Test.GENERAL_MEDIA_SERVICE_MANIFEST, mediaServiceManifestTest);
+ assertEquals(Test.GENERAL_NAVIGATION_SERVICE_MANIFEST, navigationServiceManifest);
+
+ // Invalid/Null Tests
+ AppServiceManifest msg = new AppServiceManifest();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getServiceIcon());
+ assertNull(Test.NULL, msg.getServiceName());
+ assertNull(Test.NULL, msg.getServiceType());
+ assertNull(Test.NULL, msg.getAllowAppConsumers());
+ assertNull(Test.NULL, msg.getRpcSpecVersion());
+ assertNull(Test.NULL, msg.getHandledRpcs());
+ assertNull(Test.NULL, msg.getWeatherServiceManifest());
+ assertNull(Test.NULL, msg.getMediaServiceManifest());
+ assertNull(Test.NULL, msg.getNavigationServiceManifest());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new AppServiceManifest(Test.GENERAL_STRING);
+ String appServiceType = msg.getServiceType();
+ assertEquals(Test.GENERAL_STRING, appServiceType);
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(AppServiceManifest.KEY_SERVICE_NAME, Test.GENERAL_STRING);
+ reference.put(AppServiceManifest.KEY_SERVICE_ICON, Test.GENERAL_IMAGE);
+ reference.put(AppServiceManifest.KEY_SERVICE_TYPE, Test.GENERAL_STRING);
+ reference.put(AppServiceManifest.KEY_ALLOW_APP_CONSUMERS, Test.GENERAL_BOOLEAN);
+ reference.put(AppServiceManifest.KEY_RPC_SPEC_VERSION, Test.GENERAL_SDLMSGVERSION.serializeJSON());
+ reference.put(AppServiceManifest.KEY_HANDLED_RPCS, Test.GENERAL_FUNCTION_ID_LIST);
+ reference.put(AppServiceManifest.KEY_WEATHER_SERVICE_MANIFEST, Test.GENERAL_WEATHER_SERVICE_MANIFEST);
+ reference.put(AppServiceManifest.KEY_MEDIA_SERVICE_MANIFEST, Test.GENERAL_MEDIA_SERVICE_MANIFEST);
+ reference.put(AppServiceManifest.KEY_NAVIGATION_SERVICE_MANIFEST, Test.GENERAL_NAVIGATION_SERVICE_MANIFEST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(AppServiceManifest.KEY_RPC_SPEC_VERSION)){
+ JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateSdlMsgVersion( new SdlMsgVersion(hashReference), new SdlMsgVersion(hashTest)));
+ }else if(key.equals(AppServiceManifest.KEY_HANDLED_RPCS)){
+ List<Integer> list1 = Test.GENERAL_FUNCTION_ID_LIST;
+ List<Integer> list2 = JsonUtils.readIntegerListFromJsonObject(underTest, key);
+ assertTrue(Test.TRUE, Validator.validateIntegerList(list1,list2));
+ }else if(key.equals(AppServiceManifest.KEY_WEATHER_SERVICE_MANIFEST)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateWeatherServiceManifest( Test.GENERAL_WEATHER_SERVICE_MANIFEST, new WeatherServiceManifest(hashTest)));
+ }else if(key.equals(AppServiceManifest.KEY_MEDIA_SERVICE_MANIFEST)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateMediaServiceManifest( Test.GENERAL_MEDIA_SERVICE_MANIFEST, new MediaServiceManifest(hashTest)));
+ } else if(key.equals(AppServiceManifest.KEY_NAVIGATION_SERVICE_MANIFEST)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateNavigationServiceManifest( Test.GENERAL_NAVIGATION_SERVICE_MANIFEST, new NavigationServiceManifest(hashTest)));
+ }else if(key.equals(AppServiceManifest.KEY_SERVICE_ICON)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(testEquals));
+ assertTrue(Test.TRUE, Validator.validateImage(refIcon1, msg.getServiceIcon()));
+ }else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
new file mode 100644
index 000000000..af58b12fb
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
@@ -0,0 +1,107 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.AppServiceManifest;
+import com.smartdevicelink.proxy.rpc.AppServiceRecord;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServiceRecord}
+ */
+public class AppServiceRecordTests extends TestCase {
+
+ private AppServiceRecord msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new AppServiceRecord();
+ msg.setServicePublished(Test.GENERAL_BOOLEAN);
+ msg.setServiceActive(Test.GENERAL_BOOLEAN);
+ msg.setServiceManifest(Test.GENERAL_APP_SERVICE_MANIFEST);
+ msg.setServiceId(Test.GENERAL_STRING);
+
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+
+ boolean isServicePublished = msg.getServicePublished();
+ boolean isServiceActive = msg.getServiceActive();
+ AppServiceManifest serviceManifest = msg.getServiceManifest();
+ String serviceID = msg.getServiceId();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_BOOLEAN, isServicePublished);
+ assertEquals(Test.GENERAL_BOOLEAN, isServiceActive);
+ assertEquals(Test.GENERAL_APP_SERVICE_MANIFEST, serviceManifest);
+ assertEquals(Test.GENERAL_STRING, serviceID);
+
+ // Invalid/Null Tests
+ AppServiceRecord msg = new AppServiceRecord();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getServicePublished());
+ assertNull(Test.NULL, msg.getServiceActive());
+ assertNull(Test.NULL, msg.getServiceManifest());
+ assertNull(Test.NULL, msg.getServiceId());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new AppServiceRecord(Test.GENERAL_STRING, Test.GENERAL_APP_SERVICE_MANIFEST, Test.GENERAL_BOOLEAN, Test.GENERAL_BOOLEAN);
+
+ boolean isServicePublished = msg.getServicePublished();
+ boolean isServiceActive = msg.getServiceActive();
+ AppServiceManifest serviceManifest = msg.getServiceManifest();
+ String serviceID = msg.getServiceId();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_BOOLEAN, isServicePublished);
+ assertEquals(Test.GENERAL_BOOLEAN, isServiceActive);
+ assertEquals(Test.GENERAL_APP_SERVICE_MANIFEST, serviceManifest);
+ assertEquals(Test.GENERAL_STRING, serviceID);
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(AppServiceRecord.KEY_SERVICE_ACTIVE, Test.GENERAL_BOOLEAN);
+ reference.put(AppServiceRecord.KEY_SERVICE_PUBLISHED, Test.GENERAL_BOOLEAN);
+ reference.put(AppServiceRecord.KEY_SERVICE_ID, Test.GENERAL_STRING);
+ reference.put(AppServiceRecord.KEY_SERVICE_MANIFEST, Test.GENERAL_APP_SERVICE_MANIFEST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(AppServiceRecord.KEY_SERVICE_MANIFEST)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateAppServiceManifest( Test.GENERAL_APP_SERVICE_MANIFEST, new AppServiceManifest(hashTest)));
+ }else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
new file mode 100644
index 000000000..bb2d102f2
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServicesCapabilities}
+ */
+public class AppServicesCapabilitiesTests extends TestCase {
+
+ private AppServicesCapabilities msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new AppServicesCapabilities();
+ msg.setAppServices(Test.GENERAL_APPSERVICECAPABILITY_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ List<AppServiceCapability> serviceCapabilityList = msg.getAppServices();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, serviceCapabilityList, Test.GENERAL_APPSERVICECAPABILITY_LIST);
+
+ // Invalid/Null Tests
+ AppServicesCapabilities msg = new AppServicesCapabilities();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getAppServices());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(AppServicesCapabilities.KEY_APP_SERVICES, Test.GENERAL_APPSERVICETYPE_LIST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(AppServicesCapabilities.KEY_APP_SERVICES)) {
+ List<AppServiceCapability> list1 = Test.GENERAL_APPSERVICECAPABILITY_LIST;
+ List<AppServiceCapability> list2 = JsonUtils.readAppServiceCapabilityListFromJsonObject(underTest, key);
+ assertTrue(Test.TRUE, Validator.validateAppServiceCapabilityList(list1,list2));
+ }else{
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
new file mode 100644
index 000000000..2b4c352c5
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
@@ -0,0 +1,121 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.MediaServiceData;
+import com.smartdevicelink.proxy.rpc.enums.MediaType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.MediaServiceData}
+ */
+public class MediaServiceDataTests extends TestCase {
+
+ private MediaServiceData msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new MediaServiceData();
+ msg.setMediaType(Test.GENERAL_MEDIATYPE);
+ msg.setMediaTitle(Test.GENERAL_STRING);
+ msg.setMediaArtist(Test.GENERAL_STRING);
+ msg.setMediaAlbum(Test.GENERAL_STRING);
+ msg.setPlaylistName(Test.GENERAL_STRING);
+ msg.setIsExplicit(Test.GENERAL_BOOLEAN);
+ msg.setTrackPlaybackProgress(Test.GENERAL_INTEGER);
+ msg.setTrackPlaybackDuration(Test.GENERAL_INTEGER);
+ msg.setQueuePlaybackProgress(Test.GENERAL_INTEGER);
+ msg.setQueuePlaybackDuration(Test.GENERAL_INTEGER);
+ msg.setQueueCurrentTrackNumber(Test.GENERAL_INTEGER);
+ msg.setQueueTotalTrackCount(Test.GENERAL_INTEGER);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ MediaType mediaType = msg.getMediaType();
+ String mediaTitle = msg.getMediaTitle();
+ String mediaArtist = msg.getMediaArtist();
+ String mediaAlbum = msg.getMediaAlbum();
+ String playlistName = msg.getPlaylistName();
+ boolean isExplicit = msg.getIsExplicit();
+ Integer trackPlaybackProgress = msg.getTrackPlaybackProgress();
+ Integer trackPlaybackDuration = msg.getTrackPlaybackDuration();
+ Integer queuePlaybackProgress = msg.getQueuePlaybackProgress();
+ Integer queuePlaybackDuration = msg.getQueuePlaybackDuration();
+ Integer queueCurrentTrackNumber = msg.getQueueCurrentTrackNumber();
+ Integer queueTotalTrackCount = msg.getQueueTotalTrackCount();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_MEDIATYPE, mediaType);
+ assertEquals(Test.GENERAL_STRING, mediaTitle);
+ assertEquals(Test.GENERAL_STRING, mediaArtist);
+ assertEquals(Test.GENERAL_STRING, mediaAlbum);
+ assertEquals(Test.GENERAL_STRING, playlistName);
+ assertEquals(Test.GENERAL_BOOLEAN, isExplicit);
+ assertEquals(Test.GENERAL_INTEGER, trackPlaybackProgress);
+ assertEquals(Test.GENERAL_INTEGER, trackPlaybackDuration);
+ assertEquals(Test.GENERAL_INTEGER, queuePlaybackProgress);
+ assertEquals(Test.GENERAL_INTEGER, queuePlaybackDuration);
+ assertEquals(Test.GENERAL_INTEGER, queueCurrentTrackNumber);
+ assertEquals(Test.GENERAL_INTEGER, queueTotalTrackCount);
+
+ // Invalid/Null Tests
+ MediaServiceData msg = new MediaServiceData();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getMediaType());
+ assertNull(Test.NULL, msg.getMediaTitle());
+ assertNull(Test.NULL, msg.getMediaArtist());
+ assertNull(Test.NULL, msg.getMediaAlbum());
+ assertNull(Test.NULL, msg.getPlaylistName());
+ assertNull(Test.NULL, msg.getIsExplicit());
+ assertNull(Test.NULL, msg.getTrackPlaybackProgress());
+ assertNull(Test.NULL, msg.getTrackPlaybackDuration());
+ assertNull(Test.NULL, msg.getQueuePlaybackProgress());
+ assertNull(Test.NULL, msg.getQueuePlaybackDuration());
+ assertNull(Test.NULL, msg.getQueueCurrentTrackNumber());
+ assertNull(Test.NULL, msg.getQueueTotalTrackCount());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(MediaServiceData.KEY_MEDIA_TYPE, Test.GENERAL_MEDIATYPE);
+ reference.put(MediaServiceData.KEY_MEDIA_TITLE, Test.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_MEDIA_ARTIST, Test.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_MEDIA_ALBUM, Test.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_PLAYLIST_NAME, Test.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_IS_EXPLICIT, Test.GENERAL_BOOLEAN);
+ reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_PROGRESS, Test.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_DURATION, Test.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_PROGRESS, Test.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_DURATION, Test.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_CURRENT_TRACK_NUMBER, Test.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_TOTAL_TRACK_COUNT, Test.GENERAL_INTEGER);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
new file mode 100644
index 000000000..85332bc0c
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
@@ -0,0 +1,30 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.MediaServiceManifest}
+ */
+public class MediaServiceManifestTests extends TestCase {
+
+ @Override
+ public void setUp(){
+ // nothing to setup yet, this class doesn't contain anything
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+
+ // Invalid/Null Tests
+ MediaServiceManifest msg = new MediaServiceManifest();
+ assertNotNull(Test.NOT_NULL, msg);
+ }
+
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
new file mode 100644
index 000000000..38500561b
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
@@ -0,0 +1,134 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DateTime;
+import com.smartdevicelink.proxy.rpc.Image;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
+import com.smartdevicelink.proxy.rpc.NavigationInstruction;
+import com.smartdevicelink.proxy.rpc.enums.Direction;
+import com.smartdevicelink.proxy.rpc.enums.NavigationAction;
+import com.smartdevicelink.proxy.rpc.enums.NavigationJunction;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.NavigationInstruction}
+ */
+public class NavigationInstructionTests extends TestCase {
+
+ private NavigationInstruction msg;
+
+ @Override
+ public void setUp(){
+ msg = new NavigationInstruction();
+
+ msg.setLocationDetails(Test.GENERAL_LOCATIONDETAILS);
+ msg.setAction(Test.GENERAL_NAVIGATION_ACTION);
+ msg.setEta(Test.GENERAL_DATETIME);
+ msg.setBearing(Test.GENERAL_INTEGER);
+ msg.setJunctionType(Test.GENERAL_NAVIGATION_JUNCTION);
+ msg.setDrivingSide(Test.GENERAL_DIRECTION);
+ msg.setDetails(Test.GENERAL_STRING);
+ msg.setImage(Test.GENERAL_IMAGE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ LocationDetails locationDetails = msg.getLocationDetails();
+ NavigationAction action = msg.getAction();
+ DateTime eta = msg.getEta();
+ Integer bearing = msg.getBearing();
+ NavigationJunction junctionType = msg.getJunctionType();
+ Direction drivingSide = msg.getDrivingSide();
+ String details = msg.getDetails();
+ Image image = msg.getImage();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_LOCATIONDETAILS, locationDetails);
+ assertEquals(Test.GENERAL_NAVIGATION_ACTION, action);
+ assertEquals(Test.GENERAL_DATETIME, eta);
+ assertEquals(Test.GENERAL_INTEGER, bearing);
+ assertEquals(Test.GENERAL_NAVIGATION_JUNCTION, junctionType);
+ assertEquals(Test.GENERAL_DIRECTION, drivingSide);
+ assertEquals(Test.GENERAL_STRING, details);
+ assertEquals(Test.GENERAL_IMAGE, image);
+
+ // Invalid/Null Tests
+ NavigationInstruction msg = new NavigationInstruction();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getLocationDetails());
+ assertNull(Test.NULL, msg.getAction());
+ assertNull(Test.NULL, msg.getEta());
+ assertNull(Test.NULL, msg.getBearing());
+ assertNull(Test.NULL, msg.getJunctionType());
+ assertNull(Test.NULL, msg.getDrivingSide());
+ assertNull(Test.NULL, msg.getDetails());
+ assertNull(Test.NULL, msg.getImage());
+ }
+
+ public void testRequiredConstructor(){
+ NavigationInstruction msg = new NavigationInstruction(Test.GENERAL_LOCATIONDETAILS, Test.GENERAL_NAVIGATION_ACTION);
+ assertNotNull(Test.NOT_NULL, msg);
+
+ LocationDetails locationDetails = msg.getLocationDetails();
+ NavigationAction action = msg.getAction();
+
+ assertEquals(Test.GENERAL_LOCATIONDETAILS, locationDetails);
+ assertEquals(Test.GENERAL_NAVIGATION_ACTION, action);
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(NavigationInstruction.KEY_LOCATION_DETAILS, Test.GENERAL_LOCATIONDETAILS);
+ reference.put(NavigationInstruction.KEY_ACTION, Test.GENERAL_NAVIGATION_ACTION);
+ reference.put(NavigationInstruction.KEY_ETA, Test.GENERAL_DATETIME);
+ reference.put(NavigationInstruction.KEY_BEARING, Test.GENERAL_INTEGER);
+ reference.put(NavigationInstruction.KEY_JUNCTION_TYPE, Test.GENERAL_NAVIGATION_JUNCTION);
+ reference.put(NavigationInstruction.KEY_DRIVING_SIDE, Test.GENERAL_DIRECTION);
+ reference.put(NavigationInstruction.KEY_DETAILS, Test.GENERAL_STRING);
+ reference.put(NavigationInstruction.KEY_IMAGE, Test.GENERAL_IMAGE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(NavigationInstruction.KEY_IMAGE)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(testEquals));
+ assertTrue(Test.TRUE, Validator.validateImage(refIcon1, msg.getImage()));
+ }else if(key.equals(NavigationInstruction.KEY_LOCATION_DETAILS)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateLocationDetails( Test.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
+ }else if (key.equals(NavigationInstruction.KEY_ETA)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateDateTime(Test.GENERAL_DATETIME, new DateTime(hashTest)));
+ }else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
new file mode 100644
index 000000000..9b59062d4
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
@@ -0,0 +1,143 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DateTime;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
+import com.smartdevicelink.proxy.rpc.NavigationInstruction;
+import com.smartdevicelink.proxy.rpc.NavigationServiceData;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.NavigationServiceData}
+ */
+public class NavigationServiceDataTests extends TestCase {
+
+ private NavigationServiceData msg;
+
+ @Override
+ public void setUp(){
+ msg = new NavigationServiceData();
+
+ msg.setTimeStamp(Test.GENERAL_DATETIME);
+ msg.setOrigin(Test.GENERAL_LOCATIONDETAILS);
+ msg.setDestination(Test.GENERAL_LOCATIONDETAILS);
+ msg.setDestinationETA(Test.GENERAL_DATETIME);
+ msg.setInstructions(Test.GENERAL_NAVIGATION_INSTRUCTION_LIST);
+ msg.setNextInstructionETA(Test.GENERAL_DATETIME);
+ msg.setNextInstructionDistance(Test.GENERAL_FLOAT);
+ msg.setNextInstructionDistanceScale(Test.GENERAL_FLOAT);
+ msg.setPrompt(Test.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ DateTime timestamp = msg.getTimeStamp();
+ LocationDetails origin = msg.getOrigin();
+ LocationDetails destination = msg.getDestination();
+ DateTime destinationETA = msg.getDestinationETA();
+ List<NavigationInstruction> instructions = msg.getInstructions();
+ DateTime nextInstructionETA = msg.getNextInstructionETA();
+ Float nextInstructionDistance = msg.getNextInstructionDistance();
+ Float nextInstructionDistanceScale = msg.getNextInstructionDistanceScale();
+ String prompt = msg.getPrompt();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_DATETIME, timestamp);
+ assertEquals(Test.GENERAL_LOCATIONDETAILS, origin);
+ assertEquals(Test.GENERAL_LOCATIONDETAILS, destination);
+ assertEquals(Test.GENERAL_DATETIME, destinationETA);
+ assertEquals(Test.GENERAL_NAVIGATION_INSTRUCTION_LIST, instructions);
+ assertEquals(Test.GENERAL_DATETIME, nextInstructionETA);
+ assertEquals(Test.GENERAL_FLOAT, nextInstructionDistance);
+ assertEquals(Test.GENERAL_FLOAT, nextInstructionDistanceScale);
+ assertEquals(Test.GENERAL_STRING, prompt);
+
+ // Invalid/Null Tests
+ NavigationServiceData msg = new NavigationServiceData();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getTimeStamp());
+ assertNull(Test.NULL, msg.getOrigin());
+ assertNull(Test.NULL, msg.getDestination());
+ assertNull(Test.NULL, msg.getDestinationETA());
+ assertNull(Test.NULL, msg.getInstructions());
+ assertNull(Test.NULL, msg.getNextInstructionETA());
+ assertNull(Test.NULL, msg.getNextInstructionDistance());
+ assertNull(Test.NULL, msg.getNextInstructionDistanceScale());
+ assertNull(Test.NULL, msg.getPrompt());
+ }
+
+ public void testRequiredConstructor(){
+ NavigationServiceData msg = new NavigationServiceData(Test.GENERAL_DATETIME);
+ assertNotNull(Test.NOT_NULL, msg);
+
+ DateTime locationDetails = msg.getTimeStamp();
+
+ assertEquals(Test.GENERAL_DATETIME, locationDetails);
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(NavigationServiceData.KEY_TIMESTAMP, Test.GENERAL_DATETIME);
+ reference.put(NavigationServiceData.KEY_ORIGIN, Test.GENERAL_LOCATIONDETAILS);
+ reference.put(NavigationServiceData.KEY_DESTINATION, Test.GENERAL_LOCATIONDETAILS);
+ reference.put(NavigationServiceData.KEY_DESTINATION_ETA, Test.GENERAL_DATETIME);
+ reference.put(NavigationServiceData.KEY_INSTRUCTIONS, Test.GENERAL_NAVIGATION_INSTRUCTION_LIST);
+ reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_ETA, Test.GENERAL_DATETIME);
+ reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE, Test.GENERAL_FLOAT);
+ reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE_SCALE, Test.GENERAL_FLOAT);
+ reference.put(NavigationServiceData.KEY_PROMPT, Test.GENERAL_STRING);
+
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(NavigationServiceData.KEY_TIMESTAMP)||key.equals(NavigationServiceData.KEY_DESTINATION_ETA)||key.equals(NavigationServiceData.KEY_NEXT_INSTRUCTION_ETA)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateDateTime(Test.GENERAL_DATETIME, new DateTime(hashTest)));
+ }else if(key.equals(NavigationServiceData.KEY_DESTINATION)||key.equals(NavigationServiceData.KEY_ORIGIN)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateLocationDetails( Test.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
+ }else if (key.equals(NavigationServiceData.KEY_INSTRUCTIONS)){
+ JSONArray NavigationInstructionUnderTestListArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<NavigationInstruction> NavigationInstructionUnderTestList = new ArrayList<>();
+ for (int index = 0; index < NavigationInstructionUnderTestListArrayObjTest.length(); index++) {
+ NavigationInstruction NavigationInstructionData = new NavigationInstruction(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)NavigationInstructionUnderTestListArrayObjTest.get(index) ));
+ NavigationInstructionUnderTestList.add(NavigationInstructionData);
+ }
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateNavigationInstructionList(Test.GENERAL_NAVIGATION_INSTRUCTION_LIST, NavigationInstructionUnderTestList));
+ }else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
new file mode 100644
index 000000000..de4144677
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
@@ -0,0 +1,64 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.NavigationServiceManifest}
+ */
+public class NavigationServiceManifestTests extends TestCase {
+
+ private NavigationServiceManifest msg;
+
+ @Override
+ public void setUp(){
+ msg = new NavigationServiceManifest();
+
+ msg.setAcceptsWayPoints(Test.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ boolean acceptsWayPoints = msg.getAcceptsWayPoints();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_BOOLEAN, acceptsWayPoints);
+
+ // Invalid/Null Tests
+ NavigationServiceManifest msg = new NavigationServiceManifest();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getAcceptsWayPoints());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(NavigationServiceManifest.KEY_ACCEPTS_WAY_POINTS, Test.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
index aa0d75c07..bc50907db 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
@@ -1,6 +1,9 @@
package com.smartdevicelink.test.rpc.datatypes;
+import android.util.Log;
+
import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.PhoneCapability;
import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
@@ -20,7 +23,7 @@ import java.util.Iterator;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.SystemCapability}
+ * {@link com.smartdevicelink.proxy.rpc.SystemCapability}
*/
public class SystemCapabilityTests extends TestCase {
@@ -34,6 +37,7 @@ public class SystemCapabilityTests extends TestCase {
msg.setCapabilityForType(SystemCapabilityType.NAVIGATION, Test.GENERAL_NAVIGATIONCAPABILITY);
msg.setCapabilityForType(SystemCapabilityType.PHONE_CALL, Test.GENERAL_PHONECAPABILITY);
msg.setCapabilityForType(SystemCapabilityType.REMOTE_CONTROL, Test.GENERAL_REMOTECONTROLCAPABILITIES);
+ msg.setCapabilityForType(SystemCapabilityType.APP_SERVICES, Test.GENERAL_APP_SERVICE_CAPABILITIES);
}
@@ -46,12 +50,14 @@ public class SystemCapabilityTests extends TestCase {
NavigationCapability testNavigationCapability = (NavigationCapability) msg.getCapabilityForType(SystemCapabilityType.NAVIGATION);
PhoneCapability testPhoneCapability = (PhoneCapability) msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL);
RemoteControlCapabilities testRemoteControlCapabilities = (RemoteControlCapabilities) msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL);
+ AppServicesCapabilities testAppServicesCapabilities = (AppServicesCapabilities) msg.getCapabilityForType(SystemCapabilityType.APP_SERVICES);
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITYTYPE, testType);
assertTrue(Test.TRUE, Validator.validateNavigationCapability(Test.GENERAL_NAVIGATIONCAPABILITY, testNavigationCapability));
assertTrue(Test.TRUE, Validator.validatePhoneCapability(Test.GENERAL_PHONECAPABILITY, testPhoneCapability));
assertTrue(Test.TRUE, Validator.validateRemoteControlCapabilities(Test.GENERAL_REMOTECONTROLCAPABILITIES, testRemoteControlCapabilities));
+ assertTrue(Test.TRUE, Validator.validateAppServiceCapabilities(Test.GENERAL_APP_SERVICE_CAPABILITIES, testAppServicesCapabilities));
// Invalid/Null Tests
SystemCapability msg = new SystemCapability();
@@ -61,6 +67,7 @@ public class SystemCapabilityTests extends TestCase {
assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.NAVIGATION));
assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL));
assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL));
+ assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.APP_SERVICES));
}
public void testJson() {
@@ -71,6 +78,7 @@ public class SystemCapabilityTests extends TestCase {
reference.put(SystemCapability.KEY_NAVIGATION_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_NAVIGATIONCAPABILITY.getStore()));
reference.put(SystemCapability.KEY_PHONE_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_PHONECAPABILITY.getStore()));
reference.put(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_REMOTECONTROLCAPABILITIES.getStore()));
+ reference.put(SystemCapability.KEY_APP_SERVICES_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APP_SERVICE_CAPABILITIES.getStore()));
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -97,6 +105,14 @@ public class SystemCapabilityTests extends TestCase {
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
assertTrue(Test.TRUE, Validator.validateRemoteControlCapabilities( new RemoteControlCapabilities(hashReference), new RemoteControlCapabilities(hashTest)));
+ }else if(key.equals(SystemCapability.KEY_APP_SERVICES_CAPABILITIES)){
+ JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ Log.i("TEST REF", hashReference.toString());
+ Log.i("TEST TEST", hashTest.toString());
+ assertTrue(Test.TRUE, Validator.validateAppServiceCapabilities( new AppServicesCapabilities(hashReference), new AppServicesCapabilities(hashTest)));
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
new file mode 100644
index 000000000..4a8ade572
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
@@ -0,0 +1,112 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DateTime;
+import com.smartdevicelink.proxy.rpc.WeatherAlert;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WeatherAlert}
+ */
+public class WeatherAlertTests extends TestCase {
+
+ private WeatherAlert msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new WeatherAlert();
+ msg.setExpires(Test.GENERAL_DATETIME);
+ msg.setTimeIssued(Test.GENERAL_DATETIME);
+ msg.setRegions(Test.GENERAL_STRING_LIST);
+ msg.setSeverity(Test.GENERAL_STRING);
+ msg.setSummary(Test.GENERAL_STRING);
+ msg.setTitle(Test.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ DateTime expires = msg.getExpires();
+ DateTime issued = msg.getTimeIssued();
+ List<String> regions = msg.getRegions();
+ String severity = msg.getSeverity();
+ String summary = msg.getSummary();
+ String title = msg.getTitle();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, expires, Test.GENERAL_DATETIME);
+ assertEquals(Test.MATCH, issued, Test.GENERAL_DATETIME);
+ assertEquals(Test.MATCH, regions, Test.GENERAL_STRING_LIST);
+ assertEquals(Test.MATCH, severity, Test.GENERAL_STRING);
+ assertEquals(Test.MATCH, summary, Test.GENERAL_STRING);
+ assertEquals(Test.MATCH, title, Test.GENERAL_STRING);
+
+ // Invalid/Null Tests
+ WeatherAlert msg = new WeatherAlert();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getExpires());
+ assertNull(Test.NULL, msg.getTimeIssued());
+ assertNull(Test.NULL, msg.getRegions());
+ assertNull(Test.NULL, msg.getSeverity());
+ assertNull(Test.NULL, msg.getSummary());
+ assertNull(Test.NULL, msg.getTitle());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new WeatherAlert(Test.GENERAL_STRING_LIST);
+ List<String> regions = msg.getRegions();
+ assertEquals(Test.MATCH, regions, Test.GENERAL_STRING_LIST);
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(WeatherAlert.KEY_EXPIRES, Test.GENERAL_DATETIME);
+ reference.put(WeatherAlert.KEY_TIME_ISSUED, Test.GENERAL_DATETIME);
+ reference.put(WeatherAlert.KEY_REGIONS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ reference.put(WeatherAlert.KEY_SEVERITY, Test.GENERAL_STRING);
+ reference.put(WeatherAlert.KEY_SUMMARY, Test.GENERAL_STRING);
+ reference.put(WeatherAlert.KEY_TITLE, Test.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(WeatherAlert.KEY_EXPIRES)||key.equals(WeatherAlert.KEY_TIME_ISSUED)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateDateTime(Test.GENERAL_DATETIME, new DateTime(hashTest)));
+ } else if (key.equals(WeatherAlert.KEY_REGIONS)){
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
new file mode 100644
index 000000000..70454f5c3
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
@@ -0,0 +1,184 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DateTime;
+import com.smartdevicelink.proxy.rpc.Temperature;
+import com.smartdevicelink.proxy.rpc.WeatherData;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WeatherData}
+ */
+public class WeatherDataTests extends TestCase {
+
+ private WeatherData msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new WeatherData();
+ msg.setCurrentTemperature(Test.GENERAL_TEMPERATURE);
+ msg.setTemperatureHigh(Test.GENERAL_TEMPERATURE);
+ msg.setTemperatureLow(Test.GENERAL_TEMPERATURE);
+ msg.setApparentTemperature(Test.GENERAL_TEMPERATURE);
+ msg.setApparentTemperatureHigh(Test.GENERAL_TEMPERATURE);
+ msg.setApparentTemperatureLow(Test.GENERAL_TEMPERATURE);
+ msg.setWeatherSummary(Test.GENERAL_STRING);
+ msg.setTime(Test.GENERAL_DATETIME);
+ msg.setHumidity(Test.GENERAL_FLOAT);
+ msg.setCloudCover(Test.GENERAL_FLOAT);
+ msg.setMoonPhase(Test.GENERAL_FLOAT);
+ msg.setWindBearing(Test.GENERAL_INTEGER);
+ msg.setWindGust(Test.GENERAL_FLOAT);
+ msg.setWindSpeed(Test.GENERAL_FLOAT);
+ msg.setNearestStormBearing(Test.GENERAL_INTEGER);
+ msg.setNearestStormDistance(Test.GENERAL_INTEGER);
+ msg.setPrecipAccumulation(Test.GENERAL_FLOAT);
+ msg.setPrecipIntensity(Test.GENERAL_FLOAT);
+ msg.setPrecipProbability(Test.GENERAL_FLOAT);
+ msg.setPrecipType(Test.GENERAL_STRING);
+ msg.setVisibility(Test.GENERAL_FLOAT);
+ msg.setWeatherIconImageName(Test.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Temperature currentTemperature = msg.getCurrentTemperature();
+ Temperature temperatureHigh = msg.getTemperatureHigh();
+ Temperature temperatureLow = msg.getTemperatureLow();
+ Temperature apparentTemperature = msg.getApparentTemperature();
+ Temperature apparentTemperatureHigh = msg.getApparentTemperatureHigh();
+ String weatherSummary = msg.getWeatherSummary();
+ DateTime time = msg.getTime();
+ Float humidity = msg.getHumidity();
+ Float cloudCover = msg.getCloudCover();
+ Float moonPhase = msg.getMoonPhase();
+ Integer windBearing = msg.getWindBearing();
+ Float windGust = msg.getWindGust();
+ Float windSpeed = msg.getWindSpeed();
+ Integer nearestStormBearing = msg.getNearestStormBearing();
+ Integer nearestStormDistance = msg.getNearestStormDistance();
+ Float precipAccumulation = msg.getPrecipAccumulation();
+ Float precipIntensity = msg.getPrecipIntensity();
+ Float precipProbability = msg.getPrecipProbability();
+ String precipType = msg.getPrecipType();
+ Float visibility = msg.getVisibility();
+ String weatherIconImageName = msg.getWeatherIconImageName();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, currentTemperature, Test.GENERAL_TEMPERATURE);
+ assertEquals(Test.MATCH, temperatureHigh, Test.GENERAL_TEMPERATURE);
+ assertEquals(Test.MATCH, temperatureLow, Test.GENERAL_TEMPERATURE);
+ assertEquals(Test.MATCH, apparentTemperature, Test.GENERAL_TEMPERATURE);
+ assertEquals(Test.MATCH, apparentTemperatureHigh, Test.GENERAL_TEMPERATURE);
+ assertEquals(Test.MATCH, weatherSummary, Test.GENERAL_STRING);
+ assertEquals(Test.MATCH, time, Test.GENERAL_DATETIME);
+ assertEquals(Test.MATCH, humidity, Test.GENERAL_FLOAT);
+ assertEquals(Test.MATCH, cloudCover, Test.GENERAL_FLOAT);
+ assertEquals(Test.MATCH, moonPhase, Test.GENERAL_FLOAT);
+ assertEquals(Test.MATCH, windBearing, Test.GENERAL_INTEGER);
+ assertEquals(Test.MATCH, windGust, Test.GENERAL_FLOAT);
+ assertEquals(Test.MATCH, windSpeed, Test.GENERAL_FLOAT);
+ assertEquals(Test.MATCH, nearestStormBearing, Test.GENERAL_INTEGER);
+ assertEquals(Test.MATCH, nearestStormDistance, Test.GENERAL_INTEGER);
+ assertEquals(Test.MATCH, precipAccumulation, Test.GENERAL_FLOAT);
+ assertEquals(Test.MATCH, precipIntensity, Test.GENERAL_FLOAT);
+ assertEquals(Test.MATCH, precipProbability, Test.GENERAL_FLOAT);
+ assertEquals(Test.MATCH, precipType, Test.GENERAL_STRING);
+ assertEquals(Test.MATCH, visibility, Test.GENERAL_FLOAT);
+ assertEquals(Test.MATCH, weatherIconImageName, Test.GENERAL_STRING);
+
+ // Invalid/Null Tests
+ WeatherData msg = new WeatherData();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getCurrentTemperature());
+ assertNull(Test.NULL, msg.getTemperatureHigh());
+ assertNull(Test.NULL, msg.getTemperatureLow());
+ assertNull(Test.NULL, msg.getApparentTemperature());
+ assertNull(Test.NULL, msg.getApparentTemperatureHigh());
+ assertNull(Test.NULL, msg.getApparentTemperatureLow());
+ assertNull(Test.NULL, msg.getWeatherSummary());
+ assertNull(Test.NULL, msg.getTime());
+ assertNull(Test.NULL, msg.getHumidity());
+ assertNull(Test.NULL, msg.getCloudCover());
+ assertNull(Test.NULL, msg.getMoonPhase());
+ assertNull(Test.NULL, msg.getWindBearing());
+ assertNull(Test.NULL, msg.getWindGust());
+ assertNull(Test.NULL, msg.getWindSpeed());
+ assertNull(Test.NULL, msg.getNearestStormBearing());
+ assertNull(Test.NULL, msg.getNearestStormDistance());
+ assertNull(Test.NULL, msg.getPrecipAccumulation());
+ assertNull(Test.NULL, msg.getPrecipIntensity());
+ assertNull(Test.NULL, msg.getPrecipProbability());
+ assertNull(Test.NULL, msg.getPrecipType());
+ assertNull(Test.NULL, msg.getVisibility());
+ assertNull(Test.NULL, msg.getWeatherIconImageName());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(WeatherData.KEY_CURRENT_TEMPERATURE, Test.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_TEMPERATURE_HIGH, Test.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_TEMPERATURE_LOW, Test.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_APPARENT_TEMPERATURE, Test.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_HIGH, Test.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_LOW, Test.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_WEATHER_SUMMARY, Test.GENERAL_STRING);
+ reference.put(WeatherData.KEY_TIME, Test.GENERAL_DATETIME);
+ reference.put(WeatherData.KEY_HUMIDITY, Test.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_CLOUD_COVER, Test.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_MOON_PHASE, Test.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_WIND_BEARING, Test.GENERAL_INTEGER);
+ reference.put(WeatherData.KEY_WIND_GUST, Test.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_WIND_SPEED, Test.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_NEAREST_STORM_BEARING, Test.GENERAL_INTEGER);
+ reference.put(WeatherData.KEY_NEAREST_STORM_DISTANCE, Test.GENERAL_INTEGER);
+ reference.put(WeatherData.KEY_PRECIP_ACCUMULATION, Test.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_PRECIP_INTENSITY, Test.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_PRECIP_PROBABILITY, Test.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_PRECIP_TYPE, Test.GENERAL_STRING);
+ reference.put(WeatherData.KEY_VISIBILITY, Test.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_WEATHER_ICON_IMAGE_NAME, Test.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(WeatherData.KEY_CURRENT_TEMPERATURE) || key.equals(WeatherData.KEY_TEMPERATURE_HIGH)||
+ key.equals(WeatherData.KEY_TEMPERATURE_LOW) || key.equals(WeatherData.KEY_APPARENT_TEMPERATURE)||
+ key.equals(WeatherData.KEY_APPARENT_TEMPERATURE_HIGH) || key.equals(WeatherData.KEY_APPARENT_TEMPERATURE_LOW)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateTemperature(Test.GENERAL_TEMPERATURE, new Temperature(hashTest)));
+ } else if (key.equals(WeatherData.KEY_TIME)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateDateTime(Test.GENERAL_DATETIME, new DateTime(hashTest)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
new file mode 100644
index 000000000..09c976538
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
@@ -0,0 +1,142 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
+import com.smartdevicelink.proxy.rpc.WeatherAlert;
+import com.smartdevicelink.proxy.rpc.WeatherData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceData;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WeatherServiceData}
+ */
+public class WeatherServiceDataTests extends TestCase {
+
+ private WeatherServiceData msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new WeatherServiceData();
+ msg.setLocation(Test.GENERAL_LOCATIONDETAILS);
+ msg.setCurrentForecast(Test.GENERAL_WEATHERDATA);
+ msg.setMinuteForecast(Test.GENERAL_WEATHERDATA_LIST);
+ msg.setHourlyForecast(Test.GENERAL_WEATHERDATA_LIST);
+ msg.setMultidayForecast(Test.GENERAL_WEATHERDATA_LIST);
+ msg.setAlerts(Test.GENERAL_WEATHERALERT_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ LocationDetails location = msg.getLocation();
+ WeatherData currentForecast = msg.getCurrentForecast();
+ List<WeatherData> minuteForecast = msg.getMinuteForecast();
+ List<WeatherData> hourlyForecast = msg.getHourlyForecast();
+ List<WeatherData> multidayForecast = msg.getMultidayForecast();
+ List<WeatherAlert> alerts = msg.getAlerts();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_LOCATIONDETAILS, location);
+ assertEquals(Test.GENERAL_WEATHERDATA, currentForecast);
+ assertEquals(Test.GENERAL_WEATHERDATA_LIST, minuteForecast);
+ assertEquals(Test.GENERAL_WEATHERDATA_LIST, hourlyForecast);
+ assertEquals(Test.GENERAL_WEATHERDATA_LIST, multidayForecast);
+ assertEquals(Test.GENERAL_WEATHERALERT_LIST, alerts);
+
+ // Invalid/Null Tests
+ WeatherServiceData msg = new WeatherServiceData();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getLocation());
+ assertNull(Test.NULL, msg.getCurrentForecast());
+ assertNull(Test.NULL, msg.getMinuteForecast());
+ assertNull(Test.NULL, msg.getHourlyForecast());
+ assertNull(Test.NULL, msg.getMultidayForecast());
+ assertNull(Test.NULL, msg.getAlerts());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new WeatherServiceData(Test.GENERAL_LOCATIONDETAILS);
+ LocationDetails location = msg.getLocation();
+ assertEquals(Test.GENERAL_LOCATIONDETAILS, location);
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(WeatherServiceData.KEY_LOCATION, Test.GENERAL_LOCATIONDETAILS);
+ reference.put(WeatherServiceData.KEY_CURRENT_FORECAST, Test.GENERAL_WEATHERDATA);
+ reference.put(WeatherServiceData.KEY_MINUTE_FORECAST, Test.GENERAL_WEATHERDATA_LIST);
+ reference.put(WeatherServiceData.KEY_HOURLY_FORECAST, Test.GENERAL_WEATHERDATA_LIST);
+ reference.put(WeatherServiceData.KEY_MULTIDAY_FORECAST, Test.GENERAL_WEATHERDATA_LIST);
+ reference.put(WeatherServiceData.KEY_ALERTS, Test.GENERAL_WEATHERALERT_LIST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(WeatherServiceData.KEY_LOCATION)){
+
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateLocationDetails( Test.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
+
+ } else if(key.equals(WeatherServiceData.KEY_CURRENT_FORECAST)){
+
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateWeatherData( Test.GENERAL_WEATHERDATA, new WeatherData(hashTest)));
+
+ } else if(key.equals(WeatherServiceData.KEY_MINUTE_FORECAST) || key.equals(WeatherServiceData.KEY_HOURLY_FORECAST)
+ || key.equals(WeatherServiceData.KEY_MULTIDAY_FORECAST)){
+
+ JSONArray weatherDataArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<WeatherData> weatherDataUnderTestList = new ArrayList<>();
+ for (int index = 0; index < weatherDataArrayObjTest.length(); index++) {
+ WeatherData weatherData1 = new WeatherData(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)weatherDataArrayObjTest.get(index) ));
+ weatherDataUnderTestList.add(weatherData1);
+ }
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateWeatherDataList(Test.GENERAL_WEATHERDATA_LIST, weatherDataUnderTestList));
+
+ } else if(key.equals(WeatherServiceData.KEY_ALERTS)){
+
+ JSONArray weatherAlertArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<WeatherAlert> weatherAlertUnderTestList = new ArrayList<>();
+ for (int index = 0; index < weatherAlertArrayObjTest.length(); index++) {
+ WeatherAlert weatherAlert1 = new WeatherAlert(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)weatherAlertArrayObjTest.get(index) ));
+ weatherAlertUnderTestList.add(weatherAlert1);
+ }
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateWeatherAlertList(Test.GENERAL_WEATHERALERT_LIST, weatherAlertUnderTestList));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
new file mode 100644
index 000000000..cbd65fae7
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
@@ -0,0 +1,84 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WeatherServiceManifest}
+ */
+public class WeatherServiceManifestTests extends TestCase {
+
+ private WeatherServiceManifest msg;
+
+ @Override
+ public void setUp(){
+ msg = new WeatherServiceManifest();
+
+ msg.setCurrentForecastSupported(Test.GENERAL_BOOLEAN);
+ msg.setMaxHourlyForecastAmount(Test.GENERAL_INT);
+ msg.setMaxMinutelyForecastAmount(Test.GENERAL_INT);
+ msg.setMaxMultidayForecastAmount(Test.GENERAL_INT);
+ msg.setWeatherForLocationSupported(Test.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ boolean currentForecastSupported = msg.getCurrentForecastSupported();
+ boolean weatherForLocationSupported = msg.getWeatherForLocationSupported();
+ Integer getMaxHourlyForecastAmt = msg.getMaxHourlyForecastAmount();
+ Integer getMaxMinutelyForecastAmt = msg.getMaxMinutelyForecastAmount();
+ Integer getMaxMultidayForecastAmt = msg.getMaxMultidayForecastAmount();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_BOOLEAN, currentForecastSupported);
+ assertEquals(Test.GENERAL_BOOLEAN, weatherForLocationSupported);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, getMaxHourlyForecastAmt);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, getMaxMinutelyForecastAmt);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, getMaxMultidayForecastAmt);
+
+ // Invalid/Null Tests
+ WeatherServiceManifest msg = new WeatherServiceManifest();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getCurrentForecastSupported());
+ assertNull(Test.NULL, msg.getWeatherForLocationSupported());
+ assertNull(Test.NULL, msg.getMaxHourlyForecastAmount());
+ assertNull(Test.NULL, msg.getMaxMinutelyForecastAmount());
+ assertNull(Test.NULL, msg.getMaxMultidayForecastAmount());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(WeatherServiceManifest.KEY_CURRENT_FORECAST_SUPPORTED, Test.GENERAL_BOOLEAN);
+ reference.put(WeatherServiceManifest.KEY_WEATHER_FOR_LOCATION_SUPPORTED, Test.GENERAL_BOOLEAN);
+ reference.put(WeatherServiceManifest.KEY_MAX_HOURLY_FORECAST_AMOUNT, Test.GENERAL_INTEGER);
+ reference.put(WeatherServiceManifest.KEY_MAX_MINUTELY_FORECAST_AMOUNT, Test.GENERAL_INTEGER);
+ reference.put(WeatherServiceManifest.KEY_MAX_MULTIDAY_FORECAST_AMOUNT, Test.GENERAL_INTEGER);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java
new file mode 100644
index 000000000..ce4867e41
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java
@@ -0,0 +1,75 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.AppServiceType}
+ */
+public class AppServiceTypeTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "MEDIA";
+ AppServiceType enumMedia = AppServiceType.valueForString(example);
+ example = "WEATHER";
+ AppServiceType enumWeather = AppServiceType.valueForString(example);
+ example = "NAVIGATION";
+ AppServiceType enumNavigation = AppServiceType.valueForString(example);
+
+ assertNotNull("MEDIA returned null", enumMedia);
+ assertNotNull("WEATHER returned null", enumWeather);
+ assertNotNull("NAVIGATION returned null", enumNavigation);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "MedIas";
+ try {
+ AppServiceType temp = AppServiceType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ AppServiceType temp = AppServiceType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of AppServiceType.
+ */
+ public void testListEnum() {
+ List<AppServiceType> enumValueList = Arrays.asList(AppServiceType.values());
+
+ List<AppServiceType> enumTestList = new ArrayList<>();
+ enumTestList.add(AppServiceType.MEDIA);
+ enumTestList.add(AppServiceType.NAVIGATION);
+ enumTestList.add(AppServiceType.WEATHER);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java
new file mode 100644
index 000000000..76492878d
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java
@@ -0,0 +1,71 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.Direction;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.Direction}
+ */
+public class DirectionTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "LEFT";
+ Direction enumLeft = Direction.valueForString(example);
+ example = "RIGHT";
+ Direction enumRight = Direction.valueForString(example);
+
+ assertNotNull("LEFT returned null", enumLeft);
+ assertNotNull("RIGHT returned null", enumRight);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "fRONT";
+ try {
+ Direction temp = Direction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ Direction temp = Direction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of Direction.
+ */
+ public void testListEnum() {
+ List<Direction> enumValueList = Arrays.asList(Direction.values());
+
+ List<Direction> enumTestList = new ArrayList<>();
+ enumTestList.add(Direction.LEFT);
+ enumTestList.add(Direction.RIGHT);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java
new file mode 100644
index 000000000..835045418
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java
@@ -0,0 +1,77 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.MediaType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.MediaType}
+ */
+public class MediaTypeTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MUSIC";
+ MediaType enumMusic = MediaType.valueForString(example);
+ example = "PODCAST";
+ MediaType enumPodcast = MediaType.valueForString(example);
+ example = "AUDIOBOOK";
+ MediaType enumAudioBook = MediaType.valueForString(example);
+ example = "OTHER";
+ MediaType enumOther = MediaType.valueForString(example);
+
+ assertNotNull("MUSIC returned null", enumMusic);
+ assertNotNull("PODCAST returned null", enumPodcast);
+ assertNotNull("AUDIOBOOK returned null", enumAudioBook);
+ assertNotNull("OTHER returned null", enumOther);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "PudCAsT";
+ try {
+ MediaType temp = MediaType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MediaType temp = MediaType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of MediaType.
+ */
+ public void testListEnum() {
+ List<MediaType> enumValueList = Arrays.asList(MediaType.values());
+
+ List<MediaType> enumTestList = new ArrayList<MediaType>();
+ enumTestList.add(MediaType.MUSIC);
+ enumTestList.add(MediaType.PODCAST);
+ enumTestList.add(MediaType.AUDIOBOOK);
+ enumTestList.add(MediaType.OTHER);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java
new file mode 100644
index 000000000..5051ef337
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java
@@ -0,0 +1,92 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.NavigationAction;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.NavigationAction}
+ */
+public class NavigationActionTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "TURN";
+ NavigationAction enumTurn = NavigationAction.valueForString(example);
+ example = "EXIT";
+ NavigationAction enumExit = NavigationAction.valueForString(example);
+ example = "STAY";
+ NavigationAction enumStay = NavigationAction.valueForString(example);
+ example = "MERGE";
+ NavigationAction enumMerge = NavigationAction.valueForString(example);
+ example = "FERRY";
+ NavigationAction enumFerry = NavigationAction.valueForString(example);
+ example = "CAR_SHUTTLE_TRAIN";
+ NavigationAction enumCarShuttleTrain = NavigationAction.valueForString(example);
+ example = "WAYPOINT";
+ NavigationAction enumWaypoint = NavigationAction.valueForString(example);
+
+ assertNotNull("TURN returned null", enumTurn);
+ assertNotNull("EXIT returned null", enumExit);
+ assertNotNull("STAY returned null", enumStay);
+ assertNotNull("MERGE returned null", enumMerge);
+ assertNotNull("FERRY returned null", enumFerry);
+ assertNotNull("CAR_SHUTTLE_TRAIN returned null", enumCarShuttleTrain);
+ assertNotNull("WAYPOINT returned null", enumWaypoint);
+
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "fRONT";
+ try {
+ NavigationAction temp = NavigationAction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ NavigationAction temp = NavigationAction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of NavigationAction.
+ */
+ public void testListEnum() {
+ List<NavigationAction> enumValueList = Arrays.asList(NavigationAction.values());
+
+ List<NavigationAction> enumTestList = new ArrayList<>();
+ enumTestList.add(NavigationAction.TURN);
+ enumTestList.add(NavigationAction.EXIT);
+ enumTestList.add(NavigationAction.STAY);
+ enumTestList.add(NavigationAction.MERGE);
+ enumTestList.add(NavigationAction.FERRY);
+ enumTestList.add(NavigationAction.CAR_SHUTTLE_TRAIN);
+ enumTestList.add(NavigationAction.WAYPOINT);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java
new file mode 100644
index 000000000..691480f78
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java
@@ -0,0 +1,95 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.NavigationJunction;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.NavigationJunction}
+ */
+public class NavigationJunctionTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "REGULAR";
+ NavigationJunction enumRegular = NavigationJunction.valueForString(example);
+ example = "BIFURCATION";
+ NavigationJunction enumBifurcation = NavigationJunction.valueForString(example);
+ example = "MULTI_CARRIAGEWAY";
+ NavigationJunction enumMultiCarriageway = NavigationJunction.valueForString(example);
+ example = "ROUNDABOUT";
+ NavigationJunction enumRoundabout = NavigationJunction.valueForString(example);
+ example = "TRAVERSABLE_ROUNDABOUT";
+ NavigationJunction enumTraversableRoundabout = NavigationJunction.valueForString(example);
+ example = "JUGHANDLE";
+ NavigationJunction enumJughandle = NavigationJunction.valueForString(example);
+ example = "ALL_WAY_YIELD";
+ NavigationJunction enumAllWayYield = NavigationJunction.valueForString(example);
+ example = "TURN_AROUND";
+ NavigationJunction enumTurnAround = NavigationJunction.valueForString(example);
+
+ assertNotNull("REGULAR returned null", enumRegular);
+ assertNotNull("BIFURCATION returned null", enumBifurcation);
+ assertNotNull("MULTI_CARRIAGEWAY returned null", enumMultiCarriageway);
+ assertNotNull("ROUNDABOUT returned null", enumRoundabout);
+ assertNotNull("TRAVERSABLE_ROUNDABOUT returned null", enumTraversableRoundabout);
+ assertNotNull("JUGHANDLE returned null", enumJughandle);
+ assertNotNull("ALL_WAY_YIELD returned null", enumAllWayYield);
+ assertNotNull("TURN_AROUND returned null", enumTurnAround);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "fRONT";
+ try {
+ NavigationJunction temp = NavigationJunction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ NavigationJunction temp = NavigationJunction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of NavigationJunction.
+ */
+ public void testListEnum() {
+ List<NavigationJunction> enumValueList = Arrays.asList(NavigationJunction.values());
+
+ List<NavigationJunction> enumTestList = new ArrayList<>();
+ enumTestList.add(NavigationJunction.REGULAR);
+ enumTestList.add(NavigationJunction.BIFURCATION);
+ enumTestList.add(NavigationJunction.MULTI_CARRIAGEWAY);
+ enumTestList.add(NavigationJunction.ROUNDABOUT);
+ enumTestList.add(NavigationJunction.TRAVERSABLE_ROUNDABOUT);
+ enumTestList.add(NavigationJunction.JUGHANDLE);
+ enumTestList.add(NavigationJunction.ALL_WAY_YIELD);
+ enumTestList.add(NavigationJunction.TURN_AROUND);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java
new file mode 100644
index 000000000..f2484ff9e
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java
@@ -0,0 +1,84 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason}
+ */
+public class ServiceUpdateReasonTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "PUBLISHED";
+ ServiceUpdateReason enumPublished = ServiceUpdateReason.valueForString(example);
+ example = "REMOVED";
+ ServiceUpdateReason enumRemoved = ServiceUpdateReason.valueForString(example);
+ example = "ACTIVATED";
+ ServiceUpdateReason enumActivated = ServiceUpdateReason.valueForString(example);
+ example = "DEACTIVATED";
+ ServiceUpdateReason enumDeactivated = ServiceUpdateReason.valueForString(example);
+ example = "MANIFEST_UPDATE";
+ ServiceUpdateReason enumManifestUpdate = ServiceUpdateReason.valueForString(example);
+
+
+ assertNotNull("PUBLISHED returned null", enumPublished);
+ assertNotNull("REMOVED returned null", enumRemoved);
+ assertNotNull("ACTIVATED returned null", enumActivated);
+ assertNotNull("DEACTIVATED returned null", enumDeactivated);
+ assertNotNull("MANIFEST_UPDATE returned null", enumManifestUpdate);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "HalFActIvAted";
+ try {
+ ServiceUpdateReason temp = ServiceUpdateReason.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ ServiceUpdateReason temp = ServiceUpdateReason.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of ServiceUpdateReason.
+ */
+ public void testListEnum() {
+ List<ServiceUpdateReason> enumValueList = Arrays.asList(ServiceUpdateReason.values());
+
+ List<ServiceUpdateReason> enumTestList = new ArrayList<>();
+ enumTestList.add(ServiceUpdateReason.MANIFEST_UPDATE);
+ enumTestList.add(ServiceUpdateReason.ACTIVATED);
+ enumTestList.add(ServiceUpdateReason.DEACTIVATED);
+ enumTestList.add(ServiceUpdateReason.PUBLISHED);
+ enumTestList.add(ServiceUpdateReason.REMOVED);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
index 9bd68a2ad..f0f876d00 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
@@ -10,7 +10,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.enums.SystemCapabilityType}
+ * {@link com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType}
*/
public class SystemCapabilityTypeTests extends TestCase {
@@ -46,6 +46,8 @@ public class SystemCapabilityTypeTests extends TestCase {
SystemCapabilityType enumVoiceRecognition = SystemCapabilityType.valueForString(example);
example = "PCM_STREAMING";
SystemCapabilityType enumPCM = SystemCapabilityType.valueForString(example);
+ example = "APP_SERVICES";
+ SystemCapabilityType enumAppServices = SystemCapabilityType.valueForString(example);
assertNotNull("NAVIGATION returned null", enumNavigation);
assertNotNull("PHONE_CALL returned null", enumPhoneCall);
@@ -61,6 +63,7 @@ public class SystemCapabilityTypeTests extends TestCase {
assertNotNull("SPEECH returned null", enumSpeech);
assertNotNull("VOICE_RECOGNITION returned null", enumVoiceRecognition);
assertNotNull("PCM_STREAMING", enumPCM);
+ assertNotNull("APP_SERVICES", enumAppServices);
}
/**
@@ -112,6 +115,7 @@ public class SystemCapabilityTypeTests extends TestCase {
enumTestList.add(SystemCapabilityType.SPEECH);
enumTestList.add(SystemCapabilityType.VOICE_RECOGNITION);
enumTestList.add(SystemCapabilityType.PCM_STREAMING);
+ enumTestList.add(SystemCapabilityType.APP_SERVICES);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
new file mode 100644
index 000000000..108ec930f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.notifications;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.AppServiceData;
+import com.smartdevicelink.proxy.rpc.OnAppServiceData;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.OnAppServiceData}
+ */
+public class OnAppServiceDataTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ OnAppServiceData msg = new OnAppServiceData();
+
+ msg.setServiceData(Test.GENERAL_APPSERVICE_DATA);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.ON_APP_SERVICE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(OnAppServiceData.KEY_SERVICE_DATA, Test.GENERAL_APPSERVICE_DATA.serializeJSON());
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ AppServiceData cmdId = ( (OnAppServiceData) msg ).getServiceData();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_APPSERVICE_DATA, cmdId);
+
+ // Invalid/Null Tests
+ OnAppServiceData msg = new OnAppServiceData();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getServiceData());
+
+ // test constructor with param
+ msg = new OnAppServiceData(Test.GENERAL_APPSERVICE_DATA);
+ AppServiceData serviceData = msg.getServiceData();
+ assertEquals(serviceData, Test.GENERAL_APPSERVICE_DATA);
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
new file mode 100644
index 000000000..ca0fa5f02
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.notifications;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
+import com.smartdevicelink.proxy.rpc.SystemCapability;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated}
+ */
+public class OnSystemCapabilityUpdatedTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
+
+ msg.setSystemCapability(Test.GENERAL_SYSTEMCAPABILITY);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(OnSystemCapabilityUpdated.KEY_SYSTEM_CAPABILITY, Test.GENERAL_SYSTEMCAPABILITY.serializeJSON());
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ SystemCapability cmdId = ( (OnSystemCapabilityUpdated) msg ).getSystemCapability();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITY, cmdId);
+
+ // Invalid/Null Tests
+ OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getSystemCapability());
+
+ // test constructor with param
+ msg = new OnSystemCapabilityUpdated(Test.GENERAL_SYSTEMCAPABILITY);
+ SystemCapability systemCapability = msg.getSystemCapability();
+ assertEquals(systemCapability, Test.GENERAL_SYSTEMCAPABILITY);
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
new file mode 100644
index 000000000..abda43557
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
@@ -0,0 +1,107 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetAppServiceData;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class GetAppServiceDataTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ GetAppServiceData msg = new GetAppServiceData();
+ msg.setServiceType(Test.GENERAL_STRING);
+ msg.setSubscribe(Test.GENERAL_BOOLEAN);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_APP_SERVICE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(GetAppServiceData.KEY_SERVICE_TYPE, Test.GENERAL_STRING);
+ result.put(GetAppServiceData.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String serviceType = ( (GetAppServiceData) msg ).getServiceType();
+ boolean subscribe = ( (GetAppServiceData) msg ).getSubscribe();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceType);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, subscribe);
+
+ // Invalid/Null Tests
+ GetAppServiceData msg = new GetAppServiceData();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(msg.getServiceType());
+ assertNull(msg.getSubscribe());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ public void testRequiredParamsConstructor () {
+
+ GetAppServiceData msg = new GetAppServiceData(Test.GENERAL_STRING);
+ assertNotNull(Test.NOT_NULL, msg);
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, msg.getServiceType());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetAppServiceData cmd = new GetAppServiceData(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetAppServiceData.KEY_SUBSCRIBE), cmd.getSubscribe());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetAppServiceData.KEY_SERVICE_TYPE).toString(), cmd.getServiceType().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
new file mode 100644
index 000000000..48214373d
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
@@ -0,0 +1,132 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetFile;
+import com.smartdevicelink.proxy.rpc.enums.FileType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+
+public class GetFileTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ GetFile msg = new GetFile();
+
+ msg.setFileName(Test.GENERAL_STRING);
+ msg.setAppServiceId(Test.GENERAL_STRING);
+ msg.setFileType(Test.GENERAL_FILETYPE);
+ msg.setOffset(Test.GENERAL_INT);
+ msg.setLength(Test.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_FILE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(GetFile.KEY_FILE_NAME, Test.GENERAL_STRING);
+ result.put(GetFile.KEY_APP_SERVICE_ID, Test.GENERAL_STRING);
+ result.put(GetFile.KEY_FILE_TYPE, Test.GENERAL_FILETYPE);
+ result.put(GetFile.KEY_OFFSET, Test.GENERAL_INTEGER);
+ result.put(GetFile.KEY_LENGTH, Test.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String fileName = ( (GetFile) msg ).getFileName();
+ String appServiceId = ( (GetFile) msg ).getAppServiceId();
+ FileType fileType = ( (GetFile) msg ).getFileType();
+ Integer offset = ( (GetFile) msg ).getOffset();
+ Integer length = ( (GetFile) msg ).getLength();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, fileName);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, appServiceId);
+ assertEquals(Test.MATCH, Test.GENERAL_FILETYPE, fileType);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, offset);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, length);
+
+ // Invalid/Null Tests
+ GetFile msg = new GetFile();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getFileName());
+ assertNull(Test.NULL, msg.getAppServiceId());
+ assertNull(Test.NULL, msg.getFileType());
+ assertNull(Test.NULL, msg.getOffset());
+ assertNull(Test.NULL, msg.getLength());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ public void testRequiredParamsConstructor () {
+
+ GetFile msg = new GetFile(Test.GENERAL_STRING);
+ assertNotNull(Test.NOT_NULL, msg);
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, msg.getFileName());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetFile cmd = new GetFile(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_APP_SERVICE_ID), cmd.getAppServiceId());
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_FILE_NAME), cmd.getFileName());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFile.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_LENGTH), cmd.getLength());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_OFFSET), cmd.getOffset());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
index 78d4507da..290a291d1 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
@@ -22,6 +22,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
GetSystemCapability msg = new GetSystemCapability();
msg.setSystemCapabilityType(Test.GENERAL_SYSTEMCAPABILITYTYPE);
+ msg.setSubscribe(Test.GENERAL_BOOLEAN);
return msg;
}
@@ -42,6 +43,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
try{
result.put(GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, Test.GENERAL_SYSTEMCAPABILITYTYPE);
+ result.put(GetSystemCapability.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -55,9 +57,11 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
public void testRpcValues () {
// Test Values
SystemCapabilityType testType = ( (GetSystemCapability) msg ).getSystemCapabilityType();
+ boolean testSubscribe = ( (GetSystemCapability) msg ).getSubscribe();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITYTYPE, testType);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSubscribe);
// Invalid/Null Tests
GetSystemCapability msg = new GetSystemCapability();
@@ -65,6 +69,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
testNullBase(msg);
assertNull(Test.NULL, msg.getSystemCapabilityType());
+ assertNull(Test.NULL, msg.getSubscribe());
}
/**
@@ -88,6 +93,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE).toString(), cmd.getSystemCapabilityType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapability.KEY_SUBSCRIBE), cmd.getSubscribe());
}catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
new file mode 100644
index 000000000..c5be9b14f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
@@ -0,0 +1,128 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.PerformAppServiceInteraction;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+
+public class PerformAppServiceInteractionTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
+
+ msg.setServiceUri(Test.GENERAL_STRING);
+ msg.setAppServiceId(Test.GENERAL_STRING);
+ msg.setOriginApp(Test.GENERAL_STRING);
+ msg.setRequestServiceActive(Test.GENERAL_BOOLEAN);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PerformAppServiceInteraction.KEY_SERVICE_URI, Test.GENERAL_STRING);
+ result.put(PerformAppServiceInteraction.KEY_SERVICE_ID, Test.GENERAL_STRING);
+ result.put(PerformAppServiceInteraction.KEY_ORIGIN_APP, Test.GENERAL_STRING);
+ result.put(PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE, Test.GENERAL_BOOLEAN);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String serviceUri = ( (PerformAppServiceInteraction) msg ).getServiceUri();
+ String appServiceId = ( (PerformAppServiceInteraction) msg ).getAppServiceId();
+ String originApp = ( (PerformAppServiceInteraction) msg ).getOriginApp();
+ boolean requestServiceActive = ( (PerformAppServiceInteraction) msg ).getRequestServiceActive();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceUri);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, appServiceId);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, originApp);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, requestServiceActive);
+
+ // Invalid/Null Tests
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getServiceUri());
+ assertNull(Test.NULL, msg.getAppServiceId());
+ assertNull(Test.NULL, msg.getOriginApp());
+ assertNull(Test.NULL, msg.getRequestServiceActive());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ public void testRequiredParamsConstructor () {
+ // test with param in constructor
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction(Test.GENERAL_STRING,Test.GENERAL_STRING,Test.GENERAL_STRING);
+ String serviceUri = msg.getServiceUri();
+ String appServiceId = msg.getAppServiceId();
+ String originApp = msg.getOriginApp();
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceUri);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, appServiceId);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, originApp);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PerformAppServiceInteraction cmd = new PerformAppServiceInteraction(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_ID), cmd.getAppServiceId());
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_URI), cmd.getServiceUri());
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_ORIGIN_APP), cmd.getOriginApp());
+ assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE), cmd.getRequestServiceActive());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
new file mode 100644
index 000000000..6d0d67490
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
@@ -0,0 +1,107 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.AppServiceManifest;
+import com.smartdevicelink.proxy.rpc.PublishAppService;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class PublishAppServiceTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ PublishAppService msg = new PublishAppService();
+ msg.setServiceManifest(Test.GENERAL_APP_SERVICE_MANIFEST);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PublishAppService.KEY_APP_SERVICE_MANIFEST, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APP_SERVICE_MANIFEST.getStore()));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ AppServiceManifest copy = ( (PublishAppService) msg ).getServiceManifest();
+
+ // Valid Tests
+ assertTrue(Validator.validateAppServiceManifest(Test.GENERAL_APP_SERVICE_MANIFEST, copy));
+
+ // Invalid/Null Tests
+ PublishAppService msg = new PublishAppService();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.MATCH, msg.getServiceManifest());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ public void testRequiredParamsConstructor () {
+
+ PublishAppService msg = new PublishAppService(Test.GENERAL_APP_SERVICE_MANIFEST);
+ assertNotNull(Test.NOT_NULL, msg);
+ // Valid Tests
+ assertTrue(Validator.validateAppServiceManifest(Test.GENERAL_APP_SERVICE_MANIFEST, msg.getServiceManifest()));
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PublishAppService cmd = new PublishAppService(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONObject appServiceManifestObject = JsonUtils.readJsonObjectFromJsonObject(parameters, PublishAppService.KEY_APP_SERVICE_MANIFEST);
+ AppServiceManifest manifestTest = new AppServiceManifest(JsonRPCMarshaller.deserializeJSONObject(appServiceManifestObject));
+ assertTrue(Test.TRUE, Validator.validateAppServiceManifest(manifestTest, cmd.getServiceManifest()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
new file mode 100644
index 000000000..08a8f6536
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
@@ -0,0 +1,85 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.AppServiceData;
+import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse}
+ */
+public class GetAppServiceDataResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new GetAppServiceDataResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_APP_SERVICE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ GetAppServiceDataResponse msg = new GetAppServiceDataResponse();
+ msg.setServiceData(Test.GENERAL_APPSERVICE_DATA);
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ // test getter
+ AppServiceData serviceData = msg.getServiceData();
+ assertEquals(Test.GENERAL_APPSERVICE_DATA, serviceData);
+
+ // test constructor
+ msg = new GetAppServiceDataResponse(true, Result.SUCCESS, Test.GENERAL_APPSERVICE_DATA);
+ serviceData = msg.getServiceData();
+ assertEquals(Test.GENERAL_APPSERVICE_DATA, serviceData);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetAppServiceDataResponse cmd = new GetAppServiceDataResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
new file mode 100644
index 000000000..25ba20949
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
@@ -0,0 +1,118 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetFileResponse;
+import com.smartdevicelink.proxy.rpc.enums.FileType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.GetFileResponse}
+ */
+public class GetFileResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+
+ GetFileResponse msg = new GetFileResponse();
+
+ msg.setCRC(Test.GENERAL_INT);
+ msg.setFileType(Test.GENERAL_FILETYPE);
+ msg.setOffset(Test.GENERAL_INT);
+ msg.setLength(Test.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_FILE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetFileResponse.KEY_CRC, Test.GENERAL_INTEGER);
+ result.put(GetFileResponse.KEY_FILE_TYPE, Test.GENERAL_FILETYPE);
+ result.put(GetFileResponse.KEY_OFFSET, Test.GENERAL_INTEGER);
+ result.put(GetFileResponse.KEY_LENGTH, Test.GENERAL_INTEGER);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer crc = ( (GetFileResponse) msg ).getCRC();
+ FileType fileType = ( (GetFileResponse) msg ).getFileType();
+ Integer offset = ( (GetFileResponse) msg ).getOffset();
+ Integer length = ( (GetFileResponse) msg ).getLength();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, crc);
+ assertEquals(Test.MATCH, Test.GENERAL_FILETYPE, fileType);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, offset);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, length);
+
+ // Invalid/Null Tests
+ GetFileResponse msg = new GetFileResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getCRC());
+ assertNull(Test.NULL, msg.getFileType());
+ assertNull(Test.NULL, msg.getOffset());
+ assertNull(Test.NULL, msg.getLength());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetFileResponse cmd = new GetFileResponse (hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_CRC), cmd.getCRC());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFileResponse.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_LENGTH), cmd.getLength());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_OFFSET), cmd.getOffset());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
new file mode 100644
index 000000000..ac3be00c6
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
@@ -0,0 +1,101 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetFileResponse;
+import com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse;
+import com.smartdevicelink.proxy.rpc.enums.FileType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse}
+ */
+public class PerformAppServiceInteractionResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+
+ PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
+
+ msg.setServiceSpecificResult(Test.GENERAL_STRING);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT, Test.GENERAL_STRING);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String serviceSpecificResult = ( (PerformAppServiceInteractionResponse) msg ).getServiceSpecificResult();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceSpecificResult);
+
+ // Invalid/Null Tests
+ PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getServiceSpecificResult());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PerformAppServiceInteractionResponse cmd = new PerformAppServiceInteractionResponse (hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT), cmd.getServiceSpecificResult());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
new file mode 100644
index 000000000..f51a7945a
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
@@ -0,0 +1,103 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.AppServiceRecord;
+import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.PublishAppServiceResponse}
+ */
+public class PublishAppServiceResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+
+ PublishAppServiceResponse msg = new PublishAppServiceResponse();
+
+ msg.setServiceRecord(Test.GENERAL_APP_SERVICE_RECORD);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.PUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(PublishAppServiceResponse.KEY_APP_SERVICE_RECORD, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APP_SERVICE_RECORD.getStore()));
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ AppServiceRecord testRecord = ( (PublishAppServiceResponse) msg ).getServiceRecord();
+
+ // Valid Tests
+ assertTrue(Test.TRUE, Validator.validateAppServiceRecord(Test.GENERAL_APP_SERVICE_RECORD, testRecord));
+
+ // Invalid/Null Tests
+ PublishAppServiceResponse msg = new PublishAppServiceResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getServiceRecord());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PublishAppServiceResponse cmd = new PublishAppServiceResponse (hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONObject appServiceRecordObject = JsonUtils.readJsonObjectFromJsonObject(parameters, PublishAppServiceResponse.KEY_APP_SERVICE_RECORD);
+ AppServiceRecord recordTest = new AppServiceRecord(JsonRPCMarshaller.deserializeJSONObject(appServiceRecordObject));
+ assertTrue(Test.TRUE, Validator.validateAppServiceRecord(recordTest, cmd.getServiceRecord()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java b/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
index 29b7c1387..c01a5769c 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
@@ -22,14 +22,17 @@ import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
+import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
+import com.smartdevicelink.proxy.rpc.GetFileResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
import com.smartdevicelink.proxy.rpc.ListFilesResponse;
import com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered;
+import com.smartdevicelink.proxy.rpc.OnAppServiceData;
import com.smartdevicelink.proxy.rpc.OnAudioPassThru;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
@@ -44,13 +47,16 @@ import com.smartdevicelink.proxy.rpc.OnLockScreenStatus;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
import com.smartdevicelink.proxy.rpc.OnRCStatus;
import com.smartdevicelink.proxy.rpc.OnStreamRPC;
+import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.OnTBTClientState;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.OnVehicleData;
import com.smartdevicelink.proxy.rpc.OnWayPointChange;
+import com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse;
import com.smartdevicelink.proxy.rpc.PerformAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
+import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
@@ -569,4 +575,33 @@ public class ProxyBridge implements IProxyListener{
public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
onRPCReceived(response);
}
+@Override
+ public void onPublishAppServiceResponse(PublishAppServiceResponse response){
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onGetAppServiceDataResponse(GetAppServiceDataResponse response){
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onGetFileResponse(GetFileResponse response){
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onPerformAppServiceInteractionResponse(PerformAppServiceInteractionResponse response){
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onOnAppServiceData(OnAppServiceData notification){
+ onRPCReceived(notification);
+ }
+
+ @Override
+ public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification){
+ onRPCReceived(notification);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java b/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
index 0a97c518b..7b51e8ecc 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -41,6 +41,7 @@ import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
import com.smartdevicelink.streaming.audio.AudioStreamingParams;
@@ -430,18 +431,14 @@ public class SdlManager{
// SENDING REQUESTS
/**
- * Send RPC Message <br>
- * <strong>Note: Only takes type of RPCRequest for now, notifications and responses will be thrown out</strong>
+ * Send RPC Message
* @param message RPCMessage
*/
public void sendRPC(RPCMessage message) {
-
- if (message instanceof RPCRequest){
- try{
- proxy.sendRPCRequest((RPCRequest)message);
- }catch (SdlException exception){
- handleSdlException(exception);
- }
+ try{
+ proxy.sendRPC(message);
+ }catch (SdlException exception){
+ handleSdlException(exception);
}
}
@@ -528,6 +525,22 @@ public class SdlManager{
proxy.removeOnRPCNotificationListener(notificationId, listener);
}
+ /**
+ * Add an OnRPCRequestListener
+ * @param listener listener that will be called when a request is received
+ */
+ public void addOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
+ proxy.addOnRPCRequestListener(requestId,listener);
+ }
+
+ /**
+ * Remove an OnRPCRequestListener
+ * @param listener listener that was previously added
+ */
+ public void removeOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
+ proxy.removeOnRPCRequestListener(requestId, listener);
+ }
+
// LIFECYCLE / OTHER
// STARTUP
@@ -668,7 +681,16 @@ public class SdlManager{
@Override
public void sendRPCRequest(RPCRequest message){
try {
- proxy.sendRPCRequest(message);
+ proxy.sendRPC(message);
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void sendRPC(RPCRequest message) {
+ try {
+ proxy.sendRPC(message);
} catch (SdlException e) {
e.printStackTrace();
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java b/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
new file mode 100644
index 000000000..07b5ccc25
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
@@ -0,0 +1,146 @@
+package com.smartdevicelink.managers.lifecycle;
+
+import android.util.Log;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.ProtocolMessage;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.util.DebugTool;
+import com.smartdevicelink.util.Version;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Hashtable;
+import java.util.Set;
+
+/**
+ * Converts a protocol message into an RPC.
+ * Built to reduce boiler plate code for each RPC added.
+ */
+public class RpcConverter {
+
+ private static final String TAG = "RpcConverter";
+
+ private static final String RPC_PACKAGE = "com.smartdevicelink.proxy.rpc.";
+ private static final String RESPONSE_KEY = "Response";
+ private static final String GENERIC_RESPONSE_STRING = FunctionID.GENERIC_RESPONSE.toString();
+
+ /**
+ * Extracts the RPC out of the payload of a given protocol message
+ * @param message protocolMessage that has the RPC in the payload
+ * @param protocolVersion RPC spec version that should be used to create RPC
+ * @return the extracted RPC
+ */
+ public static RPCMessage extractRpc(ProtocolMessage message, Version protocolVersion){
+ Hashtable<String, Object> tempTable = convertProtocolMessage(message, protocolVersion);
+ if(tempTable != null){
+ try{
+ return convertTableToRpc(tempTable);
+ }catch (Exception e){
+ DebugTool.logError("Error converting RPC",e);
+ }
+ }
+ return null;
+ }
+
+ static Hashtable<String, Object> convertProtocolMessage(ProtocolMessage message, Version protocolVersion){
+ Hashtable<String, Object> hash = new Hashtable<>();
+ if (protocolVersion!= null && protocolVersion.getMajor() > 1) {
+
+ Hashtable<String, Object> hashTemp = new Hashtable<>();
+ hashTemp.put(RPCMessage.KEY_CORRELATION_ID, message.getCorrID());
+ if (message.getJsonSize() > 0) {
+ final Hashtable<String, Object> mhash = JsonRPCMarshaller.unmarshall(message.getData());
+ if (mhash != null) {
+ hashTemp.put(RPCMessage.KEY_PARAMETERS, mhash);
+ }
+ }
+
+ String functionName = FunctionID.getFunctionName(message.getFunctionID());
+
+ if (functionName != null) {
+ hashTemp.put(RPCMessage.KEY_FUNCTION_NAME, functionName);
+ } else {
+ DebugTool.logWarning("Dispatch Incoming Message - function name is null unknown RPC. FunctionId: " + message.getFunctionID());
+ return null;
+ }
+
+ if (message.getRPCType() == 0x00) {
+ hash.put(RPCMessage.KEY_REQUEST, hashTemp);
+ } else if (message.getRPCType() == 0x01) {
+ hash.put(RPCMessage.KEY_RESPONSE, hashTemp);
+ } else if (message.getRPCType() == 0x02) {
+ hash.put(RPCMessage.KEY_NOTIFICATION, hashTemp);
+ }
+
+ if (message.getBulkData() != null) hash.put(RPCStruct.KEY_BULK_DATA, message.getBulkData());
+ if (message.getPayloadProtected()) hash.put(RPCStruct.KEY_PROTECTED, true);
+
+ return hash;
+ } else {
+ return JsonRPCMarshaller.unmarshall(message.getData());
+ }
+ }
+
+
+ public static RPCMessage convertTableToRpc(Hashtable<String,Object> rpcHashTable){
+
+ Hashtable<String,Object> params;
+ if(rpcHashTable.containsKey((RPCMessage.KEY_RESPONSE))){
+ params = (Hashtable)rpcHashTable.get((RPCMessage.KEY_RESPONSE));
+ }else if(rpcHashTable.containsKey((RPCMessage.KEY_NOTIFICATION))){
+ params = (Hashtable)rpcHashTable.get((RPCMessage.KEY_NOTIFICATION));
+ }else if(rpcHashTable.containsKey((RPCMessage.KEY_REQUEST))){
+ params = (Hashtable)rpcHashTable.get((RPCMessage.KEY_REQUEST));
+ }else{
+ DebugTool.logError(TAG + " Corrupted RPC table.");
+ return null;
+ }
+
+ if(DebugTool.isDebugEnabled()) {
+ if (params != null) {
+ Set<String> keySet = params.keySet();
+ for (String key : keySet) {
+ Log.i(TAG, key + " - " + params.get(key));
+ }
+ }
+ }
+
+ if(params.containsKey(RPCMessage.KEY_FUNCTION_NAME)){
+ StringBuilder rpcClassName = new StringBuilder();
+ String functionName = (String)params.get(RPCMessage.KEY_FUNCTION_NAME);
+ rpcClassName.append(RPC_PACKAGE);
+ rpcClassName.append (functionName);
+
+ if(rpcHashTable.containsKey(RPCMessage.KEY_RESPONSE)
+ && !GENERIC_RESPONSE_STRING.equals(functionName)){
+ rpcClassName.append(RESPONSE_KEY);
+ }
+
+ DebugTool.logInfo(TAG + " Attempting to create " + rpcClassName.toString());
+ try {
+ Class rpcClass = Class.forName(rpcClassName.toString());
+ if(rpcClass != null){
+ java.lang.reflect.Constructor rpcConstructor = rpcClass.getConstructor(Hashtable.class);
+ if(rpcConstructor != null){
+ return (RPCMessage)rpcConstructor.newInstance(rpcHashTable);
+ }
+ }
+ } catch (ClassNotFoundException e) {
+ } catch (NoSuchMethodException e) {
+ } catch (IllegalAccessException e) {
+ } catch (InstantiationException e) {
+ } catch (InvocationTargetException e) {
+ } catch (ClassCastException e){
+
+ }
+ }else{
+ DebugTool.logError(TAG + " Unable to parse into RPC");
+ }
+
+ return null;
+ }
+
+
+}
+
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
index 955a72fc8..55715637f 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
@@ -527,7 +527,6 @@ public class SdlProtocol {
}
public void sendMessage(ProtocolMessage protocolMsg) {
- protocolMsg.setRPCType((byte) 0x00); //always sending a request
SessionType sessionType = protocolMsg.getSessionType();
byte sessionID = protocolMsg.getSessionID();
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
index bc7c04b08..7edb4ea29 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
@@ -166,7 +166,6 @@ public class WiProProtocol extends AbstractProtocol {
} // end-method
public void SendMessage(ProtocolMessage protocolMsg) {
- protocolMsg.setRPCType((byte) 0x00); //always sending a request
SessionType sessionType = protocolMsg.getSessionType();
byte sessionID = protocolMsg.getSessionID();
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
index c5cacaed9..4fd4d1d73 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -63,8 +63,12 @@ public enum FunctionID{
UNSUBSCRIBE_WAY_POINTS(47, "UnsubscribeWayPoints"),
GET_SYSTEM_CAPABILITY(48, "GetSystemCapability"),
SEND_HAPTIC_DATA(49, "SendHapticData"),
- SET_CLOUD_APP_PROPERTIES(50, "SetCloudAppProperties"),
+ SET_CLOUD_APP_PROPERTIES(50, "SetCloudAppProperties"),
GET_CLOUD_APP_PROPERTIES(51, "GetCloudAppProperties"),
+ PUBLISH_APP_SERVICE(52, "PublishAppService"),
+ GET_APP_SERVICE_DATA(53, "GetAppServiceData"),
+ GET_FILE(54, "GetFile"),
+ PERFORM_APP_SERVICES_INTERACTION(55, "PerformAppServiceInteraction"),
// NOTIFICATIONS
ON_HMI_STATUS(32768, "OnHMIStatus"),
@@ -85,6 +89,8 @@ public enum FunctionID{
ON_INTERIOR_VEHICLE_DATA(32783, "OnInteriorVehicleData"),
ON_WAY_POINT_CHANGE(32784, "OnWayPointChange"),
ON_RC_STATUS(32785, "OnRCStatus"),
+ ON_APP_SERVICE_DATA(32786, "OnAppServiceData"),
+ ON_SYSTEM_CAPABILITY_UPDATED(32787, "OnSystemCapabilityUpdated"),
// MOCKED FUNCTIONS (NOT SENT FROM HEAD-UNIT)
ON_LOCK_SCREEN_STATUS(-1, "OnLockScreenStatus"),
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
index db493fecf..e6a92924e 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
@@ -23,8 +23,11 @@ public class RPCRequest extends RPCMessage {
public RPCRequest(RPCRequest request){
super(request);
- setCorrelationID(CorrelationIdGenerator.generateId());
+ if (request.getCorrelationID() == null) {
+ setCorrelationID(CorrelationIdGenerator.generateId());
+ }
}
+
public Integer getCorrelationID() {
//First we check to see if a correlation ID is set. If not, create one.
if(!function.containsKey(RPCMessage.KEY_CORRELATION_ID)){
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
index 986310d5f..2535178f0 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -30,6 +30,7 @@ import com.smartdevicelink.encoder.VirtualDisplayEncoder;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
import com.smartdevicelink.haptic.HapticInterfaceManager;
+import com.smartdevicelink.managers.lifecycle.RpcConverter;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -77,6 +78,7 @@ import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.streaming.StreamRPCPacketizer;
@@ -134,7 +136,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private static final int PROX_PROT_VER_ONE = 1;
private static final int RESPONSE_WAIT_TIME = 2000;
- public static final com.smartdevicelink.util.Version MAX_SUPPORTED_RPC_VERSION = new com.smartdevicelink.util.Version("5.0.0");
+ public static final com.smartdevicelink.util.Version MAX_SUPPORTED_RPC_VERSION = new com.smartdevicelink.util.Version("5.1.0");
private SdlSession sdlSession = null;
private proxyListenerType _proxyListener = null;
@@ -254,6 +256,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
protected SparseArray<OnRPCResponseListener> rpcResponseListeners = null;
protected SparseArray<CopyOnWriteArrayList<OnRPCNotificationListener>> rpcNotificationListeners = null;
+ protected SparseArray<CopyOnWriteArrayList<OnRPCRequestListener>> rpcRequestListeners = null;
protected VideoStreamingManager manager; //Will move to SdlSession once the class becomes public
@@ -315,7 +318,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
- @Override public void stopAudioService() {
+ @Override public void stopAudioService() {
if(isConnected()){
sdlSession.endService(SessionType.PCM,sdlSession.getSessionId());
}
@@ -331,6 +334,15 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
@Override
+ public void sendRPC(RPCRequest message) {
+ try {
+ SdlProxyBase.this.sendRPCRequest(message);
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
public void sendRequests(List<? extends RPCRequest> rpcs, OnMultipleRequestListener listener) {
try {
SdlProxyBase.this.sendRequests(rpcs, listener);
@@ -925,6 +937,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
rpcResponseListeners = new SparseArray<OnRPCResponseListener>();
rpcNotificationListeners = new SparseArray<CopyOnWriteArrayList<OnRPCNotificationListener>>();
+ rpcRequestListeners = new SparseArray<CopyOnWriteArrayList<OnRPCRequestListener>>();
// Initialize the proxy
try {
@@ -1311,8 +1324,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
putFile.setFileData(response.toString().getBytes("UTF-8"));
putFile.setCRC(response.toString().getBytes());
updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + response.toString());
-
- sendRPCRequestPrivate(putFile);
+
+ sendRPCMessagePrivate(putFile);
Log.i("sendSystemRequestToUrl", "sent to sdl");
updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.PUT_FILE.toString());
@@ -1378,8 +1391,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
if (getIsConnected())
- {
- sendRPCRequestPrivate(mySystemRequest);
+ {
+ sendRPCMessagePrivate(mySystemRequest);
Log.i("sendSystemRequestToUrl", "sent to sdl");
updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
@@ -2027,50 +2040,73 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
/************* END Functions used by the Message Dispatching Queues ****************/
- // Private sendPRCRequest method. All RPCRequests are funneled through this method after
- // error checking.
- private void sendRPCRequestPrivate(RPCRequest request) throws SdlException {
- try {
- SdlTrace.logRPCEvent(InterfaceActivityDirection.Transmit, request, SDL_LIB_TRACE_KEY);
-
- request.format(rpcSpecVersion,true);
- byte[] msgBytes = JsonRPCMarshaller.marshall(request, (byte)getProtocolVersion().getMajor());
-
+ // Private sendRPCMessagePrivate method. All RPCMessages are funneled through this method after error checking.
+ private void sendRPCMessagePrivate(RPCMessage message) throws SdlException {
+ try {
+ SdlTrace.logRPCEvent(InterfaceActivityDirection.Transmit, message, SDL_LIB_TRACE_KEY);
+
+ message.format(rpcSpecVersion,true);
+ byte[] msgBytes = JsonRPCMarshaller.marshall(message, (byte)getProtocolVersion().getMajor());
+
ProtocolMessage pm = new ProtocolMessage();
pm.setData(msgBytes);
- if (sdlSession != null)
- pm.setSessionID(sdlSession.getSessionId());
pm.setMessageType(MessageType.RPC);
pm.setSessionType(SessionType.RPC);
- pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
- pm.setPayloadProtected(request.isPayloadProtected());
- if (request.getCorrelationID() == null)
- {
- //Log error here
- throw new SdlException("CorrelationID cannot be null. RPC: " + request.getFunctionName(), SdlExceptionCause.INVALID_ARGUMENT);
+ pm.setFunctionID(FunctionID.getFunctionId(message.getFunctionName()));
+ pm.setPayloadProtected(message.isPayloadProtected());
+
+ if (sdlSession != null) {
+ pm.setSessionID(sdlSession.getSessionId());
}
- pm.setCorrID(request.getCorrelationID());
- if (request.getBulkData() != null){
- pm.setBulkData(request.getBulkData());
+
+ if (message.getBulkData() != null) {
+ pm.setBulkData(message.getBulkData());
}
- if(request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.name())){
- pm.setPriorityCoefficient(1);
+
+
+ if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) { // Request Specifics
+ pm.setRPCType((byte)0x00);
+ RPCRequest request = (RPCRequest) message;
+ if (request.getCorrelationID() == null) {
+ //Log error here
+ throw new SdlException("CorrelationID cannot be null. RPC: " + request.getFunctionName(), SdlExceptionCause.INVALID_ARGUMENT);
+ } else {
+ pm.setCorrID(request.getCorrelationID());
+ }
+ if (request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.name())) {
+ pm.setPriorityCoefficient(1);
+ }
+ } else if (message.getMessageType().equals(RPCMessage.KEY_RESPONSE)) { // Response Specifics
+ pm.setRPCType((byte)0x01);
+ RPCResponse response = (RPCResponse) message;
+ if (response.getCorrelationID() == null) {
+ //Log error here
+ throw new SdlException("CorrelationID cannot be null. RPC: " + response.getFunctionName(), SdlExceptionCause.INVALID_ARGUMENT);
+ } else {
+ pm.setCorrID(response.getCorrelationID());
+ }
+ } else if (message.getMessageType().equals(RPCMessage.KEY_NOTIFICATION)) { // Notification Specifics
+ pm.setRPCType((byte)0x02);
+ } else {
+ //Log error here
+ throw new SdlException("RPC message is not a valid type", SdlExceptionCause.INVALID_ARGUMENT);
}
-
+
// Queue this outgoing message
synchronized(OUTGOING_MESSAGE_QUEUE_THREAD_LOCK) {
if (_outgoingProxyMessageDispatcher != null) {
_outgoingProxyMessageDispatcher.queueMessage(pm);
- //Since the message is queued we can add it's listener to our list
- OnRPCResponseListener listener = request.getOnRPCResponseListener();
- if(request.getMessageType().equals(RPCMessage.KEY_REQUEST)){//We might want to include other message types in the future
+ //Since the message is queued we can add it's listener to our list, if it is a Request
+ if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
+ RPCRequest request = (RPCRequest) message;
+ OnRPCResponseListener listener = request.getOnRPCResponseListener();
addOnRPCResponseListener(listener, request.getCorrelationID(), msgBytes.length);
}
}
}
} catch (OutOfMemoryError e) {
- SdlTrace.logProxyEvent("OutOfMemory exception while sending request " + request.getFunctionName(), SDL_LIB_TRACE_KEY);
- throw new SdlException("OutOfMemory exception while sending request " + request.getFunctionName(), e, SdlExceptionCause.INVALID_ARGUMENT);
+ SdlTrace.logProxyEvent("OutOfMemory exception while sending message " + message.getFunctionName(), SDL_LIB_TRACE_KEY);
+ throw new SdlException("OutOfMemory exception while sending message " + message.getFunctionName(), e, SdlExceptionCause.INVALID_ARGUMENT);
}
}
@@ -2155,6 +2191,20 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
return false;
}
}
+
+ @SuppressWarnings("UnusedReturnValue")
+ public boolean onRPCRequestReceived(RPCRequest request){
+ synchronized(ON_NOTIFICATION_LISTENER_LOCK){
+ CopyOnWriteArrayList<OnRPCRequestListener> listeners = rpcRequestListeners.get(FunctionID.getFunctionId(request.getFunctionName()));
+ if(listeners!=null && listeners.size()>0) {
+ for (OnRPCRequestListener listener : listeners) {
+ listener.onRequest(request);
+ }
+ return true;
+ }
+ return false;
+ }
+ }
/**
* This will ad a listener for the specific type of notification. As of now it will only allow
@@ -2175,6 +2225,24 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
/**
+ * This will ad a listener for the specific type of request. As of now it will only allow
+ * a single listener per request function id
+ * @param requestId The request type that this listener is designated for
+ * @param listener The listener that will be called when a request of the provided type is received
+ */
+ @SuppressWarnings("unused")
+ public void addOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
+ synchronized(ON_NOTIFICATION_LISTENER_LOCK){
+ if(requestId != null && listener != null){
+ if(rpcRequestListeners.indexOfKey(requestId.getId()) < 0 ){
+ rpcRequestListeners.put(requestId.getId(),new CopyOnWriteArrayList<OnRPCRequestListener>());
+ }
+ rpcRequestListeners.get(requestId.getId()).add(listener);
+ }
+ }
+ }
+
+ /**
* This method is no longer valid and will not remove the listener for the supplied notificaiton id
* @param notificationId n/a
* @see #removeOnRPCNotificationListener(FunctionID, OnRPCNotificationListener)
@@ -2198,6 +2266,18 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
return false;
}
+
+ public boolean removeOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
+ synchronized(ON_NOTIFICATION_LISTENER_LOCK){
+ if(rpcRequestListeners!= null
+ && requestId != null
+ && listener != null
+ && rpcRequestListeners.indexOfKey(requestId.getId()) >= 0){
+ return rpcRequestListeners.get(requestId.getId()).remove(listener);
+ }
+ }
+ return false;
+ }
private void processRaiResponse(RegisterAppInterfaceResponse rai)
{
@@ -2250,11 +2330,24 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private void handleRPCMessage(Hashtable<String, Object> hash) {
RPCMessage rpcMsg = new RPCMessage(hash);
//Call format to ensure the RPC is ready to be handled regardless of RPC spec version
-
String functionName = rpcMsg.getFunctionName();
String messageType = rpcMsg.getMessageType();
-
- if (messageType.equals(RPCMessage.KEY_RESPONSE)) {
+
+ // Requests need to be listened for using the SDLManager's addOnRPCRequestListener method.
+ // Requests are not supported by IProxyListenerBase
+ if (messageType.equals(RPCMessage.KEY_REQUEST)) {
+
+ RPCMessage convertedRPCMsg = RpcConverter.convertTableToRpc(hash);
+ SdlTrace.logRPCEvent(InterfaceActivityDirection.Receive, new RPCRequest((RPCRequest)convertedRPCMsg), SDL_LIB_TRACE_KEY);
+
+ if (convertedRPCMsg != null) {
+ convertedRPCMsg.format(rpcSpecVersion, true);
+ onRPCRequestReceived((RPCRequest) convertedRPCMsg);
+ }else{
+ DebugTool.logError("Received a null RPC Request, discarding.");
+ }
+
+ } else if (messageType.equals(RPCMessage.KEY_RESPONSE)) {
SdlTrace.logRPCEvent(InterfaceActivityDirection.Receive, new RPCResponse(rpcMsg), SDL_LIB_TRACE_KEY);
// Check to ensure response is not from an internal message (reserved correlation ID)
@@ -3410,6 +3503,70 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onGetCloudAppProperties(msg);
onRPCResponseReceived(msg);
}
+ } else if (functionName.equals(FunctionID.PUBLISH_APP_SERVICE.toString())) {
+ final PublishAppServiceResponse msg = new PublishAppServiceResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onPublishAppServiceResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onPublishAppServiceResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.GET_APP_SERVICE_DATA.toString())) {
+ final GetAppServiceDataResponse msg = new GetAppServiceDataResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onGetAppServiceDataResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onGetAppServiceDataResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.GET_FILE.toString())) {
+ final GetFileResponse msg = new GetFileResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onGetFileResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onGetFileResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString())) {
+ final PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onPerformAppServiceInteractionResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onPerformAppServiceInteractionResponse( msg);
+ onRPCResponseReceived(msg);
+ }
} else {
if (_sdlMsgVersion != null) {
DebugTool.logError("Unrecognized response Message: " + functionName +
@@ -3707,7 +3864,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
systemRequest.setBulkData(file);
systemRequest.setRequestType(RequestType.ICON_URL);
try {
- sendRPCRequestPrivate(systemRequest);
+ sendRPCMessagePrivate(systemRequest);
} catch (SdlException e) {
e.printStackTrace();
}
@@ -3889,8 +4046,39 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onOnRCStatus(msg);
onRPCNotificationReceived(msg);
}
- }
- else {
+ } else if (functionName.equals(FunctionID.ON_APP_SERVICE_DATA.toString())) {
+ final OnAppServiceData msg = new OnAppServiceData(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onOnAppServiceData(msg);
+ onRPCNotificationReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onOnAppServiceData(msg);
+ onRPCNotificationReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.toString())) {
+ final OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onOnSystemCapabilityUpdated(msg);
+ onRPCNotificationReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onOnSystemCapabilityUpdated(msg);
+ onRPCNotificationReceived(msg);
+ }
+ } else {
if (_sdlMsgVersion != null) {
DebugTool.logInfo("Unrecognized notification Message: " + functionName +
" connected to SDL using message version: " + _sdlMsgVersion.getMajorVersion() + "." + _sdlMsgVersion.getMinorVersion());
@@ -3965,17 +4153,17 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
/**
- * Takes a list of RPCRequests and sends it to SDL in a synchronous fashion. Responses are captured through callback on OnMultipleRequestListener.
+ * Takes a list of RPCMessages and sends it to SDL in a synchronous fashion. Responses are captured through callback on OnMultipleRequestListener.
* For sending requests asynchronously, use sendRequests <br>
*
* <strong>NOTE: This will override any listeners on individual RPCs</strong>
*
- * @param rpcs is the list of RPCRequests being sent
+ * @param rpcs is the list of RPCMessages being sent
* @param listener listener for updates and completions
* @throws SdlException if an unrecoverable error is encountered
*/
@SuppressWarnings("unused")
- public void sendSequentialRequests(final List<? extends RPCRequest> rpcs, final OnMultipleRequestListener listener) throws SdlException {
+ public void sendSequentialRequests(final List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener) throws SdlException {
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
@@ -4004,52 +4192,61 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
return;
}
- RPCRequest rpc = rpcs.remove(0);
- rpc.setCorrelationID(CorrelationIdGenerator.generateId());
+ RPCMessage rpc = rpcs.remove(0);
- rpc.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- // success
- if(listener!=null){
- listener.onUpdate(rpcs.size());
- }
- try {
- // recurse after successful response of RPC
- sendSequentialRequests(rpcs, listener);
- } catch (SdlException e) {
- e.printStackTrace();
- if(listener != null){
- listener.onError(correlationId, Result.GENERIC_ERROR, e.toString());
+ // Request Specifics
+ if (rpc.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
+ RPCRequest request = (RPCRequest) rpc;
+ request.setCorrelationID(CorrelationIdGenerator.generateId());
+
+ request.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ // success
+ if (listener != null) {
+ listener.onUpdate(rpcs.size());
+ }
+ try {
+ // recurse after successful response of RPC
+ sendSequentialRequests(rpcs, listener);
+ } catch (SdlException e) {
+ e.printStackTrace();
+ if (listener != null) {
+ listener.onError(correlationId, Result.GENERIC_ERROR, e.toString());
+ }
}
}
}
- }
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- if(listener != null){
- listener.onError(correlationId, resultCode, info);
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ if (listener != null) {
+ listener.onError(correlationId, resultCode, info);
+ }
}
- }
- });
+ });
+ sendRPCMessagePrivate(request);
+ } else {
+ // Notifications and Responses
+ sendRPCMessagePrivate(rpc);
+ }
+
- sendRPCRequestPrivate(rpc);
}
/**
- * Takes a list of RPCRequests and sends it to SDL. Responses are captured through callback on OnMultipleRequestListener.
+ * Takes a list of RPCMessages and sends it to SDL. Responses are captured through callback on OnMultipleRequestListener.
* For sending requests synchronously, use sendSequentialRequests <br>
*
* <strong>NOTE: This will override any listeners on individual RPCs</strong>
*
- * @param rpcs is the list of RPCRequests being sent
+ * @param rpcs is the list of RPCMessages being sent
* @param listener listener for updates and completions
* @throws SdlException if an unrecoverable error is encountered
*/
@SuppressWarnings("unused")
- public void sendRequests(List<? extends RPCRequest> rpcs, final OnMultipleRequestListener listener) throws SdlException {
+ public void sendRequests(List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener) throws SdlException {
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
@@ -4076,35 +4273,36 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
for (int i = 0; i < arraySize; i++) {
- RPCRequest rpc = rpcs.get(i);
- rpc.setCorrelationID(CorrelationIdGenerator.generateId());
- if(listener != null) {
- listener.addCorrelationId(rpc.getCorrelationID());
- rpc.setOnRPCResponseListener(listener.getSingleRpcResponseListener());
+ RPCMessage rpc = rpcs.get(i);
+ // Request Specifics
+ if (rpc.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
+ RPCRequest request = (RPCRequest) rpc;
+ request.setCorrelationID(CorrelationIdGenerator.generateId());
+ if (listener != null) {
+ listener.addCorrelationId(request.getCorrelationID());
+ request.setOnRPCResponseListener(listener.getSingleRpcResponseListener());
+ }
+ sendRPCMessagePrivate(request);
+ }else {
+ // Notifications and Responses
+ sendRPCMessagePrivate(rpc);
}
- sendRPCRequestPrivate(rpc);
}
}
-
- /**
- * Takes an RPCRequest and sends it to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param request is the RPCRequest being sent
- * @throws SdlException if an unrecoverable error is encountered
- */
- public void sendRPCRequest(RPCRequest request) throws SdlException {
+
+ public void sendRPC(RPCMessage message) throws SdlException {
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
+
// Test if request is null
- if (request == null) {
+ if (message == null) {
SdlTrace.logProxyEvent("Application called sendRPCRequest method with a null RPCRequest.", SDL_LIB_TRACE_KEY);
throw new IllegalArgumentException("sendRPCRequest cannot be called with a null request.");
}
-
- SdlTrace.logProxyEvent("Application called sendRPCRequest method for RPCRequest: ." + request.getFunctionName(), SDL_LIB_TRACE_KEY);
-
+
+ SdlTrace.logProxyEvent("Application called sendRPCRequest method for RPCRequest: ." + message.getFunctionName(), SDL_LIB_TRACE_KEY);
+
// Test if SdlConnection is null
synchronized(CONNECTION_REFERENCE_LOCK) {
if (!getIsConnected()) {
@@ -4112,55 +4310,73 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
throw new SdlException("There is no valid connection to SDL. sendRPCRequest cannot be called until SDL has been connected.", SdlExceptionCause.SDL_UNAVAILABLE);
}
}
-
+
// Test for illegal correlation ID
- if (isCorrelationIDProtected(request.getCorrelationID())) {
-
- SdlTrace.logProxyEvent("Application attempted to use the reserved correlation ID, " + request.getCorrelationID(), SDL_LIB_TRACE_KEY);
- throw new SdlException("Invalid correlation ID. The correlation ID, " + request.getCorrelationID()
- + " , is a reserved correlation ID.", SdlExceptionCause.RESERVED_CORRELATION_ID);
+ if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
+ RPCRequest request = (RPCRequest) message;
+ if (isCorrelationIDProtected(request.getCorrelationID())) {
+
+ SdlTrace.logProxyEvent("Application attempted to use the reserved correlation ID, " + request.getCorrelationID(), SDL_LIB_TRACE_KEY);
+ throw new SdlException("Invalid correlation ID. The correlation ID, " + request.getCorrelationID()
+ + " , is a reserved correlation ID.", SdlExceptionCause.RESERVED_CORRELATION_ID);
+ }
}
// Throw exception if RPCRequest is sent when SDL is unavailable
- if (!_appInterfaceRegisterd && !request.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
-
+ if (!_appInterfaceRegisterd && !message.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
+
SdlTrace.logProxyEvent("Application attempted to send an RPCRequest (non-registerAppInterface), before the interface was registerd.", SDL_LIB_TRACE_KEY);
throw new SdlException("SDL is currently unavailable. RPC Requests cannot be sent.", SdlExceptionCause.SDL_UNAVAILABLE);
}
-
+
if (_advancedLifecycleManagementEnabled) {
- if (request.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString())
- || request.getFunctionName().equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
-
+ if (message.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString())
+ || message.getFunctionName().equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
+
SdlTrace.logProxyEvent("Application attempted to send a RegisterAppInterface or UnregisterAppInterface while using ALM.", SDL_LIB_TRACE_KEY);
- throw new SdlException("The RPCRequest, " + request.getFunctionName() +
+ throw new SdlException("The RPCRequest, " + message.getFunctionName() +
", is un-allowed using the Advanced Lifecycle Management Model.", SdlExceptionCause.INCORRECT_LIFECYCLE_MODEL);
}
}
//FIXME this is temporary until the next major release of the library where OK is removed
- if(FunctionID.SUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
- || FunctionID.UNSUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
- || FunctionID.BUTTON_PRESS.toString().equals(request.getFunctionName())){
+ if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
+ RPCRequest request = (RPCRequest) message;
+ if(FunctionID.SUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
+ || FunctionID.UNSUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
+ || FunctionID.BUTTON_PRESS.toString().equals(request.getFunctionName())) {
- ButtonName buttonName = (ButtonName)request.getObject(ButtonName.class, SubscribeButton.KEY_BUTTON_NAME);
+ ButtonName buttonName = (ButtonName) request.getObject(ButtonName.class, SubscribeButton.KEY_BUTTON_NAME);
- if(rpcSpecVersion != null && rpcSpecVersion.getMajor() < 5) {
+ if (rpcSpecVersion != null && rpcSpecVersion.getMajor() < 5) {
- if (ButtonName.PLAY_PAUSE.equals(buttonName)) {
- request.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.OK);
- }
- } else { //Newer than version 5.0.0
- if(ButtonName.OK.equals(buttonName)){
- RPCRequest request2 = new RPCRequest(request);
- request2.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.PLAY_PAUSE);
- sendRPCRequestPrivate(request2);
+ if (ButtonName.PLAY_PAUSE.equals(buttonName)) {
+ request.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.OK);
+ }
+ } else { //Newer than version 5.0.0
+ if (ButtonName.OK.equals(buttonName)) {
+ RPCRequest request2 = new RPCRequest(request);
+ request2.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.PLAY_PAUSE);
+ sendRPCMessagePrivate(request2);
+ }
}
}
}
-
- sendRPCRequestPrivate(request);
- } // end-method
+
+ sendRPCMessagePrivate(message);
+ }
+
+ /**
+ * Takes an RPCRequest and sends it to SDL. Responses are captured through callback on IProxyListener.
+ *
+ * @param request is the RPCRequest being sent
+ * @throws SdlException if an unrecoverable error is encountered
+ * @deprecated - use sendRPC instead
+ */
+ @Deprecated
+ public void sendRPCRequest(RPCRequest request) throws SdlException {
+ sendRPC(request);
+ }
protected void notifyProxyClosed(final String info, final Exception e, final SdlDisconnectedReason reason) {
SdlTrace.logProxyEvent("NotifyProxyClose", SDL_LIB_TRACE_KEY);
@@ -6019,9 +6235,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_REQUEST);
updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
- sendBroadcastIntent(sendIntent);
-
- sendRPCRequestPrivate(msg);
+ sendBroadcastIntent(sendIntent);
+
+ sendRPCMessagePrivate(msg);
}
/*Begin V1 Enhanced helper function*/
@@ -6390,8 +6606,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
sendBroadcastIntent(sendIntent);
-
- sendRPCRequestPrivate(msg);
+
+ sendRPCMessagePrivate(msg);
}
/**
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
index bc989352d..fc348faf5 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
@@ -17,13 +17,16 @@ import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
+import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
+import com.smartdevicelink.proxy.rpc.GetFileResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
import com.smartdevicelink.proxy.rpc.ListFilesResponse;
+import com.smartdevicelink.proxy.rpc.OnAppServiceData;
import com.smartdevicelink.proxy.rpc.OnAudioPassThru;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
@@ -38,13 +41,16 @@ import com.smartdevicelink.proxy.rpc.OnLockScreenStatus;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
import com.smartdevicelink.proxy.rpc.OnRCStatus;
import com.smartdevicelink.proxy.rpc.OnStreamRPC;
+import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.OnTBTClientState;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.OnVehicleData;
import com.smartdevicelink.proxy.rpc.OnWayPointChange;
+import com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse;
import com.smartdevicelink.proxy.rpc.PerformAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
+import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
@@ -73,14 +79,14 @@ import com.smartdevicelink.proxy.rpc.UpdateTurnListResponse;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-public interface IProxyListenerBase {
+public interface IProxyListenerBase {
/**
* onOnHMIStatus being called indicates that there has been an HMI Level change,
* system context change or audio streaming state change.
- *
+ *
* @param notification - Contains information about the HMI Level,
- * system context and audio streaming state.
+ * system context and audio streaming state.
*/
public void onOnHMIStatus(OnHMIStatus notification);
@@ -90,10 +96,10 @@ public interface IProxyListenerBase {
* A new proxy object must be initiated to reestablish connection with SDL.
* In the ALM model this indicates that the app is no longer registered with SDL
* All resources on SDL (addCommands and ChoiceSets) have been deleted and will have to be
- * recreated upon the next onReadyForInitialization() call-back.
- *
+ * recreated upon the next onReadyForInitialization() call-back.
+ *
* @param info - Includes information about the reason the proxy has been closed.
- * @param e - The exception that occurred.
+ * @param e - The exception that occurred.
*/
public void onProxyClosed(String info, Exception e, SdlDisconnectedReason reason);
@@ -102,233 +108,233 @@ public interface IProxyListenerBase {
public void onServiceNACKed(OnServiceNACKed serviceNACKed);
public void onOnStreamRPC(OnStreamRPC notification);
-
+
public void onStreamRPCResponse(StreamRPCResponse response);
/**
* onProxyError() being called indicates that the SDL Proxy experenced an error.
- *
+ *
* @param info - Includes information about the Exception that occurred.
- * @param e - The exception that occurred.
+ * @param e - The exception that occurred.
*/
public void onError(String info, Exception e);
-
+
/**
* onGenericResponse() being called indicates that SDL could not determine the
* type of request it is responding to. This is usually result of an unknown RPC Request
* being sent.
- *
+ *
* @param response - Includes detailed information about the response.
*/
public void onGenericResponse(GenericResponse response);
-
+
/**
* onOnCommand() being called indicates that the user selected a command on SDL.
- *
+ *
* @param notification - Contains information about the command chosen.
*/
public void onOnCommand(OnCommand notification);
-
+
/**
* onAddCommandResponse() being called indicates that SDL has responded to
* a request to add a command.
- *
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onAddCommandResponse(AddCommandResponse response);
-
+
/**
* onAddSubMenuResponse() being called indicates that SDL has responded to
* a request to add a command.
- *
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onAddSubMenuResponse(AddSubMenuResponse response);
-
+
/**
* onCreateInteractionChoiceSetResponse() being called indicates that SDL has
* responded to a request to add an interactionChoiceSet.
- *
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onCreateInteractionChoiceSetResponse(CreateInteractionChoiceSetResponse response);
-
+
/**
* onAlertResponse being called indicates that SDL has
- * responded to a request to alert the user.
- *
+ * responded to a request to alert the user.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onAlertResponse(AlertResponse response);
-
+
/**
* onDeleteCommandResponse being called indicates that SDL has
- * responded to a request to delete a command.
- *
+ * responded to a request to delete a command.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onDeleteCommandResponse(DeleteCommandResponse response);
-
+
/**
* onDeleteCommandResponse being called indicates that SDL has
- * responded to a request to delete an interaction choice set.
- *
+ * responded to a request to delete an interaction choice set.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onDeleteInteractionChoiceSetResponse(DeleteInteractionChoiceSetResponse response);
-
+
/**
* onDeleteCommandResponse being called indicates that SDL has
- * responded to a request to delete a submenu.
- *
+ * responded to a request to delete a submenu.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onDeleteSubMenuResponse(DeleteSubMenuResponse response);
-
+
/**
* onPerformInteractionResponse being called indicates that SDL has
- * responded to a request to perform an interaction.
- *
+ * responded to a request to perform an interaction.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onPerformInteractionResponse(PerformInteractionResponse response);
-
+
/**
* onResetGlobalPropertiesResponse being called indicates that SDL has
- * responded to a request to reset global properties.
- *
+ * responded to a request to reset global properties.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onResetGlobalPropertiesResponse(ResetGlobalPropertiesResponse response);
-
+
/**
* onSetGlobalPropertiesResponse being called indicates that SDL has
- * responded to a request to set global properties.
- *
+ * responded to a request to set global properties.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onSetGlobalPropertiesResponse(SetGlobalPropertiesResponse response);
-
+
/**
* onSetMediaClockTimerResponse being called indicates that SDL has
- * responded to a request to set the media clock timer.
- *
+ * responded to a request to set the media clock timer.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onSetMediaClockTimerResponse(SetMediaClockTimerResponse response);
-
+
/**
* onShowResponse being called indicates that SDL has
- * responded to a request to display information to the user.
- *
+ * responded to a request to display information to the user.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onShowResponse(ShowResponse response);
-
+
/**
* onSpeakResponse being called indicates that SDL has
- * responded to a request to speak information to the user.
- *
+ * responded to a request to speak information to the user.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onSpeakResponse(SpeakResponse response);
-
+
/**
- * onButtonEvent being called indicates that a button event has occurred.
- *
+ * onButtonEvent being called indicates that a button event has occurred.
+ *
* @param notification - Contains information about the notification sent from SDL.
*/
public void onOnButtonEvent(OnButtonEvent notification);
/**
- * onButtonPress being called indicates that SDL has a button has
- * been pressed by the user.
- *
+ * onButtonPress being called indicates that SDL has a button has
+ * been pressed by the user.
+ *
* @param notification - Contains information about the notification sent from SDL.
*/
public void onOnButtonPress(OnButtonPress notification);
-
+
/**
* onSubscribeButtonResponse being called indicates that SDL has
- * responded to a request to subscribe to button events and button presses.
- *
+ * responded to a request to subscribe to button events and button presses.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onSubscribeButtonResponse(SubscribeButtonResponse response);
-
+
/**
* onUnsubscribeButtonResponse being called indicates that SDL has
- * responded to a request to unsubscribe from button events and button presses.
- *
+ * responded to a request to unsubscribe from button events and button presses.
+ *
* @param response - Contains information about the response sent from SDL.
*/
public void onUnsubscribeButtonResponse(UnsubscribeButtonResponse response);
/**
- * onOnPermissionsChange being called indicates that your app permissions have
+ * onOnPermissionsChange being called indicates that your app permissions have
* changed due to a policy table change. This can mean your app has received additional
* permissions OR lost permissions.
- *
+ *
* @param notification - Contains information about the changed permissions.
*/
public void onOnPermissionsChange(OnPermissionsChange notification);
-
+
public void onSubscribeVehicleDataResponse(SubscribeVehicleDataResponse response);
-
+
public void onUnsubscribeVehicleDataResponse(UnsubscribeVehicleDataResponse response);
-
- public void onGetVehicleDataResponse(GetVehicleDataResponse response);
-
+
+ public void onGetVehicleDataResponse(GetVehicleDataResponse response);
+
public void onOnVehicleData(OnVehicleData notification);
-
+
public void onPerformAudioPassThruResponse(PerformAudioPassThruResponse response);
-
+
public void onEndAudioPassThruResponse(EndAudioPassThruResponse response);
-
+
public void onOnAudioPassThru(OnAudioPassThru notification);
public void onPutFileResponse(PutFileResponse response);
-
+
public void onDeleteFileResponse(DeleteFileResponse response);
-
+
public void onListFilesResponse(ListFilesResponse response);
public void onSetAppIconResponse(SetAppIconResponse response);
-
+
public void onScrollableMessageResponse(ScrollableMessageResponse response);
public void onChangeRegistrationResponse(ChangeRegistrationResponse response);
public void onSetDisplayLayoutResponse(SetDisplayLayoutResponse response);
-
+
public void onOnLanguageChange(OnLanguageChange notification);
-
+
public void onOnHashChange(OnHashChange notification);
-
+
public void onSliderResponse(SliderResponse response);
-
+
public void onOnDriverDistraction(OnDriverDistraction notification);
-
+
public void onOnTBTClientState(OnTBTClientState notification);
-
+
public void onOnSystemRequest(OnSystemRequest notification);
-
+
public void onSystemRequestResponse(SystemRequestResponse response);
-
+
public void onOnKeyboardInput(OnKeyboardInput notification);
-
+
public void onOnTouchEvent(OnTouchEvent notification);
-
+
public void onDiagnosticMessageResponse(DiagnosticMessageResponse response);
-
+
public void onReadDIDResponse(ReadDIDResponse response);
-
+
public void onGetDTCsResponse(GetDTCsResponse response);
-
+
public void onOnLockScreenNotification(OnLockScreenStatus notification);
-
+
public void onDialNumberResponse(DialNumberResponse response);
-
+
public void onSendLocationResponse(SendLocationResponse response);
public void onShowConstantTbtResponse(ShowConstantTbtResponse response);
@@ -338,11 +344,13 @@ public interface IProxyListenerBase {
public void onUpdateTurnListResponse(UpdateTurnListResponse response);
public void onServiceDataACK(int dataSize);
+
public void onGetWayPointsResponse(GetWayPointsResponse response);
public void onSubscribeWayPointsResponse(SubscribeWayPointsResponse response);
public void onUnsubscribeWayPointsResponse(UnsubscribeWayPointsResponse response);
+
public void onOnWayPointChange(OnWayPointChange notification);
public void onGetSystemCapabilityResponse(GetSystemCapabilityResponse response);
@@ -362,4 +370,17 @@ public interface IProxyListenerBase {
public void onSetCloudAppProperties(SetCloudAppPropertiesResponse response);
public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response);
-}
+
+ public void onPublishAppServiceResponse(PublishAppServiceResponse response);
+
+ public void onGetAppServiceDataResponse(GetAppServiceDataResponse response);
+
+ public void onGetFileResponse(GetFileResponse response);
+
+ public void onPerformAppServiceInteractionResponse(PerformAppServiceInteractionResponse response);
+
+ public void onOnAppServiceData(OnAppServiceData notification);
+
+ public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification);
+
+} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
index 5eb8ff36a..9b55d4f17 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
@@ -130,9 +130,16 @@ public interface ISdl {
* Pass an RPC message through the proxy to be sent to the connected module
* @param message RPCRequest that should be sent to the module
*/
+ @Deprecated
void sendRPCRequest(RPCRequest message);
/**
+ * Pass an RPC message through the proxy to be sent to the connected module
+ * @param message RPCRequest that should be sent to the module
+ */
+ void sendRPC(RPCRequest message);
+
+ /**
* Pass a list of RPC requests through the proxy to be sent to core
* @param rpcs List of RPC requests
* @param listener OnMultipleRequestListener that is called between requests and after all are processed
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceCapability.java
new file mode 100644
index 000000000..07be9f023
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceCapability.java
@@ -0,0 +1,69 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
+
+import java.util.Hashtable;
+
+public class AppServiceCapability extends RPCStruct {
+
+ public static final String KEY_UPDATE_REASON = "updateReason";
+ public static final String KEY_UPDATED_APP_SERVICE_RECORD = "updatedAppServiceRecord";
+
+ // Constructors
+
+ public AppServiceCapability(){}
+
+ /**
+ * @param hash of parameters
+ */
+ public AppServiceCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+
+ /**
+ * @param updatedAppServiceRecord -
+ */
+ public AppServiceCapability(@NonNull AppServiceRecord updatedAppServiceRecord){
+ this();
+ setUpdatedAppServiceRecord(updatedAppServiceRecord);
+ }
+
+ // Setters and Getters
+
+ /**
+ * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
+ * @param updateReason -
+ */
+ public void setUpdateReason(ServiceUpdateReason updateReason){
+ setValue(KEY_UPDATE_REASON, updateReason);
+ }
+
+ /**
+ * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
+ * @return updateReason - The updateReason
+ */
+ public ServiceUpdateReason getUpdateReason(){
+ return (ServiceUpdateReason) getObject(ServiceUpdateReason.class, KEY_UPDATE_REASON);
+ }
+
+ /**
+ * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
+ * @param updatedAppServiceRecord -
+ */
+ public void setUpdatedAppServiceRecord(AppServiceRecord updatedAppServiceRecord){
+ setValue(KEY_UPDATED_APP_SERVICE_RECORD, updatedAppServiceRecord);
+ }
+
+ /**
+ * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
+ * @return updateReason - The updateReason
+ */
+ public AppServiceRecord getUpdatedAppServiceRecord(){
+ return (AppServiceRecord) getObject(AppServiceRecord.class, KEY_UPDATED_APP_SERVICE_RECORD);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceData.java
new file mode 100644
index 000000000..ba0966580
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceData.java
@@ -0,0 +1,108 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * Contains all the current data of the app service. The serviceType will link to which of the
+ * service data objects are included in this object. (eg if service type equals MEDIA, the
+ * mediaServiceData param should be included.
+ */
+public class AppServiceData extends RPCStruct {
+
+ public static final String KEY_SERVICE_TYPE = "serviceType";
+ public static final String KEY_SERVICE_ID = "serviceID";
+ public static final String KEY_MEDIA_SERVICE_DATA = "mediaServiceData";
+ public static final String KEY_WEATHER_SERVICE_DATA = "weatherServiceData";
+ public static final String KEY_NAVIGATION_SERVICE_DATA = "navigationServiceData";
+
+
+ // Constructors
+ public AppServiceData() { }
+
+ public AppServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public AppServiceData(@NonNull String serviceType, @NonNull String serviceId) {
+ this();
+ setServiceType(serviceType);
+ setServiceId(serviceId);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param serviceType -
+ */
+ public void setServiceType(@NonNull String serviceType) {
+ setValue(KEY_SERVICE_TYPE, serviceType);
+ }
+
+ /**
+ * @return serviceType -
+ */
+ public String getServiceType() {
+ return getString(KEY_SERVICE_TYPE);
+ }
+
+ /**
+ * @param serviceId -
+ */
+ public void setServiceId(@NonNull String serviceId) {
+ setValue(KEY_SERVICE_ID, serviceId);
+ }
+
+ /**
+ * @return serviceId -
+ */
+ public String getServiceId() {
+ return getString(KEY_SERVICE_ID);
+ }
+
+ /**
+ * @param mediaServiceData -
+ */
+ public void setMediaServiceData(MediaServiceData mediaServiceData) {
+ setValue(KEY_MEDIA_SERVICE_DATA, mediaServiceData);
+ }
+
+ /**
+ * @return mediaServiceData -
+ */
+ public MediaServiceData getMediaServiceData() {
+ return (MediaServiceData) getObject(MediaServiceData.class,KEY_MEDIA_SERVICE_DATA);
+ }
+
+ /**
+ * @param weatherServiceData -
+ */
+ public void setWeatherServiceData(WeatherServiceData weatherServiceData) {
+ setValue(KEY_WEATHER_SERVICE_DATA, weatherServiceData);
+ }
+
+ /**
+ * @return weatherServiceData -
+ */
+ public WeatherServiceData getWeatherServiceData() {
+ return (WeatherServiceData) getObject(WeatherServiceData.class,KEY_WEATHER_SERVICE_DATA);
+ }
+
+ /**
+ * @param navigationServiceData -
+ */
+ public void setNavigationServiceData(NavigationServiceData navigationServiceData) {
+ setValue(KEY_NAVIGATION_SERVICE_DATA, navigationServiceData);
+ }
+
+ /**
+ * @return navigationServiceData -
+ */
+ public NavigationServiceData getNavigationServiceData() {
+ return (NavigationServiceData) getObject(NavigationServiceData.class, KEY_NAVIGATION_SERVICE_DATA);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceManifest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceManifest.java
new file mode 100644
index 000000000..d5cee2365
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceManifest.java
@@ -0,0 +1,189 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * This manifest contains all the information necessary for the service to be
+ * published, activated, and allow consumers to interact with it
+ */
+public class AppServiceManifest extends RPCStruct {
+
+ public static final String KEY_SERVICE_NAME = "serviceName";
+ public static final String KEY_SERVICE_TYPE = "serviceType";
+ public static final String KEY_SERVICE_ICON = "serviceIcon";
+ public static final String KEY_ALLOW_APP_CONSUMERS = "allowAppConsumers";
+ public static final String KEY_RPC_SPEC_VERSION = "rpcSpecVersion";
+ public static final String KEY_HANDLED_RPCS = "handledRPCs";
+ public static final String KEY_MEDIA_SERVICE_MANIFEST = "mediaServiceManifest";
+ public static final String KEY_WEATHER_SERVICE_MANIFEST = "weatherServiceManifest";
+ public static final String KEY_NAVIGATION_SERVICE_MANIFEST = "navigationServiceManifest";
+
+ // Constructors
+ public AppServiceManifest() { }
+
+ public AppServiceManifest(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public AppServiceManifest(@NonNull String serviceType) {
+ this();
+ setServiceType(serviceType);
+ }
+
+ // Setters and Getters
+ /**
+ * Unique name of this service
+ * @param serviceName - the service name
+ */
+ public void setServiceName(String serviceName){
+ setValue(KEY_SERVICE_NAME, serviceName);
+ }
+
+ /**
+ * Unique name of this service
+ * @return ServiceName
+ */
+ public String getServiceName(){
+ return getString(KEY_SERVICE_NAME);
+ }
+
+ /**
+ * The type of service that is to be offered by this app
+ * @param serviceType - the serviceType
+ */
+ public void setServiceType(@NonNull String serviceType){
+ setValue(KEY_SERVICE_TYPE, serviceType);
+ }
+
+ /**
+ * The type of service that is to be offered by this app
+ * @return the AppServiceType
+ */
+ public String getServiceType(){
+ return getString(KEY_SERVICE_TYPE);
+ }
+
+ /**
+ * The icon to be associated with this service Most likely the same as the appIcon.
+ * @param serviceIcon - The Service Icon Image
+ */
+ public void setServiceIcon(Image serviceIcon){
+ setValue(KEY_SERVICE_ICON, serviceIcon);
+ }
+
+ /**
+ * The icon to be associated with this service Most likely the same as the appIcon.
+ * @return serviceIcon Image
+ */
+ public Image getServiceIcon(){
+ return (Image) getObject(Image.class, KEY_SERVICE_ICON);
+ }
+
+ /**
+ * If true, app service consumers beyond the IVI system will be able to access this service. If false,
+ * only the IVI system will be able consume the service. If not provided, it is assumed to be false.
+ * @param allowAppConsumers - boolean
+ */
+ public void setAllowAppConsumers(Boolean allowAppConsumers){
+ setValue(KEY_ALLOW_APP_CONSUMERS, allowAppConsumers);
+ }
+
+ /**
+ * If true, app service consumers beyond the IVI system will be able to access this service. If false,
+ * only the IVI system will be able consume the service. If not provided, it is assumed to be false.
+ * @return allowAppConsumers - boolean
+ */
+ public Boolean getAllowAppConsumers(){
+ return getBoolean(KEY_ALLOW_APP_CONSUMERS);
+ }
+
+ /**
+ * This is the max RPC Spec version the app service understands. This is important during the RPC pass through functionality.
+ * If not included, it is assumed the max version of the module is acceptable.
+ * @param rpcSpecVersion - The rpcSpecVersion
+ */
+ public void setRpcSpecVersion(SdlMsgVersion rpcSpecVersion){
+ setValue(KEY_RPC_SPEC_VERSION, rpcSpecVersion);
+ }
+
+ /**
+ * This is the max RPC Spec version the app service understands. This is important during the RPC pass through functionality.
+ * If not included, it is assumed the max version of the module is acceptable.
+ * @return rpcSpecVersion - The rpcSpecVersion
+ */
+ public SdlMsgVersion getRpcSpecVersion(){
+ return (SdlMsgVersion) getObject(SdlMsgVersion.class,KEY_RPC_SPEC_VERSION);
+ }
+
+ /**
+ * This field contains the Function IDs for the RPCs that this service intends to handle correctly.
+ * This means the service will provide meaningful responses.
+ * @param handledRPCs - The List of Handled RPCs
+ */
+ public void setHandledRpcs(List<Integer> handledRPCs){
+ setValue(KEY_HANDLED_RPCS, handledRPCs);
+ }
+
+ /**
+ * This field contains the Function IDs for the RPCs that this service intends to handle correctly.
+ * This means the service will provide meaningful responses.
+ * @return handledRPCs - The List of Handled RPCs
+ */
+ @SuppressWarnings("unchecked")
+ public List<Integer> getHandledRpcs(){
+ return (List<Integer>) getObject(Integer.class,KEY_HANDLED_RPCS);
+ }
+
+ /**
+ * The MediaServiceManifest
+ * @param mediaServiceManifest - The mediaServiceManifest
+ */
+ public void setMediaServiceManifest(MediaServiceManifest mediaServiceManifest){
+ setValue(KEY_MEDIA_SERVICE_MANIFEST, mediaServiceManifest);
+ }
+
+ /**
+ * The MediaServiceManifest
+ * @return mediaServiceManifest - The mediaServiceManifest
+ */
+ public MediaServiceManifest getMediaServiceManifest(){
+ return (MediaServiceManifest) getObject(MediaServiceManifest.class,KEY_MEDIA_SERVICE_MANIFEST);
+ }
+
+ /**
+ * The WeatherServiceManifest
+ * @param weatherServiceManifest - The weatherServiceManifest
+ */
+ public void setWeatherServiceManifest(WeatherServiceManifest weatherServiceManifest){
+ setValue(KEY_WEATHER_SERVICE_MANIFEST, weatherServiceManifest);
+ }
+
+ /**
+ * The WeatherServiceManifest
+ * @return weatherServiceManifest - The weatherServiceManifest
+ */
+ public WeatherServiceManifest getWeatherServiceManifest(){
+ return (WeatherServiceManifest) getObject(WeatherServiceManifest.class,KEY_WEATHER_SERVICE_MANIFEST);
+ }
+
+ /**
+ * The NavigationServiceManifest
+ * @param navigationServiceManifest - The navigationServiceManifest
+ */
+ public void setNavigationServiceManifest(NavigationServiceManifest navigationServiceManifest){
+ setValue(KEY_NAVIGATION_SERVICE_MANIFEST, navigationServiceManifest);
+ }
+
+ /**
+ * The NavigationServiceManifest
+ * @return navigationServiceManifest - The navigationServiceManifest
+ */
+ public NavigationServiceManifest getNavigationServiceManifest(){
+ return (NavigationServiceManifest) getObject(NavigationServiceManifest.class,KEY_NAVIGATION_SERVICE_MANIFEST);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceRecord.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceRecord.java
new file mode 100644
index 000000000..6d2d74d6d
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceRecord.java
@@ -0,0 +1,108 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * This manifest contains all the information necessary for the
+ * service to be published, activated, and consumers able to interact with it
+ */
+public class AppServiceRecord extends RPCStruct {
+
+ public static final String KEY_SERVICE_ID = "serviceID";
+ public static final String KEY_SERVICE_MANIFEST = "serviceManifest";
+ public static final String KEY_SERVICE_PUBLISHED = "servicePublished";
+ public static final String KEY_SERVICE_ACTIVE = "serviceActive";
+
+
+ // Constructors
+ public AppServiceRecord() { }
+
+ public AppServiceRecord(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public AppServiceRecord(@NonNull String serviceId, @NonNull AppServiceManifest serviceManifest,
+ @NonNull Boolean servicePublished, @NonNull Boolean serviceActive) {
+ this();
+ setServiceId(serviceId);
+ setServiceManifest(serviceManifest);
+ setServicePublished(servicePublished);
+ setServiceActive(serviceActive);
+ }
+
+ // Setters and Getters
+ /**
+ * ID of this service
+ * @param serviceId - the service ID
+ */
+ public void setServiceId(@NonNull String serviceId){
+ setValue(KEY_SERVICE_ID, serviceId);
+ }
+
+ /**
+ * ID of this service
+ * @return serviceId
+ */
+ public String getServiceId(){
+ return getString(KEY_SERVICE_ID);
+ }
+
+ /**
+ * the App Service Manifest
+ * @param serviceManifest - the App Service Manifest
+ */
+ public void setServiceManifest(@NonNull AppServiceManifest serviceManifest){
+ setValue(KEY_SERVICE_MANIFEST, serviceManifest);
+ }
+
+ /**
+ * the App Service Manifest
+ * @return serviceManifest - the App Service Manifest
+ */
+ public AppServiceManifest getServiceManifest(){
+ return (AppServiceManifest) getObject(AppServiceManifest.class,KEY_SERVICE_MANIFEST);
+ }
+
+ /**
+ * If true, the service is published and available. If false, the service has likely just been
+ * unpublished, and should be considered unavailable.
+ * @param servicePublished - boolean
+ */
+ public void setServicePublished(@NonNull Boolean servicePublished){
+ setValue(KEY_SERVICE_PUBLISHED, servicePublished);
+ }
+
+ /**
+ * If true, the service is published and available. If false, the service has likely just been
+ * unpublished, and should be considered unavailable.
+ * @return servicePublished - boolean
+ */
+ public Boolean getServicePublished(){
+ return getBoolean(KEY_SERVICE_PUBLISHED);
+ }
+
+ /**
+ * If true, the service is the active primary service of the supplied service type. It will receive
+ * all potential RPCs that are passed through to that service type. If false, it is not the primary
+ * service of the supplied type. See servicePublished for its availability.
+ * @param serviceActive - boolean
+ */
+ public void setServiceActive(@NonNull Boolean serviceActive){
+ setValue(KEY_SERVICE_ACTIVE, serviceActive);
+ }
+
+ /**
+ * If true, the service is the active primary service of the supplied service type. It will receive
+ * all potential RPCs that are passed through to that service type. If false, it is not the primary
+ * service of the supplied type. See servicePublished for its availability.
+ * @return serviceActive - boolean
+ */
+ public Boolean getServiceActive(){
+ return getBoolean(KEY_SERVICE_ACTIVE);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java
new file mode 100644
index 000000000..ab09b1f5b
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java
@@ -0,0 +1,54 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * Capabilities of app services including what service types are supported
+ * and the current state of services.
+ */
+public class AppServicesCapabilities extends RPCStruct {
+
+ public static final String KEY_APP_SERVICES = "appServices";
+
+ // Constructors
+
+ /**
+ * Capabilities of app services including what service types are supported
+ * and the current state of services.
+ */
+ public AppServicesCapabilities(){}
+
+ /**
+ * Capabilities of app services including what service types are supported
+ * and the current state of services.
+ * @param hash of parameters
+ */
+ public AppServicesCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // Setters and Getters
+
+ /**
+ * An array of currently available services. If this is an update to the
+ * capability the affected services will include an update reason in that item
+ * @param appServices -
+ */
+ public void setAppServices(List<AppServiceCapability> appServices){
+ setValue(KEY_APP_SERVICES, appServices);
+ }
+
+ /**
+ * An array of currently available services. If this is an update to the
+ * capability the affected services will include an update reason in that item
+ * @return appServices
+ */
+ @SuppressWarnings("unchecked")
+ public List<AppServiceCapability> getAppServices(){
+ return (List<AppServiceCapability>) getObject(AppServiceCapability.class,KEY_APP_SERVICES);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceData.java
new file mode 100644
index 000000000..bfc0e43be
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceData.java
@@ -0,0 +1,82 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+/**
+ * This request asks the module for current data related to the specific service.
+ * It also includes an option to subscribe to that service for future updates
+ */
+public class GetAppServiceData extends RPCRequest {
+
+ public static final String KEY_SERVICE_TYPE = "serviceType";
+ public static final String KEY_SUBSCRIBE = "subscribe";
+
+ // Constructors
+ /**
+ * Constructs a new GetAppServiceData object
+ */
+ public GetAppServiceData() {
+ super(FunctionID.GET_APP_SERVICE_DATA.toString());
+ }
+
+ /**
+ * Constructs a new GetAppServiceData object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public GetAppServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new GetAppServiceData object with the mandatory appServiceType parameter
+ * @param appServiceType - The appServiceType
+ */
+ public GetAppServiceData(@NonNull String appServiceType) {
+ this();
+ setServiceType(appServiceType);
+ }
+
+ // Getters / Setters
+
+ /**
+ * @param appServiceType - the appServiceType
+ */
+ public void setServiceType(@NonNull String appServiceType){
+ setParameters(KEY_SERVICE_TYPE, appServiceType);
+ }
+
+ /**
+ * @return appServiceType
+ */
+ public String getServiceType(){
+ return getString(KEY_SERVICE_TYPE);
+ }
+
+ /**
+ * If true, the consumer is requesting to subscribe to all future updates from the service
+ * publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed
+ * if it was previously subscribed.
+ * @param subscribe -
+ */
+ public void setSubscribe(Boolean subscribe){
+ setParameters(KEY_SUBSCRIBE, subscribe);
+ }
+
+ /**
+ * If true, the consumer is requesting to subscribe to all future updates from the service
+ * publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed
+ * if it was previously subscribed.
+ * @return subscribe
+ */
+ public Boolean getSubscribe(){
+ return getBoolean(KEY_SUBSCRIBE);
+ }
+
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceDataResponse.java
new file mode 100644
index 000000000..db2dea526
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceDataResponse.java
@@ -0,0 +1,51 @@
+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;
+
+/**
+ * This response includes the data that is requested from the specific service
+ */
+public class GetAppServiceDataResponse extends RPCResponse {
+
+ public static final String KEY_SERVICE_DATA = "serviceData";
+
+ // Constructors
+
+ public GetAppServiceDataResponse(){
+ super(FunctionID.GET_APP_SERVICE_DATA.toString());
+ }
+
+ public GetAppServiceDataResponse(Hashtable<String, Object> hash){
+ super(hash);
+ }
+
+ public GetAppServiceDataResponse(@NonNull Boolean success, @NonNull Result resultCode, @NonNull AppServiceData serviceData){
+ this();
+ setServiceData(serviceData);
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param serviceData -
+ */
+ public void setServiceData(@NonNull AppServiceData serviceData){
+ setParameters(KEY_SERVICE_DATA, serviceData);
+ }
+
+ /**
+ * @return serviceData
+ */
+ public AppServiceData getServiceData(){
+ return (AppServiceData) getObject(AppServiceData.class, KEY_SERVICE_DATA);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetFile.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetFile.java
new file mode 100644
index 000000000..51913be77
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetFile.java
@@ -0,0 +1,127 @@
+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.FileType;
+
+import java.util.Hashtable;
+
+/**
+ * This request is sent to the module to retrieve a file
+ */
+public class GetFile extends RPCRequest {
+
+ public static final String KEY_FILE_NAME = "fileName";
+ public static final String KEY_APP_SERVICE_ID = "appServiceId";
+ public static final String KEY_FILE_TYPE = "fileType";
+ public static final String KEY_OFFSET = "offset";
+ public static final String KEY_LENGTH = "length";
+
+ // Constructors
+
+ public GetFile() {
+ super(FunctionID.GET_FILE.toString());
+ }
+
+ public GetFile(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public GetFile(@NonNull String fileName) {
+ this();
+ setFileName(fileName);
+ }
+
+ // Setters and Getters
+
+ /**
+ * File name that should be retrieved.
+ * maxlength="255"
+ * @param fileName -
+ */
+ public void setFileName(@NonNull String fileName){
+ setParameters(KEY_FILE_NAME, fileName);
+ }
+
+ /**
+ * File name that should be retrieved.
+ * maxlength="255"
+ * @return fileName
+ */
+ public String getFileName(){
+ return getString(KEY_FILE_NAME);
+ }
+
+ /**
+ * ID of the service that should have uploaded the requested file
+ * @param appServiceId -
+ */
+ public void setAppServiceId(String appServiceId){
+ setParameters(KEY_APP_SERVICE_ID, appServiceId);
+ }
+
+ /**
+ * ID of the service that should have uploaded the requested file
+ * @return appServiceId
+ */
+ public String getAppServiceId(){
+ return getString(KEY_APP_SERVICE_ID);
+ }
+
+ /**
+ * Selected file type.
+ * @param fileType -
+ */
+ public void setFileType(FileType fileType){
+ setParameters(KEY_FILE_TYPE, fileType);
+ }
+
+ /**
+ * Selected file type.
+ * @return fileType
+ */
+ public FileType getFileType(){
+ return (FileType) getObject(FileType.class, KEY_FILE_TYPE);
+ }
+
+ /**
+ * Optional offset in bytes for resuming partial data chunks
+ * minvalue="0" maxvalue="2000000000"
+ * @param offset -
+ */
+ public void setOffset(Integer offset){
+ setParameters(KEY_OFFSET, offset);
+ }
+
+ /**
+ * Optional offset in bytes for resuming partial data chunks
+ * minvalue="0" maxvalue="2000000000"
+ * @return offset
+ */
+ public Integer getOffset(){
+ return getInteger(KEY_OFFSET);
+ }
+
+ /**
+ * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
+ * is the total length of the file to be downloaded
+ * minvalue="0" maxvalue="2000000000"
+ * @param length -
+ */
+ public void setLength(Integer length){
+ setParameters(KEY_LENGTH, length);
+ }
+
+ /**
+ * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
+ * is the total length of the file to be downloaded
+ * minvalue="0" maxvalue="2000000000"
+ * @return length
+ */
+ public Integer getLength(){
+ return getInteger(KEY_LENGTH);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetFileResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetFileResponse.java
new file mode 100644
index 000000000..10d8bb72e
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetFileResponse.java
@@ -0,0 +1,112 @@
+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.FileType;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+public class GetFileResponse extends RPCResponse {
+
+ public static final String KEY_OFFSET = "offset";
+ public static final String KEY_LENGTH = "length";
+ public static final String KEY_FILE_TYPE = "fileType";
+ public static final String KEY_CRC = "crc";
+ /**
+ * Constructs a new PublishAppServiceResponse object
+ */
+ public GetFileResponse() {
+ super(FunctionID.GET_FILE.toString());
+ }
+
+ public GetFileResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+ /**
+ * Constructs a new PublishAppServiceResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public GetFileResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ // Custom Getters / Setters
+
+ /**
+ * File type that is being sent in response
+ * @param fileType -
+ */
+ public void setFileType(FileType fileType){
+ setParameters(KEY_FILE_TYPE, fileType);
+ }
+
+ /**
+ * File type that is being sent in response
+ * @return fileType
+ */
+ public FileType getFileType(){
+ return (FileType) getObject(FileType.class, KEY_FILE_TYPE);
+ }
+
+ /**
+ * Optional offset in bytes for resuming partial data chunks
+ * minvalue="0" maxvalue="2000000000"
+ * @param offset -
+ */
+ public void setOffset(Integer offset){
+ setParameters(KEY_OFFSET, offset);
+ }
+
+ /**
+ * Optional offset in bytes for resuming partial data chunks
+ * minvalue="0" maxvalue="2000000000"
+ * @return offset
+ */
+ public Integer getOffset(){
+ return getInteger(KEY_OFFSET);
+ }
+
+ /**
+ * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
+ * is the total length of the file to be downloaded
+ * minvalue="0" maxvalue="2000000000"
+ * @param length -
+ */
+ public void setLength(Integer length){
+ setParameters(KEY_LENGTH, length);
+ }
+
+ /**
+ * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
+ * is the total length of the file to be downloaded
+ * minvalue="0" maxvalue="2000000000"
+ * @return length
+ */
+ public Integer getLength(){
+ return getInteger(KEY_LENGTH);
+ }
+
+ /**
+ * Additional CRC32 checksum to protect data integrity up to 512 Mbits
+ * minvalue="0" maxvalue="4294967295"
+ * @param crc -
+ */
+ public void setCRC(Integer crc){
+ setParameters(KEY_CRC, crc);
+ }
+
+ /**
+ * Additional CRC32 checksum to protect data integrity up to 512 Mbits
+ * minvalue="0" maxvalue="4294967295"
+ * @return crc
+ */
+ public Integer getCRC(){
+ return getInteger(KEY_CRC);
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java
index 031adddcf..9d8529d6d 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java
@@ -14,6 +14,7 @@ import java.util.Hashtable;
public class GetSystemCapability extends RPCRequest {
public static final String KEY_SYSTEM_CAPABILITY_TYPE = "systemCapabilityType";
+ public static final String KEY_SUBSCRIBE = "subscribe";
/**
* Constructs a new GetSystemCapability object
@@ -25,8 +26,7 @@ public class GetSystemCapability extends RPCRequest {
/**
* <p>Constructs a new GetSystemCapability object indicated by the Hashtable parameter</p>
*
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public GetSystemCapability(Hashtable<String, Object> hash) {
super(hash);
@@ -56,4 +56,24 @@ public class GetSystemCapability extends RPCRequest {
public void setSystemCapabilityType(@NonNull SystemCapabilityType value){
setParameters(KEY_SYSTEM_CAPABILITY_TYPE, value);
}
+
+ /**
+ * Flag to subscribe to updates of the supplied service capability type. If true, the requester
+ * will be subscribed. If false, the requester will not be subscribed and be removed as a
+ * subscriber if it was previously subscribed.
+ * @return if the SystemCapabilityType is subscribed to
+ */
+ public Boolean getSubscribe(){
+ return getBoolean(KEY_SUBSCRIBE);
+ }
+
+ /**
+ * Flag to subscribe to updates of the supplied service capability type. If true, the requester
+ * will be subscribed. If false, the requester will not be subscribed and be removed as a
+ * subscriber if it was previously subscribed.
+ * @param subscribe to changes in the SystemCapabilityType
+ */
+ public void setSubscribe(Boolean subscribe){
+ setParameters(KEY_SUBSCRIBE, subscribe);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java
new file mode 100644
index 000000000..bf4b960eb
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java
@@ -0,0 +1,264 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.MediaType;
+
+import java.util.Hashtable;
+
+/**
+ * This data is related to what a media service should provide
+ */
+public class MediaServiceData extends RPCStruct {
+
+ public static final String KEY_MEDIA_TYPE = "mediaType";
+ public static final String KEY_MEDIA_TITLE = "mediaTitle";
+ public static final String KEY_MEDIA_ARTIST = "mediaArtist";
+ public static final String KEY_MEDIA_ALBUM = "mediaAlbum";
+ public static final String KEY_PLAYLIST_NAME = "playlistName";
+ public static final String KEY_IS_EXPLICIT = "isExplicit";
+ public static final String KEY_TRACK_PLAYBACK_PROGRESS = "trackPlaybackProgress";
+ public static final String KEY_TRACK_PLAYBACK_DURATION = "trackPlaybackDuration";
+ public static final String KEY_QUEUE_PLAYBACK_PROGRESS = "queuePlaybackProgress";
+ public static final String KEY_QUEUE_PLAYBACK_DURATION = "queuePlaybackDuration";
+ public static final String KEY_QUEUE_CURRENT_TRACK_NUMBER = "queueCurrentTrackNumber";
+ public static final String KEY_QUEUE_TOTAL_TRACK_COUNT = "queueTotalTrackCount";
+
+ // Constructors
+
+ public MediaServiceData() { }
+
+ public MediaServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param mediaType - The type of the currently playing or paused track.
+ */
+ public void setMediaType(MediaType mediaType) {
+ setValue(KEY_MEDIA_TYPE, mediaType);
+ }
+
+ /**
+ * @return mediaType - The type of the currently playing or paused track.
+ */
+ public MediaType getMediaType() {
+ return (MediaType) getObject(MediaType.class,KEY_MEDIA_TYPE);
+ }
+
+ /**
+ * Music: The name of the current track
+ * Podcast: The name of the current episode
+ * Audiobook: The name of the current chapter
+ * @param mediaTitle -
+ */
+ public void setMediaTitle(String mediaTitle) {
+ setValue(KEY_MEDIA_TITLE, mediaTitle);
+ }
+
+ /**
+ * Music: The name of the current track
+ * Podcast: The name of the current episode
+ * Audiobook: The name of the current chapter
+ * @return mediaTitle -
+ */
+ public String getMediaTitle() {
+ return getString(KEY_MEDIA_TITLE);
+ }
+
+ /**
+ * Music: The name of the current album artist
+ * Podcast: The provider of the podcast (hosts, network, company)
+ * Audiobook: The book author's name
+ * @param mediaArtist -
+ */
+ public void setMediaArtist(String mediaArtist) {
+ setValue(KEY_MEDIA_ARTIST, mediaArtist);
+ }
+
+ /**
+ * Music: The name of the current album artist
+ * Podcast: The provider of the podcast (hosts, network, company)
+ * Audiobook: The book author's name
+ * @return mediaArtist -
+ */
+ public String getMediaArtist() {
+ return getString(KEY_MEDIA_ARTIST);
+ }
+
+ /**
+ * Music: The name of the current album
+ * Podcast: The name of the current podcast show
+ * Audiobook: The name of the current book
+ * @param mediaAlbum -
+ */
+ public void setMediaAlbum(String mediaAlbum) {
+ setValue(KEY_MEDIA_ALBUM, mediaAlbum);
+ }
+
+ /**
+ * Music: The name of the current album
+ * Podcast: The name of the current podcast show
+ * Audiobook: The name of the current book
+ * @return mediaAlbum -
+ */
+ public String getMediaAlbum() {
+ return getString(KEY_MEDIA_ALBUM);
+ }
+
+ /**
+ * Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
+ * Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
+ * Audiobook: Likely not applicable, possibly a collection or "playlist" of books
+ * @param playlistName -
+ */
+ public void setPlaylistName(String playlistName) {
+ setValue(KEY_PLAYLIST_NAME, playlistName);
+ }
+
+ /**
+ * Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
+ * Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
+ * Audiobook: Likely not applicable, possibly a collection or "playlist" of books
+ * @return playlistName -
+ */
+ public String getPlaylistName() {
+ return getString(KEY_PLAYLIST_NAME);
+ }
+
+ /**
+ * @param isExplicit - Whether or not the content currently playing (e.g. the track, episode, or book) contains explicit content
+ */
+ public void setIsExplicit(Boolean isExplicit) {
+ setValue(KEY_IS_EXPLICIT, isExplicit);
+ }
+
+ /**
+ * @return isExplicit - Whether or not the content currently playing (e.g. the track, episode, or book) contains explicit content
+ */
+ public Boolean getIsExplicit() {
+ return getBoolean(KEY_IS_EXPLICIT);
+ }
+
+ /**
+ * Music: The current progress of the track in seconds
+ * Podcast: The current progress of the episode in seconds
+ * Audiobook: The current progress of the current segment (e.g. the chapter) in seconds
+ * @param trackPlaybackProgress -
+ */
+ public void setTrackPlaybackProgress(Integer trackPlaybackProgress) {
+ setValue(KEY_TRACK_PLAYBACK_PROGRESS, trackPlaybackProgress);
+ }
+
+ /**
+ * Music: The current progress of the track in seconds
+ * Podcast: The current progress of the episode in seconds
+ * Audiobook: The current progress of the current segment (e.g. the chapter) in seconds
+ * @return trackPlaybackProgress -
+ */
+ public Integer getTrackPlaybackProgress() {
+ return getInteger(KEY_TRACK_PLAYBACK_PROGRESS);
+ }
+
+ /**
+ * Music: The total duration of the track in seconds
+ * Podcast: The total duration of the episode in seconds
+ * Audiobook: The total duration of the current segment (e.g. the chapter) in seconds
+ * @param trackPlaybackDuration -
+ */
+ public void setTrackPlaybackDuration(Integer trackPlaybackDuration) {
+ setValue(KEY_TRACK_PLAYBACK_DURATION, trackPlaybackDuration);
+ }
+
+ /**
+ * Music: The total duration of the track in seconds
+ * Podcast: The total duration of the episode in seconds
+ * Audiobook: The total duration of the current segment (e.g. the chapter) in seconds
+ * @return trackPlaybackDuration -
+ */
+ public Integer getTrackPlaybackDuration() {
+ return getInteger(KEY_TRACK_PLAYBACK_DURATION);
+ }
+
+ /**
+ * Music: The current progress of the playback queue in seconds
+ * Podcast: The current progress of the playback queue in seconds
+ * Audiobook: The current progress of the playback queue (e.g. the book) in seconds
+ * @param queuePlaybackProgress -
+ */
+ public void setQueuePlaybackProgress(Integer queuePlaybackProgress) {
+ setValue(KEY_QUEUE_PLAYBACK_PROGRESS, queuePlaybackProgress);
+ }
+
+ /**
+ * Music: The current progress of the playback queue in seconds
+ * Podcast: The current progress of the playback queue in seconds
+ * Audiobook: The current progress of the playback queue (e.g. the book) in seconds
+ * @return queuePlaybackProgress -
+ */
+ public Integer getQueuePlaybackProgress() {
+ return getInteger(KEY_QUEUE_PLAYBACK_PROGRESS);
+ }
+
+ /**
+ * Music: The total duration of the playback queue in seconds
+ * Podcast: The total duration of the playback queue in seconds
+ * Audiobook: The total duration of the playback queue (e.g. the book) in seconds
+ * @param queuePlaybackDuration -
+ */
+ public void setQueuePlaybackDuration(Integer queuePlaybackDuration) {
+ setValue(KEY_QUEUE_PLAYBACK_DURATION, queuePlaybackDuration);
+ }
+
+ /**
+ * Music: The total duration of the playback queue in seconds
+ * Podcast: The total duration of the playback queue in seconds
+ * Audiobook: The total duration of the playback queue (e.g. the book) in seconds
+ * @return queuePlaybackDuration -
+ */
+ public Integer getQueuePlaybackDuration() {
+ return getInteger(KEY_QUEUE_PLAYBACK_DURATION);
+ }
+
+ /**
+ * Music: The current number (1 based) of the track in the playback queue
+ * Podcast: The current number (1 based) of the episode in the playback queue
+ * Audiobook: The current number (1 based) of the episode in the playback queue (e.g. the chapter number in the book)
+ * @param queueCurrentTrackNumber -
+ */
+ public void setQueueCurrentTrackNumber(Integer queueCurrentTrackNumber) {
+ setValue(KEY_QUEUE_CURRENT_TRACK_NUMBER, queueCurrentTrackNumber);
+ }
+
+ /**
+ * Music: The current number (1 based) of the track in the playback queue
+ * Podcast: The current number (1 based) of the episode in the playback queue
+ * Audiobook: The current number (1 based) of the episode in the playback queue (e.g. the chapter number in the book)
+ * @return queueCurrentTrackNumber -
+ */
+ public Integer getQueueCurrentTrackNumber() {
+ return getInteger(KEY_QUEUE_CURRENT_TRACK_NUMBER);
+ }
+
+ /**
+ * Music: The total number of tracks in the playback queue
+ * Podcast: The total number of episodes in the playback queue
+ * Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
+ * @param queueTotalTrackCount -
+ */
+ public void setQueueTotalTrackCount(Integer queueTotalTrackCount) {
+ setValue(KEY_QUEUE_TOTAL_TRACK_COUNT, queueTotalTrackCount);
+ }
+
+ /**
+ * Music: The total number of tracks in the playback queue
+ * Podcast: The total number of episodes in the playback queue
+ * Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
+ * @return queueTotalTrackCount -
+ */
+ public Integer getQueueTotalTrackCount() {
+ return getInteger(KEY_QUEUE_TOTAL_TRACK_COUNT);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceManifest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceManifest.java
new file mode 100644
index 000000000..22d66e7e7
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceManifest.java
@@ -0,0 +1,15 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+
+public class MediaServiceManifest extends RPCStruct {
+
+ public MediaServiceManifest() { }
+
+ public MediaServiceManifest(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationInstruction.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationInstruction.java
new file mode 100644
index 000000000..5052e55f9
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationInstruction.java
@@ -0,0 +1,169 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.Direction;
+import com.smartdevicelink.proxy.rpc.enums.NavigationAction;
+import com.smartdevicelink.proxy.rpc.enums.NavigationJunction;
+
+import java.util.Hashtable;
+
+public class NavigationInstruction extends RPCStruct {
+
+ public static final String KEY_LOCATION_DETAILS = "locationDetails";
+ public static final String KEY_ACTION = "action";
+ public static final String KEY_ETA = "eta";
+ public static final String KEY_BEARING = "bearing";
+ public static final String KEY_JUNCTION_TYPE = "junctionType";
+ public static final String KEY_DRIVING_SIDE = "drivingSide";
+ public static final String KEY_DETAILS = "details";
+ public static final String KEY_IMAGE = "image";
+
+ // Constructors
+
+ public NavigationInstruction() { }
+
+ public NavigationInstruction(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public NavigationInstruction(@NonNull LocationDetails locationDetails, @NonNull NavigationAction action){
+ this();
+ setLocationDetails(locationDetails);
+ setAction(action);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param locationDetails -
+ */
+ public void setLocationDetails(@NonNull LocationDetails locationDetails){
+ setValue(KEY_LOCATION_DETAILS, locationDetails);
+ }
+
+ /**
+ * @return locationDetails
+ */
+ public LocationDetails getLocationDetails(){
+ return (LocationDetails) getObject(LocationDetails.class, KEY_LOCATION_DETAILS);
+ }
+
+ /**
+ * @param action -
+ */
+ public void setAction(@NonNull NavigationAction action){
+ setValue(KEY_ACTION, action);
+ }
+
+ /**
+ * @return action
+ */
+ public NavigationAction getAction(){
+ return (NavigationAction) getObject(NavigationAction.class, KEY_ACTION);
+ }
+
+ /**
+ * @param eta -
+ */
+ public void setEta(DateTime eta){
+ setValue(KEY_ETA, eta);
+ }
+
+ /**
+ * @return eta
+ */
+ public DateTime getEta(){
+ return (DateTime) getObject(DateTime.class, KEY_ETA);
+ }
+
+ /**
+ * The angle at which this instruction takes place. For example, 0 would mean straight, <=45
+ * is bearing right, >= 135 is sharp right, between 45 and 135 is a regular right, and 180 is
+ * a U-Turn, etc.
+ * @param bearing - minValue="0" maxValue="359"
+ */
+ public void setBearing(Integer bearing){
+ setValue(KEY_BEARING, bearing);
+ }
+
+ /**
+ * The angle at which this instruction takes place. For example, 0 would mean straight, <=45
+ * is bearing right, >= 135 is sharp right, between 45 and 135 is a regular right, and 180 is
+ * a U-Turn, etc.
+ * @return bearing - minValue="0" maxValue="359"
+ */
+ public Integer getBearing(){
+ return getInteger(KEY_BEARING);
+ }
+
+ /**
+ * @param junctionType -
+ */
+ public void setJunctionType(NavigationJunction junctionType){
+ setValue(KEY_JUNCTION_TYPE, junctionType);
+ }
+
+ /**
+ * @return junctionType
+ */
+ public NavigationJunction getJunctionType(){
+ return (NavigationJunction) getObject(NavigationJunction.class, KEY_JUNCTION_TYPE);
+ }
+
+ /**
+ * Used to infer which side of the road this instruction takes place. For a U-Turn
+ * (Action=Turn, direction=180) this will determine which direction the turn should take place.
+ * @param drivingSide -
+ */
+ public void setDrivingSide(Direction drivingSide){
+ setValue(KEY_DRIVING_SIDE, drivingSide);
+ }
+
+ /**
+ * Used to infer which side of the road this instruction takes place. For a U-Turn
+ * (Action=Turn, direction=180) this will determine which direction the turn should take place.
+ * @return drivingSide
+ */
+ public Direction getDrivingSide(){
+ return (Direction) getObject(Direction.class, KEY_DRIVING_SIDE);
+ }
+
+ /**
+ * This is a string representation of this instruction, used to display instructions to the
+ * users. This is not intended to be read aloud to the users, see the param prompt in
+ * NavigationServiceData for that.
+ * @param details -
+ */
+ public void setDetails(String details){
+ setValue(KEY_DETAILS, details);
+ }
+
+ /**
+ * This is a string representation of this instruction, used to display instructions to the
+ * users. This is not intended to be read aloud to the users, see the param prompt in
+ * NavigationServiceData for that.
+ * @return details
+ */
+ public String getDetails(){
+ return getString(KEY_DETAILS);
+ }
+
+ /**
+ * An image representation of this instruction.
+ * @param image -
+ */
+ public void setImage(Image image){
+ setValue(KEY_IMAGE, image);
+ }
+
+ /**
+ * An image representation of this instruction.
+ * @return image
+ */
+ public Image getImage(){
+ return (Image) getObject(Image.class, KEY_IMAGE);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceData.java
new file mode 100644
index 000000000..4c1817954
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceData.java
@@ -0,0 +1,189 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * This data is related to what a navigation service would provide.
+ */
+public class NavigationServiceData extends RPCStruct {
+
+ public static final String KEY_TIMESTAMP = "timeStamp";
+ public static final String KEY_ORIGIN= "origin";
+ public static final String KEY_DESTINATION = "destination";
+ public static final String KEY_DESTINATION_ETA = "destinationETA";
+ public static final String KEY_INSTRUCTIONS = "instructions";
+ public static final String KEY_NEXT_INSTRUCTION_ETA = "nextInstructionETA";
+ public static final String KEY_NEXT_INSTRUCTION_DISTANCE = "nextInstructionDistance";
+ public static final String KEY_NEXT_INSTRUCTION_DISTANCE_SCALE= "nextInstructionDistanceScale";
+ public static final String KEY_PROMPT = "prompt";
+
+ // Constructors
+
+ public NavigationServiceData() { }
+
+ public NavigationServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public NavigationServiceData(@NonNull DateTime timeStamp){
+ this();
+ setTimeStamp(timeStamp);
+ }
+
+ // Setters and Getters
+
+ /**
+ * This is the timeStamp of when the data was generated. This is to ensure any time or distance
+ * given in the data can accurately be adjusted if necessary.
+ * @param timeStamp -
+ */
+ public void setTimeStamp(@NonNull DateTime timeStamp){
+ setValue(KEY_TIMESTAMP, timeStamp);
+ }
+
+ /**
+ * This is the timeStamp of when the data was generated. This is to ensure any time or distance
+ * given in the data can accurately be adjusted if necessary.
+ * @return timeStamp
+ */
+ public DateTime getTimeStamp(){
+ return (DateTime) getObject(DateTime.class, KEY_TIMESTAMP);
+ }
+
+ /**
+ * @param origin -
+ */
+ public void setOrigin(LocationDetails origin){
+ setValue(KEY_ORIGIN, origin);
+ }
+
+ /**
+ * @return origin
+ */
+ public LocationDetails getOrigin(){
+ return (LocationDetails) getObject(LocationDetails.class, KEY_ORIGIN);
+ }
+
+ /**
+ * @param destination -
+ */
+ public void setDestination(LocationDetails destination){
+ setValue(KEY_DESTINATION, destination);
+ }
+
+ /**
+ * @return destination
+ */
+ public LocationDetails getDestination(){
+ return (LocationDetails) getObject(LocationDetails.class, KEY_DESTINATION);
+ }
+
+ /**
+ * @param destinationETA -
+ */
+ public void setDestinationETA(DateTime destinationETA){
+ setValue(KEY_DESTINATION_ETA, destinationETA);
+ }
+
+ /**
+ * @return destinationETA
+ */
+ public DateTime getDestinationETA(){
+ return (DateTime) getObject(DateTime.class, KEY_DESTINATION_ETA);
+ }
+
+ /**
+ * This array should be ordered with all remaining instructions. The start of this array should
+ * always contain the next instruction.
+ * @param instructions -
+ */
+ public void setInstructions(List<NavigationInstruction> instructions){
+ setValue(KEY_INSTRUCTIONS, instructions);
+ }
+
+ /**
+ * This array should be ordered with all remaining instructions. The start of this array should
+ * always contain the next instruction.
+ * @return instructions
+ */
+ @SuppressWarnings("unchecked")
+ public List<NavigationInstruction> getInstructions(){
+ return (List<NavigationInstruction>) getObject(NavigationInstruction.class,KEY_INSTRUCTIONS);
+ }
+
+ /**
+ * @param nextInstructionETA -
+ */
+ public void setNextInstructionETA(DateTime nextInstructionETA){
+ setValue(KEY_NEXT_INSTRUCTION_ETA, nextInstructionETA);
+ }
+
+ /**
+ * @return nextInstructionETA
+ */
+ public DateTime getNextInstructionETA(){
+ return (DateTime) getObject(DateTime.class, KEY_NEXT_INSTRUCTION_ETA);
+ }
+
+ /**
+ * The distance to this instruction from current location. This should only be updated every
+ * .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and
+ * the next instruction.
+ * @param nextInstructionDistance -
+ */
+ public void setNextInstructionDistance(Float nextInstructionDistance){
+ setValue(KEY_NEXT_INSTRUCTION_DISTANCE, nextInstructionDistance);
+ }
+
+ /**
+ * The distance to this instruction from current location. This should only be updated every
+ * .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and
+ * the next instruction.
+ * @return nextInstructionDistance
+ */
+ public Float getNextInstructionDistance(){
+ return getFloat(KEY_NEXT_INSTRUCTION_DISTANCE);
+ }
+
+ /**
+ * Distance till next maneuver (starting from) from previous maneuver.
+ * @param nextInstructionDistanceScale -
+ */
+ public void setNextInstructionDistanceScale(Float nextInstructionDistanceScale){
+ setValue(KEY_NEXT_INSTRUCTION_DISTANCE_SCALE, nextInstructionDistanceScale);
+ }
+
+ /**
+ * Distance till next maneuver (starting from) from previous maneuver.
+ * @return nextInstructionDistanceScale
+ */
+ public Float getNextInstructionDistanceScale(){
+ return getFloat(KEY_NEXT_INSTRUCTION_DISTANCE_SCALE);
+ }
+
+ /**
+ * This is a prompt message that should be conveyed to the user through either display or voice
+ * (TTS). This param will change often as it should represent the following: approaching
+ * instruction, post instruction, alerts that affect the current navigation session, etc.
+ * @param prompt -
+ */
+ public void setPrompt(String prompt){
+ setValue(KEY_PROMPT, prompt);
+ }
+
+ /**
+ * This is a prompt message that should be conveyed to the user through either display or voice
+ * (TTS). This param will change often as it should represent the following: approaching
+ * instruction, post instruction, alerts that affect the current navigation session, etc.
+ * @return prompt
+ */
+ public String getPrompt(){
+ return getString(KEY_PROMPT);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceManifest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceManifest.java
new file mode 100644
index 000000000..54da7bdd1
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceManifest.java
@@ -0,0 +1,37 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+public class NavigationServiceManifest extends RPCStruct {
+
+ public static final String KEY_ACCEPTS_WAY_POINTS = "acceptsWayPoints";
+
+ // Constructors
+
+ public NavigationServiceManifest() { }
+
+ public NavigationServiceManifest(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // Setters and Getters
+
+ /**
+ * Informs the subscriber if this service can actually accept way points.
+ * @param acceptsWayPoints -
+ */
+ public void setAcceptsWayPoints(Boolean acceptsWayPoints){
+ setValue(KEY_ACCEPTS_WAY_POINTS, acceptsWayPoints);
+ }
+
+ /**
+ * Informs the subscriber if this service can actually accept way points.
+ * @return acceptsWayPoints
+ */
+ public Boolean getAcceptsWayPoints(){
+ return getBoolean(KEY_ACCEPTS_WAY_POINTS);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnAppServiceData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnAppServiceData.java
new file mode 100644
index 000000000..48cab3cd6
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnAppServiceData.java
@@ -0,0 +1,48 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCNotification;
+
+import java.util.Hashtable;
+
+/**
+ * This notification includes the data that is updated from the specific service
+ */
+public class OnAppServiceData extends RPCNotification {
+
+ public static final String KEY_SERVICE_DATA = "serviceData";
+
+ // Constructors
+
+ public OnAppServiceData() {
+ super(FunctionID.ON_APP_SERVICE_DATA.toString());
+ }
+
+ public OnAppServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public OnAppServiceData(@NonNull AppServiceData serviceData) {
+ this();
+ setServiceData(serviceData);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param serviceData -
+ */
+ public void setServiceData(@NonNull AppServiceData serviceData){
+ setParameters(KEY_SERVICE_DATA, serviceData);
+ }
+
+ /**
+ * @return serviceData
+ */
+ public AppServiceData getServiceData(){
+ return (AppServiceData) getObject(AppServiceData.class, KEY_SERVICE_DATA);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemCapabilityUpdated.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemCapabilityUpdated.java
new file mode 100644
index 000000000..37d34b420
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemCapabilityUpdated.java
@@ -0,0 +1,48 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCNotification;
+
+import java.util.Hashtable;
+
+/**
+ * A notification to inform the connected device that a specific system capability has changed.
+ */
+public class OnSystemCapabilityUpdated extends RPCNotification {
+
+ public static final String KEY_SYSTEM_CAPABILITY = "systemCapability";
+
+ // Constructors
+
+ public OnSystemCapabilityUpdated() {
+ super(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.toString());
+ }
+
+ public OnSystemCapabilityUpdated(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public OnSystemCapabilityUpdated(@NonNull SystemCapability serviceData) {
+ this();
+ setSystemCapability(serviceData);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param systemCapability - The system capability that has been updated
+ */
+ public void setSystemCapability(@NonNull SystemCapability systemCapability){
+ setParameters(KEY_SYSTEM_CAPABILITY, systemCapability);
+ }
+
+ /**
+ * @return systemCapability - The system capability that has been updated
+ */
+ public SystemCapability getSystemCapability(){
+ return (SystemCapability) getObject(SystemCapability.class, KEY_SYSTEM_CAPABILITY);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteraction.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteraction.java
new file mode 100644
index 000000000..37dd36684
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteraction.java
@@ -0,0 +1,101 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+public class PerformAppServiceInteraction extends RPCRequest {
+
+ public static final String KEY_SERVICE_URI = "serviceUri";
+ public static final String KEY_SERVICE_ID = "serviceID";
+ public static final String KEY_ORIGIN_APP = "originApp";
+ public static final String KEY_REQUEST_SERVICE_ACTIVE = "requestServiceActive";
+
+ // Constructors
+
+ public PerformAppServiceInteraction() {
+ super(FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString());
+ }
+
+ public PerformAppServiceInteraction(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public PerformAppServiceInteraction(@NonNull String serviceUri, @NonNull String appServiceId, @NonNull String originApp) {
+ this();
+ setServiceUri(serviceUri);
+ setAppServiceId(appServiceId);
+ setOriginApp(originApp);
+ }
+
+ /**
+ * Fully qualified URI based on the URI prefix and URI scheme the app service provided. SDL
+ * makes no guarantee that this URI is correct.
+ * @param serviceUri -
+ */
+ public void setServiceUri(@NonNull String serviceUri){
+ setParameters(KEY_SERVICE_URI, serviceUri);
+ }
+
+ /**
+ * Fully qualified URI based on the URI prefix and URI scheme the app service provided. SDL
+ * makes no guarantee that this URI is correct.
+ * @return serviceUri
+ */
+ public String getServiceUri(){
+ return getString(KEY_SERVICE_URI);
+ }
+
+ /**
+ * The service ID that the app consumer wishes to send this URI.
+ * @param appServiceId -
+ */
+ public void setAppServiceId(@NonNull String appServiceId){
+ setParameters(KEY_SERVICE_ID, appServiceId);
+ }
+
+ /**
+ * The service ID that the app consumer wishes to send this URI.
+ * @return appServiceId
+ */
+ public String getAppServiceId(){
+ return getString(KEY_SERVICE_ID);
+ }
+
+ /**
+ * This string is the appID of the app requesting the app service provider take the specific action.
+ * @param originApp -
+ */
+ public void setOriginApp(@NonNull String originApp){
+ setParameters(KEY_ORIGIN_APP, originApp);
+ }
+
+ /**
+ * This string is the appID of the app requesting the app service provider take the specific action.
+ * @return originApp
+ */
+ public String getOriginApp(){
+ return getString(KEY_ORIGIN_APP);
+ }
+
+ /**
+ * This flag signals the requesting consumer would like this service to become the active primary
+ * service of the destination's type.
+ * @param requestServiceActive -
+ */
+ public void setRequestServiceActive(Boolean requestServiceActive){
+ setParameters(KEY_REQUEST_SERVICE_ACTIVE, requestServiceActive);
+ }
+
+ /**
+ * This string is the appID of the app requesting the app service provider take the specific action.
+ * @return requestServiceActive
+ */
+ public Boolean getRequestServiceActive(){
+ return getBoolean(KEY_REQUEST_SERVICE_ACTIVE);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteractionResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteractionResponse.java
new file mode 100644
index 000000000..718c6526b
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteractionResponse.java
@@ -0,0 +1,56 @@
+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;
+
+public class PerformAppServiceInteractionResponse extends RPCResponse {
+
+ public static final String KEY_SERVICE_SPECIFIC_RESULT = "serviceSpecificResult";
+
+ /**
+ * Constructs a new PerformAppServiceInteractionResponse object
+ */
+ public PerformAppServiceInteractionResponse() {
+ super(FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString());
+ }
+
+ public PerformAppServiceInteractionResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+ /**
+ * Constructs a new PerformAppServiceInteractionResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public PerformAppServiceInteractionResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ // Setters / getters
+
+ /**
+ * The service can provide specific result strings to the consumer through this param. These
+ * results should be described in the URI schema set in the Service Manifest
+ * @param serviceSpecificResult -
+ */
+ public void setServiceSpecificResult(String serviceSpecificResult){
+ setParameters(KEY_SERVICE_SPECIFIC_RESULT, serviceSpecificResult);
+ }
+
+ /**
+ * The service can provide specific result strings to the consumer through this param. These
+ * results should be described in the URI schema set in the Service Manifest
+ * @return serviceSpecificResult
+ */
+ public String getServiceSpecificResult(){
+ return getString(KEY_SERVICE_SPECIFIC_RESULT);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java
new file mode 100644
index 000000000..ae11f06c6
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java
@@ -0,0 +1,60 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+/**
+ * Registers a service offered by this app on the module
+ */
+public class PublishAppService extends RPCRequest {
+
+ public static final String KEY_APP_SERVICE_MANIFEST = "appServiceManifest";
+
+ // Constructors
+ /**
+ * Constructs a new PublishAppService object
+ */
+ public PublishAppService() {
+ super(FunctionID.PUBLISH_APP_SERVICE.toString());
+ }
+
+ /**
+ * Constructs a new PublishAppService object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public PublishAppService(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new PublishAppService object
+ * @param appServiceManifest - The appServiceManifest
+ */
+ public PublishAppService(@NonNull AppServiceManifest appServiceManifest) {
+ this();
+ setServiceManifest(appServiceManifest);
+ }
+
+ // Getters / Setters
+
+ /**
+ * The manifest of the service that wishes to be published.
+ * @param serviceManifest - the App Service Manifest
+ */
+ public void setServiceManifest(@NonNull AppServiceManifest serviceManifest){
+ setParameters(KEY_APP_SERVICE_MANIFEST, serviceManifest);
+ }
+
+ /**
+ * The manifest of the service that wishes to be published.
+ * @return serviceManifest - the App Service Manifest
+ */
+ public AppServiceManifest getServiceManifest(){
+ return (AppServiceManifest) getObject(AppServiceManifest.class,KEY_APP_SERVICE_MANIFEST);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppServiceResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppServiceResponse.java
new file mode 100644
index 000000000..753ad30a0
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppServiceResponse.java
@@ -0,0 +1,54 @@
+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;
+
+public class PublishAppServiceResponse extends RPCResponse {
+
+ public static final String KEY_APP_SERVICE_RECORD = "appServiceRecord";
+ /**
+ * Constructs a new PublishAppServiceResponse object
+ */
+ public PublishAppServiceResponse() {
+ super(FunctionID.PUBLISH_APP_SERVICE.toString());
+ }
+
+ public PublishAppServiceResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+ /**
+ * Constructs a new PublishAppServiceResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public PublishAppServiceResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ // Custom Getters / Setters
+
+ /**
+ * If the request was successful, this object will be the current status of the service record
+ * for the published service. This will include the Core supplied service ID.
+ * @param appServiceRecord - the App Service Record
+ */
+ public void setServiceRecord(AppServiceRecord appServiceRecord){
+ setParameters(KEY_APP_SERVICE_RECORD, appServiceRecord);
+ }
+
+ /**
+ * If the request was successful, this object will be the current status of the service record
+ * for the published service. This will include the Core supplied service ID.
+ * @return appServiceRecord - the App Service Record
+ */
+ public AppServiceRecord getServiceRecord(){
+ return (AppServiceRecord) getObject(AppServiceRecord.class,KEY_APP_SERVICE_RECORD);
+ }
+} \ 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 6ee294905..4450a83d4 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
@@ -17,6 +17,7 @@ public class SystemCapability extends RPCStruct {
public static final String KEY_PHONE_CAPABILITY = "phoneCapability";
public static final String KEY_VIDEO_STREAMING_CAPABILITY = "videoStreamingCapability";
public static final String KEY_REMOTE_CONTROL_CAPABILITY = "remoteControlCapability";
+ public static final String KEY_APP_SERVICES_CAPABILITIES = "appServicesCapabilities";
public SystemCapability(){}
@@ -57,7 +58,9 @@ public class SystemCapability extends RPCStruct {
return (RPCStruct) getObject(VideoStreamingCapability.class, KEY_VIDEO_STREAMING_CAPABILITY);
}else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
return (RPCStruct) getObject(RemoteControlCapabilities.class, KEY_REMOTE_CONTROL_CAPABILITY);
- }else{
+ }else if(type.equals(SystemCapabilityType.APP_SERVICES)){
+ return (RPCStruct) getObject(AppServicesCapabilities.class, KEY_APP_SERVICES_CAPABILITIES);
+ }else{
return null;
}
}
@@ -71,7 +74,9 @@ public class SystemCapability extends RPCStruct {
setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability);
}else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
setValue(KEY_REMOTE_CONTROL_CAPABILITY, capability);
- }else{
+ }else if(type.equals(SystemCapabilityType.APP_SERVICES)){
+ setValue(KEY_APP_SERVICES_CAPABILITIES, capability);
+ }else{
return;
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherAlert.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherAlert.java
new file mode 100644
index 000000000..3131b0998
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherAlert.java
@@ -0,0 +1,121 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+
+public class WeatherAlert extends RPCStruct {
+
+ public static final String KEY_TITLE = "title";
+ public static final String KEY_SUMMARY = "summary";
+ public static final String KEY_EXPIRES = "expires";
+ public static final String KEY_REGIONS = "regions";
+ public static final String KEY_SEVERITY = "severity";
+ public static final String KEY_TIME_ISSUED = "timeIssued";
+
+ // Constructors
+
+ public WeatherAlert() { }
+
+ public WeatherAlert(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public WeatherAlert(@NonNull List<String> regions) {
+ this();
+ setRegions(regions);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param title -
+ */
+ public void setTitle(String title) {
+ setValue(KEY_TITLE, title);
+ }
+
+ /**
+ * @return title
+ */
+ public String getTitle() {
+ return getString(KEY_TITLE);
+ }
+
+ /**
+ * @param summary -
+ */
+ public void setSummary(String summary) {
+ setValue(KEY_SUMMARY, summary);
+ }
+
+ /**
+ * @return summary
+ */
+ public String getSummary() {
+ return getString(KEY_SUMMARY);
+ }
+
+ /**
+ * @param severity -
+ */
+ public void setSeverity(String severity) {
+ setValue(KEY_SEVERITY, severity);
+ }
+
+ /**
+ * @return severity
+ */
+ public String getSeverity() {
+ return getString(KEY_SEVERITY);
+ }
+
+ /**
+ * Min Size: 1, Max Size: 99
+ * @param regions -
+ */
+ public void setRegions(@NonNull List<String> regions) {
+ setValue(KEY_REGIONS, regions);
+ }
+
+ /**
+ * @return regions list
+ */
+ @SuppressWarnings("unchecked")
+ public List<String> getRegions(){
+ return (List<String>) getObject(String.class,KEY_REGIONS);
+ }
+
+ /**
+ * @param expires -
+ */
+ public void setExpires(DateTime expires) {
+ setValue(KEY_EXPIRES, expires);
+ }
+
+ /**
+ * @return expires
+ */
+ public DateTime getExpires() {
+ return (DateTime) getObject(DateTime.class,KEY_EXPIRES);
+ }
+
+ /**
+ * @param timeIssued -
+ */
+ public void setTimeIssued(DateTime timeIssued) {
+ setValue(KEY_TIME_ISSUED, timeIssued);
+ }
+
+ /**
+ * @return timeIssued
+ */
+ public DateTime getTimeIssued() {
+ return (DateTime) getObject(DateTime.class,KEY_TIME_ISSUED);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherData.java
new file mode 100644
index 000000000..a71261902
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherData.java
@@ -0,0 +1,350 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+public class WeatherData extends RPCStruct {
+
+ public static final String KEY_CURRENT_TEMPERATURE = "currentTemperature";
+ public static final String KEY_TEMPERATURE_HIGH = "temperatureHigh";
+ public static final String KEY_TEMPERATURE_LOW = "temperatureLow";
+ public static final String KEY_APPARENT_TEMPERATURE = "apparentTemperature";
+ public static final String KEY_APPARENT_TEMPERATURE_HIGH = "apparentTemperatureHigh";
+ public static final String KEY_APPARENT_TEMPERATURE_LOW = "apparentTemperatureLow";
+ public static final String KEY_WEATHER_SUMMARY = "weatherSummary";
+ public static final String KEY_TIME = "time";
+ public static final String KEY_HUMIDITY = "humidity";
+ public static final String KEY_CLOUD_COVER = "cloudCover";
+ public static final String KEY_MOON_PHASE = "moonPhase";
+ public static final String KEY_WIND_BEARING = "windBearing";
+ public static final String KEY_WIND_GUST = "windGust";
+ public static final String KEY_WIND_SPEED = "windSpeed";
+ public static final String KEY_NEAREST_STORM_BEARING = "nearestStormBearing";
+ public static final String KEY_NEAREST_STORM_DISTANCE = "nearestStormDistance";
+ public static final String KEY_PRECIP_ACCUMULATION = "precipAccumulation";
+ public static final String KEY_PRECIP_INTENSITY = "precipIntensity";
+ public static final String KEY_PRECIP_PROBABILITY = "precipProbability";
+ public static final String KEY_PRECIP_TYPE = "precipType";
+ public static final String KEY_VISIBILITY = "visibility";
+ public static final String KEY_WEATHER_ICON_IMAGE_NAME = "weatherIconImageName";
+
+ // Constructors
+
+ public WeatherData() { }
+
+ public WeatherData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param currentTemperature -
+ */
+ public void setCurrentTemperature(Temperature currentTemperature) {
+ setValue(KEY_CURRENT_TEMPERATURE, currentTemperature);
+ }
+
+ /**
+ * @return currentTemperature
+ */
+ public Temperature getCurrentTemperature() {
+ return (Temperature) getObject(Temperature.class,KEY_CURRENT_TEMPERATURE);
+ }
+
+ /**
+ * @param temperatureHigh -
+ */
+ public void setTemperatureHigh(Temperature temperatureHigh) {
+ setValue(KEY_TEMPERATURE_HIGH, temperatureHigh);
+ }
+
+ /**
+ * @return temperatureHigh
+ */
+ public Temperature getTemperatureHigh() {
+ return (Temperature) getObject(Temperature.class,KEY_TEMPERATURE_HIGH);
+ }
+
+ /**
+ * @param temperatureLow -
+ */
+ public void setTemperatureLow(Temperature temperatureLow) {
+ setValue(KEY_TEMPERATURE_LOW, temperatureLow);
+ }
+
+ /**
+ * @return temperatureLow
+ */
+ public Temperature getTemperatureLow() {
+ return (Temperature) getObject(Temperature.class,KEY_TEMPERATURE_LOW);
+ }
+
+ /**
+ * @param apparentTemperature -
+ */
+ public void setApparentTemperature(Temperature apparentTemperature) {
+ setValue(KEY_APPARENT_TEMPERATURE, apparentTemperature);
+ }
+
+ /**
+ * @return apparentTemperature
+ */
+ public Temperature getApparentTemperature() {
+ return (Temperature) getObject(Temperature.class,KEY_APPARENT_TEMPERATURE);
+ }
+
+ /**
+ * @param apparentTemperatureHigh -
+ */
+ public void setApparentTemperatureHigh(Temperature apparentTemperatureHigh) {
+ setValue(KEY_APPARENT_TEMPERATURE_HIGH, apparentTemperatureHigh);
+ }
+
+ /**
+ * @return apparentTemperatureHigh
+ */
+ public Temperature getApparentTemperatureHigh() {
+ return (Temperature) getObject(Temperature.class,KEY_APPARENT_TEMPERATURE_HIGH);
+ }
+
+ /**
+ * @param apparentTemperatureLow -
+ */
+ public void setApparentTemperatureLow(Temperature apparentTemperatureLow) {
+ setValue(KEY_APPARENT_TEMPERATURE_LOW, apparentTemperatureLow);
+ }
+
+ /**
+ * @return apparentTemperatureLow
+ */
+ public Temperature getApparentTemperatureLow() {
+ return (Temperature) getObject(Temperature.class,KEY_APPARENT_TEMPERATURE_LOW);
+ }
+
+ /**
+ * @param weatherSummary -
+ */
+ public void setWeatherSummary(String weatherSummary) {
+ setValue(KEY_WEATHER_SUMMARY, weatherSummary);
+ }
+
+ /**
+ * @return weatherSummary
+ */
+ public String getWeatherSummary() {
+ return getString(KEY_WEATHER_SUMMARY);
+ }
+
+ /**
+ * @param time -
+ */
+ public void setTime(DateTime time) {
+ setValue(KEY_TIME, time);
+ }
+
+ /**
+ * @return time
+ */
+ public DateTime getTime() {
+ return (DateTime) getObject(DateTime.class,KEY_TIME);
+ }
+
+ /**
+ * @param humidity - 0 to 1, percentage humidity
+ */
+ public void setHumidity(Float humidity) {
+ setValue(KEY_HUMIDITY, humidity);
+ }
+
+ /**
+ * @return humidity - 0 to 1, percentage humidity
+ */
+ public Float getHumidity() {
+ return getFloat(KEY_HUMIDITY);
+ }
+
+ /**
+ * @param cloudCover - 0 to 1, cloud cover
+ */
+ public void setCloudCover(Float cloudCover) {
+ setValue(KEY_CLOUD_COVER, cloudCover);
+ }
+
+ /**
+ * @return cloudCover - 0 to 1, cloud cover
+ */
+ public Float getCloudCover() {
+ return getFloat(KEY_CLOUD_COVER);
+ }
+
+ /**
+ * @param moonPhase - 0 to 1, percentage of the moon seen, e.g. 0 = no moon, 0.25 = quarter moon
+ */
+ public void setMoonPhase(Float moonPhase) {
+ setValue(KEY_MOON_PHASE, moonPhase);
+ }
+
+ /**
+ * @return moonPhase - 0 to 1, percentage of the moon seen, e.g. 0 = no moon, 0.25 = quarter moon
+ */
+ public Float getMoonPhase() {
+ return getFloat(KEY_MOON_PHASE);
+ }
+
+ /**
+ * @param windBearing - In degrees, true north at 0 degrees
+ */
+ public void setWindBearing(Integer windBearing) {
+ setValue(KEY_WIND_BEARING, windBearing);
+ }
+
+ /**
+ * @return windBearing - In degrees, true north at 0 degrees
+ */
+ public Integer getWindBearing() {
+ return getInteger(KEY_WIND_BEARING);
+ }
+
+ /**
+ * @param windGust - km/hr
+ */
+ public void setWindGust(Float windGust) {
+ setValue(KEY_WIND_GUST, windGust);
+ }
+
+ /**
+ * @return windGust - km/hr
+ */
+ public Float getWindGust() {
+ return getFloat(KEY_WIND_GUST);
+ }
+
+ /**
+ * @param windSpeed - km/hr
+ */
+ public void setWindSpeed(Float windSpeed) {
+ setValue(KEY_WIND_SPEED, windSpeed);
+ }
+
+ /**
+ * @return windSpeed - km/hr
+ */
+ public Float getWindSpeed() {
+ return getFloat(KEY_WIND_SPEED);
+ }
+
+ /**
+ * @param nearestStormBearing - In degrees, true north at 0 degrees
+ */
+ public void setNearestStormBearing(Integer nearestStormBearing) {
+ setValue(KEY_NEAREST_STORM_BEARING, nearestStormBearing);
+ }
+
+ /**
+ * @return nearestStormBearing - In degrees, true north at 0 degrees
+ */
+ public Integer getNearestStormBearing() {
+ return getInteger(KEY_NEAREST_STORM_BEARING);
+ }
+
+ /**
+ * @param nearestStormDistance - In km
+ */
+ public void setNearestStormDistance(Integer nearestStormDistance) {
+ setValue(KEY_NEAREST_STORM_DISTANCE, nearestStormDistance);
+ }
+
+ /**
+ * @return nearestStormDistance - In km
+ */
+ public Integer getNearestStormDistance() {
+ return getInteger(KEY_NEAREST_STORM_DISTANCE);
+ }
+
+ /**
+ * @param precipAccumulation - cm
+ */
+ public void setPrecipAccumulation(Float precipAccumulation) {
+ setValue(KEY_PRECIP_ACCUMULATION, precipAccumulation);
+ }
+
+ /**
+ * @return precipAccumulation - cm
+ */
+ public Float getPrecipAccumulation() {
+ return getFloat(KEY_PRECIP_ACCUMULATION);
+ }
+
+ /**
+ * @param precipIntensity - cm of water per hour
+ */
+ public void setPrecipIntensity(Float precipIntensity) {
+ setValue(KEY_PRECIP_INTENSITY, precipIntensity);
+ }
+
+ /**
+ * @return precipIntensity - cm of water per hour
+ */
+ public Float getPrecipIntensity() {
+ return getFloat(KEY_PRECIP_INTENSITY);
+ }
+
+ /**
+ * @param precipProbability - 0 to 1, percentage chance
+ */
+ public void setPrecipProbability(Float precipProbability) {
+ setValue(KEY_PRECIP_PROBABILITY, precipProbability);
+ }
+
+ /**
+ * @return precipProbability - 0 to 1, percentage chance
+ */
+ public Float getPrecipProbability() {
+ return getFloat(KEY_PRECIP_PROBABILITY);
+ }
+
+ /**
+ * @param precipType - e.g. "rain", "snow", "sleet", "hail"
+ */
+ public void setPrecipType(String precipType) {
+ setValue(KEY_PRECIP_TYPE, precipType);
+ }
+
+ /**
+ * @return precipType - e.g. "rain", "snow", "sleet", "hail"
+ */
+ public String getPrecipType() {
+ return getString(KEY_PRECIP_TYPE);
+ }
+
+ /**
+ * @param weatherIconImageName -
+ */
+ public void setWeatherIconImageName(String weatherIconImageName) {
+ setValue(KEY_WEATHER_ICON_IMAGE_NAME, weatherIconImageName);
+ }
+
+ /**
+ * @return weatherIconImageName
+ */
+ public String getWeatherIconImageName() {
+ return getString(KEY_WEATHER_ICON_IMAGE_NAME);
+ }
+
+ /**
+ * @param visibility - In km
+ */
+ public void setVisibility(Float visibility) {
+ setValue(KEY_VISIBILITY, visibility);
+ }
+
+ /**
+ * @return visibility - In km
+ */
+ public Float getVisibility() {
+ return getFloat(KEY_VISIBILITY);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceData.java
new file mode 100644
index 000000000..07a0b99a8
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceData.java
@@ -0,0 +1,133 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * This data is related to what a weather service would provide
+ */
+public class WeatherServiceData extends RPCStruct {
+
+ public static final String KEY_LOCATION = "location";
+ public static final String KEY_CURRENT_FORECAST = "currentForecast";
+ public static final String KEY_MINUTE_FORECAST = "minuteForecast";
+ public static final String KEY_HOURLY_FORECAST = "hourlyForecast";
+ public static final String KEY_MULTIDAY_FORECAST = "multidayForecast";
+ public static final String KEY_ALERTS = "alerts";
+
+ // Constructors
+
+ public WeatherServiceData() { }
+
+ public WeatherServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public WeatherServiceData(@NonNull LocationDetails location) {
+ this();
+ setLocation(location);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param location -
+ */
+ public void setLocation(@NonNull LocationDetails location) {
+ setValue(KEY_LOCATION, location);
+ }
+
+ /**
+ * @return location
+ */
+ public LocationDetails getLocation() {
+ return (LocationDetails) getObject(LocationDetails.class,KEY_LOCATION);
+ }
+
+ /**
+ * @param currentForecast -
+ */
+ public void setCurrentForecast(WeatherData currentForecast) {
+ setValue(KEY_CURRENT_FORECAST, currentForecast);
+ }
+
+ /**
+ * @return currentForecast
+ */
+ public WeatherData getCurrentForecast() {
+ return (WeatherData) getObject(WeatherData.class,KEY_CURRENT_FORECAST);
+ }
+
+ /**
+ * minsize: 15, maxsize: 60
+ * @param minuteForecast -
+ */
+ public void setMinuteForecast(List<WeatherData> minuteForecast){
+ setValue(KEY_MINUTE_FORECAST, minuteForecast);
+ }
+
+ /**
+ * minsize: 15, maxsize: 60
+ * @return minuteForecast
+ */
+ @SuppressWarnings("unchecked")
+ public List<WeatherData> getMinuteForecast(){
+ return (List<WeatherData>) getObject(WeatherData.class,KEY_MINUTE_FORECAST);
+ }
+
+ /**
+ * minsize: 1, maxsize: 96
+ * @param hourlyForecast -
+ */
+ public void setHourlyForecast(List<WeatherData> hourlyForecast){
+ setValue(KEY_HOURLY_FORECAST, hourlyForecast);
+ }
+
+ /**
+ * minsize: 1, maxsize: 96
+ * @return hourlyForecast
+ */
+ @SuppressWarnings("unchecked")
+ public List<WeatherData> getHourlyForecast(){
+ return (List<WeatherData>) getObject(WeatherData.class,KEY_HOURLY_FORECAST);
+ }
+
+ /**
+ * minsize: 1, maxsize: 30
+ * @param multidayForecast -
+ */
+ public void setMultidayForecast(List<WeatherData> multidayForecast){
+ setValue(KEY_MULTIDAY_FORECAST, multidayForecast);
+ }
+
+ /**
+ * minsize: 1, maxsize: 30
+ * @return multidayForecast
+ */
+ @SuppressWarnings("unchecked")
+ public List<WeatherData> getMultidayForecast(){
+ return (List<WeatherData>) getObject(WeatherData.class,KEY_MULTIDAY_FORECAST);
+ }
+
+ /**
+ * minsize: 1, maxsize: 10
+ * @param alerts -
+ */
+ public void setAlerts(List<WeatherAlert> alerts){
+ setValue(KEY_ALERTS, alerts);
+ }
+
+ /**
+ * minsize: 1, maxsize: 10
+ * @return alerts
+ */
+ @SuppressWarnings("unchecked")
+ public List<WeatherAlert> getAlerts(){
+ return (List<WeatherAlert>) getObject(WeatherAlert.class,KEY_ALERTS);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceManifest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceManifest.java
new file mode 100644
index 000000000..874b37e69
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceManifest.java
@@ -0,0 +1,103 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+public class WeatherServiceManifest extends RPCStruct {
+
+ public static final String KEY_CURRENT_FORECAST_SUPPORTED = "currentForecastSupported";
+ public static final String KEY_MAX_MULTIDAY_FORECAST_AMOUNT = "maxMultidayForecastAmount";
+ public static final String KEY_MAX_HOURLY_FORECAST_AMOUNT = "maxHourlyForecastAmount";
+ public static final String KEY_MAX_MINUTELY_FORECAST_AMOUNT = "maxMinutelyForecastAmount";
+ public static final String KEY_WEATHER_FOR_LOCATION_SUPPORTED = "weatherForLocationSupported";
+
+ // Constructors
+
+ public WeatherServiceManifest() { }
+
+ public WeatherServiceManifest(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // Setters and Getters
+ /**
+ * Set whether the current forecast is supported
+ * @param currentForecastSupported -
+ */
+ public void setCurrentForecastSupported(Boolean currentForecastSupported){
+ setValue(KEY_CURRENT_FORECAST_SUPPORTED, currentForecastSupported);
+ }
+
+ /**
+ * Get whether the current forecast is supported
+ * @return currentForecastSupported
+ */
+ public Boolean getCurrentForecastSupported(){
+ return getBoolean(KEY_CURRENT_FORECAST_SUPPORTED);
+ }
+
+ /**
+ * Set the max multi day forecast amount
+ * @param maxMultidayForecastAmount -
+ */
+ public void setMaxMultidayForecastAmount(Integer maxMultidayForecastAmount){
+ setValue(KEY_MAX_MULTIDAY_FORECAST_AMOUNT, maxMultidayForecastAmount);
+ }
+
+ /**
+ * Get the max multi day forecast amount
+ * @return maxMultidayForecastAmount
+ */
+ public Integer getMaxMultidayForecastAmount(){
+ return getInteger(KEY_MAX_MULTIDAY_FORECAST_AMOUNT);
+ }
+
+ /**
+ * Set the max hourly forecast amount
+ * @param maxHourlyForecastAmount -
+ */
+ public void setMaxHourlyForecastAmount(Integer maxHourlyForecastAmount){
+ setValue(KEY_MAX_HOURLY_FORECAST_AMOUNT, maxHourlyForecastAmount);
+ }
+
+ /**
+ * Get the max hourly forecast amount
+ * @return maxHourlyForecastAmount
+ */
+ public Integer getMaxHourlyForecastAmount(){
+ return getInteger(KEY_MAX_HOURLY_FORECAST_AMOUNT);
+ }
+
+ /**
+ * Set the max minutely forecast amount
+ * @param maxMinutelyForecastAmount -
+ */
+ public void setMaxMinutelyForecastAmount(Integer maxMinutelyForecastAmount){
+ setValue(KEY_MAX_MINUTELY_FORECAST_AMOUNT, maxMinutelyForecastAmount);
+ }
+
+ /**
+ * Get the max minutely forecast amount
+ * @return maxMinutelyForecastAmount
+ */
+ public Integer getMaxMinutelyForecastAmount(){
+ return getInteger(KEY_MAX_MINUTELY_FORECAST_AMOUNT);
+ }
+
+ /**
+ * Set whether the weather is supported for the current location
+ * @param weatherForLocationSupported -
+ */
+ public void setWeatherForLocationSupported(Boolean weatherForLocationSupported){
+ setValue(KEY_WEATHER_FOR_LOCATION_SUPPORTED, weatherForLocationSupported);
+ }
+
+ /**
+ * Get whether the weather is supported for the current location
+ * @return weatherForLocationSupported
+ */
+ public Boolean getWeatherForLocationSupported(){
+ return getBoolean(KEY_WEATHER_FOR_LOCATION_SUPPORTED);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppServiceType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppServiceType.java
new file mode 100644
index 000000000..a4b8e16c2
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppServiceType.java
@@ -0,0 +1,28 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Enumeration listing possible app service types.
+ */
+public enum AppServiceType {
+
+ MEDIA,
+
+ WEATHER,
+
+ NAVIGATION,
+
+ ;
+
+ /**
+ * Convert String to AppServiceType
+ * @param value String
+ * @return AppServiceType
+ */
+ public static AppServiceType valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Direction.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Direction.java
new file mode 100644
index 000000000..546d1316c
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Direction.java
@@ -0,0 +1,18 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+public enum Direction {
+
+ LEFT,
+
+ RIGHT,
+
+ ;
+
+ public static Direction valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaType.java
new file mode 100644
index 000000000..f28face34
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaType.java
@@ -0,0 +1,23 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+
+public enum MediaType {
+
+ MUSIC,
+
+ PODCAST,
+
+ AUDIOBOOK,
+
+ OTHER,
+
+ ;
+
+ public static MediaType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationAction.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationAction.java
new file mode 100644
index 000000000..2619b5505
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationAction.java
@@ -0,0 +1,31 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+public enum NavigationAction {
+
+ /**
+ * Using this action plus a supplied direction can give the type of turn.
+ */
+ TURN,
+
+ EXIT,
+
+ STAY,
+
+ MERGE,
+
+ FERRY,
+
+ CAR_SHUTTLE_TRAIN,
+
+ WAYPOINT,
+
+ ;
+
+ public static NavigationAction valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationJunction.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationJunction.java
new file mode 100644
index 000000000..693582a13
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationJunction.java
@@ -0,0 +1,58 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+public enum NavigationJunction {
+
+ /**
+ * A junction that represents a standard intersection with a single road crossing another.
+ */
+ REGULAR,
+
+ /**
+ * A junction where the road splits off into two paths; a fork in the road.
+ */
+ BIFURCATION,
+
+ /**
+ * A junction that has multiple intersections and paths.
+ */
+ MULTI_CARRIAGEWAY,
+
+ /**
+ * A junction where traffic moves in a single direction around a central, non-traversable point
+ * to reach one of the connecting roads.
+ */
+ ROUNDABOUT,
+
+ /**
+ * Similar to a roundabout, however the center of the roundabout is fully traversable. Also
+ * known as a mini-roundabout.
+ */
+ TRAVERSABLE_ROUNDABOUT,
+
+ /**
+ * A junction where lefts diverge to the right, then curve to the left, converting a left turn
+ * to a crossing maneuver.
+ */
+ JUGHANDLE,
+
+ /**
+ * Multiple way intersection that allows traffic to flow based on priority; most commonly right
+ * of way and first in, first out.
+ */
+ ALL_WAY_YIELD,
+
+ /**
+ * A junction designated for traffic turn arounds.
+ */
+ TURN_AROUND,
+
+ ;
+
+ public static NavigationJunction valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ServiceUpdateReason.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ServiceUpdateReason.java
new file mode 100644
index 000000000..302feff3f
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ServiceUpdateReason.java
@@ -0,0 +1,49 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Enumeration listing possible Service update reasons.
+ */
+public enum ServiceUpdateReason {
+
+ /**
+ * The service has just been published with the module and once
+ * activated to the primary service of its type, it will be ready for possible consumption.
+ */
+ PUBLISHED,
+
+ /**
+ * The service has just been unpublished with the module and is no longer accessible
+ */
+ REMOVED,
+
+ /**
+ * The service is activated as the primary service of this type. All requests dealing with
+ * this service type will be handled by this service.
+ */
+ ACTIVATED,
+
+ /**
+ * The service has been deactivated as the primary service of its type
+ */
+ DEACTIVATED,
+
+ /**
+ * The service has updated its manifest. This could imply updated capabilities
+ */
+ MANIFEST_UPDATE,
+
+ ;
+
+ /**
+ * Convert String to ServiceUpdateReason
+ * @param value String
+ * @return ServiceUpdateReason
+ */
+ public static ServiceUpdateReason valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
index 81dc7a455..c9f612bec 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
@@ -110,6 +110,13 @@ package com.smartdevicelink.proxy.rpc.enums;
* <td align=center>N</td>
* <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
* </tr>
+ * <tr>
+ * <td>APP_SERVICES</td>
+ * <td>AppServicesCapabilities</td>
+ * <td>Returns APP_SERVICES</td>
+ * <td align=center>N</td>
+ * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
* </table>
*
*/
@@ -416,6 +423,26 @@ public enum SystemCapabilityType {
* </table>
*/
VOICE_RECOGNITION (false),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Enum Name</th>
+ * <th>Return Type</th>
+ * <th>Description</th>
+ * <th>Requires Async?</th>
+ * <th>Notes</th>
+ * </tr>
+ * <tr>
+ * <td>APP_SERVICES</td>
+ * <td>AppServicesCapabilities</td>
+ * <td>Returns APP_SERVICES</td>
+ * <td align=center>N</td>
+ * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
+ * </table>
+ */
+ APP_SERVICES (true),
;
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCRequestListener.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCRequestListener.java
new file mode 100644
index 000000000..df3f4bc3f
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCRequestListener.java
@@ -0,0 +1,19 @@
+package com.smartdevicelink.proxy.rpc.listeners;
+
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.RPCRequest;
+
+public abstract class OnRPCRequestListener extends OnRPCListener {
+
+ public final void onReceived(final RPCMessage message){
+ if (message instanceof RPCRequest){
+ onRequest((RPCRequest)message);
+ }
+ }
+
+ /**
+ * @param request - The incoming RPC Request
+ */
+ public abstract void onRequest(final RPCRequest request);
+
+}