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;
21 using System.Threading.Tasks;
22 using System.Collections;
24 namespace Tizen.Network.Connection
27 /// This class is ConnectionProfileManager
29 public class ConnectionProfileManager
32 /// Adds a new profile
34 /// <privilege>http://tizen.org/privilege/network.profile</privilege>
35 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
36 static public int AddProfile(RequestProfile profile)
38 return ConnectionInternalManager.AddProfile(profile);
42 /// Gets the list of profile with profile list type
44 /// <privilege>http://tizen.org/privilege/network.get</privilege>
45 static public Task<IEnumerable<ConnectionProfile>> GetProfileListAsync(ProfileListType type)
47 return ConnectionInternalManager.GetProfileListAsync(type);
51 /// Opens a connection of profile, asynchronously.
53 /// <privilege>http://tizen.org/privilege/network.get</privilege>
54 /// <privilege>http://tizen.org/privilege/network.set</privilege>
55 static public Task<ConnectionError> ConnectProfileAsync(ConnectionProfile profile)
57 return ConnectionInternalManager.OpenProfileAsync(profile);
61 /// Closes a connection of profile.
63 /// <privilege>http://tizen.org/privilege/network.set</privilege>
64 static public Task<ConnectionError> DisconnectProfileAsync(ConnectionProfile profile)
66 return ConnectionInternalManager.CloseProfileAsync(profile);
70 /// Removes an existing profile.
72 /// <privilege>http://tizen.org/privilege/network.get</privilege>
73 /// <privilege>http://tizen.org/privilege/network.profile</privilege>
74 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
75 static public int RemoveProfile(ConnectionProfile profile)
77 Log.Debug(Globals.LogTag, "RemoveProfile. Id: " + profile.Id + ", Name: " + profile.Name + ", Type: " + profile.Type);
78 return ConnectionInternalManager.RemoveProfile(profile);
82 /// Updates an existing profile.
83 /// When a profile is changed, these changes will be not applied to the ConnectionProfileManager immediately.
84 /// When you call this function, your changes affect the ConnectionProfileManager and the existing profile is updated.
86 /// <privilege>http://tizen.org/privilege/network.get</privilege>
87 /// <privilege>http://tizen.org/privilege/network.profile</privilege>
88 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
89 static public int UpdateProfile(ConnectionProfile profile)
91 return ConnectionInternalManager.UpdateProfile(profile);
95 /// Gets the name of the default profile.
97 /// <privilege>http://tizen.org/privilege/network.get</privilege>
98 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
99 static public ConnectionProfile GetCurrentProfile()
101 return ConnectionInternalManager.GetCurrentProfile();
105 /// Gets the default profile which provides the given cellular service.
107 /// <privilege>http://tizen.org/privilege/network.get</privilege>
108 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
109 static public ConnectionProfile GetDefaultCellularProfile(CellularServiceType type)
111 return ConnectionInternalManager.GetDefaultCellularProfile(type);
115 /// Sets the default profile which provides the given cellular service.
117 /// <privilege>http://tizen.org/privilege/network.get</privilege>
118 /// <privilege>http://tizen.org/privilege/network.profile</privilege>
119 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
120 static public Task<ConnectionError> SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile)
122 return ConnectionInternalManager.SetDefaultCellularProfile(type, profile);
127 /// An extended EventArgs class which contains the state of changed connection profile.
129 public class ConnectionProfileStateEventArgs : EventArgs
131 private ConnectionProfileState State;
133 internal ConnectionProfileStateEventArgs(ConnectionProfileState state)
139 /// The connection profile state.
141 public ConnectionProfileState ConnectionProfileState