2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.Threading.Tasks;
21 namespace Tizen.Network.Mtp
24 /// A class for MTP management. It allows applications to use MTP service.
27 /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.
28 /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
30 /// <since_tizen> 5 </since_tizen>
31 static public class MtpManager
34 /// Gets the list of MTP devices.
36 /// <returns>List of MtpDevice objects.</returns>
37 /// <feature>http://tizen.org/feature/network.mtp</feature>
38 /// <exception cref="NotSupportedException">Thrown when Mtp is not supported.</exception>
39 /// <exception cref="InvalidOperationException">Thrown when the method failed due to invalid operation.</exception>
40 /// <since_tizen> 5 </since_tizen>
41 static public IEnumerable<MtpDevice> GetDevices()
45 return MtpManagerImpl.Instance.GetDevices();
47 catch (TypeInitializationException e)
49 throw e.InnerException;
54 /// MtpStateChanged is raised when the Mtp device state is changed.
56 /// <since_tizen> 5 </since_tizen>
57 static public event EventHandler<MtpStateChangedEventArgs> MtpStateChanged
63 MtpManagerImpl.Instance.MtpStateChanged += value;
65 catch (TypeInitializationException e)
67 throw e.InnerException;
74 MtpManagerImpl.Instance.MtpStateChanged -= value;
76 catch (TypeInitializationException e)
78 throw e.InnerException;