summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyihong Chae <hh.chae@samsung.com>2017-07-26 11:56:53 (GMT)
committerHyihong Chae <hh.chae@samsung.com>2017-07-26 11:56:53 (GMT)
commit3411f317154d33c6c47a622f9a4810e59a680a4f (patch)
treedd161656fd54c6865823769c5fb20a6cd9c9ccf2
parent3d094766897575c3fdcdb65d998386322867d0be (diff)
downloadmtp-tizen.zip
mtp-tizen.tar.gz
mtp-tizen.tar.bz2
Change-Id: I4cf4d600dde81ea1685877a847dfebe29b9eb53e Signed-off-by: HyiHong Chae <hh.chae@samsung.com>
-rw-r--r--Tizen.Network.Mtp/Tizen.Network.Mtp.csproj2
-rw-r--r--Tizen.Network.Mtp/Tizen.Network.Mtp/MtpObject.cs4
-rw-r--r--Tizen.Network.Mtp/Tizen.Network.Mtp/MtpStorage.cs27
3 files changed, 27 insertions, 6 deletions
diff --git a/Tizen.Network.Mtp/Tizen.Network.Mtp.csproj b/Tizen.Network.Mtp/Tizen.Network.Mtp.csproj
index fcdb344..87ada72 100644
--- a/Tizen.Network.Mtp/Tizen.Network.Mtp.csproj
+++ b/Tizen.Network.Mtp/Tizen.Network.Mtp.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <Version>1.0.2</Version>
+ <Version>1.0.3</Version>
<Authors>Samsung Electronics</Authors>
<Copyright>© Samsung Electronics Co., Ltd All Rights Reserved</Copyright>
<Description>Provides the Mtp API for Tizen .NET</Description>
diff --git a/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpObject.cs b/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpObject.cs
index 8bb9f33..6607e13 100644
--- a/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpObject.cs
+++ b/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpObject.cs
@@ -385,5 +385,9 @@ namespace Tizen.Network.Mtp
disposed = true;
}
+ internal int GetHandle()
+ {
+ return _objectHandle;
+ }
}
}
diff --git a/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpStorage.cs b/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpStorage.cs
index 1c0bd27..1e44f1f 100644
--- a/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpStorage.cs
+++ b/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpStorage.cs
@@ -31,7 +31,7 @@ namespace Tizen.Network.Mtp
private bool disposed = false;
private List<int> _objectHandleList = new List<int>();
private List<MtpObject> _objectList = new List<MtpObject>();
- //private int _objectHandle = 0;
+ private MtpObject _rootObject;
/// <summary>
/// Gets the description of the storage information.
@@ -172,11 +172,28 @@ namespace Tizen.Network.Mtp
}
/// <summary>
- /// Gets the list of storages.
+ /// Gets the root folder object.
+ /// </summary>
+ /// <returns>List of storage objects.</returns>
+ /// <feature>http://tizen.org/feature/network.mtp</feature>
+ /// <remarks>
+ /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.
+ /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ /// </remarks>
+ /// <since_tizen> 5 </since_tizen>
+ public MtpObject GetRootObject()
+ {
+ _rootObject = new MtpObject(_deviceHandle, 0);
+
+ return _rootObject;
+ }
+
+ /// <summary>
+ /// Gets the list of objects.
/// </summary>
/// <param name="parentHandle">The parent object handle. If parentHandle is 0, it means "root folder" of mtp storage.</param>
/// <param name="fileType">The file type what you want.</param>
- /// <returns>List of storage objects.</returns>
+ /// <returns>List of objects.</returns>
/// <feature>http://tizen.org/feature/network.mtp</feature>
/// <remarks>
/// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.
@@ -186,12 +203,12 @@ namespace Tizen.Network.Mtp
/// <exception cref="ArgumentException">Thrown when method is failed due to an invalid parameter.</exception>
/// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
/// <since_tizen> 5 </since_tizen>
- public IEnumerable<MtpObject> GetObjectHandles(int parentHandle, MtpFileType fileType)
+ public IEnumerable<MtpObject> GetObjectList(MtpObject parentObject, MtpFileType fileType)
{
IntPtr objectPtr;
int count = 0;
- int ret = Interop.Mtp.GetObjectHandles(_deviceHandle, _storageHandle, parentHandle, (int)fileType, out objectPtr, out count);
+ int ret = Interop.Mtp.GetObjectHandles(_deviceHandle, _storageHandle, parentObject.GetHandle(), (int)fileType, out objectPtr, out count);
if (ret != (int)MtpError.None)
{
Log.Error(Globals.LogTag, "Failed to get object handle lists, Error - " + (MtpError)ret);