Skip to content

Commit eccc2c9

Browse files
author
Mike Burke
committed
Merge branch 'refs/heads/anildahiya/AddedPutFileStreamParam' into sdl_android_parent/develop
2 parents e90e44e + 1ecee2c commit eccc2c9

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,18 @@ public static PutFile buildPutFile(String sdlFileName, Integer iOffset, Integer
514514
putFile.setLength(iLength);
515515
return putFile;
516516
}
517-
517+
518+
public static PutFile buildPutFile(String syncFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) {
519+
PutFile putFile = new PutFile();
520+
putFile.setCorrelationID(10000);
521+
putFile.setSdlFileName(syncFileName);
522+
putFile.setFileType(fileType);
523+
putFile.setPersistentFile(bPersistentFile);
524+
putFile.setSystemFile(bSystemFile);
525+
putFile.setOffset(iOffset);
526+
putFile.setLength(iLength);
527+
return putFile;
528+
}
518529

519530
public static RegisterAppInterface buildRegisterAppInterface(String appName, String appID) {
520531
return buildRegisterAppInterface(appName, false, appID);

sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import android.telephony.TelephonyManager;
3232
import android.util.Log;
3333

34+
import com.smartdevicelink.proxy.RPCRequestFactory;
35+
import com.smartdevicelink.proxy.rpc.PutFile;
3436
import com.smartdevicelink.Dispatcher.IDispatchingStrategy;
3537
import com.smartdevicelink.Dispatcher.IncomingProtocolMessageComparitor;
3638
import com.smartdevicelink.Dispatcher.InternalProxyMessageComparitor;
@@ -4142,7 +4144,47 @@ public OutputStream PutFileStream(String sdlFileName, Integer iOffset, Integer i
41424144
PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength);
41434145
return startRPCStream(msg);
41444146
}
4147+
4148+
/**
4149+
* Used to push a binary stream of file data onto the module from a mobile device.
4150+
* Responses are captured through callback on IProxyListener.
4151+
*
4152+
* @param is - The input stream of byte data that PutFileStream will read from
4153+
* @param syncFileName - The file reference name used by the putFile RPC.
4154+
* @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of the file.
4155+
* A value greater than zero is used for resuming partial data chunks.
4156+
* @param iLength - The total length of the file being sent.
4157+
* @param fileType - The selected file type -- see the FileType enumeration for details
4158+
* @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
4159+
* @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
4160+
* @throws SyncException
4161+
*/
4162+
public void PutFileStream(InputStream is, String syncFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
4163+
{
4164+
PutFile msg = RPCRequestFactory.buildPutFile(syncFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile);
4165+
startRPCStream(is, msg);
4166+
}
41454167

4168+
/**
4169+
* Used to push a binary stream of file data onto the module from a mobile device.
4170+
* Responses are captured through callback on IProxyListener.
4171+
*
4172+
* @param syncFileName - The file reference name used by the putFile RPC.
4173+
* @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of a file.
4174+
* A value greater than zero is used for resuming partial data chunks.
4175+
* @param iLength - The total length of the file being sent.
4176+
* @param fileType - The selected file type -- see the FileType enumeration for details
4177+
* @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
4178+
* @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
4179+
* @return OutputStream - The output stream of byte data that is written to by the app developer
4180+
* @throws SyncException
4181+
*/
4182+
public OutputStream PutFileStream(String syncFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
4183+
{
4184+
PutFile msg = RPCRequestFactory.buildPutFile(syncFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile);
4185+
return startRPCStream(msg);
4186+
}
4187+
41464188
/**
41474189
*
41484190
* Used to end an existing PutFileStream that was previously initiated with any PutFileStream method.

0 commit comments

Comments
 (0)