diff --git a/sdl_android/build.gradle b/sdl_android/build.gradle index 7904206a95..bdce1c53dd 100644 --- a/sdl_android/build.gradle +++ b/sdl_android/build.gradle @@ -42,6 +42,7 @@ dependencies { }) testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.9.0' + implementation 'com.android.support:support-annotations:27.1.1' } diff --git a/sdl_android/src/androidTest/assets/json/OnSeekMediaClockTimer.json b/sdl_android/src/androidTest/assets/json/OnSeekMediaClockTimer.json new file mode 100644 index 0000000000..4b3aff677f --- /dev/null +++ b/sdl_android/src/androidTest/assets/json/OnSeekMediaClockTimer.json @@ -0,0 +1,13 @@ +{ + "notification":{ + "name":"OnSeekMediaClockTimer", + "correlationID":150, + "parameters":{ + "seekTime":{ + "minutes":55, + "seconds":19, + "hours":12 + } + } + } +} \ No newline at end of file diff --git a/sdl_android/src/androidTest/assets/json/SetMediaClockTimer.json b/sdl_android/src/androidTest/assets/json/SetMediaClockTimer.json index af16712009..57fbacfa05 100644 --- a/sdl_android/src/androidTest/assets/json/SetMediaClockTimer.json +++ b/sdl_android/src/androidTest/assets/json/SetMediaClockTimer.json @@ -13,7 +13,8 @@ "seconds":19, "hours":12 }, - "updateMode":"COUNTDOWN" + "updateMode":"COUNTDOWN", + "enableSeek": true } }, "response":{ diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java index e31aedbe70..f30febd11d 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java @@ -722,20 +722,23 @@ public void testBuildSetGlobalProperties () { public void testBuildSetMediaClockTimer () { Integer hours = 0, minutes = 0, seconds = 0, testCorrelationID = 0; + Boolean enableSeek = true; UpdateMode testMode = UpdateMode.COUNTUP; SetMediaClockTimer testSMCT; // Test -- buildSetMediaClockTimer(Integer hours, Integer minutes, Integer seconds, UpdateMode updateMode, Integer correlationID) - testSMCT = RPCRequestFactory.buildSetMediaClockTimer(hours, minutes, seconds, testMode, testCorrelationID); + testSMCT = RPCRequestFactory.buildSetMediaClockTimer(hours, minutes, seconds, testMode, enableSeek, testCorrelationID); assertEquals(Test.MATCH, hours, testSMCT.getStartTime().getHours()); assertEquals(Test.MATCH, minutes, testSMCT.getStartTime().getMinutes()); assertEquals(Test.MATCH, seconds, testSMCT.getStartTime().getSeconds()); assertEquals(Test.MATCH, testMode, testSMCT.getUpdateMode()); + assertEquals(Test.MATCH, enableSeek, testSMCT.getEnableSeek()); assertEquals(Test.MATCH, testCorrelationID, testSMCT.getCorrelationID()); - testSMCT = RPCRequestFactory.buildSetMediaClockTimer(null, null, null, null, null); + testSMCT = RPCRequestFactory.buildSetMediaClockTimer(null, null, null, null, null, null); assertNull(Test.NULL, testSMCT.getStartTime()); assertNull(Test.NULL, testSMCT.getUpdateMode()); + assertNull(Test.NULL, testSMCT.getEnableSeek()); assertNotNull(Test.NOT_NULL, testSMCT.getCorrelationID()); // Test -- buildSetMediaClockTimer(UpdateMode updateMode, Integer correlationID) 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 b50f6f48d2..1792b68023 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 @@ -50,6 +50,7 @@ import com.smartdevicelink.proxy.rpc.OnLanguageChange; import com.smartdevicelink.proxy.rpc.OnLockScreenStatus; import com.smartdevicelink.proxy.rpc.OnPermissionsChange; +import com.smartdevicelink.proxy.rpc.OnSeekMediaClockTimer; import com.smartdevicelink.proxy.rpc.OnStreamRPC; import com.smartdevicelink.proxy.rpc.OnSystemRequest; import com.smartdevicelink.proxy.rpc.OnTBTClientState; @@ -619,5 +620,10 @@ public void onGenericResponse(GenericResponse response) { public void onSendHapticDataResponse(SendHapticDataResponse response) { Log.i(TAG, "SendHapticDataResponse response from SDL: " + response); } + + @Override + public void onSeekMediaClockTimer(OnSeekMediaClockTimer notification) { + + } } } diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSeekMediaClockTimerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSeekMediaClockTimerTests.java new file mode 100644 index 0000000000..ac6477bcf3 --- /dev/null +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSeekMediaClockTimerTests.java @@ -0,0 +1,95 @@ +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.OnSeekMediaClockTimer; +import com.smartdevicelink.proxy.rpc.StartTime; +import com.smartdevicelink.test.BaseRpcTests; +import com.smartdevicelink.test.JsonUtils; +import com.smartdevicelink.test.Test; +import com.smartdevicelink.test.Validator; +import com.smartdevicelink.test.json.rpc.JsonFileReader; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Hashtable; + + +public class OnSeekMediaClockTimerTests extends BaseRpcTests { + @Override + protected RPCMessage createMessage(){ + OnSeekMediaClockTimer msg = new OnSeekMediaClockTimer(); + msg.setSeekTime(Test.GENERAL_STARTTIME); + + return msg; + } + + @Override + protected String getMessageType(){ + return RPCMessage.KEY_NOTIFICATION; + } + + @Override + protected String getCommandType(){ + return FunctionID.ON_SEEK_MEDIA_CLOCK_TIMER.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion){ + JSONObject result = new JSONObject(); + try { + result.put(OnSeekMediaClockTimer.KEY_SEEK_TIME, Test.JSON_STARTTIME); + } catch (JSONException e) { + e.printStackTrace(); + } + + return result; + } + + /** + * Tests the expected values of the RPC message. + */ + public void testRpcValues () { + // Test Values + StartTime seekTime = ((OnSeekMediaClockTimer) msg).getSeekTime(); + + // Valid Tests + assertEquals(Test.MATCH, Test.GENERAL_STARTTIME, seekTime); + + // Invalid/Null Tests + OnSeekMediaClockTimer msg = new OnSeekMediaClockTimer(); + assertNotNull(Test.NOT_NULL, msg); + testNullBase(msg); + + assertNull(Test.NULL, msg.getSeekTime()); + } + + /** + * 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 hash = JsonRPCMarshaller.deserializeJSONObject(commandJson); + OnSeekMediaClockTimer cmd = new OnSeekMediaClockTimer(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()); + + JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS); + JSONObject seekTime = JsonUtils.readJsonObjectFromJsonObject(parameters, OnSeekMediaClockTimer.KEY_SEEK_TIME); + StartTime referenceSeekTime = new StartTime(JsonRPCMarshaller.deserializeJSONObject(seekTime)); + assertTrue(Test.TRUE, Validator.validateStartTime(referenceSeekTime, cmd.getSeekTime())); + + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + } +} diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java index 7d52bb75ce..27234291b9 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java @@ -19,7 +19,7 @@ /** * This is a unit test class for the SmartDeviceLink library project class : - * {@link com.smartdevicelink.rpc.SetMediaClockTimer} + * {@link com.smartdevicelink.proxy.rpc.SetMediaClockTimer} */ public class SetMediaClockTimerTests extends BaseRpcTests { @@ -30,6 +30,7 @@ protected RPCMessage createMessage() { msg.setStartTime(Test.GENERAL_STARTTIME); msg.setEndTime(Test.GENERAL_STARTTIME); msg.setUpdateMode(Test.GENERAL_UPDATEMODE); + msg.setEnableSeek(Test.GENERAL_BOOLEAN); return msg; } @@ -51,7 +52,8 @@ protected JSONObject getExpectedParameters(int sdlVersion) { try { result.put(SetMediaClockTimer.KEY_START_TIME, Test.JSON_STARTTIME); result.put(SetMediaClockTimer.KEY_END_TIME, Test.JSON_STARTTIME); - result.put(SetMediaClockTimer.KEY_UPDATE_MODE, Test.GENERAL_UPDATEMODE); + result.put(SetMediaClockTimer.KEY_UPDATE_MODE, Test.GENERAL_UPDATEMODE); + result.put(SetMediaClockTimer.KEY_ENABLE_SEEK, Test.GENERAL_BOOLEAN); } catch (JSONException e) { fail(Test.JSON_FAIL); } @@ -67,12 +69,14 @@ public void testRpcValues () { StartTime testStartTime = ( (SetMediaClockTimer) msg ).getStartTime(); StartTime testEndTime = ( (SetMediaClockTimer) msg ).getEndTime(); UpdateMode testUpdateMode = ( (SetMediaClockTimer) msg ).getUpdateMode(); + Boolean testEnableSeek = ( (SetMediaClockTimer) msg ).getEnableSeek(); // Valid Tests assertEquals(Test.MATCH, Test.GENERAL_UPDATEMODE, testUpdateMode); assertTrue(Test.TRUE, Validator.validateStartTime(Test.GENERAL_STARTTIME, testStartTime)); assertTrue(Test.TRUE, Validator.validateStartTime(Test.GENERAL_STARTTIME, testEndTime)); - + assertEquals(Test.MATCH, Boolean.valueOf(Test.GENERAL_BOOLEAN), testEnableSeek); + // Invalid/Null Tests SetMediaClockTimer msg = new SetMediaClockTimer(); assertNotNull(Test.NOT_NULL, msg); @@ -81,6 +85,7 @@ public void testRpcValues () { assertNull(Test.NULL, msg.getStartTime()); assertNull(Test.NULL, msg.getEndTime()); assertNull(Test.NULL, msg.getUpdateMode()); + assertNull(Test.NULL, msg.getEnableSeek()); } /** @@ -110,6 +115,8 @@ public void testJsonConstructor () { StartTime referenceEndTime = new StartTime(JsonRPCMarshaller.deserializeJSONObject(endTime)); assertTrue(Test.TRUE, Validator.validateStartTime(referenceEndTime, cmd.getEndTime())); assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetMediaClockTimer.KEY_UPDATE_MODE), cmd.getUpdateMode().toString()); + + assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SetMediaClockTimer.KEY_ENABLE_SEEK), cmd.getEnableSeek()); } catch (JSONException e) { fail(Test.JSON_FAIL); } 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 412d3f8577..686a1b30eb 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 @@ -82,6 +82,7 @@ public enum FunctionID{ ON_HASH_CHANGE(32782, "OnHashChange"), ON_INTERIOR_VEHICLE_DATA(32783, "OnInteriorVehicleData"), ON_WAY_POINT_CHANGE(32784, "OnWayPointChange"), + ON_SEEK_MEDIA_CLOCK_TIMER(32785, "OnSeekMediaClockTimer"), // MOCKED FUNCTIONS (NOT SENT FROM HEAD-UNIT) ON_LOCK_SCREEN_STATUS(-1, "OnLockScreenStatus"), diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java index e249839d5b..f24fcafce8 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java @@ -691,10 +691,9 @@ public static SetGlobalProperties buildSetGlobalProperties( return req; } - - public static SetMediaClockTimer buildSetMediaClockTimer(Integer hours, - Integer minutes, Integer seconds, UpdateMode updateMode, - Integer correlationID) { + + public static SetMediaClockTimer buildSetMediaClockTimer(Integer hours, Integer minutes, + Integer seconds, UpdateMode updateMode, Boolean enableSeek, Integer correlationID) { SetMediaClockTimer msg = new SetMediaClockTimer(); if (hours != null || minutes != null || seconds != null) { @@ -706,10 +705,21 @@ public static SetMediaClockTimer buildSetMediaClockTimer(Integer hours, } msg.setUpdateMode(updateMode); + msg.setEnableSeek(enableSeek); msg.setCorrelationID(correlationID); return msg; } + + @Deprecated + public static SetMediaClockTimer buildSetMediaClockTimer(Integer hours, + Integer minutes, Integer seconds, UpdateMode updateMode, + Integer correlationID) { + + SetMediaClockTimer msg = buildSetMediaClockTimer(hours, minutes, seconds, updateMode, null, correlationID); + + return msg; + } @Deprecated public static SetMediaClockTimer buildSetMediaClockTimer( @@ -717,9 +727,10 @@ public static SetMediaClockTimer buildSetMediaClockTimer( Integer hours = null; Integer minutes = null; Integer seconds = null; + Boolean enableSeek = null; SetMediaClockTimer msg = buildSetMediaClockTimer(hours, minutes, - seconds, updateMode, correlationID); + seconds, updateMode, enableSeek, correlationID); return msg; } 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 79ee5a0ff2..4570bb3384 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java @@ -41,7 +41,6 @@ import android.view.MotionEvent; import android.view.Surface; -import com.smartdevicelink.BuildConfig; import com.smartdevicelink.Dispatcher.IDispatchingStrategy; import com.smartdevicelink.Dispatcher.ProxyMessageDispatcher; import com.smartdevicelink.SdlConnection.ISdlConnectionListener; @@ -1954,7 +1953,7 @@ private void handleRPCMessage(Hashtable hash) { RPCMessage rpcMsg = new RPCMessage(hash); String functionName = rpcMsg.getFunctionName(); String messageType = rpcMsg.getMessageType(); - + if (messageType.equals(RPCMessage.KEY_RESPONSE)) { SdlTrace.logRPCEvent(InterfaceActivityDirection.Receive, new RPCResponse(rpcMsg), SDL_LIB_TRACE_KEY); @@ -2744,7 +2743,7 @@ public void run() { }); } else { _proxyListener.onGetVehicleDataResponse(msg); - onRPCResponseReceived(msg); + onRPCResponseReceived(msg); } } else if (functionName.equals(FunctionID.SUBSCRIBE_WAY_POINTS.toString())) { // SubscribeWayPoints @@ -3139,7 +3138,7 @@ public void run() { } } else if (functionName.equals(FunctionID.ON_PERMISSIONS_CHANGE.toString())) { //OnPermissionsChange - + final OnPermissionsChange msg = new OnPermissionsChange(hash); if (_callbackToUIThread) { // Run in UI thread @@ -3401,6 +3400,22 @@ public void run() { onRPCNotificationReceived(msg); } } + else if (functionName.equals(FunctionID.ON_SEEK_MEDIA_CLOCK_TIMER.toString())) { + final OnSeekMediaClockTimer msg = new OnSeekMediaClockTimer(hash); + if (_callbackToUIThread) { + // Run in UI thread + _mainUIHandler.post(new Runnable() { + @Override + public void run() { + _proxyListener.onSeekMediaClockTimer(msg); + onRPCNotificationReceived(msg); + } + }); + } else { + _proxyListener.onSeekMediaClockTimer(msg); + onRPCNotificationReceived(msg); + } + } else if (functionName.equals(FunctionID.ON_INTERIOR_VEHICLE_DATA.toString())) { final OnInteriorVehicleData msg = new OnInteriorVehicleData(hash); if (_callbackToUIThread) { @@ -5407,8 +5422,29 @@ public void resetGlobalProperties(Vector properties, sendRPCRequest(req); } - - + + /** + * Sends a SetMediaClockTimer RPCRequest to SDL. Responses are captured through callback on IProxyListener. + * + * @param hours integer for hours + * @param minutes integer for minutes + * @param seconds integer for seconds + * @param updateMode mode in which the media clock timer should be updated + * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse + * @param enableSeek a Boolean representing whether seek media clock timer functionality will be available + * @throws SdlException if an unrecoverable error is encountered + */ + @SuppressWarnings("unused") + public void setMediaClockTimer(Integer hours, + Integer minutes, Integer seconds, UpdateMode updateMode, + Boolean enableSeek, Integer correlationID) throws SdlException { + + SetMediaClockTimer msg = RPCRequestFactory.buildSetMediaClockTimer(hours, + minutes, seconds, updateMode, null, correlationID); + + sendRPCRequest(msg); + } + /** * Sends a SetMediaClockTimer RPCRequest to SDL. Responses are captured through callback on IProxyListener. * @@ -5420,32 +5456,68 @@ public void resetGlobalProperties(Vector properties, * @throws SdlException if an unrecoverable error is encountered */ @SuppressWarnings("unused") + @Deprecated public void setMediaClockTimer(Integer hours, Integer minutes, Integer seconds, UpdateMode updateMode, Integer correlationID) throws SdlException { SetMediaClockTimer msg = RPCRequestFactory.buildSetMediaClockTimer(hours, - minutes, seconds, updateMode, correlationID); + minutes, seconds, updateMode, null, correlationID); sendRPCRequest(msg); } - + /** * Pauses the media clock. Responses are captured through callback on IProxyListener. - * + * + * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse + * @param enableSeek a Boolean representing whether seek media clock timer functionality will be available + * @throws SdlException if an unrecoverable error is encountered + */ + @SuppressWarnings("unused") + public void pauseMediaClockTimer(Integer correlationID, Boolean enableSeek) + throws SdlException { + + SetMediaClockTimer msg = RPCRequestFactory.buildSetMediaClockTimer(0, + 0, 0, UpdateMode.PAUSE, enableSeek, correlationID); + + sendRPCRequest(msg); + } + + /** + * Pauses the media clock. Responses are captured through callback on IProxyListener. + * * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse * @throws SdlException if an unrecoverable error is encountered */ @SuppressWarnings("unused") + @Deprecated public void pauseMediaClockTimer(Integer correlationID) throws SdlException { SetMediaClockTimer msg = RPCRequestFactory.buildSetMediaClockTimer(0, - 0, 0, UpdateMode.PAUSE, correlationID); + 0, 0, UpdateMode.PAUSE, null, correlationID); sendRPCRequest(msg); } - + + /** + * Resumes the media clock. Responses are captured through callback on IProxyListener. + * + * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse + * @param enableSeek a Boolean representing whether seek media clock timer functionality will be available + * @throws SdlException if an unrecoverable error is encountered + */ + @SuppressWarnings("unused") + public void resumeMediaClockTimer(Integer correlationID, Boolean enableSeek) + throws SdlException { + + SetMediaClockTimer msg = RPCRequestFactory.buildSetMediaClockTimer(0, + 0, 0, UpdateMode.RESUME, enableSeek, correlationID); + + sendRPCRequest(msg); + } + /** * Resumes the media clock. Responses are captured through callback on IProxyListener. * @@ -5453,15 +5525,16 @@ public void pauseMediaClockTimer(Integer correlationID) * @throws SdlException if an unrecoverable error is encountered */ @SuppressWarnings("unused") + @Deprecated public void resumeMediaClockTimer(Integer correlationID) throws SdlException { SetMediaClockTimer msg = RPCRequestFactory.buildSetMediaClockTimer(0, - 0, 0, UpdateMode.RESUME, correlationID); + 0, 0, UpdateMode.RESUME, null, correlationID); sendRPCRequest(msg); } - + /** * Clears the media clock. Responses are captured through callback on IProxyListener. * 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 618819f20b..9dbaca6eb3 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 @@ -35,6 +35,7 @@ import com.smartdevicelink.proxy.rpc.OnLanguageChange; import com.smartdevicelink.proxy.rpc.OnLockScreenStatus; import com.smartdevicelink.proxy.rpc.OnPermissionsChange; +import com.smartdevicelink.proxy.rpc.OnSeekMediaClockTimer; import com.smartdevicelink.proxy.rpc.OnStreamRPC; import com.smartdevicelink.proxy.rpc.OnSystemRequest; import com.smartdevicelink.proxy.rpc.OnTBTClientState; @@ -353,4 +354,6 @@ public interface IProxyListenerBase { public void onOnInteriorVehicleData(OnInteriorVehicleData notification); public void onSendHapticDataResponse(SendHapticDataResponse response); + + public void onSeekMediaClockTimer(OnSeekMediaClockTimer notification); } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSeekMediaClockTimer.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSeekMediaClockTimer.java new file mode 100644 index 0000000000..445594fb65 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSeekMediaClockTimer.java @@ -0,0 +1,75 @@ +package com.smartdevicelink.proxy.rpc; + +import android.support.annotation.NonNull; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCNotification; + +import java.util.Hashtable; + +/** + * Callback for the seek media clock timer notification. Notifies the application of + * progress bar seek event on the media clock timer. System will automatically update + * the media clock timer position based on the seek notification location. + *

Parameter List

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameTypeDescriptionReqNotesSmartDeviceLink Ver Available
seekTimeStartTimeDescribes the hour, minute and second values used for the current media clock timer.YSmartDeviceLink 4.6
+ */ + +public class OnSeekMediaClockTimer extends RPCNotification { + public static final String KEY_SEEK_TIME = "seekTime"; + + /** + *Constructs a newly allocated OnSeekMediaClockTimer object + */ + public OnSeekMediaClockTimer() { + super(FunctionID.ON_SEEK_MEDIA_CLOCK_TIMER.toString()); + } + /** + *

Constructs a newly allocated OnSeekMediaClockTimer object indicated by the Hashtable parameter

+ *@param hash The Hashtable to use + */ + public OnSeekMediaClockTimer(Hashtable hash) { + super(hash); + } + /** + *Constructs a newly allocated OnSeekMediaClockTimer object + */ + public OnSeekMediaClockTimer(@NonNull StartTime seekTime) { + this(); + setSeekTime(seekTime); + } + /** + * Gets the StartTime object representing the current media clock timer + * + * @return seekTime -a StartTime object specifying hour, minute, second values + */ + public StartTime getSeekTime() { + return (StartTime) getObject(StartTime.class, KEY_SEEK_TIME); + } + /** + * Sets a seekTime with specifying hour, minute, second values + * + * @param seekTime -a StartTime object with specifying hour, minute, second values + */ + public void setSeekTime( @NonNull StartTime seekTime ) { + setParameters(KEY_SEEK_TIME, seekTime); + } + +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java index bcef52745b..b24905a79c 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java @@ -52,6 +52,14 @@ * SmartDeviceLink 1.0 * * + * enableSeek + * Boolean + * Defines if seek media clock timer functionality will be available. + * N + * If omitted, the value is set to false. The value is retained until the next SetMediaClockTimer is sent. + * SmartDeviceLink 4.6 + * + * * * * @@ -74,6 +82,7 @@ public class SetMediaClockTimer extends RPCRequest { public static final String KEY_START_TIME = "startTime"; public static final String KEY_END_TIME = "endTime"; public static final String KEY_UPDATE_MODE = "updateMode"; + public static final String KEY_ENABLE_SEEK = "enableSeek"; /** * Constructs a new SetMediaClockTimer object */ @@ -131,13 +140,13 @@ public void setEndTime( StartTime endTime ) { * Gets the media clock/timer update mode (COUNTUP/COUNTDOWN/PAUSE/RESUME) * * @return UpdateMode -a Enumeration value (COUNTUP/COUNTDOWN/PAUSE/RESUME) - */ - public UpdateMode getUpdateMode() { + */ + public UpdateMode getUpdateMode() { return (UpdateMode) getObject(UpdateMode.class, KEY_UPDATE_MODE); - } + } /** * Sets the media clock/timer update mode (COUNTUP/COUNTDOWN/PAUSE/RESUME) - * + * * @param updateMode * a Enumeration value (COUNTUP/COUNTDOWN/PAUSE/RESUME) *

@@ -148,8 +157,32 @@ public UpdateMode getUpdateMode() { *
  • When updateMode is RESUME, the timer resumes counting from * the timer's value when it was paused
  • * - */ - public void setUpdateMode( UpdateMode updateMode ) { + */ + public void setUpdateMode( UpdateMode updateMode ) { setParameters(KEY_UPDATE_MODE, updateMode); - } + } + + /** + * Gets enableSeek + * + * @return enableSeek -a Boolean representing whether seek media clock timer functionality will be available + */ + public Boolean getEnableSeek() { + return getBoolean(KEY_ENABLE_SEEK); + } + /** + * Sets enableSeek + * + * @param enableSeek + * a Boolean representing whether seek media clock timer functionality will be available + *

    + * Notes: + *
      + *
    • If omitted, the value is set to false.
    • + *
    • The value is retained until the next SetMediaClockTimer is sent.
    • + *
    + */ + public void setEnableSeek( Boolean enableSeek ) { + setParameters(KEY_ENABLE_SEEK, enableSeek); + } }