summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2019-03-11 16:00:59 -0400
committerJoey Grover <joeygrover@gmail.com>2019-03-11 16:00:59 -0400
commit90bcb0e5b3e765862835490275e27981e0c1afe6 (patch)
treedacd791905544866d1855bead724f7d972d1fc0b
parent441ad003b9ebb281726657171222aa9606b01d18 (diff)
downloadsdl_android-90bcb0e5b3e765862835490275e27981e0c1afe6.tar.gz
Remove RPC streaming for this release.
To be implemented later through the FileManager
-rw-r--r--base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java46
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCStreamController.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java308
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java169
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java239
5 files changed, 0 insertions, 794 deletions
diff --git a/base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java b/base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
index dc1d67d85..829691b30 100644
--- a/base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -19,7 +19,6 @@ import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.streaming.AbstractPacketizer;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamPacketizer;
-import com.smartdevicelink.streaming.StreamRPCPacketizer;
import com.smartdevicelink.streaming.video.RTPH264Packetizer;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
@@ -62,7 +61,6 @@ public class SdlSession implements ISdlProtocol, ISdlConnectionListener, IStream
//FIXME IHeartbeatMonitor _outgoingHeartbeatMonitor = null;
//FIXME IHeartbeatMonitor _incomingHeartbeatMonitor = null;
- StreamRPCPacketizer mRPCPacketizer = null;
AbstractPacketizer mVideoPacketizer = null;
StreamPacketizer mAudioPacketizer = null;
//FIXME SdlEncoder mSdlEncoder = null;
@@ -190,51 +188,7 @@ public class SdlSession implements ISdlProtocol, ISdlConnectionListener, IStream
}
}
- public void startRPCStream(InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion) {
- try {
- mRPCPacketizer = new StreamRPCPacketizer(null, this, is, request, sType, rpcSessionID, wiproVersion, 0, this);
- mRPCPacketizer.start();
- } catch (Exception e) {
- Log.e(TAG, "Unable to start streaming:" + e.toString());
- }
- }
- public OutputStream startRPCStream(RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion) {
- try {
- OutputStream os = new PipedOutputStream();
- InputStream is = new PipedInputStream((PipedOutputStream) os);
- mRPCPacketizer = new StreamRPCPacketizer(null, this, is, request, sType, rpcSessionID, wiproVersion, 0, this);
- mRPCPacketizer.start();
- return os;
- } catch (Exception e) {
- Log.e(TAG, "Unable to start streaming:" + e.toString());
- }
- return null;
- }
-
- public void pauseRPCStream()
- {
- if (mRPCPacketizer != null)
- {
- mRPCPacketizer.pause();
- }
- }
-
- public void resumeRPCStream()
- {
- if (mRPCPacketizer != null)
- {
- mRPCPacketizer.resume();
- }
- }
-
- public void stopRPCStream()
- {
- if (mRPCPacketizer != null)
- {
- mRPCPacketizer.stop();
- }
- }
public boolean stopAudioStream()
{
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCStreamController.java b/base/src/main/java/com/smartdevicelink/proxy/RPCStreamController.java
deleted file mode 100644
index 0e2af0bc6..000000000
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCStreamController.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.smartdevicelink.proxy;
-
-import com.smartdevicelink.streaming.StreamRPCPacketizer;
-
-public class RPCStreamController {
- private StreamRPCPacketizer rpcPacketizer;
- private Integer iCorrelationID;
-
- public RPCStreamController(StreamRPCPacketizer rpcPacketizer, Integer iCorrelationID)
- {
- this.rpcPacketizer = rpcPacketizer;
- this.iCorrelationID = iCorrelationID;
- }
-
- public Integer getCorrelationID()
- {
- return iCorrelationID;
- }
-
- public void pause()
- {
- rpcPacketizer.pause();
- }
- public void resume()
- {
- rpcPacketizer.resume();
- }
- public void stop()
- {
- rpcPacketizer.onPutFileStreamError(null, "Stop Putfile Stream Requested");
- }
-}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java b/base/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
deleted file mode 100644
index 1e3821ff8..000000000
--- a/base/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
+++ /dev/null
@@ -1,308 +0,0 @@
-package com.smartdevicelink.streaming;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Hashtable;
-
-import com.smartdevicelink.SdlConnection.SdlSession;
-
-import com.smartdevicelink.marshal.JsonRPCMarshaller;
-import com.smartdevicelink.protocol.ProtocolMessage;
-import com.smartdevicelink.protocol.enums.FunctionID;
-import com.smartdevicelink.protocol.enums.MessageType;
-import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.interfaces.IProxyListenerBase;
-import com.smartdevicelink.proxy.interfaces.IPutFileResponseListener;
-import com.smartdevicelink.proxy.rpc.OnStreamRPC;
-import com.smartdevicelink.proxy.rpc.PutFile;
-import com.smartdevicelink.proxy.rpc.PutFileResponse;
-import com.smartdevicelink.proxy.rpc.StreamRPCResponse;
-import com.smartdevicelink.proxy.rpc.enums.Result;
-import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
-import com.smartdevicelink.util.Version;
-
-public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileResponseListener, Runnable{
-
- private Integer iInitialCorrID = 0;
- private Hashtable<Integer, OnStreamRPC> notificationList = new Hashtable<Integer, OnStreamRPC>();
- private Thread thread = null;
- private long lFileSize = 0;
- private String sFileName;
- private Object proxy; //FIXME SdlProxyBase<IProxyListenerBase> _proxy;
- private IProxyListenerBase _proxyListener;
-
- private Object mPauseLock;
- private boolean mPaused;
- private boolean isRPCProtected = false;
- private OnPutFileUpdateListener callBack;
-
- private Version rpcSpecVersion;
-
- //public StreamRPCPacketizer(SdlProxyBase<IProxyListenerBase> proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion, long lLength, SdlSession session) throws IOException {
- public StreamRPCPacketizer(Object proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion, long lLength, SdlSession session) throws IOException {
- super(streamListener, is, request, sType, rpcSessionID, wiproVersion, session);
- lFileSize = lLength;
- iInitialCorrID = request.getCorrelationID();
- mPauseLock = new Object();
- mPaused = false;
- isRPCProtected = request.isPayloadProtected();
- /* FIXME if (proxy != null)
- {
- _proxy = proxy;
- _proxyListener = _proxy.getProxyListener();
- _proxy.addPutFileResponseListener(this);
- }*/
- if(_request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.toString())){
- callBack = ((PutFile)_request).getOnPutFileUpdateListener();
- }
- }
-
- //public StreamRPCPacketizer(SdlProxyBase<IProxyListenerBase> proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, Version wiproVersion, Version rpcSpecVersion, long lLength, SdlSession session) throws IOException {
- public StreamRPCPacketizer(Object proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, Version wiproVersion, Version rpcSpecVersion, long lLength, SdlSession session) throws IOException {
- super(streamListener, is, request, sType, rpcSessionID, wiproVersion, session);
- this.rpcSpecVersion = rpcSpecVersion;
- lFileSize = lLength;
- iInitialCorrID = request.getCorrelationID();
- mPauseLock = new Object();
- mPaused = false;
- isRPCProtected = request.isPayloadProtected();
- /* FIXME if (proxy != null) {
- _proxy = proxy;
- _proxyListener = _proxy.getProxyListener();
- _proxy.addPutFileResponseListener(this);
- }*/
- if(_request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.toString())){
- callBack = ((PutFile)_request).getOnPutFileUpdateListener();
- }
- }
-
- @Override
- public void start() throws IOException {
- if (thread == null) {
- thread = new Thread(this);
- thread.start();
- }
- }
-
- @Override
- public void stop() {
- try {
- is.close();
- } catch (IOException ignore) {}
- if (thread != null)
- {
- thread.interrupt();
- thread = null;
- }
- }
-
- private void handleStreamSuccess(RPCResponse rpc, Long iSize)
- {
- StreamRPCResponse result = new StreamRPCResponse();
- result.setSuccess(rpc.getSuccess());
- result.setResultCode(rpc.getResultCode());
- result.setInfo(rpc.getInfo());
- result.setFileName(sFileName);
- result.setFileSize(iSize);
- result.setCorrelationID(iInitialCorrID);
- if (_proxyListener != null)
- _proxyListener.onStreamRPCResponse(result);
- stop();
- //FIXME _proxy.remPutFileResponseListener(this);
- return;
- }
-
- private void handleStreamException(RPCResponse rpc, Exception e, String error)
- {
- StreamRPCResponse result = new StreamRPCResponse();
- result.setFileName(sFileName);
- result.setCorrelationID(iInitialCorrID);
- if (rpc != null)
- {
- result.setSuccess(rpc.getSuccess());
- result.setResultCode(rpc.getResultCode());
- result.setInfo(rpc.getInfo());
- }
- else
- {
- result.setSuccess(false);
- result.setResultCode(Result.GENERIC_ERROR);
- String sException = "";
-
- if (e != null)
- sException = sException + " " + e.toString();
-
- sException = sException + " " + error;
- result.setInfo(sException);
- }
- if (_proxyListener != null)
- _proxyListener.onStreamRPCResponse(result);
- if (e != null)
- e.printStackTrace();
- stop();
- //FIXME _proxy.remPutFileResponseListener(this);
- return;
- }
-
- @Override
- public void pause() {
- synchronized (mPauseLock) {
- mPaused = true;
- }
- }
-
- @Override
- public void resume() {
- synchronized (mPauseLock) {
- mPaused = false;
- mPauseLock.notifyAll();
- }
- }
-
- public void run() {
- int length;
- byte[] msgBytes;
- ProtocolMessage pm;
- OnStreamRPC notification;
-
- // Moves the current Thread into the background
- //FIXME android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
-
- try {
-
- int iCorrID = 0;
- PutFile msg = (PutFile) _request;
- sFileName = msg.getSdlFileName();
- long iOffsetCounter = msg.getOffset();
-
- int priorityCoefficient = 1;
-
- if (lFileSize != 0)
- {
- Long iFileSize = (long) lFileSize;
- //TODO: PutFile RPC needs to be updated to accept Long as we might run into overflows since a Long can store a wider range than an Integer
- msg.setLength(iFileSize);
- }
- Long iFileLength = msg.getLength();
-
- notificationList.clear();
-
- //start reading from the stream at the given offset
- long iSkipBytes = is.skip(iOffsetCounter);
-
- if (iOffsetCounter != iSkipBytes)
- {
- handleStreamException(null,null," Error, PutFile offset invalid for file: " + sFileName);
- }
- if(callBack!=null){
- callBack.onStart(_request.getCorrelationID(), lFileSize);
- }
- while (!Thread.interrupted()) {
-
- synchronized (mPauseLock)
- {
- while (mPaused)
- {
- try
- {
- mPauseLock.wait();
- }
- catch (InterruptedException e) {}
- }
- }
-
- length = is.read(buffer, 0, bufferSize);
-
- if (length == -1)
- stop();
-
- if (length >= 0) {
-
- if (msg.getOffset() != 0)
- msg.setLength((Long)null); //only need to send length when offset 0
-
- msg.format(rpcSpecVersion,true);
- msgBytes = JsonRPCMarshaller.marshall(msg, (byte)_wiproVersion.getMajor());
- pm = new ProtocolMessage();
- pm.setData(msgBytes);
-
- pm.setSessionID(_rpcSessionID);
- pm.setMessageType(MessageType.RPC);
- pm.setSessionType(_serviceType);
- pm.setFunctionID(FunctionID.getFunctionId(msg.getFunctionName()));
-
- if (buffer.length != length)
- pm.setBulkData(buffer, length);
- else
- pm.setBulkDataNoCopy(buffer);
-
- pm.setCorrID(msg.getCorrelationID());
- pm.setPayloadProtected(isRPCProtected);
- priorityCoefficient++;
- pm.setPriorityCoefficient(priorityCoefficient);
-
- notification = new OnStreamRPC();
- notification.setFileName(msg.getSdlFileName());
- notification.setFileSize(iFileLength);
- iOffsetCounter = iOffsetCounter + length;
- notification.setBytesComplete(iOffsetCounter);
- notificationList.put(msg.getCorrelationID(),notification);
-
- msg.setOffset(iOffsetCounter);
- iCorrID = msg.getCorrelationID() + 1;
- msg.setCorrelationID(iCorrID);
-
- _streamListener.sendStreamPacket(pm);
- }
- }
- } catch (Exception e) {
- handleStreamException(null, e, "");
- }
- }
-
- @Override
- public void onPutFileResponse(PutFileResponse response)
- {
-
- OnStreamRPC streamNote = notificationList.get(response.getCorrelationID());
- if (streamNote == null) return;
-
- if (response.getSuccess())
- {
- if(callBack!=null){
- callBack.onUpdate(response.getCorrelationID(), streamNote.getBytesComplete(), lFileSize);
- }
- if (_proxyListener != null){
- _proxyListener.onOnStreamRPC(streamNote);
- }
-
- }
- else
- {
- if(callBack!=null){
- callBack.onError(response.getCorrelationID(), response.getResultCode(), response.getInfo());
- }
- handleStreamException(response, null, "");
-
- }
-
- if (response.getSuccess() && streamNote.getBytesComplete().equals(streamNote.getFileSize()) )
- {
- if(callBack!=null){
- callBack.onResponse(iInitialCorrID, response, streamNote.getBytesComplete());
- }
- handleStreamSuccess(response, streamNote.getBytesComplete());
-
- }
- }
-
- @Override
- public void onPutFileStreamError(Exception e, String info)
- {
- if (thread != null)
- handleStreamException(null, e, info);
-
- }
-}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
index c9da05578..83b988cc5 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -12,7 +12,6 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.proxy.RPCStreamController;
import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
import com.smartdevicelink.proxy.callbacks.OnServiceNACKed;
@@ -397,174 +396,6 @@ public class SdlManager extends BaseSdlManager{
return null;
}
- /* *******************************************************************************************************
- ************************************* FileStream Methods - START ****************************************
- *********************************************************************************************************/
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param inputStream The input stream of byte data that will be read from.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- */
- public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length) {
- if (proxy != null){
- proxy.putFileStream(inputStream, fileName, offset, length);
- }
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param inputStream The input stream of byte data that will be read from.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- */
- public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) {
- if (proxy != null){
- proxy.putFileStream(inputStream, fileName, offset, length, fileType, isPersistentFile, isSystemFile, cb);
- }
- }
-
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- */
- public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length) {
- if (proxy != null){
- return proxy.putFileStream(fileName, offset, length);
- }
- return null;
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- */
- public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) {
- if (proxy != null){
- return proxy.putFileStream(fileName, offset, length, fileType, isPersistentFile, isSystemFile, cb);
- }
- return null;
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param path The physical file path on the mobile device.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- * @param correlationId A unique id that correlates each RPCRequest and
- * RPCResponse.
- * @return RPCStreamController If the putFileStream was not started
- * successfully null is returned, otherwise a valid object reference is
- * returned .
- */
- public RPCStreamController putFileStream(String path, @NonNull String fileName, Long offset, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId, OnPutFileUpdateListener cb) {
- if (proxy != null){
- return proxy.putFileStream(path, fileName, offset, fileType, isPersistentFile, isSystemFile, isPayloadProtected, correlationId, cb);
- }
- return null;
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param inputStream The input stream of byte data that will be read from.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- * @param correlationId A unique id that correlates each RPCRequest and
- * RPCResponse.
- */
- public RPCStreamController putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId) {
- if (proxy != null){
- return proxy.putFileStream(inputStream, fileName, offset, length, fileType, isPersistentFile, isSystemFile, isPayloadProtected, correlationId);
- }
- return null;
-
- }
-
- /**
- * Used to end an existing putFileStream that was previously initiated with any putFileStream method.
- */
- public void endPutFileStream() {
- if (proxy != null){
- proxy.endPutFileStream();
- }
- }
-
- public void endRPCStream() {
- if (proxy != null){
- proxy.endRPCStream();
- }
- }
-
- public boolean startRPCStream(InputStream is, RPCRequest msg) {
- if (proxy != null){
- return proxy.startRPCStream(is, msg);
- }
- return false;
- }
-
- public OutputStream startRPCStream(RPCRequest msg) {
- if (proxy != null){
- return proxy.startRPCStream(msg);
- }
- return null;
- }
-
- /* *******************************************************************************************************
- ************************************** FileStream Methods - END *****************************************
- *********************************************************************************************************/
-
-
// PROTECTED GETTERS
protected String getAppName() { return appName; }
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
index 908f7b123..29b2672c3 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -17,7 +17,6 @@ import com.smartdevicelink.proxy.rpc.*;
import com.smartdevicelink.proxy.rpc.enums.*;
import com.smartdevicelink.proxy.rpc.listeners.*;
import com.smartdevicelink.security.SdlSecurityBase;
-import com.smartdevicelink.streaming.StreamRPCPacketizer;
import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
import com.smartdevicelink.streaming.audio.AudioStreamingParams;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
@@ -946,242 +945,4 @@ public class LifecycleManager extends BaseLifecycleManager {
}
}
}
-
-
- /* *******************************************************************************************************
- ************************************* FileStream Methods - START ****************************************
- *********************************************************************************************************/
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param inputStream The input stream of byte data that will be read from.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- */
- public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length) {
- PutFile msg = new PutFile(fileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(offset);
- msg.setLength(length);
-
- startRPCStream(inputStream, msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param inputStream The input stream of byte data that will be read from.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- */
- public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) {
- PutFile msg = new PutFile(fileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(offset);
- msg.setLength(length);
- msg.setOnPutFileUpdateListener(cb);
- startRPCStream(inputStream, msg);
- }
-
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- */
- public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length) {
- PutFile msg = new PutFile(fileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(offset);
- msg.setLength(length);
-
- return startRPCStream(msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- */
- public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) {
- PutFile msg = new PutFile(fileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(offset);
- msg.setLength(length);
- msg.setOnPutFileUpdateListener(cb);
-
- return startRPCStream(msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param path The physical file path on the mobile device.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- * @param correlationId A unique id that correlates each RPCRequest and
- * RPCResponse.
- * @return RPCStreamController If the putFileStream was not started
- * successfully null is returned, otherwise a valid object reference is
- * returned .
- */
- public RPCStreamController putFileStream(String path, @NonNull String fileName, Long offset, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId, OnPutFileUpdateListener cb) {
- PutFile msg = new PutFile(fileName, fileType);
- msg.setCorrelationID(correlationId);
- msg.setPersistentFile(isPersistentFile);
- msg.setSystemFile(isSystemFile);
- msg.setOffset(offset);
- msg.setLength(0L);
- msg.setPayloadProtected(isPayloadProtected);
- msg.setOnPutFileUpdateListener(cb);
-
- if (session == null) return null;
-
- FileInputStream is = null;
- try {
- is = new FileInputStream(path);
- } catch (IOException e1) {
- e1.printStackTrace();
- }
-
-
- if (is == null) return null;
-
- Long lSize = null;
-
- try {
- lSize = is.getChannel().size();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- if (lSize == null) {
- try {
- is.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- try {
- StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer(this, session, is, msg, SessionType.RPC, session.getSessionId(), getProtocolVersion(), rpcSpecVersion, lSize, session);
- rpcPacketizer.start();
- return new RPCStreamController(rpcPacketizer, msg.getCorrelationID());
- } catch (Exception e) {
- Log.e("SyncConnection", "Unable to start streaming:" + e.toString());
- return null;
- }
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- *
- * @param inputStream The input stream of byte data that will be read from.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- * @param correlationId A unique id that correlates each RPCRequest and
- * RPCResponse.
- */
- public RPCStreamController putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId) {
- PutFile msg = new PutFile(fileName, fileType);
- msg.setCorrelationID(correlationId);
- msg.setPersistentFile(isPersistentFile);
- msg.setSystemFile(isSystemFile);
- msg.setOffset(offset);
- msg.setLength(length);
- msg.setPayloadProtected(isPayloadProtected);
-
- if (session == null) return null;
- Long lSize = msg.getLength();
-
- if (lSize == null) {
- return null;
- }
-
- try {
- StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer(this, session, inputStream, msg, SessionType.RPC, session.getSessionId(), getProtocolVersion(), rpcSpecVersion, lSize, session);
- rpcPacketizer.start();
- return new RPCStreamController(rpcPacketizer, msg.getCorrelationID());
- } catch (Exception e) {
- Log.e("SyncConnection", "Unable to start streaming:" + e.toString());
- return null;
- }
- }
-
- /**
- * Used to end an existing putFileStream that was previously initiated with any putFileStream method.
- */
- public void endPutFileStream() {
- endRPCStream();
- }
-
- public void endRPCStream() {
- if (this.session == null) return;
- session.stopRPCStream();
- }
-
- public boolean startRPCStream(InputStream is, RPCRequest msg) {
- if (session == null) return false;
- session.startRPCStream(is, msg, SessionType.RPC, session.getSessionId(), (byte) getProtocolVersion().getMajor());
- return true;
- }
-
- public OutputStream startRPCStream(RPCRequest msg) {
- if (session == null) return null;
- return session.startRPCStream(msg, SessionType.RPC, session.getSessionId(), (byte) getProtocolVersion().getMajor());
- }
-
- /* *******************************************************************************************************
- ************************************** FileStream Methods - END *****************************************
- *********************************************************************************************************/
-
}