Static class ConnectionManager cannot be created multiple time.
It causes a problem in multi-thread environment.
Handle created in one thread cannot be used in other threads due to characteristics of handle-based native connection capi.
Therefore ConnectionManager is modified to map one ConnectionManager
instance to one native capi handle.
Change-Id: If1e80df24400bc6477717f33eaadb05a198c3322
Signed-off-by: cheoleun <chleun.moon@samsung.com>
Name: csapi-network-connection
Summary: Tizen Connection API for C#
-Version: 1.0.4
+Version: 1.0.5
Release: 1
Group: Development/Libraries
License: Apache-2.0
if (disposing)
{
// Free managed objects.
+ Interop.Connection.Destroy(Handle);
}
- Interop.Connection.Destroy(Handle);
disposed = true;
}
}
- static class ConnectionInternalManager
+ internal class ConnectionInternalManager
{
- private static HandleHolder Holder = new HandleHolder();
+ private HandleHolder Holder = null;
+ private bool disposed = false;
+
+ internal ConnectionInternalManager()
+ {
+ Holder = new HandleHolder();
+ }
+
+ ~ConnectionInternalManager()
+ {
+ Dispose(false);
+ }
- static public IntPtr GetHandle()
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ Holder.Dispose();
+ }
+ disposed = true;
+ }
+
+ public IntPtr GetHandle()
{
return Holder.GetHandle();
}
- static internal int GetProfileIterator(ProfileListType type, out IntPtr iterator)
+ internal int GetProfileIterator(ProfileListType type, out IntPtr iterator)
{
return Interop.Connection.GetProfileIterator(Holder.GetHandle(), (int)type, out iterator);
}
- static internal bool HasNext(IntPtr iterator)
+ internal bool HasNext(IntPtr iterator)
{
return Interop.Connection.HasNextProfileIterator(iterator);
}
- static internal int NextProfileIterator(IntPtr iterator, out IntPtr profileHandle)
+ internal int NextProfileIterator(IntPtr iterator, out IntPtr profileHandle)
{
return Interop.Connection.GetNextProfileIterator(iterator, out profileHandle);
}
- static internal int DestoryProfileIterator(IntPtr iterator)
+ internal int DestoryProfileIterator(IntPtr iterator)
{
return Interop.Connection.DestroyProfileIterator(iterator);
}
- static public string GetIpAddress(AddressFamily family)
+ public string GetIpAddress(AddressFamily family)
{
IntPtr ip;
int ret = Interop.Connection.GetIpAddress(Holder.GetHandle(), (int)family, out ip);
return result;
}
- static public string GetProxy(AddressFamily family)
+ public string GetProxy(AddressFamily family)
{
IntPtr ip;
int ret = Interop.Connection.GetProxy(Holder.GetHandle(), (int)family, out ip);
return result;
}
- static public string GetMacAddress(ConnectionType type)
+ public string GetMacAddress(ConnectionType type)
{
IntPtr ip;
int ret = Interop.Connection.GetMacAddress(Holder.GetHandle(), (int)type, out ip);
return result;
}
- static public ConnectionType ConnectionType
+ public ConnectionType ConnectionType
{
get
{
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to get connection type, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
return (ConnectionType)type;
}
}
- static public CellularState CellularState
+ public CellularState CellularState
{
get
{
int type = 0;
+ Log.Debug(Globals.LogTag, "CellularState Handle: " + Holder.GetHandle());
int ret = Interop.Connection.GetCellularState(Holder.GetHandle(), out type);
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to get cellular state, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
return (CellularState)type;
}
}
- static public ConnectionState WiFiState
+ public ConnectionState WiFiState
{
get
{
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to get wifi state, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
return (ConnectionState)type;
}
}
- static public ConnectionState BluetoothState
+ public ConnectionState BluetoothState
{
get
{
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to get bluetooth state, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
return (ConnectionState)type;
}
}
- static public ConnectionState EthernetState
+ public ConnectionState EthernetState
{
get
{
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to get ethernet state, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
return (ConnectionState)type;
}
}
- static public EthernetCableState EthernetCableState
+ public EthernetCableState EthernetCableState
{
get
{
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to get ethernet cable state, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
return (EthernetCableState)type;
}
static public IntPtr CreateRequestProfile(ConnectionProfileType type, string keyword)
{
Log.Error(Globals.LogTag, "CreateRequestProfile, " + type + ", " + keyword);
- Log.Debug(Globals.LogTag, "Handle: " + GetHandle());
IntPtr handle = IntPtr.Zero;
int ret = Interop.ConnectionProfile.Create((int)type, keyword, out handle);
if ((ConnectionError)ret != ConnectionError.None)
return handle;
}
- static public int AddProfile(RequestProfile profile)
+ public int AddProfile(RequestProfile profile)
{
int ret = 0;
if (profile.Type == ConnectionProfileType.Cellular)
return ret;
}
- static public int RemoveProfile(ConnectionProfile profile)
+ public int RemoveProfile(ConnectionProfile profile)
{
int ret = Interop.Connection.RemoveProfile(Holder.GetHandle(), profile.ProfileHandle);
if ((ConnectionError)ret != ConnectionError.None)
return ret;
}
- static public int UpdateProfile(ConnectionProfile profile)
+ public int UpdateProfile(ConnectionProfile profile)
{
int ret = Interop.Connection.UpdateProfile(Holder.GetHandle(), profile.ProfileHandle);
if ((ConnectionError)ret != ConnectionError.None)
return ret;
}
- static public ConnectionProfile GetCurrentProfile()
+ public ConnectionProfile GetCurrentProfile()
{
IntPtr ProfileHandle;
int ret = Interop.Connection.GetCurrentProfile(Holder.GetHandle(), out ProfileHandle);
return Profile;
}
- static public ConnectionProfile GetDefaultCellularProfile(CellularServiceType type)
+ public ConnectionProfile GetDefaultCellularProfile(CellularServiceType type)
{
IntPtr ProfileHandle;
int ret = Interop.Connection.GetDefaultCellularServiceProfile(Holder.GetHandle(), (int)type, out ProfileHandle);
return Profile;
}
- static public Task<ConnectionError> SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile)
+ public Task<ConnectionError> SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile)
{
var task = new TaskCompletionSource<ConnectionError>();
Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
}
- static public Task<IEnumerable<ConnectionProfile>> GetProfileListAsync(ProfileListType type)
+ public Task<IEnumerable<ConnectionProfile>> GetProfileListAsync(ProfileListType type)
{
var task = new TaskCompletionSource<IEnumerable<ConnectionProfile>>();
return task.Task;
}
- static public Task<ConnectionError> OpenProfileAsync(ConnectionProfile profile)
+ public Task<ConnectionError> OpenProfileAsync(ConnectionProfile profile)
{
var task = new TaskCompletionSource<ConnectionError>();
Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
return task.Task;
}
- static public Task<ConnectionError> CloseProfileAsync(ConnectionProfile profile)
+ public Task<ConnectionError> CloseProfileAsync(ConnectionProfile profile)
{
var task = new TaskCompletionSource<ConnectionError>();
Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
/// <summary>
/// This class is ConnectionManager
/// </summary>
- public class ConnectionManager : IDisposable
+ public partial class ConnectionManager : IDisposable
{
- static internal ConnectionItem CurConnction = new ConnectionItem();
+ private ConnectionInternalManager _internalManager = null;
+ private ConnectionItem _currentConnection = null;
private bool disposed = false;
- static private EventHandler _ConnectionTypeChanged = null;
- static private EventHandler _IPAddressChanged = null;
- static private EventHandler _EthernetCableStateChanged = null;
- static private EventHandler _ProxyAddressChanged = null;
+ private EventHandler _ConnectionTypeChanged = null;
+ private EventHandler _IPAddressChanged = null;
+ private EventHandler _EthernetCableStateChanged = null;
+ private EventHandler _ProxyAddressChanged = null;
+
+ public ConnectionManager()
+ {
+ _internalManager = new ConnectionInternalManager();
+ _currentConnection = new ConnectionItem(_internalManager);
+ }
+
+ ~ConnectionManager()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ return;
+
+ if (disposing)
+ {
+ // Free managed objects.
+ _internalManager.Dispose();
+ }
+ disposed = true;
+ }
/// <summary>
/// Event that is called when the type of the current connection is changed.
/// </summary>
- static public event EventHandler ConnectionTypeChanged
+ public event EventHandler ConnectionTypeChanged
{
add
{
}
}
- static private void ConnectionTypeChangedStart()
+ private void ConnectionTypeChangedStart()
{
- int ret = Interop.Connection.SetTypeChangedCallback(ConnectionInternalManager.GetHandle(), TypeChangedCallback, IntPtr.Zero);
+ int ret = Interop.Connection.SetTypeChangedCallback(_internalManager.GetHandle(), TypeChangedCallback, IntPtr.Zero);
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to register connection type changed callback, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
}
- static private void ConnectionTypeChangedStop()
+ private void ConnectionTypeChangedStop()
{
- int ret = Interop.Connection.UnsetTypeChangedCallback(ConnectionInternalManager.GetHandle());
+ int ret = Interop.Connection.UnsetTypeChangedCallback(_internalManager.GetHandle());
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to unregister connection type changed callback, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
}
- static private void TypeChangedCallback(ConnectionType type, IntPtr user_data)
+ private void TypeChangedCallback(ConnectionType type, IntPtr user_data)
{
if (_ConnectionTypeChanged != null)
{
/// <summary>
/// Event for ethernet cable is plugged [in/out] event.
/// </summary>
- static public event EventHandler EthernetCableStateChanged
+ public event EventHandler EthernetCableStateChanged
{
add
{
}
}
- static private void EthernetCableStateChangedStart()
+ private void EthernetCableStateChangedStart()
{
- int ret = Interop.Connection.SetEthernetCableStateChagedCallback(ConnectionInternalManager.GetHandle(), EthernetCableStateChangedCallback, IntPtr.Zero);
+ int ret = Interop.Connection.SetEthernetCableStateChagedCallback(_internalManager.GetHandle(), EthernetCableStateChangedCallback, IntPtr.Zero);
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to register ethernet cable state changed callback, " + (ConnectionError)ret);
}
}
- static private void EthernetCableStateChangedStop()
+ private void EthernetCableStateChangedStop()
{
- int ret = Interop.Connection.UnsetEthernetCableStateChagedCallback(ConnectionInternalManager.GetHandle());
+ int ret = Interop.Connection.UnsetEthernetCableStateChagedCallback(_internalManager.GetHandle());
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to unregister ethernet cable state changed callback, " + (ConnectionError)ret);
}
}
- static private void EthernetCableStateChangedCallback(EthernetCableState state, IntPtr user_data)
+ private void EthernetCableStateChangedCallback(EthernetCableState state, IntPtr user_data)
{
if (_EthernetCableStateChanged != null)
{
/// <summary>
/// Event that is called when the IP address is changed.
/// </summary>
- static public event EventHandler IpAddressChanged
+ public event EventHandler IpAddressChanged
{
add
{
}
}
- static private void IpAddressChangedStart()
+ private void IpAddressChangedStart()
{
- int ret = Interop.Connection.SetIpAddressChangedCallback(ConnectionInternalManager.GetHandle(), IPAddressChangedCallback, IntPtr.Zero);
+ Log.Debug(Globals.LogTag, "Handle: " + _internalManager.GetHandle());
+ int ret = Interop.Connection.SetIpAddressChangedCallback(_internalManager.GetHandle(), IPAddressChangedCallback, IntPtr.Zero);
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to register callback for changing IP address, " + (ConnectionError)ret);
}
}
- static private void IpAddressChangedStop()
+ private void IpAddressChangedStop()
{
- int ret = Interop.Connection.UnsetIpAddressChangedCallback(ConnectionInternalManager.GetHandle());
+ int ret = Interop.Connection.UnsetIpAddressChangedCallback(_internalManager.GetHandle());
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to unregister callback for changing IP address, " + (ConnectionError)ret);
}
}
- static private void IPAddressChangedCallback(IntPtr Ipv4, IntPtr Ipv6, IntPtr UserData)
+ private void IPAddressChangedCallback(IntPtr Ipv4, IntPtr Ipv6, IntPtr UserData)
{
if (_IPAddressChanged != null)
{
/// <summary>
/// Event that is called when the proxy address is changed.
/// </summary>
- static public event EventHandler ProxyAddressChanged
+ public event EventHandler ProxyAddressChanged
{
add
{
}
}
- static private void ProxyAddressChangedStart()
+ private void ProxyAddressChangedStart()
{
- int ret = Interop.Connection.SetProxyAddressChangedCallback(ConnectionInternalManager.GetHandle(), IPAddressChangedCallback, IntPtr.Zero);
+ int ret = Interop.Connection.SetProxyAddressChangedCallback(_internalManager.GetHandle(), IPAddressChangedCallback, IntPtr.Zero);
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to register callback for changing proxy address, " + (ConnectionError)ret);
}
}
- static private void ProxyAddressChangedStop()
+ private void ProxyAddressChangedStop()
{
- int ret = Interop.Connection.UnsetProxyAddressChangedCallback(ConnectionInternalManager.GetHandle());
+ int ret = Interop.Connection.UnsetProxyAddressChangedCallback(_internalManager.GetHandle());
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to unregister callback for changing proxy address, " + (ConnectionError)ret);
}
}
- static private void ProxyAddressChangedCallback(IntPtr Ipv4, IntPtr Ipv6, IntPtr UserData)
+ private void ProxyAddressChangedCallback(IntPtr Ipv4, IntPtr Ipv6, IntPtr UserData)
{
if (_ProxyAddressChanged != null)
{
}
}
- internal ConnectionManager()
- {
- }
-
- ~ConnectionManager()
- {
- Dispose(false);
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- private void Dispose(bool disposing)
- {
- if (disposed)
- return;
-
- if (disposing)
- {
- // Free managed objects.
- }
- ProxyAddressChangedStop();
- ConnectionTypeChangedStop();
- EthernetCableStateChangedStop();
- IpAddressChangedStop();
- disposed = true;
- }
-
-
/// <summary>
/// Gets the IP address of the current connection.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
- static public string GetIpAddress(AddressFamily family)
+ public string GetIpAddress(AddressFamily family)
{
- return ConnectionInternalManager.GetIpAddress(family);
+ return _internalManager.GetIpAddress(family);
}
/// <summary>
/// Gets the proxy address of the current connection.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
- static public string GetProxy(AddressFamily family)
+ public string GetProxy(AddressFamily family)
{
- return ConnectionInternalManager.GetProxy(family);
+ return _internalManager.GetProxy(family);
}
/// <summary>
/// Gets the MAC address of the Wi-Fi or ethernet.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
- static public string GetMacAddress(ConnectionType type)
+ public string GetMacAddress(ConnectionType type)
{
- return ConnectionInternalManager.GetMacAddress(type);
+ return _internalManager.GetMacAddress(type);
}
/// <summary>
- /// Gets the type of the current profile for data connection.
+ /// Gets type and state of the current profile for data connection
/// </summary>
- static public ConnectionItem CurrentConnection
+ public ConnectionItem CurrentConnection
{
get
{
- return CurConnction;
+ return _currentConnection;
}
}
+ public RequestProfile CreateRequestProfile(ConnectionProfileType type, string keyword)
+ {
+ IntPtr ProfileHandle = ConnectionInternalManager.CreateRequestProfile(type, keyword);
+ if (type == ConnectionProfileType.WiFi)
+ {
+ return new RequestWiFiProfile(ProfileHandle);
+ }
+ else if (type == ConnectionProfileType.Cellular)
+ {
+ return new RequestCellularProfile(ProfileHandle);
+ }
+ else
+ {
+ Log.Error(Globals.LogTag, "Nut supported profile type");
+ ConnectionErrorFactory.ThrowConnectionException((int)ConnectionError.InvalidParameter);
+ }
+ return null;
+ }
+
/// <summary>
/// Gets the state of cellular connection.
/// </summary>
- static public CellularState CellularState
+ public CellularState CellularState
{
get
{
- return ConnectionInternalManager.CellularState;
+ return _internalManager.CellularState;
}
}
/// Gets the state of the Wi-Fi.
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
- static public ConnectionState WiFiState
+ public ConnectionState WiFiState
{
get
{
- return ConnectionInternalManager.WiFiState;
+ return _internalManager.WiFiState;
}
}
/// The state of the Bluetooth.
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
- static public ConnectionState BluetoothState
+ public ConnectionState BluetoothState
{
get
{
- return ConnectionInternalManager.BluetoothState;
+ return _internalManager.BluetoothState;
}
}
/// The Ethernet connection state.
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
- static public ConnectionState EthernetState
+ public ConnectionState EthernetState
{
get
{
- return ConnectionInternalManager.EthernetState;
+ return _internalManager.EthernetState;
}
}
/// Checks for ethernet cable is attached or not.
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
- static public EthernetCableState EthernetCableState
+ public EthernetCableState EthernetCableState
{
get
{
- return ConnectionInternalManager.EthernetCableState;
+ return _internalManager.EthernetCableState;
}
}
- }
+
+ } // class ConnectionManager
/// <summary>
- ///
+ /// class which contains connection information such as connection type and state
/// </summary>
public class ConnectionItem
{
- internal ConnectionItem()
+ ConnectionInternalManager _internalManager = null;
+ internal ConnectionItem(ConnectionInternalManager manager)
{
+ _internalManager = manager;
}
/// <summary>
{
get
{
- return ConnectionInternalManager.ConnectionType;
+ return _internalManager.ConnectionType;
}
}
/// <summary>
- /// Gets the type of the current profile for data connection.
+ /// Gets the state of the current profile for data connection.
/// </summary>
public ConnectionState State
{
get
{
- if (ConnectionInternalManager.ConnectionType == ConnectionType.Cellular)
+ if (_internalManager.ConnectionType == ConnectionType.Cellular)
{
- if (ConnectionInternalManager.CellularState == CellularState.Connected)
+ if (_internalManager.CellularState == CellularState.Connected)
{
return ConnectionState.Connected;
}
- else if (ConnectionInternalManager.CellularState == CellularState.Available)
+ else if (_internalManager.CellularState == CellularState.Available)
{
return ConnectionState.Disconnected;
}
return ConnectionState.Deactivated;
}
}
- else if (ConnectionInternalManager.ConnectionType == ConnectionType.Bluetooth)
+ else if (_internalManager.ConnectionType == ConnectionType.Bluetooth)
{
- return ConnectionInternalManager.BluetoothState;
+ return _internalManager.BluetoothState;
}
- else if (ConnectionInternalManager.ConnectionType == ConnectionType.WiFi)
+ else if (_internalManager.ConnectionType == ConnectionType.WiFi)
{
- return ConnectionInternalManager.WiFiState;
+ return _internalManager.WiFiState;
}
- else if (ConnectionInternalManager.ConnectionType == ConnectionType.Ethernet)
+ else if (_internalManager.ConnectionType == ConnectionType.Ethernet)
{
- return ConnectionInternalManager.EthernetState;
+ return _internalManager.EthernetState;
}
else { // TO DO : Add Net Proxy
return ConnectionState.Disconnected;
}
}
}
-
- }
+ } // class ConnectionItem
/// <summary>
/// An extended EventArgs class which contains changed connection type.
private bool disposed = false;
private EventHandler _ProfileStateChanged;
+ internal IntPtr GetHandle()
+ {
+ return ProfileHandle;
+ }
+
/// <summary>
/// The event that is called when the state of profile is changed.
/// </summary>
}
}
- public ConnectionProfile(IntPtr handle)
+ internal ConnectionProfile(IntPtr handle)
{
ProfileHandle = handle;
Ipv4 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.Ipv4);
if (disposing)
{
// Free managed objects.
+// ProfileStateChangedStop();
+ Interop.ConnectionProfile.Destroy(ProfileHandle);
}
- Interop.ConnectionProfile.Destroy(ProfileHandle);
- ProfileStateChangedStop();
disposed = true;
}
namespace Tizen.Network.Connection
{
/// <summary>
- /// This class is ConnectionProfileManager
+ /// This class is ConnectionManager
/// </summary>
- public class ConnectionProfileManager
+ public partial class ConnectionManager
{
/// <summary>
/// Adds a new profile
/// </summary>
/// <privilege>http://tizen.org/privilege/network.profile</privilege>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
- static public int AddProfile(RequestProfile profile)
+ public int AddProfile(RequestProfile profile)
{
- return ConnectionInternalManager.AddProfile(profile);
+ return _internalManager.AddProfile(profile);
}
/// <summary>
/// Gets the list of profile with profile list type
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
- static public Task<IEnumerable<ConnectionProfile>> GetProfileListAsync(ProfileListType type)
+ public Task<IEnumerable<ConnectionProfile>> GetProfileListAsync(ProfileListType type)
{
- return ConnectionInternalManager.GetProfileListAsync(type);
+ return _internalManager.GetProfileListAsync(type);
}
/// <summary>
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
/// <privilege>http://tizen.org/privilege/network.set</privilege>
- static public Task<ConnectionError> ConnectProfileAsync(ConnectionProfile profile)
+ public Task<ConnectionError> ConnectProfileAsync(ConnectionProfile profile)
{
- return ConnectionInternalManager.OpenProfileAsync(profile);
+ return _internalManager.OpenProfileAsync(profile);
}
/// <summary>
/// Closes a connection of profile.
/// </summary>
/// <privilege>http://tizen.org/privilege/network.set</privilege>
- static public Task<ConnectionError> DisconnectProfileAsync(ConnectionProfile profile)
+ public Task<ConnectionError> DisconnectProfileAsync(ConnectionProfile profile)
{
- return ConnectionInternalManager.CloseProfileAsync(profile);
+ return _internalManager.CloseProfileAsync(profile);
}
/// <summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
/// <privilege>http://tizen.org/privilege/network.profile</privilege>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
- static public int RemoveProfile(ConnectionProfile profile)
+ public int RemoveProfile(ConnectionProfile profile)
{
Log.Debug(Globals.LogTag, "RemoveProfile. Id: " + profile.Id + ", Name: " + profile.Name + ", Type: " + profile.Type);
- return ConnectionInternalManager.RemoveProfile(profile);
+ return _internalManager.RemoveProfile(profile);
}
/// <summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
/// <privilege>http://tizen.org/privilege/network.profile</privilege>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
- static public int UpdateProfile(ConnectionProfile profile)
+ public int UpdateProfile(ConnectionProfile profile)
{
- return ConnectionInternalManager.UpdateProfile(profile);
+ return _internalManager.UpdateProfile(profile);
}
/// <summary>
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
- static public ConnectionProfile GetCurrentProfile()
+ public ConnectionProfile GetCurrentProfile()
{
- return ConnectionInternalManager.GetCurrentProfile();
+ return _internalManager.GetCurrentProfile();
}
/// <summary>
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
- static public ConnectionProfile GetDefaultCellularProfile(CellularServiceType type)
+ public ConnectionProfile GetDefaultCellularProfile(CellularServiceType type)
{
- return ConnectionInternalManager.GetDefaultCellularProfile(type);
+ return _internalManager.GetDefaultCellularProfile(type);
}
/// <summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
/// <privilege>http://tizen.org/privilege/network.profile</privilege>
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
- static public Task<ConnectionError> SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile)
+ public Task<ConnectionError> SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile)
{
- return ConnectionInternalManager.SetDefaultCellularProfile(type, profile);
+ return _internalManager.SetDefaultCellularProfile(type, profile);
}
}
/// The constructor of CellularProfile class with profile type and keyword.
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
- public RequestCellularProfile(string keyword)
+ internal RequestCellularProfile(IntPtr handle)
{
- Log.Debug(Globals.LogTag, "RequestCellularProfile : " + keyword);
- ProfileHandle = ConnectionInternalManager.CreateRequestProfile(ConnectionProfileType.Cellular, keyword);
- Log.Debug(Globals.LogTag, "RequestCellularProfile is created : " + ProfileHandle);
+ Log.Debug(Globals.LogTag, "RequestCellularProfile is created : " + handle);
+ ProfileHandle = handle;
Ipv4 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.Ipv4);
Ipv6 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.Ipv6);
-
AuthInfo = new CellularAuthInformation(ProfileHandle);
}
/// The constructor of WiFiProfile class with profile type and keyword.
/// </summary>
/// <privilege>http://tizen.org/privilege/network.get</privilege>
- public RequestWiFiProfile(string keyword)
+ internal RequestWiFiProfile(IntPtr handle)
{
- Log.Debug(Globals.LogTag, "RequestWiFiProfile : " + keyword);
- ProfileHandle = ConnectionInternalManager.CreateRequestProfile(ConnectionProfileType.WiFi, keyword);
+ Log.Debug(Globals.LogTag, "RequestWiFiProfile is created : " + handle);
+ ProfileHandle = handle;
Ipv4 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.Ipv4);
Ipv6 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.Ipv6);
}