diff options
Diffstat (limited to 'sdl_android')
61 files changed, 4979 insertions, 20 deletions
diff --git a/sdl_android/src/androidTest/assets/json/ButtonPress.json b/sdl_android/src/androidTest/assets/json/ButtonPress.json new file mode 100644 index 000000000..e74e857be --- /dev/null +++ b/sdl_android/src/androidTest/assets/json/ButtonPress.json @@ -0,0 +1,15 @@ +{ + "request":{ + "name":"ButtonPress", + "correlationID":215, + "parameters":{ + "buttonName":"OK", + "buttonPressMode":"LONG", + "moduleType":"CLIMATE" + } + }, + "response":{ + "name":"ButtonPressResponse", + "correlationID":216 + } +}
\ No newline at end of file diff --git a/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json b/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json new file mode 100644 index 000000000..7000d2918 --- /dev/null +++ b/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json @@ -0,0 +1,38 @@ +{ + "request":{ + "name":"GetInteriorVehicleData", + "correlationID":101, + "parameters":{ + "subscribe":true, + "moduleType":"CLIMATE" + } + }, + "response":{ + "name":"GetInteriorVehicleDataResponse", + "correlationID":102, + "parameters":{ + "isSubscribed":true, + "moduleData":{ + "moduleType":"CLIMATE", + "climateControlData":{ + "circulateAirEnable":true, + "ventilationMode":"UPPER", + "acEnable":true, + "currentTemperature":{ + "unit":"CELSIUS", + "value":100.0 + }, + "acMaxEnable":true, + "desiredTemperature":{ + "unit":"CELSIUS", + "value":100.0 + }, + "dualModeEnable":true, + "autoModeEnable":true, + "fanSpeed":100, + "defrostZone":"FRONT" + } + } + } + } +}
\ No newline at end of file diff --git a/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json b/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json new file mode 100644 index 000000000..9bcdc01dc --- /dev/null +++ b/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json @@ -0,0 +1,56 @@ +{ + "request":{ + "name":"SetInteriorVehicleData", + "correlationID":126, + "parameters":{ + "moduleData":{ + "moduleType":"CLIMATE", + "climateControlData":{ + "circulateAirEnable":true, + "ventilationMode":"BOTH", + "acEnable":true, + "currentTemperature":{ + "unit":"CELSIUS", + "value":100.0 + }, + "acMaxEnable":true, + "desiredTemperature":{ + "unit":"CELSIUS", + "value":100.0 + }, + "dualModeEnable":true, + "autoModeEnable":true, + "fanSpeed":100, + "defrostZone":"ALL" + } + } + } + }, + "response":{ + "name":"SetInteriorVehicleDataResponse", + "correlationID":127, + "parameters":{ + "moduleData":{ + "moduleType":"CLIMATE", + "climateControlData":{ + "circulateAirEnable":true, + "ventilationMode":"BOTH", + "acEnable":true, + "currentTemperature":{ + "unit":"CELSIUS", + "value":100.0 + }, + "acMaxEnable":true, + "desiredTemperature":{ + "unit":"CELSIUS", + "value":100.0 + }, + "dualModeEnable":true, + "autoModeEnable":true, + "fanSpeed":100, + "defrostZone":"ALL" + } + } + } + } +}
\ No newline at end of file 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 782692d69..46f4e89be 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java @@ -6,6 +6,8 @@ import com.smartdevicelink.proxy.TTSChunkFactory; import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities; import com.smartdevicelink.proxy.rpc.ButtonCapabilities; import com.smartdevicelink.proxy.rpc.Choice; +import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities; +import com.smartdevicelink.proxy.rpc.ClimateControlData; import com.smartdevicelink.proxy.rpc.Coordinate; import com.smartdevicelink.proxy.rpc.DIDResult; import com.smartdevicelink.proxy.rpc.DeviceInfo; @@ -19,11 +21,18 @@ import com.smartdevicelink.proxy.rpc.ImageResolution; import com.smartdevicelink.proxy.rpc.KeyboardProperties; import com.smartdevicelink.proxy.rpc.LocationDetails; import com.smartdevicelink.proxy.rpc.MenuParams; +import com.smartdevicelink.proxy.rpc.ModuleData; +import com.smartdevicelink.proxy.rpc.NavigationCapability; import com.smartdevicelink.proxy.rpc.MetadataTags; import com.smartdevicelink.proxy.rpc.OasisAddress; import com.smartdevicelink.proxy.rpc.ParameterPermissions; import com.smartdevicelink.proxy.rpc.PermissionItem; +import com.smartdevicelink.proxy.rpc.PhoneCapability; import com.smartdevicelink.proxy.rpc.PresetBankCapabilities; +import com.smartdevicelink.proxy.rpc.RadioControlCapabilities; +import com.smartdevicelink.proxy.rpc.RadioControlData; +import com.smartdevicelink.proxy.rpc.RdsData; +import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities; import com.smartdevicelink.proxy.rpc.Rectangle; import com.smartdevicelink.proxy.rpc.ScreenParams; import com.smartdevicelink.proxy.rpc.SdlMsgVersion; @@ -32,6 +41,7 @@ import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities; import com.smartdevicelink.proxy.rpc.StartTime; import com.smartdevicelink.proxy.rpc.SystemCapability; import com.smartdevicelink.proxy.rpc.TTSChunk; +import com.smartdevicelink.proxy.rpc.Temperature; import com.smartdevicelink.proxy.rpc.TextField; import com.smartdevicelink.proxy.rpc.TouchCoord; import com.smartdevicelink.proxy.rpc.TouchEvent; @@ -55,6 +65,7 @@ import com.smartdevicelink.proxy.rpc.enums.CarModeStatus; import com.smartdevicelink.proxy.rpc.enums.CharacterSet; import com.smartdevicelink.proxy.rpc.enums.CompassDirection; 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.DisplayType; @@ -77,10 +88,13 @@ import com.smartdevicelink.proxy.rpc.enums.Language; import com.smartdevicelink.proxy.rpc.enums.LayoutMode; import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus; import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; import com.smartdevicelink.proxy.rpc.enums.PowerModeQualificationStatus; import com.smartdevicelink.proxy.rpc.enums.PowerModeStatus; import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech; import com.smartdevicelink.proxy.rpc.enums.PrimaryAudioSource; +import com.smartdevicelink.proxy.rpc.enums.RadioBand; +import com.smartdevicelink.proxy.rpc.enums.RadioState; import com.smartdevicelink.proxy.rpc.enums.RequestType; import com.smartdevicelink.proxy.rpc.enums.SamplingRate; import com.smartdevicelink.proxy.rpc.enums.SoftButtonType; @@ -89,6 +103,7 @@ import com.smartdevicelink.proxy.rpc.enums.SystemAction; import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType; import com.smartdevicelink.proxy.rpc.enums.SystemContext; import com.smartdevicelink.proxy.rpc.enums.TBTState; +import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit; import com.smartdevicelink.proxy.rpc.enums.TextAlignment; import com.smartdevicelink.proxy.rpc.enums.TextFieldName; import com.smartdevicelink.proxy.rpc.enums.MetadataType; @@ -100,6 +115,7 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataNotificationStatus; import com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode; import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus; import com.smartdevicelink.proxy.rpc.enums.VehicleDataType; +import com.smartdevicelink.proxy.rpc.enums.VentilationMode; import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec; import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol; import com.smartdevicelink.proxy.rpc.enums.VrCapabilities; @@ -215,13 +231,30 @@ public class Test { public static final VehicleDataNotificationStatus GENERAL_VEHICLEDATANOTIFICATIONSTATUS = VehicleDataNotificationStatus.NORMAL; public static final AppInterfaceUnregisteredReason GENERAL_APPINTERFACEUNREGISTEREDREASON = AppInterfaceUnregisteredReason.BLUETOOTH_OFF; public static final SystemCapabilityType GENERAL_SYSTEMCAPABILITYTYPE = SystemCapabilityType.NAVIGATION; + public static final NavigationCapability GENERAL_NAVIGATIONCAPABILITY = new NavigationCapability(); + public static final PhoneCapability GENERAL_PHONECAPABILITY = new PhoneCapability(); + public static final RemoteControlCapabilities GENERAL_REMOTECONTROLCAPABILITIES = new RemoteControlCapabilities(); public static final SystemCapability GENERAL_SYSTEMCAPABILITY = new SystemCapability(); public static final VideoStreamingProtocol GENERAL_VIDEOSTREAMINGPROTOCOL = VideoStreamingProtocol.RAW; public static final VideoStreamingCodec GENERAL_VIDEOSTREAMINGCODEC = VideoStreamingCodec.H264; public static final VideoStreamingCapability GENERAL_VIDEOSTREAMINGCAPABILITY = new VideoStreamingCapability(); public static final VideoStreamingFormat GENERAL_VIDEOSTREAMINGFORMAT = new VideoStreamingFormat(); + + public static final ModuleType GENERAL_MODULETYPE = ModuleType.CLIMATE; + public static final Temperature GENERAL_TEMPERATURE = new Temperature(); + public static final TemperatureUnit GENERAL_TEMPERATUREUNIT = TemperatureUnit.CELSIUS; + public static final DefrostZone GENERAL_DEFROSTZONE = DefrostZone.ALL; + public static final VentilationMode GENERAL_VENTILATIONMODE = VentilationMode.BOTH; + public static final RadioBand GENERAL_RADIOBAND = RadioBand.AM; + public static final ClimateControlData GENERAL_CLIMATECONTROLDATA = new ClimateControlData(); + public static final RdsData GENERAL_RDSDATA = new RdsData(); + public static final RadioState GENERAL_RADIOSTATE = RadioState.ACQUIRED; + public static final RadioControlData GENERAL_RADIOCONTROLDATA = new RadioControlData(); + public static final ModuleData GENERAL_MODULEDATA = new ModuleData(); + public static final ClimateControlCapabilities GENERAL_CLIMATECONTROLCAPABILITIES = new ClimateControlCapabilities(); + public static final RadioControlCapabilities GENERAL_RADIOCONTROLCAPABILITIES = new RadioControlCapabilities(); + public static final HMICapabilities GENERAL_HMICAPABILITIES = new HMICapabilities(); - public static final MetadataTags GENERAL_METADATASTRUCT = new MetadataTags(); public static final Rectangle GENERAL_RECTANGLE = new Rectangle(); @@ -255,7 +288,11 @@ public class Test { public static final List<SoftButtonCapabilities> GENERAL_SOFTBUTTONCAPABILITIES_LIST = new ArrayList<SoftButtonCapabilities>(1); public static final List<AudioPassThruCapabilities> GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST = new ArrayList<AudioPassThruCapabilities>(1); public static final List<VideoStreamingFormat> GENERAL_VIDEOSTREAMINGFORMAT_LIST = new ArrayList<VideoStreamingFormat>(2); - + public static final List<DefrostZone> GENERAL_DEFROSTZONE_LIST = Arrays.asList(new DefrostZone[]{DefrostZone.FRONT, DefrostZone.REAR}); + public static final List<VentilationMode> GENERAL_VENTILATIONMODE_LIST = Arrays.asList(new VentilationMode[]{VentilationMode.LOWER, VentilationMode.UPPER}); + public static final List<ClimateControlCapabilities> GENERAL_CLIMATECONTROLCAPABILITIES_LIST = new ArrayList<ClimateControlCapabilities>(1); + public static final List<RadioControlCapabilities> GENERAL_RADIOCONTROLCAPABILITIES_LIST = new ArrayList<RadioControlCapabilities>(1); + public static final JSONArray JSON_TURNS = new JSONArray(); public static final JSONArray JSON_CHOICES = new JSONArray(); public static final JSONArray JSON_HMILEVELS = new JSONArray(); @@ -271,8 +308,9 @@ public class Test { public static final JSONArray JSON_BUTTONCAPABILITIES = new JSONArray(); public static final JSONArray JSON_SOFTBUTTONCAPABILITIES = new JSONArray(); public static final JSONArray JSON_AUDIOPASSTHRUCAPABILITIES = new JSONArray(); + public static final JSONArray JSON_RADIOCONTROLCAPABILITIES = new JSONArray(); + public static final JSONArray JSON_CLIMATECONTROLCAPABILITIES = new JSONArray(); public static final JSONArray JSON_TEXTFIELDTYPES = new JSONArray(); - public static final JSONObject JSON_TURN = new JSONObject(); public static final JSONObject JSON_IMAGE = new JSONObject(); public static final JSONObject JSON_CHOICE = new JSONObject(); @@ -296,15 +334,52 @@ public class Test { public static final JSONObject JSON_PARAMETERPERMISSIONS = new JSONObject(); public static final JSONObject JSON_PRESETBANKCAPABILITIES = new JSONObject(); public static final JSONObject JSON_TOUCHEVENTCAPABILITIES = new JSONObject(); - + static { GENERAL_TOUCHEVENTCAPABILITIES.setDoublePressAvailable(GENERAL_BOOLEAN); GENERAL_TOUCHEVENTCAPABILITIES.setMultiTouchAvailable(GENERAL_BOOLEAN); GENERAL_TOUCHEVENTCAPABILITIES.setPressAvailable(GENERAL_BOOLEAN); GENERAL_IMAGERESOLUTION.setResolutionHeight(GENERAL_INT); - GENERAL_IMAGERESOLUTION.setResolutionWidth(GENERAL_INT); - + GENERAL_IMAGERESOLUTION.setResolutionWidth(GENERAL_INT); + + GENERAL_TEMPERATURE.setUnit(GENERAL_TEMPERATUREUNIT); + GENERAL_TEMPERATURE.setValue(GENERAL_FLOAT); + + GENERAL_CLIMATECONTROLDATA.setFanSpeed(GENERAL_INT); + GENERAL_CLIMATECONTROLDATA.setCurrentTemperature(GENERAL_TEMPERATURE); + GENERAL_CLIMATECONTROLDATA.setDesiredTemperature(GENERAL_TEMPERATURE); + GENERAL_CLIMATECONTROLDATA.setAcEnable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLDATA.setCirculateAirEnable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLDATA.setAutoModeEnable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLDATA.setDualModeEnable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLDATA.setAcMaxEnable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLDATA.setDefrostZone(GENERAL_DEFROSTZONE); + GENERAL_CLIMATECONTROLDATA.setVentilationMode(GENERAL_VENTILATIONMODE); + + GENERAL_RDSDATA.setProgramService(GENERAL_STRING); + GENERAL_RDSDATA.setRadioText(GENERAL_STRING); + GENERAL_RDSDATA.setClockText(GENERAL_STRING); + GENERAL_RDSDATA.setProgramIdentification(GENERAL_STRING); + GENERAL_RDSDATA.setRegion(GENERAL_STRING); + GENERAL_RDSDATA.setTrafficProgram(GENERAL_BOOLEAN); + GENERAL_RDSDATA.setTrafficAnnouncement(GENERAL_BOOLEAN); + GENERAL_RDSDATA.setProgramType(GENERAL_INT); + + GENERAL_RADIOCONTROLDATA.setFrequencyInteger(GENERAL_INT); + GENERAL_RADIOCONTROLDATA.setFrequencyFraction(GENERAL_INT); + GENERAL_RADIOCONTROLDATA.setBand(GENERAL_RADIOBAND); + GENERAL_RADIOCONTROLDATA.setRdsData(GENERAL_RDSDATA); + GENERAL_RADIOCONTROLDATA.setAvailableHDs(GENERAL_INT); + GENERAL_RADIOCONTROLDATA.setHdChannel(GENERAL_INT); + GENERAL_RADIOCONTROLDATA.setSignalStrength(GENERAL_INT); + GENERAL_RADIOCONTROLDATA.setSignalChangeThreshold(GENERAL_INT); + GENERAL_RADIOCONTROLDATA.setRadioEnable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLDATA.setState(GENERAL_RADIOSTATE); + + GENERAL_MODULEDATA.setModuleType(GENERAL_MODULETYPE); + GENERAL_MODULEDATA.setClimateControlData(GENERAL_CLIMATECONTROLDATA); + GENERAL_CHOICE.setMenuName(GENERAL_STRING); GENERAL_CHOICE.setSecondaryText(GENERAL_STRING); GENERAL_CHOICE.setTertiaryText(GENERAL_STRING); @@ -486,6 +561,11 @@ public class Test { GENERAL_SYSTEMCAPABILITY.setSystemCapabilityType(GENERAL_SYSTEMCAPABILITYTYPE); + GENERAL_NAVIGATIONCAPABILITY.setSendLocationEnabled(GENERAL_BOOLEAN); + GENERAL_NAVIGATIONCAPABILITY.setWayPointsEnabled(GENERAL_BOOLEAN); + + GENERAL_PHONECAPABILITY.setDialNumberEnabled(GENERAL_BOOLEAN); + GENERAL_VIDEOSTREAMINGFORMAT.setProtocol(GENERAL_VIDEOSTREAMINGPROTOCOL); GENERAL_VIDEOSTREAMINGFORMAT.setCodec(GENERAL_VIDEOSTREAMINGCODEC); @@ -496,6 +576,36 @@ public class Test { GENERAL_VIDEOSTREAMINGCAPABILITY.setPreferredResolution(GENERAL_IMAGERESOLUTION); GENERAL_VIDEOSTREAMINGCAPABILITY.setSupportedFormats(GENERAL_VIDEOSTREAMINGFORMAT_LIST); + GENERAL_CLIMATECONTROLCAPABILITIES.setModuleName(GENERAL_STRING); + GENERAL_CLIMATECONTROLCAPABILITIES.setFanSpeedAvailable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLCAPABILITIES.setDesiredTemperatureAvailable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLCAPABILITIES.setAcEnableAvailable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLCAPABILITIES.setAcMaxEnableAvailable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLCAPABILITIES.setCirculateAirEnableAvailable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLCAPABILITIES.setAutoModeEnableAvailable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLCAPABILITIES.setDualModeEnableAvailable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLCAPABILITIES.setDefrostZoneAvailable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLCAPABILITIES.setDefrostZone(GENERAL_DEFROSTZONE_LIST); + GENERAL_CLIMATECONTROLCAPABILITIES.setVentilationModeAvailable(GENERAL_BOOLEAN); + GENERAL_CLIMATECONTROLCAPABILITIES.setVentilationMode(GENERAL_VENTILATIONMODE_LIST); + GENERAL_CLIMATECONTROLCAPABILITIES_LIST.add(GENERAL_CLIMATECONTROLCAPABILITIES); + + GENERAL_RADIOCONTROLCAPABILITIES.setModuleName(GENERAL_STRING); + GENERAL_RADIOCONTROLCAPABILITIES.setRadioEnableAvailable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLCAPABILITIES.setRadioBandAvailable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLCAPABILITIES.setRadioFrequencyAvailable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLCAPABILITIES.setHdChannelAvailable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLCAPABILITIES.setRdsDataAvailable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLCAPABILITIES.setAvailableHDsAvailable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLCAPABILITIES.setStateAvailable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLCAPABILITIES.setSignalStrengthAvailable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLCAPABILITIES.setSignalChangeThresholdAvailable(GENERAL_BOOLEAN); + GENERAL_RADIOCONTROLCAPABILITIES_LIST.add(GENERAL_RADIOCONTROLCAPABILITIES); + + GENERAL_REMOTECONTROLCAPABILITIES.setButtonCapabilities(GENERAL_BUTTONCAPABILITIES_LIST); + GENERAL_REMOTECONTROLCAPABILITIES.setClimateControlCapabilities(GENERAL_CLIMATECONTROLCAPABILITIES_LIST); + GENERAL_REMOTECONTROLCAPABILITIES.setRadioControlCapabilities(GENERAL_RADIOCONTROLCAPABILITIES_LIST); + GENERAL_HMICAPABILITIES.setNavigationAvilable(GENERAL_BOOLEAN); GENERAL_HMICAPABILITIES.setVideoStreamingAvailable(GENERAL_BOOLEAN); GENERAL_HMICAPABILITIES.setPhoneCallAvilable(GENERAL_BOOLEAN); @@ -620,7 +730,35 @@ public class Test { jsonButton.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, GENERAL_BOOLEAN); jsonButton.put(ButtonCapabilities.KEY_NAME, ButtonName.SEEKRIGHT); JSON_BUTTONCAPABILITIES.put(jsonButton); - + + JSONObject jsonRadioControlCapabilities = new JSONObject(); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_MODULE_NAME, GENERAL_STRING); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RADIO_ENABLE_AVAILABLE, GENERAL_BOOLEAN); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RADIO_BAND_AVAILABLE, GENERAL_BOOLEAN); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RADIO_FREQUENCY_AVAILABLE, GENERAL_BOOLEAN); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_HD_CHANNEL_AVAILABLE, GENERAL_BOOLEAN); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RDS_DATA_AVAILABLE, GENERAL_BOOLEAN); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_AVAILABLE_HDS_AVAILABLE, GENERAL_BOOLEAN); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_STATE_AVAILABLE, GENERAL_BOOLEAN); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_SIGNAL_STRENGTH_AVAILABLE, GENERAL_BOOLEAN); + jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, GENERAL_BOOLEAN); + JSON_RADIOCONTROLCAPABILITIES.put(jsonRadioControlCapabilities); + + JSONObject jsonClimateControlCapabilities = new JSONObject(); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_MODULE_NAME, GENERAL_STRING); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_FAN_SPEED_AVAILABLE, GENERAL_BOOLEAN); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DESIRED_TEMPERATURE_AVAILABLE, GENERAL_BOOLEAN); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_AC_ENABLE_AVAILABLE, GENERAL_BOOLEAN); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_AC_MAX_ENABLE_AVAILABLE, GENERAL_BOOLEAN); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, GENERAL_BOOLEAN); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_AUTO_MODE_ENABLE_AVAILABLE, GENERAL_BOOLEAN); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DUAL_MODE_ENABLE_AVAILABLE, GENERAL_BOOLEAN); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DEFROST_ZONE_AVAILABLE, GENERAL_BOOLEAN); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DEFROST_ZONE, GENERAL_DEFROSTZONE_LIST); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_VENTILATION_MODE_AVAILABLE, GENERAL_BOOLEAN); + jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_VENTILATION_MODE, GENERAL_VENTILATIONMODE_LIST); + JSON_CLIMATECONTROLCAPABILITIES.put(jsonClimateControlCapabilities); + jsonButton = new JSONObject(); jsonButton.put(SoftButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, GENERAL_BOOLEAN); jsonButton.put(SoftButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, GENERAL_BOOLEAN); 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 090dce405..1e99e96a5 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java @@ -13,6 +13,8 @@ import com.smartdevicelink.proxy.rpc.BeltStatus; import com.smartdevicelink.proxy.rpc.BodyInformation; import com.smartdevicelink.proxy.rpc.ButtonCapabilities; import com.smartdevicelink.proxy.rpc.Choice; +import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities; +import com.smartdevicelink.proxy.rpc.ClimateControlData; import com.smartdevicelink.proxy.rpc.ClusterModeStatus; import com.smartdevicelink.proxy.rpc.Coordinate; import com.smartdevicelink.proxy.rpc.DIDResult; @@ -31,11 +33,18 @@ import com.smartdevicelink.proxy.rpc.ImageField; import com.smartdevicelink.proxy.rpc.ImageResolution; import com.smartdevicelink.proxy.rpc.KeyboardProperties; 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.OasisAddress; import com.smartdevicelink.proxy.rpc.ParameterPermissions; import com.smartdevicelink.proxy.rpc.PermissionItem; +import com.smartdevicelink.proxy.rpc.PhoneCapability; import com.smartdevicelink.proxy.rpc.PresetBankCapabilities; +import com.smartdevicelink.proxy.rpc.RadioControlCapabilities; +import com.smartdevicelink.proxy.rpc.RadioControlData; +import com.smartdevicelink.proxy.rpc.RdsData; +import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities; import com.smartdevicelink.proxy.rpc.Rectangle; import com.smartdevicelink.proxy.rpc.ScreenParams; import com.smartdevicelink.proxy.rpc.SdlMsgVersion; @@ -44,6 +53,7 @@ import com.smartdevicelink.proxy.rpc.SoftButton; import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities; import com.smartdevicelink.proxy.rpc.StartTime; import com.smartdevicelink.proxy.rpc.TTSChunk; +import com.smartdevicelink.proxy.rpc.Temperature; import com.smartdevicelink.proxy.rpc.TextField; import com.smartdevicelink.proxy.rpc.TireStatus; import com.smartdevicelink.proxy.rpc.TouchCoord; @@ -55,8 +65,10 @@ 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.enums.DefrostZone; import com.smartdevicelink.proxy.rpc.enums.FileType; import com.smartdevicelink.proxy.rpc.enums.HMILevel; +import com.smartdevicelink.proxy.rpc.enums.VentilationMode; import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities; import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; @@ -526,6 +538,342 @@ public class Validator{ return true; } + public static boolean validateTemperature(Temperature temperature1, Temperature temperature2){ + if(temperature1 == null){ + return ( temperature2 == null ); + } + if(temperature2 == null){ + return ( temperature1 == null ); + } + + if((float) temperature1.getValue() != (float) temperature2.getValue()){ + log("validateTemperature", + "Value " + temperature1.getValue() + " didn't match value " + temperature2.getValue() + + "."); + return false; + } + + if(temperature1.getUnit() != temperature2.getUnit()){ + log("validateTemperature", + "Unit " + temperature1.getUnit() + " didn't match unit " + temperature2.getUnit() + "."); + return false; + } + + return true; + } + + public static boolean validateRdsData(RdsData rdsData1, RdsData rdsData2){ + if(rdsData1 == null){ + return ( rdsData2 == null ); + } + if(rdsData2 == null){ + return ( rdsData1 == null ); + } + + if(rdsData1.getProgramService() != rdsData2.getProgramService()){ + log("validateRdsData", + "Ps " + rdsData1.getProgramService() + " didn't match Ps " + rdsData2.getProgramService() + + "."); + return false; + } + + if(rdsData1.getRadioText() != rdsData2.getRadioText()){ + log("validateRdsData", + "Rt " + rdsData1.getRadioText() + " didn't match Rt " + rdsData2.getRadioText() + + "."); + return false; + } + + if(rdsData1.getClockText() != rdsData2.getClockText()){ + log("validateRdsData", + "Ct " + rdsData1.getClockText() + " didn't match Ct " + rdsData2.getClockText() + + "."); + return false; + } + + if(rdsData1.getProgramIdentification() != rdsData2.getProgramIdentification()){ + log("validateRdsData", + "Pi " + rdsData1.getProgramIdentification() + " didn't match Pi " + rdsData2.getProgramIdentification() + + "."); + return false; + } + + if(rdsData1.getRegion() != rdsData2.getRegion()){ + log("validateRdsData", + "Reg " + rdsData1.getRegion() + " didn't match Reg " + rdsData2.getRegion() + + "."); + return false; + } + + if(rdsData1.getTrafficProgram() != rdsData2.getTrafficProgram()){ + log("validateRdsData", + "Tp " + rdsData1.getTrafficProgram() + " didn't match Tp " + rdsData2.getTrafficProgram() + + "."); + return false; + } + + if(rdsData1.getTrafficAnnouncement() != rdsData2.getTrafficAnnouncement()){ + log("validateRdsData", + "Ta " + rdsData1.getTrafficAnnouncement() + " didn't match Ta " + rdsData2.getTrafficAnnouncement() + + "."); + return false; + } + + if(rdsData1.getProgramType() != rdsData2.getProgramType()){ + log("validateRdsData", + "Pty " + rdsData1.getProgramType() + " didn't match Pty " + rdsData2.getProgramType() + + "."); + return false; + } + + return true; + } + + public static boolean validateClimateControlData(ClimateControlData climateControlData1, ClimateControlData climateControlData2){ + if(climateControlData1 == null){ + return ( climateControlData2 == null ); + } + if(climateControlData2 == null){ + return ( climateControlData1 == null ); + } + + if(climateControlData1.getFanSpeed() != climateControlData2.getFanSpeed()){ + log("validateClimateControlData", + "FanSpeed " + climateControlData1.getFanSpeed() + " didn't match fanSpeed " + climateControlData2.getFanSpeed() + + "."); + return false; + } + + if(!( validateTemperature(climateControlData1.getCurrentTemperature(), climateControlData2.getCurrentTemperature()) )){ + return false; + } + + if(!( validateTemperature(climateControlData1.getDesiredTemperature(), climateControlData2.getDesiredTemperature()) )){ + return false; + } + + if(climateControlData1.getAcEnable() != climateControlData2.getAcEnable()){ + log("validateClimateControlData", + "AcEnable " + climateControlData1.getAcEnable() + " didn't match AcEnable " + climateControlData2.getAcEnable() + + "."); + return false; + } + + if(climateControlData1.getCirculateAirEnable() != climateControlData2.getCirculateAirEnable()){ + log("validateClimateControlData", + "CirculateAirEnable " + climateControlData1.getCirculateAirEnable() + " didn't match CirculateAirEnable " + climateControlData2.getCirculateAirEnable() + + "."); + return false; + } + + if(climateControlData1.getAutoModeEnable() != climateControlData2.getAutoModeEnable()){ + log("validateClimateControlData", + "AutoModeEnable " + climateControlData1.getAutoModeEnable() + " didn't match AutoModeEnable " + climateControlData2.getAutoModeEnable() + + "."); + return false; + } + + if(climateControlData1.getDefrostZone() != climateControlData2.getDefrostZone()){ + log("validateClimateControlData", + "DefrostZone " + climateControlData1.getDefrostZone() + " didn't match DefrostZone " + climateControlData2.getDefrostZone() + + "."); + return false; + } + + if(climateControlData1.getDualModeEnable() != climateControlData2.getDualModeEnable()){ + log("validateClimateControlData", + "DualModeEnable " + climateControlData1.getDualModeEnable() + " didn't match DualModeEnable " + climateControlData2.getDualModeEnable() + + "."); + return false; + } + + if(climateControlData1.getAcMaxEnable() != climateControlData2.getAcMaxEnable()){ + log("validateClimateControlData", + "AcMaxEnable " + climateControlData1.getAcMaxEnable() + " didn't match AcMaxEnable " + climateControlData2.getAcMaxEnable() + + "."); + return false; + } + + if(climateControlData1.getVentilationMode() != climateControlData2.getVentilationMode()){ + log("validateClimateControlData", + "VentilationMode " + climateControlData1.getVentilationMode() + " didn't match VentilationMode " + climateControlData2.getVentilationMode() + + "."); + return false; + } + + + return true; + } + + public static boolean validateModuleData(ModuleData moduleData1, ModuleData moduleData2){ + if(moduleData1 == null){ + return ( moduleData2 == null ); + } + if(moduleData2 == null){ + return ( moduleData1 == null ); + } + + if(moduleData1.getModuleType() != moduleData2.getModuleType()){ + log("validateModuleData", + "ModuleType " + moduleData1.getModuleType() + " didn't match ModuleType " + moduleData2.getModuleType() + + "."); + return false; + } + + if(!( validateRadioControlData(moduleData1.getRadioControlData(), moduleData2.getRadioControlData()) )){ + return false; + } + + if(!( validateClimateControlData(moduleData1.getClimateControlData(), moduleData2.getClimateControlData()) )){ + return false; + } + + return true; + } + + public static boolean validateRemoteControlCapabilities(RemoteControlCapabilities remoteControlCapabilities1, RemoteControlCapabilities remoteControlCapabilities2){ + if(remoteControlCapabilities1 == null){ + return ( remoteControlCapabilities2 == null ); + } + if(remoteControlCapabilities2 == null){ + return ( remoteControlCapabilities1 == null ); + } + + if(!( validateButtonCapabilities(remoteControlCapabilities1.getButtonCapabilities(), remoteControlCapabilities2.getButtonCapabilities()) )){ + return false; + } + + if(!( validateRadioControlCapabilities(remoteControlCapabilities1.getRadioControlCapabilities(), remoteControlCapabilities2.getRadioControlCapabilities()) )){ + return false; + } + + if(!( validateClimateControlCapabilities(remoteControlCapabilities1.getClimateControlCapabilities(), remoteControlCapabilities2.getClimateControlCapabilities()) )){ + return false; + } + + return true; + } + + public static boolean validateRadioControlData(RadioControlData radioControlData1, RadioControlData radioControlData2){ + if(radioControlData1 == null){ + return ( radioControlData2 == null ); + } + if(radioControlData2 == null){ + return ( radioControlData1 == null ); + } + + if(radioControlData1.getFrequencyInteger() != radioControlData2.getFrequencyInteger()){ + log("validateRadioControlData", + "FrequencyInteger " + radioControlData1.getFrequencyInteger() + " didn't match FrequencyInteger " + radioControlData2.getFrequencyInteger() + + "."); + return false; + } + + if(radioControlData1.getFrequencyFraction() != radioControlData2.getFrequencyFraction()){ + log("validateRadioControlData", + "FrequencyFraction " + radioControlData1.getFrequencyFraction() + " didn't match FrequencyFraction " + radioControlData2.getFrequencyFraction() + + "."); + return false; + } + + if(radioControlData1.getBand() != radioControlData2.getBand()){ + log("validateRadioControlData", + "Band " + radioControlData1.getBand() + " didn't match Band " + radioControlData2.getBand() + + "."); + return false; + } + + if(!( validateRdsData(radioControlData1.getRdsData(), radioControlData2.getRdsData()) )){ + return false; + } + + if(radioControlData1.getAvailableHDs() != radioControlData2.getAvailableHDs()){ + log("validateRadioControlData", + "AvailableHDs " + radioControlData1.getAvailableHDs() + " didn't match AvailableHDs " + radioControlData2.getAvailableHDs() + + "."); + return false; + } + + if(radioControlData1.getHdChannel() != radioControlData2.getHdChannel()){ + log("validateRadioControlData", + "HdChannel " + radioControlData1.getHdChannel() + " didn't match HdChannel " + radioControlData2.getHdChannel() + + "."); + return false; + } + + if(radioControlData1.getSignalStrength() != radioControlData2.getSignalStrength()){ + log("validateRadioControlData", + "SignalStrength " + radioControlData1.getSignalStrength() + " didn't match SignalStrength " + radioControlData2.getSignalStrength() + + "."); + return false; + } + + if(radioControlData1.getSignalChangeThreshold() != radioControlData2.getSignalChangeThreshold()){ + log("validateRadioControlData", + "SignalChangeThreshold " + radioControlData1.getSignalChangeThreshold() + " didn't match SignalChangeThreshold " + radioControlData2.getSignalChangeThreshold() + + "."); + return false; + } + + if(radioControlData1.getRadioEnable() != radioControlData2.getRadioEnable()){ + log("validateRadioControlData", + "RadioEnable " + radioControlData1.getRadioEnable() + " didn't match RadioEnable " + radioControlData2.getRadioEnable() + + "."); + return false; + } + + if(radioControlData1.getState() != radioControlData2.getState()){ + log("validateRadioControlData", + "State " + radioControlData1.getState() + " didn't match State " + radioControlData2.getState() + + "."); + return false; + } + + return true; + } + + public static boolean validateNavigationCapability(NavigationCapability navigationCapability1, NavigationCapability navigationCapability2){ + if(navigationCapability1 == null){ + return ( navigationCapability2 == null ); + } + if(navigationCapability2 == null){ + return ( navigationCapability1 == null ); + } + + if(navigationCapability1.getSendLocationEnabled() != navigationCapability2.getSendLocationEnabled()){ + log("validateNavigationCapability", + "SendLocationEnabled " + navigationCapability1.getSendLocationEnabled() + " didn't match SendLocationEnabled " + navigationCapability2.getSendLocationEnabled() + + "."); + return false; + } + + if(navigationCapability1.getWayPointsEnabled() != navigationCapability2.getWayPointsEnabled()){ + log("validateNavigationCapability", + "WayPointsEnabled " + navigationCapability1.getWayPointsEnabled() + " didn't match WayPointsEnabled " + navigationCapability2.getWayPointsEnabled() + "."); + return false; + } + + return true; + } + + public static boolean validatePhoneCapability(PhoneCapability phoneCapability1, PhoneCapability phoneCapability2){ + if(phoneCapability1 == null){ + return ( phoneCapability2 == null ); + } + if(phoneCapability2 == null){ + return ( phoneCapability1 == null ); + } + + if(phoneCapability1.getDialNumberEnabled() != phoneCapability2.getDialNumberEnabled()){ + log("validatePhoneCapability", + "DialNumberEnabled " + phoneCapability1.getDialNumberEnabled() + " didn't match DialNumberEnabled " + phoneCapability1.getDialNumberEnabled() + + "."); + return false; + } + + return true; + } + public static boolean validateTouchEventCapabilities(TouchEventCapabilities item1, TouchEventCapabilities item2){ if(item1 == null){ return ( item2 == null ); @@ -1369,7 +1717,154 @@ public class Validator{ return true; } - + + public static boolean validateRadioControlCapabilities (List<RadioControlCapabilities> item1, List<RadioControlCapabilities> item2) { + if (item1 == null) { + return ( item2 == null ); + } + if (item2 == null) { + return ( item1 == null ); + } + + if (item1.size() != item2.size()) { + return false; + } + + for (int i = 0; i < item1.size(); i++) { + if (item1.get(i).getModuleName() != item2.get(i).getModuleName()) { + return false; + } + if (item1.get(i).getRadioEnableAvailable() != item2.get(i).getRadioEnableAvailable()) { + return false; + } + if (item1.get(i).getRadioBandAvailable() != item2.get(i).getRadioBandAvailable()) { + return false; + } + if (item1.get(i).getRadioFrequencyAvailable() != item2.get(i).getRadioFrequencyAvailable()) { + return false; + } + if (item1.get(i).getHdChannelAvailable() != item2.get(i).getHdChannelAvailable()) { + return false; + } + if (item1.get(i).getRdsDataAvailable() != item2.get(i).getRdsDataAvailable()) { + return false; + } + if (item1.get(i).getAvailableHDsAvailable() != item2.get(i).getAvailableHDsAvailable()) { + return false; + } + if (item1.get(i).getStateAvailable() != item2.get(i).getStateAvailable()) { + return false; + } + if (item1.get(i).getSignalStrengthAvailable() != item2.get(i).getSignalStrengthAvailable()) { + return false; + } + if (item1.get(i).getSignalChangeThresholdAvailable() != item2.get(i).getSignalChangeThresholdAvailable()) { + return false; + } + } + + return true; + } + + public static boolean validateClimateControlCapabilities (List<ClimateControlCapabilities> item1, List<ClimateControlCapabilities> item2) { + if (item1 == null) { + return ( item2 == null ); + } + if (item2 == null) { + return ( item1 == null ); + } + + if (item1.size() != item2.size()) { + return false; + } + + for (int i = 0; i < item1.size(); i++) { + if (item1.get(i).getModuleName() != item2.get(i).getModuleName()) { + return false; + } + if (item1.get(i).getFanSpeedAvailable() != item2.get(i).getFanSpeedAvailable()) { + return false; + } + if (item1.get(i).getDesiredTemperatureAvailable() != item2.get(i).getDesiredTemperatureAvailable()) { + return false; + } + if (item1.get(i).getAcEnableAvailable() != item2.get(i).getAcEnableAvailable()) { + return false; + } + if (item1.get(i).getAcMaxEnableAvailable() != item2.get(i).getAcMaxEnableAvailable()) { + return false; + } + if (item1.get(i).getCirculateAirEnableAvailable() != item2.get(i).getCirculateAirEnableAvailable()) { + return false; + } + if (item1.get(i).getAutoModeEnableAvailable() != item2.get(i).getAutoModeEnableAvailable()) { + return false; + } + if (item1.get(i).getDualModeEnableAvailable() != item2.get(i).getDualModeEnableAvailable()) { + return false; + } + if (item1.get(i).getDefrostZoneAvailable() != item2.get(i).getDefrostZoneAvailable()) { + return false; + } + + if(! (validateDefrostZones(item1.get(i).getDefrostZone(), item2.get(i).getDefrostZone()) )){ + return false; + } + + if (item1.get(i).getVentilationModeAvailable() != item2.get(i).getVentilationModeAvailable()) { + return false; + } + + if(! (validateVentilationModes(item1.get(i).getVentilationMode(), item2.get(i).getVentilationMode()) )){ + return false; + } + } + + return true; + } + + public static boolean validateDefrostZones (List<DefrostZone> item1, List<DefrostZone> item2) { + if (item1 == null) { + return ( item2 == null ); + } + if (item2 == null) { + return ( item1 == null ); + } + + if (item1.size() != item2.size()) { + return false; + } + + for (int i = 0; i < item1.size(); i++) { + if (item1.get(i) != item2.get(i)) { + return false; + } + } + + return true; + } + + public static boolean validateVentilationModes (List<VentilationMode> item1, List<VentilationMode> item2) { + if (item1 == null) { + return ( item2 == null ); + } + if (item2 == null) { + return ( item1 == null ); + } + + if (item1.size() != item2.size()) { + return false; + } + + for (int i = 0; i < item1.size(); i++) { + if (item1.get(i) != item2.get(i)) { + return false; + } + } + + return true; + } + public static boolean validateTurnList (List<Turn> item1, List<Turn> 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 ee8d7d0ee..678a4e95b 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 @@ -17,6 +17,7 @@ import com.smartdevicelink.proxy.rpc.AddCommandResponse; import com.smartdevicelink.proxy.rpc.AddSubMenuResponse; import com.smartdevicelink.proxy.rpc.AlertManeuverResponse; import com.smartdevicelink.proxy.rpc.AlertResponse; +import com.smartdevicelink.proxy.rpc.ButtonPressResponse; import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse; import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse; import com.smartdevicelink.proxy.rpc.DeleteCommandResponse; @@ -28,6 +29,7 @@ import com.smartdevicelink.proxy.rpc.DialNumberResponse; import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse; import com.smartdevicelink.proxy.rpc.GenericResponse; import com.smartdevicelink.proxy.rpc.GetDTCsResponse; +import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse; import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse; import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse; import com.smartdevicelink.proxy.rpc.GetWayPointsResponse; @@ -39,6 +41,7 @@ import com.smartdevicelink.proxy.rpc.OnCommand; import com.smartdevicelink.proxy.rpc.OnDriverDistraction; import com.smartdevicelink.proxy.rpc.OnHMIStatus; import com.smartdevicelink.proxy.rpc.OnHashChange; +import com.smartdevicelink.proxy.rpc.OnInteriorVehicleData; import com.smartdevicelink.proxy.rpc.OnKeyboardInput; import com.smartdevicelink.proxy.rpc.OnLanguageChange; import com.smartdevicelink.proxy.rpc.OnLockScreenStatus; @@ -60,6 +63,7 @@ import com.smartdevicelink.proxy.rpc.SendLocationResponse; import com.smartdevicelink.proxy.rpc.SetAppIconResponse; import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse; import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse; +import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse; import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse; import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse; import com.smartdevicelink.proxy.rpc.ShowResponse; @@ -439,6 +443,26 @@ public class SdlProxyBaseTests extends AndroidTestCase{ } @Override + public void onGetInteriorVehicleDataResponse(GetInteriorVehicleDataResponse response) { + Log.i(TAG, "GetInteriorVehicleData response from SDL: " + response); + } + + @Override + public void onButtonPressResponse(ButtonPressResponse response) { + Log.i(TAG, "ButtonPress response from SDL: " + response); + } + + @Override + public void onSetInteriorVehicleDataResponse(SetInteriorVehicleDataResponse response) { + Log.i(TAG, "SetInteriorVehicleData response from SDL: " + response); + } + + @Override + public void onOnInteriorVehicleData(OnInteriorVehicleData notification) { + + } + + @Override public void onOnDriverDistraction(OnDriverDistraction notification) { // Some RPCs (depending on region) cannot be sent when driver distraction is active. } diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java new file mode 100644 index 000000000..33f9d2631 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java @@ -0,0 +1,160 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities; +import com.smartdevicelink.proxy.rpc.enums.DefrostZone; +import com.smartdevicelink.proxy.rpc.enums.VentilationMode; +import com.smartdevicelink.test.JsonUtils; +import com.smartdevicelink.test.Test; + +import junit.framework.TestCase; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** + * This is a unit test class for the SmartDeviceLink library project class : + * {@link com.smartdevicelink.rpc.ClimateControlCapabilities} + */ +public class ClimateControlCapabilitiesTests extends TestCase{ + + private ClimateControlCapabilities msg; + + @Override + public void setUp(){ + msg = new ClimateControlCapabilities(); + + msg.setModuleName(Test.GENERAL_STRING); + msg.setFanSpeedAvailable(Test.GENERAL_BOOLEAN); + msg.setDesiredTemperatureAvailable(Test.GENERAL_BOOLEAN); + msg.setAcEnableAvailable(Test.GENERAL_BOOLEAN); + msg.setAcMaxEnableAvailable(Test.GENERAL_BOOLEAN); + msg.setCirculateAirEnableAvailable(Test.GENERAL_BOOLEAN); + msg.setAutoModeEnableAvailable(Test.GENERAL_BOOLEAN); + msg.setDualModeEnableAvailable(Test.GENERAL_BOOLEAN); + msg.setDefrostZoneAvailable(Test.GENERAL_BOOLEAN); + msg.setDefrostZone(Test.GENERAL_DEFROSTZONE_LIST); + msg.setVentilationModeAvailable(Test.GENERAL_BOOLEAN); + msg.setVentilationMode(Test.GENERAL_VENTILATIONMODE_LIST); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + String moduleName = msg.getModuleName(); + boolean fanSpeedAvailable = msg.getFanSpeedAvailable(); + boolean desiredTemperatureAvailable = msg.getDesiredTemperatureAvailable(); + boolean acEnableAvailable = msg.getAcEnableAvailable(); + boolean acMaxEnableAvailable = msg.getAcMaxEnableAvailable(); + boolean circulateAirEnableAvailable = msg.getCirculateAirEnableAvailable(); + boolean autoModeEnableAvailable = msg.getAutoModeEnableAvailable(); + boolean dualModeEnableAvailable = msg.getDualModeEnableAvailable(); + boolean defrostZoneAvailable = msg.getDefrostZoneAvailable(); + List<DefrostZone> defrostZone = msg.getDefrostZone(); + boolean ventilationModeAvailable = msg.getVentilationModeAvailable(); + List<VentilationMode> ventilationMode = msg.getVentilationMode(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, fanSpeedAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, desiredTemperatureAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acEnableAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acMaxEnableAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, circulateAirEnableAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, autoModeEnableAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnableAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, defrostZoneAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ventilationModeAvailable); + + assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.size(), defrostZone.size()); + assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.size(), ventilationMode.size()); + + for(int i = 0; i < Test.GENERAL_DEFROSTZONE_LIST.size(); i++){ + assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.get(i), defrostZone.get(i)); + } + for(int i = 0; i < Test.GENERAL_VENTILATIONMODE_LIST.size(); i++){ + assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.get(i), ventilationMode.get(i)); + } + + // Invalid/Null Tests + ClimateControlCapabilities msg = new ClimateControlCapabilities(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getModuleName()); + assertNull(Test.NULL, msg.getFanSpeedAvailable()); + assertNull(Test.NULL, msg.getDesiredTemperatureAvailable()); + assertNull(Test.NULL, msg.getAcEnableAvailable()); + assertNull(Test.NULL, msg.getAcMaxEnableAvailable()); + assertNull(Test.NULL, msg.getAutoModeEnableAvailable()); + assertNull(Test.NULL, msg.getDualModeEnableAvailable()); + assertNull(Test.NULL, msg.getDefrostZoneAvailable()); + assertNull(Test.NULL, msg.getDefrostZone()); + assertNull(Test.NULL, msg.getVentilationModeAvailable()); + assertNull(Test.NULL, msg.getVentilationMode()); + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(ClimateControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING); + reference.put(ClimateControlCapabilities.KEY_FAN_SPEED_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_DESIRED_TEMPERATURE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_AC_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_AC_MAX_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_AUTO_MODE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_DUAL_MODE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_DEFROST_ZONE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_VENTILATION_MODE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_DEFROST_ZONE, JsonUtils.createJsonArray(Test.GENERAL_DEFROSTZONE_LIST)); + reference.put(ClimateControlCapabilities.KEY_VENTILATION_MODE, JsonUtils.createJsonArray(Test.GENERAL_VENTILATIONMODE_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(ClimateControlCapabilities.KEY_DEFROST_ZONE)) { + JSONArray defrostZoneArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key); + JSONArray defrostZoneArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key); + List<DefrostZone> defrostZoneListReference = new ArrayList<DefrostZone>(); + List<DefrostZone> defrostZoneListTest = new ArrayList<DefrostZone>(); + + assertEquals(Test.MATCH, defrostZoneArrayReference.length(), defrostZoneArrayTest.length()); + + for (int index = 0 ; index < defrostZoneArrayReference.length(); index++) { + defrostZoneListReference.add( (DefrostZone)defrostZoneArrayReference.get(index) ); + defrostZoneListTest.add( (DefrostZone)defrostZoneArrayTest.get(index) ); + } + assertTrue(Test.TRUE, defrostZoneListReference.containsAll(defrostZoneListTest) && defrostZoneListTest.containsAll(defrostZoneListReference)); + } else if(key.equals(ClimateControlCapabilities.KEY_VENTILATION_MODE)) { + JSONArray ventilationModeArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key); + JSONArray ventilationModeArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key); + List<VentilationMode> ventilationModeListReference = new ArrayList<VentilationMode>(); + List<VentilationMode> ventilationModeListTest = new ArrayList<VentilationMode>(); + + assertEquals(Test.MATCH, ventilationModeArrayReference.length(), ventilationModeArrayTest.length()); + + for (int index = 0 ; index < ventilationModeArrayReference.length(); index++) { + ventilationModeListReference.add( (VentilationMode)ventilationModeArrayReference.get(index) ); + ventilationModeListTest.add( (VentilationMode)ventilationModeArrayTest.get(index) ); + } + assertTrue(Test.TRUE, ventilationModeListReference.containsAll(ventilationModeListTest) && ventilationModeListTest.containsAll(ventilationModeListReference)); + } 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/ClimateControlDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java new file mode 100644 index 000000000..5b0eefa9f --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java @@ -0,0 +1,130 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.ClimateControlData; +import com.smartdevicelink.proxy.rpc.Temperature; +import com.smartdevicelink.proxy.rpc.enums.DefrostZone; +import com.smartdevicelink.proxy.rpc.enums.VentilationMode; +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.rpc.ClimateControlData} + */ +public class ClimateControlDataTests extends TestCase{ + + private ClimateControlData msg; + + @Override + public void setUp(){ + msg = new ClimateControlData(); + + msg.setFanSpeed(Test.GENERAL_INT); + msg.setCurrentTemperature(Test.GENERAL_TEMPERATURE); + msg.setDesiredTemperature(Test.GENERAL_TEMPERATURE); + msg.setAcEnable(Test.GENERAL_BOOLEAN); + msg.setCirculateAirEnable(Test.GENERAL_BOOLEAN); + msg.setAutoModeEnable(Test.GENERAL_BOOLEAN); + msg.setDefrostZone(Test.GENERAL_DEFROSTZONE); + msg.setDualModeEnable(Test.GENERAL_BOOLEAN); + msg.setAcMaxEnable(Test.GENERAL_BOOLEAN); + msg.setVentilationMode(Test.GENERAL_VENTILATIONMODE); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + int fanSpeed = msg.getFanSpeed(); + Temperature currentTemperature = msg.getCurrentTemperature(); + Temperature desiredTemperature = msg.getDesiredTemperature(); + boolean acEnable = msg.getAcEnable(); + boolean circulateAirEnable = msg.getCirculateAirEnable(); + boolean autoModeEnable = msg.getAutoModeEnable(); + DefrostZone defrostZone = msg.getDefrostZone(); + boolean dualModeEnable = msg.getDualModeEnable(); + boolean acMaxEnable = msg.getAcMaxEnable(); + VentilationMode ventilationMode = msg.getVentilationMode(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_INT, fanSpeed); + assertTrue(Test.TRUE, Validator.validateTemperature(Test.GENERAL_TEMPERATURE, currentTemperature)); + assertTrue(Test.TRUE, Validator.validateTemperature(Test.GENERAL_TEMPERATURE, desiredTemperature)); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acEnable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, circulateAirEnable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, autoModeEnable); + assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE, defrostZone); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acMaxEnable); + assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE, ventilationMode); + + // Invalid/Null Tests + ClimateControlData msg = new ClimateControlData(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getFanSpeed()); + assertNull(Test.NULL, msg.getCurrentTemperature()); + assertNull(Test.NULL, msg.getDesiredTemperature()); + assertNull(Test.NULL, msg.getAcEnable()); + assertNull(Test.NULL, msg.getCirculateAirEnable()); + assertNull(Test.NULL, msg.getAutoModeEnable()); + assertNull(Test.NULL, msg.getDefrostZone()); + assertNull(Test.NULL, msg.getDualModeEnable()); + assertNull(Test.NULL, msg.getAcMaxEnable()); + assertNull(Test.NULL, msg.getVentilationMode()); + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(ClimateControlData.KEY_FAN_SPEED, Test.GENERAL_INT); + reference.put(ClimateControlData.KEY_CURRENT_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_TEMPERATURE.getStore())); + reference.put(ClimateControlData.KEY_DESIRED_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_TEMPERATURE.getStore())); + reference.put(ClimateControlData.KEY_AC_ENABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlData.KEY_CIRCULATE_AIR_ENABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlData.KEY_AUTO_MODE_ENABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlData.KEY_DUAL_MODE_ENABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlData.KEY_AC_MAX_ENABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlData.KEY_DEFROST_ZONE, Test.GENERAL_DEFROSTZONE); + reference.put(ClimateControlData.KEY_VENTILATION_MODE, Test.GENERAL_VENTILATIONMODE); + + 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(ClimateControlData.KEY_CURRENT_TEMPERATURE)){ + 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.validateTemperature( new Temperature(hashReference), new Temperature(hashTest))); + } else if(key.equals(ClimateControlData.KEY_DESIRED_TEMPERATURE)){ + 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.validateTemperature( new Temperature(hashReference), new Temperature(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/ModuleDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java new file mode 100644 index 000000000..ea71dfc8a --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java @@ -0,0 +1,95 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.ClimateControlData; +import com.smartdevicelink.proxy.rpc.ModuleData; +import com.smartdevicelink.proxy.rpc.RadioControlData; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; +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.rpc.ModuleData} + */ +public class ModuleDataTests extends TestCase{ + + private ModuleData msg; + + @Override + public void setUp(){ + msg = new ModuleData(); + + msg.setModuleType(Test.GENERAL_MODULETYPE); + msg.setRadioControlData(Test.GENERAL_RADIOCONTROLDATA); + msg.setClimateControlData(Test.GENERAL_CLIMATECONTROLDATA); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + ModuleType moduleType = msg.getModuleType(); + RadioControlData radioControlData = msg.getRadioControlData(); + ClimateControlData climateControlData = msg.getClimateControlData(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, moduleType); + assertTrue(Test.TRUE, Validator.validateRadioControlData(Test.GENERAL_RADIOCONTROLDATA, radioControlData)); + assertTrue(Test.TRUE, Validator.validateClimateControlData(Test.GENERAL_CLIMATECONTROLDATA, climateControlData)); + + // Invalid/Null Tests + ModuleData msg = new ModuleData(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getModuleType()); + assertNull(Test.NULL, msg.getRadioControlData()); + assertNull(Test.NULL, msg.getClimateControlData()); + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(ModuleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE); + reference.put(ModuleData.KEY_RADIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_RADIOCONTROLDATA.getStore())); + reference.put(ModuleData.KEY_CLIMATE_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_CLIMATECONTROLDATA.getStore())); + + 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(ModuleData.KEY_RADIO_CONTROL_DATA)){ + 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.validateRadioControlData( new RadioControlData(hashReference), new RadioControlData(hashTest))); + } else if(key.equals(ModuleData.KEY_CLIMATE_CONTROL_DATA)){ + 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.validateClimateControlData( new ClimateControlData(hashReference), new ClimateControlData(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/NavigationCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java new file mode 100644 index 000000000..efbf7e30d --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java @@ -0,0 +1,69 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.proxy.rpc.NavigationCapability; +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.rpc.NavigationCapability} + */ +public class NavigationCapabilityTests extends TestCase{ + + private NavigationCapability msg; + + @Override + public void setUp(){ + msg = new NavigationCapability(); + + msg.setSendLocationEnabled(Test.GENERAL_BOOLEAN); + msg.setWayPointsEnabled(Test.GENERAL_BOOLEAN); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + boolean sendLocationEnabled = msg.getSendLocationEnabled(); + boolean getWayPointsEnabled = msg.getWayPointsEnabled(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, sendLocationEnabled); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, getWayPointsEnabled); + + // Invalid/Null Tests + NavigationCapability msg = new NavigationCapability(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getSendLocationEnabled()); + assertNull(Test.NULL, msg.getWayPointsEnabled()); + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(NavigationCapability.KEY_GETWAYPOINTS_ENABLED, Test.GENERAL_BOOLEAN); + reference.put(NavigationCapability.KEY_LOCATION_ENABLED, 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/PhoneCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java new file mode 100644 index 000000000..2614db0fd --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java @@ -0,0 +1,64 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.proxy.rpc.PhoneCapability; +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.rpc.PhoneCapability} + */ +public class PhoneCapabilityTests extends TestCase{ + + private PhoneCapability msg; + + @Override + public void setUp(){ + msg = new PhoneCapability(); + + msg.setDialNumberEnabled(Test.GENERAL_BOOLEAN); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + boolean dialNumberEnabled = msg.getDialNumberEnabled(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dialNumberEnabled); + + // Invalid/Null Tests + PhoneCapability msg = new PhoneCapability(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getDialNumberEnabled()); + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(PhoneCapability.KEY_DIALNUMBER_ENABLED, 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/RadioControlCapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java new file mode 100644 index 000000000..28c1d2c5b --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java @@ -0,0 +1,112 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.proxy.rpc.RadioControlCapabilities; +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.rpc.RadioControlCapabilities} + */ +public class RadioControlCapabilitiesTests extends TestCase{ + + private RadioControlCapabilities msg; + + @Override + public void setUp(){ + msg = new RadioControlCapabilities(); + + msg.setModuleName(Test.GENERAL_STRING); + msg.setRadioEnableAvailable(Test.GENERAL_BOOLEAN); + msg.setRadioBandAvailable(Test.GENERAL_BOOLEAN); + msg.setRadioFrequencyAvailable(Test.GENERAL_BOOLEAN); + msg.setHdChannelAvailable(Test.GENERAL_BOOLEAN); + msg.setRdsDataAvailable(Test.GENERAL_BOOLEAN); + msg.setAvailableHDsAvailable(Test.GENERAL_BOOLEAN); + msg.setStateAvailable(Test.GENERAL_BOOLEAN); + msg.setSignalStrengthAvailable(Test.GENERAL_BOOLEAN); + msg.setSignalChangeThresholdAvailable(Test.GENERAL_BOOLEAN); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + String moduleName = msg.getModuleName(); + boolean radioEnableAvailable = msg.getRadioEnableAvailable(); + boolean radioBandAvailable = msg.getRadioBandAvailable(); + boolean radioFrequencyAvailable = msg.getRadioFrequencyAvailable(); + boolean hdChannelAvailable = msg.getHdChannelAvailable(); + boolean rdsDataAvailable = msg.getRdsDataAvailable(); + boolean availableHDsAvailable = msg.getAvailableHDsAvailable(); + boolean stateAvailable = msg.getStateAvailable(); + boolean signalStrengthAvailable = msg.getSignalStrengthAvailable(); + boolean signalChangeThresholdAvailable = msg.getSignalChangeThresholdAvailable(); + + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioEnableAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioBandAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioFrequencyAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdChannelAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, rdsDataAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, availableHDsAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, stateAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, signalStrengthAvailable); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, signalChangeThresholdAvailable); + + // Invalid/Null Tests + RadioControlCapabilities msg = new RadioControlCapabilities(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getModuleName()); + assertNull(Test.NULL, msg.getRadioEnableAvailable()); + assertNull(Test.NULL, msg.getRadioBandAvailable()); + assertNull(Test.NULL, msg.getRadioFrequencyAvailable()); + assertNull(Test.NULL, msg.getHdChannelAvailable()); + assertNull(Test.NULL, msg.getRdsDataAvailable()); + assertNull(Test.NULL, msg.getAvailableHDsAvailable()); + assertNull(Test.NULL, msg.getStateAvailable()); + assertNull(Test.NULL, msg.getSignalStrengthAvailable()); + assertNull(Test.NULL, msg.getSignalChangeThresholdAvailable()); + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(RadioControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING); + reference.put(RadioControlCapabilities.KEY_RADIO_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlCapabilities.KEY_RADIO_BAND_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlCapabilities.KEY_RADIO_FREQUENCY_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlCapabilities.KEY_HD_CHANNEL_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlCapabilities.KEY_RDS_DATA_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlCapabilities.KEY_AVAILABLE_HDS_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlCapabilities.KEY_STATE_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlCapabilities.KEY_SIGNAL_STRENGTH_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlCapabilities.KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, 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/RadioControlDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java new file mode 100644 index 000000000..b42145e8f --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java @@ -0,0 +1,124 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.RadioControlData; +import com.smartdevicelink.proxy.rpc.RdsData; +import com.smartdevicelink.proxy.rpc.enums.RadioBand; +import com.smartdevicelink.proxy.rpc.enums.RadioState; +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.rpc.RadioControlData} + */ +public class RadioControlDataTests extends TestCase{ + + private RadioControlData msg; + + @Override + public void setUp(){ + msg = new RadioControlData(); + + msg.setFrequencyInteger(Test.GENERAL_INT); + msg.setFrequencyFraction(Test.GENERAL_INT); + msg.setBand(Test.GENERAL_RADIOBAND); + msg.setRdsData(Test.GENERAL_RDSDATA); + msg.setAvailableHDs(Test.GENERAL_INT); + msg.setHdChannel(Test.GENERAL_INT); + msg.setSignalStrength(Test.GENERAL_INT); + msg.setSignalChangeThreshold(Test.GENERAL_INT); + msg.setRadioEnable(Test.GENERAL_BOOLEAN); + msg.setState(Test.GENERAL_RADIOSTATE); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + int frequencyInteger = msg.getFrequencyInteger(); + int frequencyFraction = msg.getFrequencyFraction(); + RadioBand band = msg.getBand(); + RdsData rdsData = msg.getRdsData(); + int availableHDs = msg.getAvailableHDs(); + int hdChannel = msg.getHdChannel(); + int signalStrength = msg.getSignalStrength(); + int signalChangeThreshold = msg.getSignalChangeThreshold(); + boolean radioEnable = msg.getRadioEnable(); + RadioState state = msg.getState(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_INT, frequencyInteger); + assertEquals(Test.MATCH, Test.GENERAL_INT, frequencyFraction); + assertEquals(Test.MATCH, Test.GENERAL_RADIOBAND, band); + assertTrue(Test.TRUE, Validator.validateRdsData(Test.GENERAL_RDSDATA, rdsData)); + assertEquals(Test.MATCH, Test.GENERAL_INT, availableHDs); + assertEquals(Test.MATCH, Test.GENERAL_INT, hdChannel); + assertEquals(Test.MATCH, Test.GENERAL_INT, signalStrength); + assertEquals(Test.MATCH, Test.GENERAL_INT, signalChangeThreshold); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioEnable); + assertEquals(Test.MATCH, Test.GENERAL_RADIOSTATE, state); + + // Invalid/Null Tests + RadioControlData msg = new RadioControlData(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getFrequencyInteger()); + assertNull(Test.NULL, msg.getFrequencyFraction()); + assertNull(Test.NULL, msg.getBand()); + assertNull(Test.NULL, msg.getRdsData()); + assertNull(Test.NULL, msg.getAvailableHDs()); + assertNull(Test.NULL, msg.getHdChannel()); + assertNull(Test.NULL, msg.getSignalStrength()); + assertNull(Test.NULL, msg.getSignalChangeThreshold()); + assertNull(Test.NULL, msg.getRadioEnable()); + assertNull(Test.NULL, msg.getState()); + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(RadioControlData.KEY_FREQUENCY_INTEGER, Test.GENERAL_INT); + reference.put(RadioControlData.KEY_FREQUENCY_FRACTION, Test.GENERAL_INT); + reference.put(RadioControlData.KEY_BAND, Test.GENERAL_RADIOBAND); + reference.put(RadioControlData.KEY_RDS_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_RDSDATA.getStore())); + reference.put(RadioControlData.KEY_AVAILABLE_HDS, Test.GENERAL_INT); + reference.put(RadioControlData.KEY_HD_CHANNEL, Test.GENERAL_INT); + reference.put(RadioControlData.KEY_SIGNAL_STRENGTH, Test.GENERAL_INT); + reference.put(RadioControlData.KEY_SIGNAL_CHANGE_THRESHOLD, Test.GENERAL_INT); + reference.put(RadioControlData.KEY_RADIO_ENABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlData.KEY_STATE, Test.GENERAL_RADIOSTATE); + + 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(RadioControlData.KEY_RDS_DATA)){ + 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.validateRadioControlData( new RadioControlData(hashReference), new RadioControlData(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/RdsDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java new file mode 100644 index 000000000..7414304b0 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java @@ -0,0 +1,101 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.proxy.rpc.RdsData; +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.rpc.RdsData} + */ +public class RdsDataTests extends TestCase{ + + private RdsData msg; + + @Override + public void setUp(){ + msg = new RdsData(); + + msg.setProgramService(Test.GENERAL_STRING); + msg.setRadioText(Test.GENERAL_STRING); + msg.setClockText(Test.GENERAL_STRING); + msg.setProgramIdentification(Test.GENERAL_STRING); + msg.setRegion(Test.GENERAL_STRING); + msg.setTrafficProgram(Test.GENERAL_BOOLEAN); + msg.setTrafficAnnouncement(Test.GENERAL_BOOLEAN); + msg.setProgramType(Test.GENERAL_INT); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + String ps = msg.getProgramService(); + String rt = msg.getRadioText(); + String ct = msg.getClockText(); + String pi = msg.getProgramIdentification(); + int pty = msg.getProgramType(); + boolean tp = msg.getTrafficProgram(); + boolean ta = msg.getTrafficAnnouncement(); + String reg = msg.getRegion(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_STRING, ps); + assertEquals(Test.MATCH, Test.GENERAL_STRING, rt); + assertEquals(Test.MATCH, Test.GENERAL_STRING, ct); + assertEquals(Test.MATCH, Test.GENERAL_STRING, pi); + assertEquals(Test.MATCH, Test.GENERAL_INT, pty); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, tp); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ta); + assertEquals(Test.MATCH, Test.GENERAL_STRING, reg); + + // Invalid/Null Tests + RdsData msg = new RdsData(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getProgramService()); + assertNull(Test.NULL, msg.getRadioText()); + assertNull(Test.NULL, msg.getClockText()); + assertNull(Test.NULL, msg.getProgramIdentification()); + assertNull(Test.NULL, msg.getRegion()); + assertNull(Test.NULL, msg.getTrafficProgram()); + assertNull(Test.NULL, msg.getTrafficAnnouncement()); + assertNull(Test.NULL, msg.getProgramType()); + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(RdsData.KEY_PS, Test.GENERAL_STRING); + reference.put(RdsData.KEY_RT, Test.GENERAL_STRING); + reference.put(RdsData.KEY_CT, Test.GENERAL_STRING); + reference.put(RdsData.KEY_PI, Test.GENERAL_STRING); + reference.put(RdsData.KEY_PTY, Test.GENERAL_INT); + reference.put(RdsData.KEY_TP, Test.GENERAL_BOOLEAN); + reference.put(RdsData.KEY_TA, Test.GENERAL_BOOLEAN); + reference.put(RdsData.KEY_REG, 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(); + + 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/RemoteControlCapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java new file mode 100644 index 000000000..a15179b8f --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java @@ -0,0 +1,131 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.ButtonCapabilities; +import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities; +import com.smartdevicelink.proxy.rpc.RadioControlCapabilities; +import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities; +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.rpc.RemoteControlCapabilities} + */ +public class RemoteControlCapabilitiesTests extends TestCase{ + + private RemoteControlCapabilities msg; + + @Override + public void setUp(){ + msg = new RemoteControlCapabilities(); + + msg.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST); + msg.setRadioControlCapabilities(Test.GENERAL_RADIOCONTROLCAPABILITIES_LIST); + msg.setClimateControlCapabilities(Test.GENERAL_CLIMATECONTROLCAPABILITIES_LIST); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + List<ButtonCapabilities> buttonCapabilities = msg.getButtonCapabilities(); + List<RadioControlCapabilities> radioControlCapabilities = msg.getRadioControlCapabilities(); + List<ClimateControlCapabilities> climateControlCapabilities = msg.getClimateControlCapabilities(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size()); + assertEquals(Test.MATCH, Test.GENERAL_RADIOCONTROLCAPABILITIES_LIST.size(), radioControlCapabilities.size()); + assertEquals(Test.MATCH, Test.GENERAL_CLIMATECONTROLCAPABILITIES_LIST.size(), climateControlCapabilities.size()); + + assertTrue(Test.TRUE, Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities)); + assertTrue(Test.TRUE, Validator.validateRadioControlCapabilities(Test.GENERAL_RADIOCONTROLCAPABILITIES_LIST, radioControlCapabilities)); + assertTrue(Test.TRUE, Validator.validateClimateControlCapabilities(Test.GENERAL_CLIMATECONTROLCAPABILITIES_LIST, climateControlCapabilities)); + + // Invalid/Null Tests + RemoteControlCapabilities msg = new RemoteControlCapabilities(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getButtonCapabilities()); + assertNull(Test.NULL, msg.getRadioControlCapabilities()); + assertNull(Test.NULL, msg.getClimateControlCapabilities()); + + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES, Test.JSON_BUTTONCAPABILITIES); + reference.put(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES, Test.JSON_RADIOCONTROLCAPABILITIES); + reference.put(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES, Test.JSON_CLIMATECONTROLCAPABILITIES); + + 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(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES)){ + JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key); + JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key); + assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length()); + + List<ButtonCapabilities> referenceList = new ArrayList<ButtonCapabilities>(); + List<ButtonCapabilities> testList = new ArrayList<ButtonCapabilities>(); + for(int i = 0; i < referenceArray.length(); i++){ + Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i)); + referenceList.add(new ButtonCapabilities(hashReference)); + Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i)); + testList.add(new ButtonCapabilities(hashTest)); + } + assertTrue(Test.TRUE, Validator.validateButtonCapabilities(referenceList, testList)); + } else if(key.equals(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES)){ + JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key); + JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key); + assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length()); + + List<RadioControlCapabilities> referenceList = new ArrayList<RadioControlCapabilities>(); + List<RadioControlCapabilities> testList = new ArrayList<RadioControlCapabilities>(); + for(int i = 0; i < referenceArray.length(); i++){ + Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i)); + referenceList.add(new RadioControlCapabilities(hashReference)); + Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i)); + testList.add(new RadioControlCapabilities(hashTest)); + } + assertTrue(Test.TRUE, Validator.validateRadioControlCapabilities(referenceList, testList)); + } else if(key.equals(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES)){ + JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key); + JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key); + assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length()); + + List<ClimateControlCapabilities> referenceList = new ArrayList<ClimateControlCapabilities>(); + List<ClimateControlCapabilities> testList = new ArrayList<ClimateControlCapabilities>(); + for(int i = 0; i < referenceArray.length(); i++){ + Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i)); + referenceList.add(new ClimateControlCapabilities(hashReference)); + Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i)); + testList.add(new ClimateControlCapabilities(hashTest)); + } + assertTrue(Test.TRUE, Validator.validateClimateControlCapabilities(referenceList, testList)); + } + } + } 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 566b2733e..aa0d75c07 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,17 +1,27 @@ package com.smartdevicelink.test.rpc.datatypes; +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.NavigationCapability; +import com.smartdevicelink.proxy.rpc.PhoneCapability; +import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities; import com.smartdevicelink.proxy.rpc.SystemCapability; import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType; 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.rpc.SystemCapability} + */ public class SystemCapabilityTests extends TestCase { private SystemCapability msg; @@ -21,6 +31,10 @@ public class SystemCapabilityTests extends TestCase { msg = new SystemCapability(); msg.setSystemCapabilityType(Test.GENERAL_SYSTEMCAPABILITYTYPE); + msg.setCapabilityForType(SystemCapabilityType.NAVIGATION, Test.GENERAL_NAVIGATIONCAPABILITY); + msg.setCapabilityForType(SystemCapabilityType.PHONE_CALL, Test.GENERAL_PHONECAPABILITY); + msg.setCapabilityForType(SystemCapabilityType.REMOTE_CONTROL, Test.GENERAL_REMOTECONTROLCAPABILITIES); + } /** @@ -29,15 +43,24 @@ public class SystemCapabilityTests extends TestCase { public void testRpcValues () { // Test Values SystemCapabilityType testType = msg.getSystemCapabilityType(); + NavigationCapability testNavigationCapability = (NavigationCapability) msg.getCapabilityForType(SystemCapabilityType.NAVIGATION); + PhoneCapability testPhoneCapability = (PhoneCapability) msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL); + RemoteControlCapabilities testRemoteControlCapabilities = (RemoteControlCapabilities) msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL); // Valid Tests - assertEquals(Test.MATCH, (SystemCapabilityType) Test.GENERAL_SYSTEMCAPABILITYTYPE, testType); + 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)); // Invalid/Null Tests SystemCapability msg = new SystemCapability(); assertNotNull(Test.NOT_NULL, msg); assertNull(Test.NULL, msg.getSystemCapabilityType()); + assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.NAVIGATION)); + assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL)); + assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL)); } public void testJson() { @@ -45,6 +68,9 @@ public class SystemCapabilityTests extends TestCase { try { reference.put(SystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, Test.GENERAL_SYSTEMCAPABILITYTYPE); + 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())); JSONObject underTest = msg.serializeJSON(); assertEquals(Test.MATCH, reference.length(), underTest.length()); @@ -52,7 +78,28 @@ public class SystemCapabilityTests extends TestCase { Iterator<?> iterator = reference.keys(); while (iterator.hasNext()) { String key = (String) iterator.next(); - assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); + + if(key.equals(SystemCapability.KEY_NAVIGATION_CAPABILITY)){ + 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.validateNavigationCapability( new NavigationCapability(hashReference), new NavigationCapability(hashTest))); + } else if(key.equals(SystemCapability.KEY_PHONE_CAPABILITY)){ + 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.validatePhoneCapability( new PhoneCapability(hashReference), new PhoneCapability(hashTest))); + } else if(key.equals(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY)){ + 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.validateRemoteControlCapabilities( new RemoteControlCapabilities(hashReference), new RemoteControlCapabilities(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/TemperatureTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java new file mode 100644 index 000000000..090f5a235 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java @@ -0,0 +1,72 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.proxy.rpc.Temperature; +import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit; +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.rpc.Temperature} + */ +public class TemperatureTests extends TestCase{ + + private Temperature msg; + + @Override + public void setUp(){ + msg = new Temperature(); + + msg.setUnit(Test.GENERAL_TEMPERATUREUNIT); + msg.setValue(Test.GENERAL_FLOAT); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + TemperatureUnit unit = msg.getUnit(); + float value = msg.getValue(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_FLOAT, value); + assertEquals(Test.MATCH, Test.GENERAL_TEMPERATUREUNIT, unit); + + // Invalid/Null Tests + Temperature msg = new Temperature(); + assertNotNull(Test.NOT_NULL, msg); + + assertNull(Test.NULL, msg.getUnit()); + assertNull(Test.NULL, msg.getValue()); + } + + public void testJson(){ + JSONObject reference = new JSONObject(); + + try{ + reference.put(Temperature.KEY_VALUE, (Float) Test.GENERAL_FLOAT); + reference.put(Temperature.KEY_UNIT, Test.GENERAL_TEMPERATUREUNIT); + + 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/AppHmiTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java index bcaeae93d..6446cb914 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java @@ -40,6 +40,8 @@ public class AppHmiTypeTests extends TestCase { AppHMIType enumTesting = AppHMIType.valueForString(example); example = "SYSTEM"; AppHMIType enumSystem = AppHMIType.valueForString(example); + example = "REMOTE_CONTROL"; + AppHMIType enumRemoteControl = AppHMIType.valueForString(example); assertNotNull("DEFAULT returned null", enumDefault); assertNotNull("COMMUNICATION returned null", enumCommunication); @@ -52,6 +54,7 @@ public class AppHmiTypeTests extends TestCase { assertNotNull("PROJECTION returned null", enumProjection); assertNotNull("TESTING returned null", enumTesting); assertNotNull("SYSTEM returned null", enumSystem); + assertNotNull("REMOTE_CONTROL returned null", enumRemoteControl); } /** @@ -99,7 +102,8 @@ public class AppHmiTypeTests extends TestCase { enumTestList.add(AppHMIType.BACKGROUND_PROCESS); enumTestList.add(AppHMIType.PROJECTION); enumTestList.add(AppHMIType.TESTING); - enumTestList.add(AppHMIType.SYSTEM); + enumTestList.add(AppHMIType.SYSTEM); + enumTestList.add(AppHMIType.REMOTE_CONTROL); 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/ButtonNameTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java index 1db7c4580..e37eb2fd1 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java @@ -52,7 +52,44 @@ public class ButtonNameTests extends TestCase { ButtonName enumCustomButton = ButtonName.valueForString(example); example = "SEARCH"; ButtonName enumSearch = ButtonName.valueForString(example); - + example = "AC_MAX"; + ButtonName enumAcMax = ButtonName.valueForString(example); + example = "AC"; + ButtonName enumAc = ButtonName.valueForString(example); + example = "RECIRCULATE"; + ButtonName enumRecirculate = ButtonName.valueForString(example); + example = "FAN_UP"; + ButtonName enumFanUp = ButtonName.valueForString(example); + example = "FAN_DOWN"; + ButtonName enumFanDown = ButtonName.valueForString(example); + example = "TEMP_UP"; + ButtonName enumTempUp = ButtonName.valueForString(example); + example = "TEMP_DOWN"; + ButtonName enumTempDown = ButtonName.valueForString(example); + example = "DEFROST_MAX"; + ButtonName enumDefrostMax = ButtonName.valueForString(example); + example = "DEFROST"; + ButtonName enumDefrost = ButtonName.valueForString(example); + example = "DEFROST_REAR"; + ButtonName enumDefrostRear = ButtonName.valueForString(example); + example = "UPPER_VENT"; + ButtonName enumUpperVent = ButtonName.valueForString(example); + example = "LOWER_VENT"; + ButtonName enumLowerVent = ButtonName.valueForString(example); + example = "VOLUME_UP"; + ButtonName enumVolumeUp = ButtonName.valueForString(example); + example = "VOLUME_DOWN"; + ButtonName enumVolumeDown = ButtonName.valueForString(example); + example = "EJECT"; + ButtonName enumEject = ButtonName.valueForString(example); + example = "SOURCE"; + ButtonName enumSource = ButtonName.valueForString(example); + example = "SHUFFLE"; + ButtonName enumShuffle = ButtonName.valueForString(example); + example = "REPEAT"; + ButtonName enumRepeat = ButtonName.valueForString(example); + + assertNotNull("OK returned null", enumOk); assertNotNull("SEEKLEFT returned null", enumSeekLeft); @@ -71,6 +108,24 @@ public class ButtonNameTests extends TestCase { assertNotNull("PRESET_9 returned null", enumPreset9); assertNotNull("CUSTOM_BUTTON returned null", enumCustomButton); assertNotNull("SEARCH returned null", enumSearch); + assertNotNull("AC_MAX returned null", enumAcMax); + assertNotNull("AC returned null", enumAc); + assertNotNull("RECIRCULATE returned null", enumRecirculate); + assertNotNull("FAN_UP returned null", enumFanUp); + assertNotNull("FAN_DOWN returned null", enumFanDown); + assertNotNull("TEMP_UP returned null", enumTempUp); + assertNotNull("TEMP_DOWN returned null", enumTempDown); + assertNotNull("DEFROST_MAX returned null", enumDefrostMax); + assertNotNull("DEFROST returned null", enumDefrost); + assertNotNull("DEFROST_REAR returned null", enumDefrostRear); + assertNotNull("UPPER_VENT returned null", enumUpperVent); + assertNotNull("LOWER_VENT returned null", enumLowerVent); + assertNotNull("VOLUME_UP returned null", enumVolumeUp); + assertNotNull("VOLUME_DOWN returned null", enumVolumeDown); + assertNotNull("EJECT returned null", enumEject); + assertNotNull("SOURCE returned null", enumSource); + assertNotNull("SHUFFLE returned null", enumShuffle); + assertNotNull("REPEAT returned null", enumRepeat); } /** @@ -125,7 +180,25 @@ public class ButtonNameTests extends TestCase { enumTestList.add(ButtonName.PRESET_8); enumTestList.add(ButtonName.PRESET_9); enumTestList.add(ButtonName.CUSTOM_BUTTON); - enumTestList.add(ButtonName.SEARCH); + enumTestList.add(ButtonName.SEARCH); + enumTestList.add(ButtonName.AC_MAX); + enumTestList.add(ButtonName.AC); + enumTestList.add(ButtonName.RECIRCULATE); + enumTestList.add(ButtonName.FAN_UP); + enumTestList.add(ButtonName.FAN_DOWN); + enumTestList.add(ButtonName.TEMP_UP); + enumTestList.add(ButtonName.TEMP_DOWN); + enumTestList.add(ButtonName.DEFROST_MAX); + enumTestList.add(ButtonName.DEFROST); + enumTestList.add(ButtonName.DEFROST_REAR); + enumTestList.add(ButtonName.UPPER_VENT); + enumTestList.add(ButtonName.LOWER_VENT); + enumTestList.add(ButtonName.VOLUME_UP); + enumTestList.add(ButtonName.VOLUME_DOWN); + enumTestList.add(ButtonName.EJECT); + enumTestList.add(ButtonName.SOURCE); + enumTestList.add(ButtonName.SHUFFLE); + enumTestList.add(ButtonName.REPEAT); 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/DefrostZoneTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java new file mode 100644 index 000000000..f1f375623 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java @@ -0,0 +1,79 @@ +package com.smartdevicelink.test.rpc.enums; + +import com.smartdevicelink.proxy.rpc.enums.DefrostZone; + +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.rpc.enums.DefrostZone} + */ +public class DefrostZoneTests extends TestCase { + + /** + * Verifies that the enum values are not null upon valid assignment. + */ + public void testValidEnums () { + String example = "FRONT"; + DefrostZone enumFront = DefrostZone.valueForString(example); + example = "REAR"; + DefrostZone enumRear = DefrostZone.valueForString(example); + example = "ALL"; + DefrostZone enumAll = DefrostZone.valueForString(example); + example = "NONE"; + DefrostZone enumNone = DefrostZone.valueForString(example); + + assertNotNull("FRONT returned null", enumFront); + assertNotNull("REAR returned null", enumRear); + assertNotNull("ALL returned null", enumAll); + assertNotNull("NONE returned null", enumNone); + } + + /** + * Verifies that an invalid assignment is null. + */ + public void testInvalidEnum () { + String example = "fRONT"; + try { + DefrostZone temp = DefrostZone.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 { + DefrostZone temp = DefrostZone.valueForString(example); + assertNull("Result of valueForString should be null.", temp); + } + catch (NullPointerException exception) { + fail("Null string throws NullPointerException."); + } + } + + /** + * Verifies the possible enum values of DefrostZone. + */ + public void testListEnum() { + List<DefrostZone> enumValueList = Arrays.asList(DefrostZone.values()); + + List<DefrostZone> enumTestList = new ArrayList<DefrostZone>(); + enumTestList.add(DefrostZone.FRONT); + enumTestList.add(DefrostZone.REAR); + enumTestList.add(DefrostZone.ALL); + enumTestList.add(DefrostZone.NONE); + + 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/ModuleTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java new file mode 100644 index 000000000..18a47b79d --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java @@ -0,0 +1,71 @@ +package com.smartdevicelink.test.rpc.enums; + +import com.smartdevicelink.proxy.rpc.enums.ModuleType; + +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.rpc.enums.ModuleType} + */ +public class ModuleTypeTests extends TestCase { + + /** + * Verifies that the enum values are not null upon valid assignment. + */ + public void testValidEnums () { + String example = "CLIMATE"; + ModuleType enumClimate = ModuleType.valueForString(example); + example = "RADIO"; + ModuleType enumRadio = ModuleType.valueForString(example); + + assertNotNull("CLIMATE returned null", enumClimate); + assertNotNull("RADIO returned null", enumRadio); + } + + /** + * Verifies that an invalid assignment is null. + */ + public void testInvalidEnum () { + String example = "cLIMATE"; + try { + ModuleType temp = ModuleType.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 { + ModuleType temp = ModuleType.valueForString(example); + assertNull("Result of valueForString should be null.", temp); + } + catch (NullPointerException exception) { + fail("Null string throws NullPointerException."); + } + } + + /** + * Verifies the possible enum values of ModuleType. + */ + public void testListEnum() { + List<ModuleType> enumValueList = Arrays.asList(ModuleType.values()); + + List<ModuleType> enumTestList = new ArrayList<ModuleType>(); + enumTestList.add(ModuleType.CLIMATE); + enumTestList.add(ModuleType.RADIO); + + 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/RadioBandTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java new file mode 100644 index 000000000..cc5d5b700 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java @@ -0,0 +1,75 @@ +package com.smartdevicelink.test.rpc.enums; + +import com.smartdevicelink.proxy.rpc.enums.RadioBand; + +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.rpc.enums.RadioBand} + */ +public class RadioBandTests extends TestCase { + + /** + * Verifies that the enum values are not null upon valid assignment. + */ + public void testValidEnums () { + String example = "AM"; + RadioBand enumAm = RadioBand.valueForString(example); + example = "FM"; + RadioBand enumFm = RadioBand.valueForString(example); + example = "XM"; + RadioBand enumXm = RadioBand.valueForString(example); + + assertNotNull("AM returned null", enumAm); + assertNotNull("FM returned null", enumFm); + assertNotNull("XM returned null", enumXm); + } + + /** + * Verifies that an invalid assignment is null. + */ + public void testInvalidEnum () { + String example = "aM"; + try { + RadioBand temp = RadioBand.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 { + RadioBand temp = RadioBand.valueForString(example); + assertNull("Result of valueForString should be null.", temp); + } + catch (NullPointerException exception) { + fail("Null string throws NullPointerException."); + } + } + + /** + * Verifies the possible enum values of RadioBand. + */ + public void testListEnum() { + List<RadioBand> enumValueList = Arrays.asList(RadioBand.values()); + + List<RadioBand> enumTestList = new ArrayList<RadioBand>(); + enumTestList.add(RadioBand.AM); + enumTestList.add(RadioBand.FM); + enumTestList.add(RadioBand.XM); + + 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/RadioStateTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java new file mode 100644 index 000000000..d16f00599 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java @@ -0,0 +1,79 @@ +package com.smartdevicelink.test.rpc.enums; + +import com.smartdevicelink.proxy.rpc.enums.RadioState; + +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.rpc.enums.RadioState} + */ +public class RadioStateTests extends TestCase { + + /** + * Verifies that the enum values are not null upon valid assignment. + */ + public void testValidEnums () { + String example = "ACQUIRING"; + RadioState enumAcquiring = RadioState.valueForString(example); + example = "ACQUIRED"; + RadioState enumAcquired = RadioState.valueForString(example); + example = "MULTICAST"; + RadioState enumMultiCast = RadioState.valueForString(example); + example = "NOT_FOUND"; + RadioState enumNotFound = RadioState.valueForString(example); + + assertNotNull("ACQUIRING returned null", enumAcquiring); + assertNotNull("ACQUIRED returned null", enumAcquired); + assertNotNull("MULTICAST returned null", enumMultiCast); + assertNotNull("NOT_FOUND returned null", enumNotFound); + } + + /** + * Verifies that an invalid assignment is null. + */ + public void testInvalidEnum () { + String example = "aCQUIRING"; + try { + RadioState temp = RadioState.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 { + RadioState temp = RadioState.valueForString(example); + assertNull("Result of valueForString should be null.", temp); + } + catch (NullPointerException exception) { + fail("Null string throws NullPointerException."); + } + } + + /** + * Verifies the possible enum values of RadioState. + */ + public void testListEnum() { + List<RadioState> enumValueList = Arrays.asList(RadioState.values()); + + List<RadioState> enumTestList = new ArrayList<RadioState>(); + enumTestList.add(RadioState.ACQUIRING); + enumTestList.add(RadioState.ACQUIRED); + enumTestList.add(RadioState.MULTICAST); + enumTestList.add(RadioState.NOT_FOUND); + + 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/ResultTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java index 3eaae9937..5156c4f44 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java @@ -82,6 +82,10 @@ public class ResultTests extends TestCase { Result enumExpiredCert = Result.valueForString(example); example = "RESUME_FAILED"; Result enumResumeFailed = Result.valueForString(example); + example = "DATA_NOT_AVAILABLE"; + Result enumDataNotAvailable = Result.valueForString(example); + example = "READ_ONLY"; + Result enumReadOnly = Result.valueForString(example); assertNotNull("SUCCESS returned null", enumSuccess); assertNotNull("INVALID_DATA returned null", enumInvalidData); @@ -115,6 +119,8 @@ public class ResultTests extends TestCase { assertNotNull("INVALID_CERT returned null", enumInvalidCert); assertNotNull("EXPIRED_CERT returned null", enumExpiredCert); assertNotNull("RESUME_FAILED returned null", enumResumeFailed); + assertNotNull("DATA_NOT_AVAILABLE returned null", enumDataNotAvailable); + assertNotNull("READ_ONLY returned null", enumReadOnly); } /** @@ -183,7 +189,9 @@ public class ResultTests extends TestCase { enumTestList.add(Result.SAVED); enumTestList.add(Result.INVALID_CERT); enumTestList.add(Result.EXPIRED_CERT); - enumTestList.add(Result.RESUME_FAILED); + enumTestList.add(Result.RESUME_FAILED); + enumTestList.add(Result.DATA_NOT_AVAILABLE); + enumTestList.add(Result.READ_ONLY); 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/SystemCapabilityTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java new file mode 100644 index 000000000..5f30113fc --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java @@ -0,0 +1,79 @@ +package com.smartdevicelink.test.rpc.enums; + +import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType; + +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.rpc.enums.SystemCapabilityType} + */ +public class SystemCapabilityTypeTests extends TestCase { + + /** + * Verifies that the enum values are not null upon valid assignment. + */ + public void testValidEnums () { + String example = "NAVIGATION"; + SystemCapabilityType enumNavigation = SystemCapabilityType.valueForString(example); + example = "PHONE_CALL"; + SystemCapabilityType enumPhoneCall = SystemCapabilityType.valueForString(example); + example = "VIDEO_STREAMING"; + SystemCapabilityType enumVideoStreaming = SystemCapabilityType.valueForString(example); + example = "REMOTE_CONTROL"; + SystemCapabilityType enumRemoteControl = SystemCapabilityType.valueForString(example); + + assertNotNull("NAVIGATION returned null", enumNavigation); + assertNotNull("PHONE_CALL returned null", enumPhoneCall); + assertNotNull("VIDEO_STREAMING returned null", enumVideoStreaming); + assertNotNull("REMOTE_CONTROL returned null", enumRemoteControl); + } + + /** + * Verifies that an invalid assignment is null. + */ + public void testInvalidEnum () { + String example = "nAVIGATION"; + try { + SystemCapabilityType temp = SystemCapabilityType.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 { + SystemCapabilityType temp = SystemCapabilityType.valueForString(example); + assertNull("Result of valueForString should be null.", temp); + } + catch (NullPointerException exception) { + fail("Null string throws NullPointerException."); + } + } + + /** + * Verifies the possible enum values of SystemCapabilityType. + */ + public void testListEnum() { + List<SystemCapabilityType> enumValueList = Arrays.asList(SystemCapabilityType.values()); + + List<SystemCapabilityType> enumTestList = new ArrayList<SystemCapabilityType>(); + enumTestList.add(SystemCapabilityType.NAVIGATION); + enumTestList.add(SystemCapabilityType.PHONE_CALL); + enumTestList.add(SystemCapabilityType.VIDEO_STREAMING); + enumTestList.add(SystemCapabilityType.REMOTE_CONTROL); + + 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/VentilationModeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java new file mode 100644 index 000000000..561e66a77 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java @@ -0,0 +1,79 @@ +package com.smartdevicelink.test.rpc.enums; + +import com.smartdevicelink.proxy.rpc.enums.VentilationMode; + +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.rpc.enums.VentilationMode} + */ +public class VentilationModeTests extends TestCase { + + /** + * Verifies that the enum values are not null upon valid assignment. + */ + public void testValidEnums () { + String example = "UPPER"; + VentilationMode enumUpper = VentilationMode.valueForString(example); + example = "LOWER"; + VentilationMode enumLower = VentilationMode.valueForString(example); + example = "BOTH"; + VentilationMode enumBoth = VentilationMode.valueForString(example); + example = "NONE"; + VentilationMode enumNone = VentilationMode.valueForString(example); + + assertNotNull("UPPER returned null", enumUpper); + assertNotNull("LOWER returned null", enumLower); + assertNotNull("BOTH returned null", enumBoth); + assertNotNull("NONE returned null", enumNone); + } + + /** + * Verifies that an invalid assignment is null. + */ + public void testInvalidEnum () { + String example = "uPPER"; + try { + VentilationMode temp = VentilationMode.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 { + VentilationMode temp = VentilationMode.valueForString(example); + assertNull("Result of valueForString should be null.", temp); + } + catch (NullPointerException exception) { + fail("Null string throws NullPointerException."); + } + } + + /** + * Verifies the possible enum values of VentilationMode. + */ + public void testListEnum() { + List<VentilationMode> enumValueList = Arrays.asList(VentilationMode.values()); + + List<VentilationMode> enumTestList = new ArrayList<VentilationMode>(); + enumTestList.add(VentilationMode.UPPER); + enumTestList.add(VentilationMode.LOWER); + enumTestList.add(VentilationMode.BOTH); + enumTestList.add(VentilationMode.NONE); + + 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/notifications/OnInteriorVehicleDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java new file mode 100644 index 000000000..4fded53fe --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java @@ -0,0 +1,69 @@ +package com.smartdevicelink.test.rpc.notifications; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCMessage; +import com.smartdevicelink.proxy.rpc.ModuleData; +import com.smartdevicelink.proxy.rpc.OnInteriorVehicleData; +import com.smartdevicelink.test.BaseRpcTests; +import com.smartdevicelink.test.Test; +import com.smartdevicelink.test.Validator; + +import org.json.JSONException; +import org.json.JSONObject; + +/** + * This is a unit test class for the SmartDeviceLink library project class : + * {@link com.smartdevicelink.rpc.OnInteriorVehicleData} + */ +public class OnInteriorVehicleDataTests extends BaseRpcTests{ + + @Override + protected RPCMessage createMessage(){ + OnInteriorVehicleData msg = new OnInteriorVehicleData(); + msg.setModuleData(Test.GENERAL_MODULEDATA); + + return msg; + } + + @Override + protected String getMessageType(){ + return RPCMessage.KEY_NOTIFICATION; + } + + @Override + protected String getCommandType(){ + return FunctionID.ON_INTERIOR_VEHICLE_DATA.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion){ + JSONObject result = new JSONObject(); + + try{ + result.put(OnInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore())); + }catch(JSONException e){ + fail(Test.JSON_FAIL); + } + + return result; + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + ModuleData moduleData = ( (OnInteriorVehicleData) msg ).getModuleData(); + + // Valid Tests + assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, moduleData)); + + // Invalid/Null Tests + OnInteriorVehicleData msg = new OnInteriorVehicleData(); + assertNotNull(Test.NOT_NULL, msg); + testNullBase(msg); + + assertNull(Test.NULL, msg.getModuleData()); + } +}
\ No newline at end of file diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java new file mode 100644 index 000000000..f16a3a87c --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java @@ -0,0 +1,113 @@ +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.ButtonPress; +import com.smartdevicelink.proxy.rpc.enums.ButtonName; +import com.smartdevicelink.proxy.rpc.enums.ButtonPressMode; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; +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.rpc.ButtonPress} + */ +public class ButtonPressTests extends BaseRpcTests { + + @Override + protected RPCMessage createMessage(){ + ButtonPress msg = new ButtonPress(); + + msg.setModuleType(Test.GENERAL_MODULETYPE); + msg.setButtonPressMode(Test.GENERAL_BUTTONPRESSMODE); + msg.setButtonName(Test.GENERAL_BUTTONNAME); + + return msg; + } + + @Override + protected String getMessageType(){ + return RPCMessage.KEY_REQUEST; + } + + @Override + protected String getCommandType(){ + return FunctionID.BUTTON_PRESS.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion){ + JSONObject result = new JSONObject(); + + try{ + result.put(ButtonPress.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE); + result.put(ButtonPress.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME); + result.put(ButtonPress.KEY_BUTTON_PRESS_MODE, Test.GENERAL_BUTTONPRESSMODE); + }catch(JSONException e){ + fail(Test.JSON_FAIL); + } + + return result; + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + ModuleType testModuleType = ( (ButtonPress) msg ).getModuleType(); + ButtonName testButtonName = ( (ButtonPress) msg ).getButtonName(); + ButtonPressMode testButtonPressMode = ( (ButtonPress) msg ).getButtonPressMode(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType); + assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, testButtonName); + assertEquals(Test.MATCH, Test.GENERAL_BUTTONPRESSMODE, testButtonPressMode); + + // Invalid/Null Tests + ButtonPress msg = new ButtonPress(); + assertNotNull(Test.NOT_NULL, msg); + testNullBase(msg); + + assertNull(Test.NULL, msg.getModuleType()); + assertNull(Test.NULL, msg.getButtonName()); + assertNull(Test.NULL, msg.getButtonPressMode()); + } + + /** + * 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); + ButtonPress cmd = new ButtonPress(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.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString()); + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_NAME).toString(), cmd.getButtonName().toString()); + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_PRESS_MODE).toString(), cmd.getButtonPressMode().toString()); + }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/requests/GetInteriorVehicleDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java new file mode 100644 index 000000000..5a08d4266 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java @@ -0,0 +1,105 @@ +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.GetInteriorVehicleData; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; +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.rpc.GetInteriorVehicleData} + */ +public class GetInteriorVehicleDataTests extends BaseRpcTests { + + @Override + protected RPCMessage createMessage(){ + GetInteriorVehicleData msg = new GetInteriorVehicleData(); + + msg.setModuleType(Test.GENERAL_MODULETYPE); + msg.setSubscribe(Test.GENERAL_BOOLEAN); + + return msg; + } + + @Override + protected String getMessageType(){ + return RPCMessage.KEY_REQUEST; + } + + @Override + protected String getCommandType(){ + return FunctionID.GET_INTERIOR_VEHICLE_DATA.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion){ + JSONObject result = new JSONObject(); + + try{ + result.put(GetInteriorVehicleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE); + result.put(GetInteriorVehicleData.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 + ModuleType testModuleType = ( (GetInteriorVehicleData) msg ).getModuleType(); + boolean testSubscribed = ( (GetInteriorVehicleData) msg ).getSubscribe(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSubscribed); + + // Invalid/Null Tests + GetInteriorVehicleData msg = new GetInteriorVehicleData(); + assertNotNull(Test.NOT_NULL, msg); + testNullBase(msg); + + assertNull(Test.NULL, msg.getModuleType()); + assertNull(Test.NULL, msg.getSubscribe()); + } + + /** + * 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); + GetInteriorVehicleData cmd = new GetInteriorVehicleData(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.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString()); + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_SUBSCRIBE), cmd.getSubscribe()); + }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/requests/SetInteriorVehicleDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java new file mode 100644 index 000000000..f5ecb0d06 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java @@ -0,0 +1,102 @@ +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.ModuleData; +import com.smartdevicelink.proxy.rpc.SetInteriorVehicleData; +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.rpc.SetInteriorVehicleData} + */ +public class SetInteriorVehicleDataTests extends BaseRpcTests { + + @Override + protected RPCMessage createMessage(){ + SetInteriorVehicleData msg = new SetInteriorVehicleData(); + + msg.setModuleData(Test.GENERAL_MODULEDATA); + + return msg; + } + + @Override + protected String getMessageType(){ + return RPCMessage.KEY_REQUEST; + } + + @Override + protected String getCommandType(){ + return FunctionID.SET_INTERIOR_VEHICLE_DATA.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion){ + JSONObject result = new JSONObject(); + + try{ + result.put(SetInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore())); + }catch(JSONException e){ + fail(Test.JSON_FAIL); + } + + return result; + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + ModuleData testModuleData = ( (SetInteriorVehicleData) msg ).getModuleData(); + + // Valid Tests + assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, testModuleData)); + + // Invalid/Null Tests + SetInteriorVehicleData msg = new SetInteriorVehicleData(); + assertNotNull(Test.NOT_NULL, msg); + testNullBase(msg); + + assertNull(Test.NULL, msg.getModuleData()); + } + + /** + * 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); + SetInteriorVehicleData cmd = new SetInteriorVehicleData(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); + + ModuleData referenceModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, SetInteriorVehicleData.KEY_MODULE_DATA))); + + assertTrue(Test.TRUE, Validator.validateModuleData(referenceModuleData, cmd.getModuleData())); + }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/responses/ButtonPressResponseTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java new file mode 100644 index 000000000..64f5b0c75 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java @@ -0,0 +1,74 @@ +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.ButtonPressResponse; +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.rpc.ButtonPressResponse} + */ +public class ButtonPressResponseTest extends BaseRpcTests { + + @Override + protected RPCMessage createMessage(){ + return new ButtonPressResponse(); + } + + @Override + protected String getMessageType(){ + return RPCMessage.KEY_RESPONSE; + } + + @Override + protected String getCommandType(){ + return FunctionID.BUTTON_PRESS.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion){ + return new JSONObject(); + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Invalid/Null Tests + ButtonPressResponse msg = new ButtonPressResponse(); + assertNotNull(Test.NOT_NULL, msg); + testNullBase(msg); + } + + /** + * 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); + ButtonPressResponse cmd = new ButtonPressResponse(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()); + } catch (JSONException e) { + e.printStackTrace(); + } + } +}
\ No newline at end of file diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java new file mode 100644 index 000000000..c76388c69 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java @@ -0,0 +1,110 @@ +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.GetInteriorVehicleDataResponse; +import com.smartdevicelink.proxy.rpc.ModuleData; +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.rpc.GetInteriorVehicleDataResponse} + */ +public class GetInteriorVehicleDataResponseTests extends BaseRpcTests { + + @Override + protected RPCMessage createMessage(){ + + GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse(); + + msg.setIsSubscribed(Test.GENERAL_BOOLEAN); + msg.setModuleData(Test.GENERAL_MODULEDATA); + + return msg; + } + + @Override + protected String getMessageType(){ + return RPCMessage.KEY_RESPONSE; + } + + @Override + protected String getCommandType(){ + return FunctionID.GET_INTERIOR_VEHICLE_DATA.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion){ + JSONObject result = new JSONObject(); + + try{ + result.put(GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED, Test.GENERAL_BOOLEAN); + result.put(GetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore())); + }catch(JSONException e){ + fail(Test.JSON_FAIL); + } + + return result; + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + boolean testIsSubscribed = ( (GetInteriorVehicleDataResponse) msg ).getIsSubscribed(); + ModuleData testModuleData = ( (GetInteriorVehicleDataResponse) msg ).getModuleData(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testIsSubscribed); + assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, testModuleData)); + + // Invalid/Null Tests + GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse(); + assertNotNull(Test.NOT_NULL, msg); + testNullBase(msg); + + assertNull(Test.NULL, msg.getIsSubscribed()); + assertNull(Test.NULL, msg.getModuleData()); + } + + /** + * 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); + GetInteriorVehicleDataResponse cmd = new GetInteriorVehicleDataResponse (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); + + ModuleData testModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataResponse.KEY_MODULE_DATA))); + ModuleData cmdModuleData = cmd.getModuleData(); + + assertTrue(Test.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) ); + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED), cmd.getIsSubscribed()); + } catch (JSONException e) { + e.printStackTrace(); + } + } +} diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java new file mode 100644 index 000000000..c25685157 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java @@ -0,0 +1,104 @@ +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.ModuleData; +import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse; +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.rpc.SetInteriorVehicleDataResponse} + */ +public class SetInteriorVehicleDataResponseTests extends BaseRpcTests { + + @Override + protected RPCMessage createMessage(){ + + SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse(); + + msg.setModuleData(Test.GENERAL_MODULEDATA); + + return msg; + } + + @Override + protected String getMessageType(){ + return RPCMessage.KEY_RESPONSE; + } + + @Override + protected String getCommandType(){ + return FunctionID.SET_INTERIOR_VEHICLE_DATA.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion){ + JSONObject result = new JSONObject(); + + try{ + result.put(SetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore())); + }catch(JSONException e){ + fail(Test.JSON_FAIL); + } + + return result; + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + ModuleData testModuleData = ( (SetInteriorVehicleDataResponse) msg ).getModuleData(); + + // Valid Tests + assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, testModuleData)); + + // Invalid/Null Tests + SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse(); + assertNotNull(Test.NOT_NULL, msg); + testNullBase(msg); + + assertNull(Test.NULL, msg.getModuleData()); + } + + /** + * 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); + SetInteriorVehicleDataResponse cmd = new SetInteriorVehicleDataResponse (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); + + ModuleData testModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, SetInteriorVehicleDataResponse.KEY_MODULE_DATA))); + ModuleData cmdModuleData = cmd.getModuleData(); + + assertTrue(Test.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) ); + } catch (JSONException e) { + e.printStackTrace(); + } + } +} 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 06116c5b9..412d3f857 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 @@ -53,6 +53,11 @@ public enum FunctionID{ SYSTEM_REQUEST(38, "SystemRequest"),
SEND_LOCATION(39, "SendLocation"),
DIAL_NUMBER(40, "DialNumber"),
+
+ BUTTON_PRESS(41, "ButtonPress"),
+ GET_INTERIOR_VEHICLE_DATA(43, "GetInteriorVehicleData"),
+ SET_INTERIOR_VEHICLE_DATA(44, "SetInteriorVehicleData"),
+
GET_WAY_POINTS(45, "GetWayPoints"),
SUBSCRIBE_WAY_POINTS(46, "SubscribeWayPoints"),
UNSUBSCRIBE_WAY_POINTS(47, "UnsubscribeWayPoints"),
@@ -75,6 +80,7 @@ public enum FunctionID{ ON_TOUCH_EVENT(32780, "OnTouchEvent"),
ON_SYSTEM_REQUEST(32781, "OnSystemRequest"),
ON_HASH_CHANGE(32782, "OnHashChange"),
+ ON_INTERIOR_VEHICLE_DATA(32783, "OnInteriorVehicleData"),
ON_WAY_POINT_CHANGE(32784, "OnWayPointChange"),
// MOCKED FUNCTIONS (NOT SENT FROM HEAD-UNIT)
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 c61eecc49..3b59d1ddf 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java @@ -2818,6 +2818,34 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> _proxyListener.onUpdateTurnListResponse(msg);
onRPCResponseReceived(msg);
}
+ } else if (functionName.equals(FunctionID.SET_INTERIOR_VEHICLE_DATA.toString())) {
+ final SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onSetInteriorVehicleDataResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onSetInteriorVehicleDataResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.GET_INTERIOR_VEHICLE_DATA.toString())) {
+ final GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onGetInteriorVehicleDataResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onGetInteriorVehicleDataResponse(msg);
+ onRPCResponseReceived(msg);
+ }
} else if (functionName.equals(FunctionID.GET_SYSTEM_CAPABILITY.toString())) {
// GetSystemCapabilityResponse
final GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse(hash);
@@ -2833,8 +2861,21 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> _proxyListener.onGetSystemCapabilityResponse(msg);
onRPCResponseReceived(msg);
}
- }
- else if (functionName.equals(FunctionID.SEND_HAPTIC_DATA.toString())) {
+ } else if (functionName.equals(FunctionID.BUTTON_PRESS.toString())) {
+ final ButtonPressResponse msg = new ButtonPressResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onButtonPressResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onButtonPressResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.SEND_HAPTIC_DATA.toString())) {
final SendHapticDataResponse msg = new SendHapticDataResponse(hash);
if (_callbackToUIThread) {
// Run in UI thread
@@ -3246,6 +3287,22 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> onRPCNotificationReceived(msg);
}
}
+ else if (functionName.equals(FunctionID.ON_INTERIOR_VEHICLE_DATA.toString())) {
+ final OnInteriorVehicleData msg = new OnInteriorVehicleData(hash);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onOnInteriorVehicleData(msg);
+ onRPCNotificationReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onOnInteriorVehicleData(msg);
+ onRPCNotificationReceived(msg);
+ }
+ }
else {
if (_sdlMsgVersion != null) {
DebugTool.logInfo("Unrecognized notification Message: " + functionName +
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 80842cfc2..618819f20 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 @@ -6,6 +6,7 @@ import com.smartdevicelink.proxy.rpc.AddCommandResponse; import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
+import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
@@ -17,6 +18,7 @@ import com.smartdevicelink.proxy.rpc.DialNumberResponse; import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
@@ -28,6 +30,7 @@ import com.smartdevicelink.proxy.rpc.OnCommand; import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnHashChange;
+import com.smartdevicelink.proxy.rpc.OnInteriorVehicleData;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.OnLanguageChange;
import com.smartdevicelink.proxy.rpc.OnLockScreenStatus;
@@ -49,6 +52,7 @@ import com.smartdevicelink.proxy.rpc.SendLocationResponse; import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
+import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
@@ -340,5 +344,13 @@ public interface IProxyListenerBase { public void onGetSystemCapabilityResponse(GetSystemCapabilityResponse response);
+ public void onGetInteriorVehicleDataResponse(GetInteriorVehicleDataResponse response);
+
+ public void onButtonPressResponse(ButtonPressResponse response);
+
+ public void onSetInteriorVehicleDataResponse(SetInteriorVehicleDataResponse response);
+
+ public void onOnInteriorVehicleData(OnInteriorVehicleData notification);
+
public void onSendHapticDataResponse(SendHapticDataResponse response);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java new file mode 100644 index 000000000..d0162e7ac --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java @@ -0,0 +1,94 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCRequest; +import com.smartdevicelink.proxy.rpc.enums.ButtonName; +import com.smartdevicelink.proxy.rpc.enums.ButtonPressMode; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; +import java.util.Hashtable; + +/** + * This function allows a remote control type mobile application + * simulate a hardware button press event. + */ +public class ButtonPress extends RPCRequest { + public static final String KEY_MODULE_TYPE = "moduleType"; + public static final String KEY_BUTTON_NAME = "buttonName"; + public static final String KEY_BUTTON_PRESS_MODE = "buttonPressMode"; + + /** + * Constructs a new ButtonPress object + */ + public ButtonPress() { + super(FunctionID.BUTTON_PRESS.toString()); + } + + /** + * <p>Constructs a new ButtonPress object indicated by the + * Hashtable parameter</p> + * + * + * @param hash + * The Hashtable to use + */ + public ButtonPress(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Gets the ModuleType + * + * @return ModuleType - The module where the button should be pressed + */ + public ModuleType getModuleType() { + return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE); + } + + /** + * Sets a ModuleType + * + * @param moduleType + * Represents module where the button should be pressed + */ + public void setModuleType(ModuleType moduleType) { + setParameters(KEY_MODULE_TYPE, moduleType); + } + + /** + * Gets the ButtonName + * + * @return ButtonName - The name of supported RC climate or radio button + */ + public ButtonName getButtonName() { + return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME); + } + + /** + * Sets a ButtonName + * + * @param buttonName + * Represents name of supported RC climate or radio button + */ + public void setButtonName(ButtonName buttonName) { + setParameters(KEY_BUTTON_NAME, buttonName); + } + + /** + * Gets the ButtonPressMode + * + * @return ButtonPressMode - Indicates whether this is a LONG or SHORT button press event. + */ + public ButtonPressMode getButtonPressMode() { + return (ButtonPressMode) getObject(ButtonPressMode.class, KEY_BUTTON_PRESS_MODE); + } + + /** + * Sets a ButtonPressMode + * + * @param buttonPressMode + * Indicates whether this is a LONG or SHORT button press event. + */ + public void setButtonPressMode(ButtonPressMode buttonPressMode) { + setParameters(KEY_BUTTON_PRESS_MODE, buttonPressMode); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java new file mode 100644 index 000000000..94ccd61a6 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java @@ -0,0 +1,28 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCResponse; + +import java.util.Hashtable; + +public class ButtonPressResponse extends RPCResponse { + + /** + * Constructs a new ButtonPressResponse object + */ + public ButtonPressResponse() { + super(FunctionID.BUTTON_PRESS.toString()); + } + + /** + * <p>Constructs a new ButtonPressResponse object indicated by the + * Hashtable parameter</p> + * + * + * @param hash + * The Hashtable to use + */ + public ButtonPressResponse(Hashtable<String, Object> hash) { + super(hash); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java new file mode 100644 index 000000000..ac9c3fc1c --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java @@ -0,0 +1,280 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; +import com.smartdevicelink.proxy.rpc.enums.DefrostZone; +import com.smartdevicelink.proxy.rpc.enums.VentilationMode; +import java.util.Hashtable; +import java.util.List; + +/** + * Contains information about a climate control module's capabilities. + */ + +public class ClimateControlCapabilities extends RPCStruct{ + public static final String KEY_MODULE_NAME= "moduleName"; + public static final String KEY_FAN_SPEED_AVAILABLE= "fanSpeedAvailable"; + public static final String KEY_DESIRED_TEMPERATURE_AVAILABLE= "desiredTemperatureAvailable"; + public static final String KEY_AC_ENABLE_AVAILABLE= "acEnableAvailable"; + public static final String KEY_AC_MAX_ENABLE_AVAILABLE= "acMaxEnableAvailable"; + public static final String KEY_CIRCULATE_AIR_ENABLE_AVAILABLE= "circulateAirEnableAvailable"; + public static final String KEY_AUTO_MODE_ENABLE_AVAILABLE= "autoModeEnableAvailable"; + public static final String KEY_DUAL_MODE_ENABLE_AVAILABLE= "dualModeEnableAvailable"; + public static final String KEY_DEFROST_ZONE_AVAILABLE= "defrostZoneAvailable"; + public static final String KEY_DEFROST_ZONE= "defrostZone"; + public static final String KEY_VENTILATION_MODE_AVAILABLE= "ventilationModeAvailable"; + public static final String KEY_VENTILATION_MODE= "ventilationMode"; + + public ClimateControlCapabilities() { + } + + public ClimateControlCapabilities(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Sets the moduleName portion of the ClimateControlCapabilities class + * + * @param moduleName + * The short friendly name of the climate control module. + * It should not be used to identify a module by mobile application. + */ + public void setModuleName(String moduleName) { + setValue(KEY_MODULE_NAME, moduleName); + } + + /** + * Gets the moduleName portion of the ClimateControlCapabilities class + * + * @return String - Short friendly name of the climate control module. + */ + public String getModuleName() { + return getString(KEY_MODULE_NAME); + } + + /** + * Sets the fanSpeedAvailable portion of the ClimateControlCapabilities class + * + * @param fanSpeedAvailable + * Availability of the control of fan speed. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setFanSpeedAvailable(Boolean fanSpeedAvailable) { + setValue(KEY_FAN_SPEED_AVAILABLE, fanSpeedAvailable); + } + + /** + * Gets the fanSpeedAvailable portion of the ClimateControlCapabilities class + * + * @return Boolean - Availability of the control of fan speed. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getFanSpeedAvailable() { + return getBoolean(KEY_FAN_SPEED_AVAILABLE); + } + + /** + * Sets the desiredTemperatureAvailable portion of the ClimateControlCapabilities class + * + * @param desiredTemperatureAvailable + * Availability of the control of desired temperature. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setDesiredTemperatureAvailable(Boolean desiredTemperatureAvailable) { + setValue(KEY_DESIRED_TEMPERATURE_AVAILABLE, desiredTemperatureAvailable); + } + + /** + * Gets the desiredTemperatureAvailable portion of the ClimateControlCapabilities class + * + * @return Boolean - Availability of the control of desired temperature. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getDesiredTemperatureAvailable() { + return getBoolean(KEY_DESIRED_TEMPERATURE_AVAILABLE); + } + + /** + * Sets the acEnableAvailable portion of the ClimateControlCapabilities class + * + * @param acEnableAvailable + * Availability of the control of turn on/off AC. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setAcEnableAvailable(Boolean acEnableAvailable) { + setValue(KEY_AC_ENABLE_AVAILABLE, acEnableAvailable); + } + + /** + * Gets the acEnableAvailable portion of the ClimateControlCapabilities class + * + * @return Boolean - Availability of the control of turn on/off AC. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getAcEnableAvailable() { + return getBoolean(KEY_AC_ENABLE_AVAILABLE); + } + + /** + * Sets the acMaxEnableAvailable portion of the ClimateControlCapabilities class + * + * @param acMaxEnableAvailable + * Availability of the control of enable/disable air conditioning is ON on the maximum level. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setAcMaxEnableAvailable(Boolean acMaxEnableAvailable) { + setValue(KEY_AC_MAX_ENABLE_AVAILABLE, acMaxEnableAvailable); + } + + /** + * Gets the acMaxEnableAvailable portion of the ClimateControlCapabilities class + * + * @return Boolean - Availability of the control of enable/disable air conditioning is ON on the maximum level. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getAcMaxEnableAvailable() { + return getBoolean(KEY_AC_MAX_ENABLE_AVAILABLE); + } + + /** + * Sets the circulateAirEnableAvailable portion of the ClimateControlCapabilities class + * + * @param circulateAirEnableAvailable + * Availability of the control of enable/disable circulate Air mode. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setCirculateAirEnableAvailable(Boolean circulateAirEnableAvailable) { + setValue(KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, circulateAirEnableAvailable); + } + + /** + * Gets the circulateAirEnableAvailable portion of the ClimateControlCapabilities class + * + * @return Boolean - Availability of the control of enable/disable circulate Air mode. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getCirculateAirEnableAvailable() { + return getBoolean(KEY_CIRCULATE_AIR_ENABLE_AVAILABLE); + } + + /** + * Sets the autoModeEnableAvailable portion of the ClimateControlCapabilities class + * + * @param autoModeEnableAvailable + * Availability of the control of enable/disable auto mode. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setAutoModeEnableAvailable(Boolean autoModeEnableAvailable) { + setValue(KEY_AUTO_MODE_ENABLE_AVAILABLE, autoModeEnableAvailable); + } + + /** + * Gets the autoModeEnableAvailable portion of the ClimateControlCapabilities class + * + * @return Boolean - Availability of the control of enable/disable auto mode. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getAutoModeEnableAvailable() { + return getBoolean(KEY_AUTO_MODE_ENABLE_AVAILABLE); + } + + /** + * Sets the dualModeEnableAvailable portion of the ClimateControlCapabilities class + * + * @param dualModeEnableAvailable + * Availability of the control of enable/disable dual mode. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setDualModeEnableAvailable(Boolean dualModeEnableAvailable) { + setValue(KEY_DUAL_MODE_ENABLE_AVAILABLE, dualModeEnableAvailable); + } + + /** + * Gets the dualModeEnableAvailable portion of the ClimateControlCapabilities class + * + * @return Boolean - Availability of the control of enable/disable dual mode. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getDualModeEnableAvailable() { + return getBoolean(KEY_DUAL_MODE_ENABLE_AVAILABLE); + } + + /** + * Sets the defrostZoneAvailable portion of the ClimateControlCapabilities class + * + * @param defrostZoneAvailable + * Availability of the control of defrost zones. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setDefrostZoneAvailable(Boolean defrostZoneAvailable) { + setValue(KEY_DEFROST_ZONE_AVAILABLE, defrostZoneAvailable); + } + + /** + * Gets the defrostZoneAvailable portion of the ClimateControlCapabilities class + * + * @return Boolean - Availability of the control of defrost zones. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getDefrostZoneAvailable() { + return getBoolean(KEY_DEFROST_ZONE_AVAILABLE); + } + + /** + * Gets the List<DefrostZone> portion of the ClimateControlCapabilities class + * + * @return List<DefrostZone> - A set of all defrost zones that are controllable. + */ + public List<DefrostZone> getDefrostZone() { + return (List<DefrostZone>) getObject(DefrostZone.class, KEY_DEFROST_ZONE); + } + + /** + * Sets the defrostZone portion of the ClimateControlCapabilities class + * + * @param defrostZone + * A set of all defrost zones that are controllable. + */ + public void setDefrostZone(List<DefrostZone> defrostZone) { + setValue(KEY_DEFROST_ZONE, defrostZone); + } + + /** + * Sets the ventilationModeAvailable portion of the ClimateControlCapabilities class + * + * @param ventilationModeAvailable + * Availability of the control of air ventilation mode. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setVentilationModeAvailable(Boolean ventilationModeAvailable) { + setValue(KEY_VENTILATION_MODE_AVAILABLE, ventilationModeAvailable); + } + + /** + * Gets the ventilationModeAvailable portion of the ClimateControlCapabilities class + * + * @return Boolean - Availability of the control of air ventilation mode. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getVentilationModeAvailable() { + return getBoolean(KEY_VENTILATION_MODE_AVAILABLE); + } + + /** + * Gets the List<VentilationMode> portion of the ClimateControlCapabilities class + * + * @return List<VentilationMode> - A set of all ventilation modes that are controllable. + */ + public List<VentilationMode> getVentilationMode() { + return (List<VentilationMode>) getObject(VentilationMode.class, KEY_VENTILATION_MODE); + } + + /** + * Sets the ventilationMode portion of the ClimateControlCapabilities class + * + * @param ventilationMode + * A set of all ventilation modes that are controllable. + */ + public void setVentilationMode(List<VentilationMode> ventilationMode) { + setValue(KEY_VENTILATION_MODE, ventilationMode); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java new file mode 100644 index 000000000..0da8060f3 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java @@ -0,0 +1,106 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; +import com.smartdevicelink.proxy.rpc.enums.DefrostZone; +import com.smartdevicelink.proxy.rpc.enums.VentilationMode; +import java.util.Hashtable; + +public class ClimateControlData extends RPCStruct{ + public static final String KEY_FAN_SPEED= "fanSpeed"; + public static final String KEY_CURRENT_TEMPERATURE= "currentTemperature"; + public static final String KEY_DESIRED_TEMPERATURE= "desiredTemperature"; + public static final String KEY_AC_ENABLE= "acEnable"; + public static final String KEY_CIRCULATE_AIR_ENABLE= "circulateAirEnable"; + public static final String KEY_AUTO_MODE_ENABLE= "autoModeEnable"; + public static final String KEY_DEFROST_ZONE= "defrostZone"; + public static final String KEY_DUAL_MODE_ENABLE= "dualModeEnable"; + public static final String KEY_AC_MAX_ENABLE= "acMaxEnable"; + public static final String KEY_VENTILATION_MODE= "ventilationMode"; + + public ClimateControlData() { + } + + public ClimateControlData(Hashtable<String, Object> hash) { + super(hash); + } + + public void setFanSpeed(Integer fanSpeed) { + setValue(KEY_FAN_SPEED, fanSpeed); + } + + public Integer getFanSpeed() { + return getInteger(KEY_FAN_SPEED); + } + + public void setCurrentTemperature(Temperature currentTemperature) { + setValue(KEY_CURRENT_TEMPERATURE, currentTemperature); + } + + public Temperature getCurrentTemperature() { + return (Temperature) getObject(Temperature.class, KEY_CURRENT_TEMPERATURE); + } + + public void setDesiredTemperature(Temperature desiredTemperature) { + setValue(KEY_DESIRED_TEMPERATURE, desiredTemperature); + } + + public Temperature getDesiredTemperature() { + return (Temperature) getObject(Temperature.class, KEY_DESIRED_TEMPERATURE); + } + + public void setAcEnable(Boolean acEnable) { + setValue(KEY_AC_ENABLE, acEnable); + } + + public Boolean getAcEnable() { + return getBoolean(KEY_AC_ENABLE); + } + + public void setCirculateAirEnable(Boolean circulateAirEnable) { + setValue(KEY_CIRCULATE_AIR_ENABLE, circulateAirEnable); + } + + public Boolean getCirculateAirEnable() { + return getBoolean(KEY_CIRCULATE_AIR_ENABLE); + } + + public void setAutoModeEnable(Boolean autoModeEnable) { + setValue(KEY_AUTO_MODE_ENABLE, autoModeEnable); + } + + public Boolean getAutoModeEnable() { + return getBoolean(KEY_AUTO_MODE_ENABLE); + } + + public void setDefrostZone(DefrostZone defrostZone) { + setValue(KEY_DEFROST_ZONE, defrostZone); + } + + public DefrostZone getDefrostZone() { + return (DefrostZone) getObject(DefrostZone.class, KEY_DEFROST_ZONE); + } + + public void setDualModeEnable(Boolean dualModeEnable) { + setValue(KEY_DUAL_MODE_ENABLE, dualModeEnable); + } + + public Boolean getDualModeEnable() { + return getBoolean(KEY_DUAL_MODE_ENABLE); + } + + public void setAcMaxEnable(Boolean acMaxEnable) { + setValue(KEY_AC_MAX_ENABLE, acMaxEnable); + } + + public Boolean getAcMaxEnable() { + return getBoolean(KEY_AC_MAX_ENABLE); + } + + public void setVentilationMode(VentilationMode ventilationMode) { + setValue(KEY_VENTILATION_MODE, ventilationMode); + } + + public VentilationMode getVentilationMode() { + return (VentilationMode) getObject(VentilationMode.class, KEY_VENTILATION_MODE); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java new file mode 100644 index 000000000..53108b4fb --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java @@ -0,0 +1,79 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCRequest; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; +import java.util.Hashtable; + +/** + * Read the current status value of specified remote control module (type). In addition, + * When subscribe=true, subscribes for specific remote control module data items; + * When subscribe=false, un-subscribes for specific remote control module data items. + * Once subscribed, the application will be notified by the onInteriorVehicleData notification + * whenever new data is available for the module. + */ +public class GetInteriorVehicleData extends RPCRequest { + public static final String KEY_MODULE_TYPE = "moduleType"; + public static final String KEY_SUBSCRIBE = "subscribe"; + + /** + * Constructs a new GetInteriorVehicleData object + */ + public GetInteriorVehicleData() { + super(FunctionID.GET_INTERIOR_VEHICLE_DATA.toString()); + } + + /** + * <p>Constructs a new GetInteriorVehicleData object indicated by the + * Hashtable parameter</p> + * + * + * @param hash + * The Hashtable to use + */ + public GetInteriorVehicleData(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Gets the ModuleType + * + * @return ModuleType - The type of a RC module to retrieve module data from the vehicle. + * In the future, this should be the Identification of a module. + */ + public ModuleType getModuleType() { + return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE); + } + + /** + * Sets a ModuleType + * + * @param moduleType + * The type of a RC module to retrieve module data from the vehicle. + * In the future, this should be the Identification of a module. + */ + public void setModuleType(ModuleType moduleType) { + setParameters(KEY_MODULE_TYPE, moduleType); + } + + /** + * Sets subscribe parameter + * + * @param subscribe + * If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduelType. + * If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduelType. + */ + public void setSubscribe(Boolean subscribe) { + setParameters(KEY_SUBSCRIBE, subscribe); + } + + /** + * Gets subscribe parameter + * + * @return Boolean - If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduelType. + * If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduelType. + */ + public Boolean getSubscribe() { + return getBoolean(KEY_SUBSCRIBE); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java new file mode 100644 index 000000000..0e74001f6 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java @@ -0,0 +1,70 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCResponse; +import java.util.Hashtable; + +public class GetInteriorVehicleDataResponse extends RPCResponse { + public static final String KEY_MODULE_DATA = "moduleData"; + public static final String KEY_IS_SUBSCRIBED = "isSubscribed"; + + /** + * Constructs a new GetInteriorVehicleDataResponse object + */ + public GetInteriorVehicleDataResponse() { + super(FunctionID.GET_INTERIOR_VEHICLE_DATA.toString()); + } + + /** + * <p>Constructs a new GetInteriorVehicleDataResponse object indicated by the + * Hashtable parameter</p> + * + * + * @param hash + * The Hashtable to use + */ + public GetInteriorVehicleDataResponse(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Gets the moduleData + * + * @return ModuleData + */ + public ModuleData getModuleData() { + return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA); + } + + /** + * Sets the moduleData + * + * @param moduleData + */ + public void setModuleData(ModuleData moduleData) { + setParameters(KEY_MODULE_DATA, moduleData); + } + + /** + * Sets isSubscribed parameter + * + * @param isSubscribed + * It is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request. + * If "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleType. + * If "false" - the "moduleType" from request is either unsubscribed or failed to subscribe. + * */ + public void setIsSubscribed(Boolean isSubscribed) { + setParameters(KEY_IS_SUBSCRIBED, isSubscribed); + } + + /** + * Gets isSubscribed parameter + * + * @return Boolean - It is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request. + * If "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleType. + * If "false" - the "moduleType" from request is either unsubscribed or failed to subscribe. + * */ + public Boolean getIsSubscribed() { + return getBoolean(KEY_IS_SUBSCRIBED); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java new file mode 100644 index 000000000..e04ab1ad5 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java @@ -0,0 +1,75 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; +import java.util.Hashtable; + +public class ModuleData extends RPCStruct{ + public static final String KEY_MODULE_TYPE= "moduleType"; + public static final String KEY_RADIO_CONTROL_DATA = "radioControlData"; + public static final String KEY_CLIMATE_CONTROL_DATA = "climateControlData"; + + public ModuleData() { + } + + public ModuleData(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Sets the moduleType portion of the ModuleData class + * + * @param moduleType + * The moduleType indicates which type of data should be changed and identifies which data object exists in this struct. + * For example, if the moduleType is CLIMATE then a "climateControlData" should exist + */ + public void setModuleType(ModuleType moduleType) { + setValue(KEY_MODULE_TYPE, moduleType); + } + + /** + * Gets the moduleType portion of the ModuleData class + * + * @return ModuleType - The moduleType indicates which type of data should be changed and identifies which data object exists in this struct. + * For example, if the moduleType is CLIMATE then a "climateControlData" should exist. + */ + public ModuleType getModuleType() { + return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE); + } + + /** + * Sets the radioControlData portion of the ModuleData class + * + * @param radioControlData + */ + public void setRadioControlData(RadioControlData radioControlData) { + setValue(KEY_RADIO_CONTROL_DATA, radioControlData); + } + + /** + * Gets the radioControlData portion of the ModuleData class + * + * @return RadioControlData + */ + public RadioControlData getRadioControlData() { + return (RadioControlData) getObject(RadioControlData.class, KEY_RADIO_CONTROL_DATA); + } + + /** + * Sets the climateControlData portion of the ModuleData class + * + * @param climateControlData + */ + public void setClimateControlData(ClimateControlData climateControlData) { + setValue(KEY_CLIMATE_CONTROL_DATA, climateControlData); + } + + /** + * Gets the climateControlData portion of the ModuleData class + * + * @return ClimateControlData + */ + public ClimateControlData getClimateControlData() { + return (ClimateControlData) getObject(ClimateControlData.class, KEY_CLIMATE_CONTROL_DATA); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java new file mode 100644 index 000000000..61e9ee17a --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java @@ -0,0 +1,47 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCNotification; + +import java.util.Hashtable; + +public class OnInteriorVehicleData extends RPCNotification { + public static final String KEY_MODULE_DATA = "moduleData"; + + /** + * Constructs a new OnInteriorVehicleData object + */ + public OnInteriorVehicleData() { + super(FunctionID.ON_INTERIOR_VEHICLE_DATA.toString()); + } + + /** + * <p>Constructs a new OnInteriorVehicleData object indicated by the + * Hashtable parameter</p> + * + * + * @param hash + * The Hashtable to use + */ + public OnInteriorVehicleData(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Gets the moduleData + * + * @return ModuleData + */ + public ModuleData getModuleData() { + return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA); + } + + /** + * Sets the moduleData + * + * @param moduleData + */ + public void setModuleData(ModuleData moduleData) { + setParameters(KEY_MODULE_DATA, moduleData); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java new file mode 100644 index 000000000..3acfe77a9 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java @@ -0,0 +1,236 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; +import java.util.Hashtable; + +/** + * Contains information about a radio control module's capabilities. + */ +public class RadioControlCapabilities extends RPCStruct{ + public static final String KEY_MODULE_NAME= "moduleName"; + public static final String KEY_RADIO_ENABLE_AVAILABLE= "radioEnableAvailable"; + public static final String KEY_RADIO_BAND_AVAILABLE= "radioBandAvailable"; + public static final String KEY_RADIO_FREQUENCY_AVAILABLE= "radioFrequencyAvailable"; + public static final String KEY_HD_CHANNEL_AVAILABLE= "hdChannelAvailable"; + public static final String KEY_RDS_DATA_AVAILABLE= "rdsDataAvailable"; + public static final String KEY_AVAILABLE_HDS_AVAILABLE= "availableHDsAvailable"; + public static final String KEY_STATE_AVAILABLE= "stateAvailable"; + public static final String KEY_SIGNAL_STRENGTH_AVAILABLE= "signalStrengthAvailable"; + public static final String KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE= "signalChangeThresholdAvailable"; + + public RadioControlCapabilities() { + } + + public RadioControlCapabilities(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Sets the moduleName portion of the RadioControlCapabilities class + * + * @param moduleName + * The short friendly name of the climate control module. + * It should not be used to identify a module by mobile application. + */ + public void setModuleName(String moduleName) { + setValue(KEY_MODULE_NAME, moduleName); + } + + /** + * Gets the moduleName portion of the RadioControlCapabilities class + * + * @return String - Short friendly name of the climate control module. + */ + public String getModuleName() { + return getString(KEY_MODULE_NAME); + } + + /** + * Sets the radioEnableAvailable portion of the RadioControlCapabilities class + * + * @param radioEnableAvailable + * Availability of the control of enable/disable radio. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setRadioEnableAvailable(Boolean radioEnableAvailable) { + setValue(KEY_RADIO_ENABLE_AVAILABLE, radioEnableAvailable); + } + + /** + * Gets the radioEnableAvailable portion of the RadioControlCapabilities class + * + * @return Boolean - Availability of the control of enable/disable radio. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getRadioEnableAvailable() { + return getBoolean(KEY_RADIO_ENABLE_AVAILABLE); + } + + /** + * Sets the radioBandAvailable portion of the RadioControlCapabilities class + * + * @param radioBandAvailable + * Availability of the control of radio band. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setRadioBandAvailable(Boolean radioBandAvailable) { + setValue(KEY_RADIO_BAND_AVAILABLE, radioBandAvailable); + } + + /** + * Gets the radioBandAvailable portion of the RadioControlCapabilities class + * + * @return Boolean - Availability of the control of radio band. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getRadioBandAvailable() { + return getBoolean(KEY_RADIO_BAND_AVAILABLE); + } + + /** + * Sets the radioFrequencyAvailable portion of the RadioControlCapabilities class + * + * @param radioFrequencyAvailable + * Availability of the control of radio frequency. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setRadioFrequencyAvailable(Boolean radioFrequencyAvailable) { + setValue(KEY_RADIO_FREQUENCY_AVAILABLE, radioFrequencyAvailable); + } + + /** + * Gets the radioFrequencyAvailable portion of the RadioControlCapabilities class + * + * @return Boolean - Availability of the control of radio frequency. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getRadioFrequencyAvailable() { + return getBoolean(KEY_RADIO_FREQUENCY_AVAILABLE); + } + + /** + * Sets the hdChannelAvailable portion of the RadioControlCapabilities class + * + * @param hdChannelAvailable + * Availability of the control of HD radio channel. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setHdChannelAvailable(Boolean hdChannelAvailable) { + setValue(KEY_HD_CHANNEL_AVAILABLE, hdChannelAvailable); + } + + /** + * Gets the hdChannelAvailable portion of the RadioControlCapabilities class + * + * @return Boolean - Availability of the control of HD radio channel. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getHdChannelAvailable() { + return getBoolean(KEY_HD_CHANNEL_AVAILABLE); + } + + /** + * Sets the rdsDataAvailable portion of the RadioControlCapabilities class + * + * @param rdsDataAvailable + * Availability of the getting Radio Data System (RDS) data. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setRdsDataAvailable(Boolean rdsDataAvailable) { + setValue(KEY_RDS_DATA_AVAILABLE, rdsDataAvailable); + } + + /** + * Gets the rdsDataAvailable portion of the RadioControlCapabilities class + * + * @return Boolean - Availability of the getting Radio Data System (RDS) data. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getRdsDataAvailable() { + return getBoolean(KEY_RDS_DATA_AVAILABLE); + } + + /** + * Sets the availableHDsAvailable portion of the RadioControlCapabilities class + * + * @param availableHDsAvailable + * Availability of the getting the number of available HD channels. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setAvailableHDsAvailable(Boolean availableHDsAvailable) { + setValue(KEY_AVAILABLE_HDS_AVAILABLE, availableHDsAvailable); + } + + /** + * Gets the availableHDsAvailable portion of the RadioControlCapabilities class + * + * @return Boolean - Availability of the getting the number of available HD channels. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getAvailableHDsAvailable() { + return getBoolean(KEY_AVAILABLE_HDS_AVAILABLE); + } + + /** + * Sets the stateAvailable portion of the RadioControlCapabilities class + * + * @param stateAvailable + * Availability of the getting the Radio state. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setStateAvailable(Boolean stateAvailable) { + setValue(KEY_STATE_AVAILABLE, stateAvailable); + } + + /** + * Gets the stateAvailable portion of the RadioControlCapabilities class + * + * @return Boolean - Availability of the getting the Radio state. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getStateAvailable() { + return getBoolean(KEY_STATE_AVAILABLE); + } + + /** + * Sets the signalStrengthAvailable portion of the RadioControlCapabilities class + * + * @param signalStrengthAvailable + * Availability of the getting the signal strength. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setSignalStrengthAvailable(Boolean signalStrengthAvailable) { + setValue(KEY_SIGNAL_STRENGTH_AVAILABLE, signalStrengthAvailable); + } + + /** + * Gets the signalStrengthAvailable portion of the RadioControlCapabilities class + * + * @return Boolean - Availability of the getting the signal strength. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getSignalStrengthAvailable() { + return getBoolean(KEY_SIGNAL_STRENGTH_AVAILABLE); + } + + /** + * Sets the signalChangeThresholdAvailable portion of the RadioControlCapabilities class + * + * @param signalChangeThresholdAvailable + * Availability of the getting the signal Change Threshold. + * True: Available, False: Not Available, Not present: Not Available. + */ + public void setSignalChangeThresholdAvailable(Boolean signalChangeThresholdAvailable) { + setValue(KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, signalChangeThresholdAvailable); + } + + /** + * Gets the signalChangeThresholdAvailable portion of the RadioControlCapabilities class + * + * @return Boolean - Availability of the getting the signal Change Threshold. + * True: Available, False: Not Available, Not present: Not Available. + */ + public Boolean getSignalChangeThresholdAvailable() { + return getBoolean(KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java new file mode 100644 index 000000000..90d8a9de0 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java @@ -0,0 +1,220 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; +import com.smartdevicelink.proxy.rpc.enums.RadioBand; +import com.smartdevicelink.proxy.rpc.enums.RadioState; +import java.util.Hashtable; + +/** + * Include information (both read-only and changeable data) about a + * remote control radio module. + */ +public class RadioControlData extends RPCStruct{ + public static final String KEY_FREQUENCY_INTEGER= "frequencyInteger"; + public static final String KEY_FREQUENCY_FRACTION= "frequencyFraction"; + public static final String KEY_BAND= "band"; + public static final String KEY_RDS_DATA= "rdsData"; + public static final String KEY_AVAILABLE_HDS= "availableHDs"; + public static final String KEY_HD_CHANNEL= "hdChannel"; + public static final String KEY_SIGNAL_STRENGTH= "signalStrength"; + public static final String KEY_SIGNAL_CHANGE_THRESHOLD= "signalChangeThreshold"; + public static final String KEY_RADIO_ENABLE= "radioEnable"; + public static final String KEY_STATE= "state"; + + public RadioControlData() { + } + + public RadioControlData(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Sets the frequencyInteger portion of the RadioControlData class + * + * @param frequencyInteger + * The integer part of the frequency i.e. for 101.7 this value should be 101 + */ + public void setFrequencyInteger(Integer frequencyInteger) { + setValue(KEY_FREQUENCY_INTEGER, frequencyInteger); + } + + /** + * Gets the frequencyInteger portion of the RadioControlData class + * + * @return Integer - The integer part of the frequency i.e. for 101.7 this value should be 101. + */ + public Integer getFrequencyInteger() { + return getInteger(KEY_FREQUENCY_INTEGER); + } + + /** + * Sets the frequencyFraction portion of the RadioControlData class + * + * @param frequencyFraction + * The fractional part of the frequency i.e. for 101.7 is 7. + */ + public void setFrequencyFraction(Integer frequencyFraction) { + setValue(KEY_FREQUENCY_FRACTION, frequencyFraction); + } + + /** + * Gets the frequencyFraction portion of the RadioControlData class + * + * @return Integer - The fractional part of the frequency i.e. for 101.7 is 7. + */ + public Integer getFrequencyFraction() { + return getInteger(KEY_FREQUENCY_FRACTION); + } + + /** + * Sets the band portion of the RadioControlData class + * + * @param band + * The radio band (AM|FM|XM) of the radio tuner. + */ + public void setBand(RadioBand band) { + setValue(KEY_BAND, band); + } + + /** + * Gets the band portion of the RadioControlData class + * + * @return RadioBand - The radio band (AM|FM|XM) of the radio tuner. + */ + public RadioBand getBand() { + return (RadioBand) getObject(RadioBand.class, KEY_BAND); + } + + /** + * Sets the rdsData portion of the RadioControlData class + * + * @param rdsData + * Read only parameter. See RdsData data type for details. + */ + public void setRdsData(RdsData rdsData) { + setValue(KEY_RDS_DATA, rdsData); + } + + /** + * Gets the rdsData portion of the RadioControlData class + * + * @return RdsData - Read only parameter. See RdsData data type for details. + */ + public RdsData getRdsData() { + return (RdsData) getObject(RdsData.class, KEY_RDS_DATA); + } + + /** + * Sets the availableHDs portion of the RadioControlData class + * + * @param availableHDs + * Number of HD sub-channels if available. + */ + public void setAvailableHDs(Integer availableHDs) { + setValue(KEY_AVAILABLE_HDS, availableHDs); + } + + /** + * Gets the availableHDs portion of the RadioControlData class + * + * @return Integer - Number of HD sub-channels if available. + */ + public Integer getAvailableHDs() { + return getInteger(KEY_AVAILABLE_HDS); + } + + /** + * Sets the hdChannel portion of the RadioControlData class + * + * @param hdChannel + * Current HD sub-channel if available. + */ + public void setHdChannel(Integer hdChannel) { + setValue(KEY_HD_CHANNEL, hdChannel); + } + + /** + * Gets the hdChannel portion of the RadioControlData class + * + * @return Integer - Current HD sub-channel if available. + */ + public Integer getHdChannel() { + return getInteger(KEY_HD_CHANNEL); + } + + /** + * Sets the signalStrength portion of the RadioControlData class + * + * @param signalStrength + * Read only parameter. Indicates the strength of receiving radio signal in current frequency. + */ + public void setSignalStrength(Integer signalStrength) { + setValue(KEY_SIGNAL_STRENGTH, signalStrength); + } + + /** + * Gets the signalStrength portion of the RadioControlData class + * + * @return Integer - Read only parameter. Indicates the strength of receiving radio signal in current frequency. + */ + public Integer getSignalStrength() { + return getInteger(KEY_SIGNAL_STRENGTH); + } + + /** + * Sets the signalChangeThreshold portion of the RadioControlData class + * + * @param signalChangeThreshold + * If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency. + */ + public void setSignalChangeThreshold(Integer signalChangeThreshold) { + setValue(KEY_SIGNAL_CHANGE_THRESHOLD, signalChangeThreshold); + } + + /** + * Gets the signalChangeThreshold portion of the RadioControlData class + * + * @return Integer - If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency. + */ + public Integer getSignalChangeThreshold() { + return getInteger(KEY_SIGNAL_CHANGE_THRESHOLD); + } + + /** + * Sets the radioEnable portion of the RadioControlData class + * + * @param radioEnable + * True if the radio is on, false is the radio is off. + */ + public void setRadioEnable(Boolean radioEnable) { + setValue(KEY_RADIO_ENABLE, radioEnable); + } + + /** + * Gets the radioEnable portion of the RadioControlData class + * + * @return Boolean - True if the radio is on, false is the radio is off. + */ + public Boolean getRadioEnable() { + return getBoolean(KEY_RADIO_ENABLE); + } + + /** + * Sets the state portion of the RadioControlData class + * + * @param state + * Read only parameter. See RadioState data type for details. + */ + public void setState(RadioState state) { + setValue(KEY_STATE, state); + } + + /** + * Gets the state portion of the RadioControlData class + * + * @return RadioState - Read only parameter. See RadioState data type for details. + */ + public RadioState getState() { + return (RadioState) getObject(RadioState.class, KEY_STATE); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java new file mode 100644 index 000000000..2ed934865 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java @@ -0,0 +1,180 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; + +import java.util.Hashtable; + +/** + * Include the data defined in Radio Data System, which is a communications protocol standard + * for embedding small amounts of digital information in conventional FM radio broadcasts. + */ +public class RdsData extends RPCStruct{ + public static final String KEY_PS= "PS"; + public static final String KEY_RT= "RT"; + public static final String KEY_CT= "CT"; + public static final String KEY_PI= "PI"; + public static final String KEY_PTY= "PTY"; + public static final String KEY_TP= "TP"; + public static final String KEY_TA= "TA"; + public static final String KEY_REG= "REG"; + + public RdsData() { + } + + public RdsData(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Sets the programService portion of the RdsData class + * + * @param programService + * Program Service Name. + */ + public void setProgramService(String programService) { + setValue(KEY_PS, programService); + } + + /** + * Gets the programService portion of the RdsData class + * + * @return String - Program Service Name. + */ + public String getProgramService() { + return getString(KEY_PS); + } + + /** + * Sets the radioText portion of the RdsData class + * + * @param radioText + * Radio Text. + */ + public void setRadioText(String radioText) { + setValue(KEY_RT, radioText); + } + + /** + * Gets the radioText portion of the RdsData class + * + * @return String - Radio Text. + */ + public String getRadioText() { + return getString(KEY_RT); + } + + /** + * Sets the clockText portion of the RdsData class + * + * @param clockText + * The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD. + */ + public void setClockText(String clockText) { + setValue(KEY_CT, clockText); + } + + /** + * Gets the clockText portion of the RdsData class + * + * @return String - The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD. + */ + public String getClockText() { + return getString(KEY_CT); + } + + /** + * Sets the programIdentification portion of the RdsData class + * + * @param programIdentification + * Program Identification - the call sign for the radio station. + */ + public void setProgramIdentification(String programIdentification) { + setValue(KEY_PI, programIdentification); + } + + /** + * Gets the programIdentification portion of the RdsData class + * + * @return String - Program Identification - the call sign for the radio station. + */ + public String getProgramIdentification() { + return getString(KEY_PI); + } + + /** + * Sets the region portion of the RdsData class + * + * @param region + * Region. + */ + public void setRegion(String region) { + setValue(KEY_REG, region); + } + + /** + * Gets the region portion of the RdsData class + * + * @return String - Region. + */ + public String getRegion() { + return getString(KEY_REG); + } + + /** + * Sets the trafficProgram portion of the RdsData class + * + * @param trafficProgram + * Traffic Program Identification - Identifies a station that offers traffic. + */ + public void setTrafficProgram(Boolean trafficProgram) { + setValue(KEY_TP, trafficProgram); + } + + /** + * Gets the trafficProgram portion of the RdsData class + * + * @return Boolean - Traffic Program Identification - Identifies a station that offers traffic. + */ + public Boolean getTrafficProgram() { + return getBoolean(KEY_TP); + } + + /** + * Sets the trafficAnnouncement portion of the RdsData class + * + * @param trafficAnnouncement + * Traffic Announcement Identification - Indicates an ongoing traffic announcement. + */ + public void setTrafficAnnouncement(Boolean trafficAnnouncement) { + setValue(KEY_TA, trafficAnnouncement); + } + + /** + * Gets the trafficAnnouncement portion of the RdsData class + * + * @return Boolean - Traffic Announcement Identification - Indicates an ongoing traffic announcement. + */ + public Boolean getTrafficAnnouncement() { + return getBoolean(KEY_TA); + } + + /** + * Sets the programType portion of the RdsData class + * + * @param programType + * The program type - The region should be used to differentiate between EU and North America program types. + */ + public void setProgramType(Integer programType) { + setValue(KEY_PTY, programType); + } + + /** + * Gets the programType portion of the RdsData class + * + * @return Integer - The program type. + * The region should be used to differentiate between EU and North America program types. + */ + public Integer getProgramType() { + return getInteger(KEY_PTY); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java new file mode 100644 index 000000000..ec51aa633 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java @@ -0,0 +1,82 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; +import java.util.Hashtable; +import java.util.List; + +public class RemoteControlCapabilities extends RPCStruct{ + public static final String KEY_CLIMATE_CONTROL_CAPABILITIES= "climateControlCapabilities"; + public static final String KEY_RADIO_CONTROL_CAPABILITIES = "radioControlCapabilities"; + public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities"; + + public RemoteControlCapabilities() { + } + + public RemoteControlCapabilities(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Sets the climateControlCapabilities portion of the RemoteControlCapabilities class + * + * @param climateControlCapabilities + * If included, the platform supports RC climate controls. + * For this baseline version, maxsize=1. i.e. only one climate control module is supported. + */ + public void setClimateControlCapabilities(List<ClimateControlCapabilities> climateControlCapabilities) { + setValue(KEY_CLIMATE_CONTROL_CAPABILITIES, climateControlCapabilities); + } + + /** + * Gets the climateControlCapabilities portion of the RemoteControlCapabilities class + * + * @return List<ClimateControlCapabilities> + * If included, the platform supports RC climate controls. + * For this baseline version, maxsize=1. i.e. only one climate control module is supported. + */ + public List<ClimateControlCapabilities> getClimateControlCapabilities() { + return (List<ClimateControlCapabilities>) getObject(ClimateControlCapabilities.class, KEY_CLIMATE_CONTROL_CAPABILITIES); + } + + /** + * Sets the radioControlCapabilities portion of the RemoteControlCapabilities class + * + * @param radioControlCapabilities + * If included, the platform supports RC climate controls. + * For this baseline version, maxsize=1. i.e. only one radio control module is supported. + */ + public void setRadioControlCapabilities(List<RadioControlCapabilities> radioControlCapabilities) { + setValue(KEY_RADIO_CONTROL_CAPABILITIES, radioControlCapabilities); + } + + /** + * Gets the radioControlCapabilities portion of the RemoteControlCapabilities class + * + * @return List<RadioControlCapabilities> + * If included, the platform supports RC climate controls. + * For this baseline version, maxsize=1. i.e. only one radio control module is supported. + */ + public List<RadioControlCapabilities> getRadioControlCapabilities() { + return (List<RadioControlCapabilities>) getObject(RadioControlCapabilities.class, KEY_RADIO_CONTROL_CAPABILITIES); + } + + /** + * Sets the buttonCapabilities portion of the RemoteControlCapabilities class + * + * @param buttonCapabilities + * If included, the platform supports RC button controls with the included button names. + */ + public void setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) { + setValue(KEY_BUTTON_CAPABILITIES, buttonCapabilities); + } + + /** + * Gets the buttonCapabilities portion of the RemoteControlCapabilities class + * + * @return List<ButtonCapabilities> + * If included, the platform supports RC button controls with the included button names. + */ + public List<ButtonCapabilities> getButtonCapabilities() { + return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java new file mode 100644 index 000000000..75077e3cb --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java @@ -0,0 +1,51 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCRequest; + +import java.util.Hashtable; + +/** + * This function allows a remote control type mobile application change the settings + * of a specific remote control module. + */ +public class SetInteriorVehicleData extends RPCRequest { + public static final String KEY_MODULE_DATA = "moduleData"; + + /** + * Constructs a new SetInteriorVehicleData object + */ + public SetInteriorVehicleData() { + super(FunctionID.SET_INTERIOR_VEHICLE_DATA.toString()); + } + + /** + * <p>Constructs a new SetInteriorVehicleData object indicated by the + * Hashtable parameter</p> + * + * + * @param hash + * The Hashtable to use + */ + public SetInteriorVehicleData(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Sets the moduleData + * + * @param moduleData + */ + public void setModuleData(ModuleData moduleData) { + setParameters(KEY_MODULE_DATA, moduleData); + } + + /** + * Gets the moduleData + * + * @return ModuleData + */ + public ModuleData getModuleData() { + return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java new file mode 100644 index 000000000..6a7079735 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java @@ -0,0 +1,47 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCResponse; + +import java.util.Hashtable; + +public class SetInteriorVehicleDataResponse extends RPCResponse { + public static final String KEY_MODULE_DATA = "moduleData"; + + /** + * Constructs a new SetInteriorVehicleDataResponse object + */ + public SetInteriorVehicleDataResponse() { + super(FunctionID.SET_INTERIOR_VEHICLE_DATA.toString()); + } + + /** + * <p>Constructs a new SetInteriorVehicleDataResponse object indicated by the + * Hashtable parameter</p> + * + * + * @param hash + * The Hashtable to use + */ + public SetInteriorVehicleDataResponse(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Gets the moduleData + * + * @return ModuleData + */ + public ModuleData getModuleData() { + return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA); + } + + /** + * Sets the moduleData + * + * @param moduleData + */ + public void setModuleData(ModuleData moduleData) { + setParameters(KEY_MODULE_DATA, moduleData); + } +} 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 2fb2e41e3..386f28b45 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 @@ -14,7 +14,7 @@ public class SystemCapability extends RPCStruct { public static final String KEY_NAVIGATION_CAPABILITY = "navigationCapability"; 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 SystemCapability(){} @@ -44,6 +44,8 @@ public class SystemCapability extends RPCStruct { return (RPCStruct) getObject(PhoneCapability.class, KEY_PHONE_CAPABILITY); } else if (type.equals(SystemCapabilityType.VIDEO_STREAMING)){ 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{ return null; } @@ -56,6 +58,8 @@ public class SystemCapability extends RPCStruct { setValue(KEY_PHONE_CAPABILITY, capability); }else if(type.equals(SystemCapabilityType.VIDEO_STREAMING)){ setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability); + }else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){ + setValue(KEY_REMOTE_CONTROL_CAPABILITY, capability); }else{ return; } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java new file mode 100644 index 000000000..29fea734f --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java @@ -0,0 +1,56 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; +import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit; +import com.smartdevicelink.util.SdlDataTypeConverter; + +import java.util.Hashtable; + +public class Temperature extends RPCStruct{ + public static final String KEY_UNIT = "unit"; + public static final String KEY_VALUE = "value"; + + public Temperature() { } + public Temperature(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Sets the unit portion of the Temperature class + * + * @param unit + * Temperature Unit. + */ + public void setUnit(TemperatureUnit unit) { + setValue(KEY_UNIT, unit); + } + + /** + * Gets the unit portion of the Temperature class + * + * @return TemperatureUnit - Temperature Unit. + */ + public TemperatureUnit getUnit() { + return (TemperatureUnit) getObject(TemperatureUnit.class, KEY_UNIT); + } + + /** + * Gets the value portion of the Temperature class + * + * @return Float - Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL. + */ + public Float getValue() { + Object value = getValue(KEY_VALUE); + return SdlDataTypeConverter.objectToFloat(value); + } + + /** + * Sets the value portion of the Temperature class + * + * @param value + * Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL. + */ + public void setValue(Float value) { + setValue(KEY_VALUE, value); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java index 2a12bec1e..0a4f56255 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java @@ -45,7 +45,12 @@ public enum AppHMIType { /**
* System App
*/
- SYSTEM;
+ SYSTEM,
+ /**
+ * Remote Control
+ */
+ REMOTE_CONTROL,
+ ;
/**
* Convert String to AppHMIType
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java index 1391a9d44..f478a78ee 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java @@ -115,7 +115,28 @@ public enum ButtonName{ *
* @since SmartDeviceLink 1.0
*/
- PRESET_9, CUSTOM_BUTTON, SEARCH;
+ PRESET_9,
+ CUSTOM_BUTTON,
+ SEARCH,
+ AC_MAX,
+ AC,
+ RECIRCULATE,
+ FAN_UP,
+ FAN_DOWN,
+ TEMP_UP,
+ TEMP_DOWN,
+ DEFROST_MAX,
+ DEFROST,
+ DEFROST_REAR,
+ UPPER_VENT,
+ LOWER_VENT,
+ VOLUME_UP,
+ VOLUME_DOWN,
+ EJECT,
+ SOURCE,
+ SHUFFLE,
+ REPEAT,
+ ;
public static ButtonName valueForString(String value) {
try{
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java new file mode 100644 index 000000000..4c6b15e85 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java @@ -0,0 +1,17 @@ +package com.smartdevicelink.proxy.rpc.enums; + +public enum DefrostZone { + FRONT, + REAR, + ALL, + NONE, + ; + + public static DefrostZone 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/ModuleType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java new file mode 100644 index 000000000..faef92d36 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java @@ -0,0 +1,15 @@ +package com.smartdevicelink.proxy.rpc.enums; + +public enum ModuleType { + CLIMATE, + RADIO, + ; + + public static ModuleType 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/RadioBand.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java new file mode 100644 index 000000000..2b2c862d8 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java @@ -0,0 +1,16 @@ +package com.smartdevicelink.proxy.rpc.enums; + +public enum RadioBand { + AM, + FM, + XM, + ; + + public static RadioBand 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/RadioState.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java new file mode 100644 index 000000000..533c86dca --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java @@ -0,0 +1,20 @@ +package com.smartdevicelink.proxy.rpc.enums; + +/** + * List possible states of a remote control radio module. + */ +public enum RadioState { + ACQUIRING, + ACQUIRED, + MULTICAST, + NOT_FOUND, + ; + + public static RadioState 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/Result.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java index 870e4115e..c0a15f235 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java @@ -168,7 +168,16 @@ public enum Result { /**
* The provided hash ID does not match the hash of the current set of registered data or the core could not resume the previous data.
*/
- RESUME_FAILED;
+ RESUME_FAILED,
+ /**
+ * The requested data is not available on this vehicle or is not published for the connected app.
+ */
+ DATA_NOT_AVAILABLE,
+ /**
+ * The requested data is read only thus cannot be change via remote control
+ */
+ READ_ONLY,
+ ;
/**
* Convert String to Result
* @param value String
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java new file mode 100644 index 000000000..6c9b04875 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java @@ -0,0 +1,14 @@ +package com.smartdevicelink.proxy.rpc.enums; + +public enum TemperatureUnit { + CELSIUS, + FAHRENHEIT; + + public static TemperatureUnit 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/VentilationMode.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java new file mode 100644 index 000000000..b7a2ae9a2 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java @@ -0,0 +1,17 @@ +package com.smartdevicelink.proxy.rpc.enums; + +public enum VentilationMode { + UPPER, + LOWER, + BOTH, + NONE, + ; + + public static VentilationMode valueForString(String value) { + try{ + return valueOf(value); + }catch(Exception e){ + return null; + } + } +} |