/// <summary> /// Creates a cellular profile handle. /// </summary> /// <since_tizen> 3 </since_tizen> /// <param name="type">The type of profile. Cellular profile type is supported.</param> /// <param name="keyword">The keyword included in profile name.</param> /// <returns>CellularProfile object.</returns> /// <privilege>http://tizen.org/privilege/network.get</privilege> /// <feature>http://tizen.org/feature/network.telephony</feature> /// <feature>http://tizen.org/feature/network.wifi</feature> /// <exception cref="System.NotSupportedException">Thrown when a feature is not supported.</exception> /// <exception cref="System.UnauthorizedAccessException">Thrown when a permission is denied.</exception> /// <exception cref="System.ArgumentException">Thrown when a value is an invalid parameter.</exception> /// <exception cref="System.ArgumentNullException">Thrown when a keyword value is null.</exception> /// <exception cref="System.InvalidOperationException">Thrown when a method fails due to invalid operation.</exception> public static CellularProfile CreateCellularProfile(ConnectionProfileType type, string keyword) { IntPtr profileHandle = IntPtr.Zero; if (type == ConnectionProfileType.Cellular) { profileHandle = ConnectionInternalManager.Instance.CreateCellularProfile(type, keyword); } else { Log.Error(Globals.LogTag, "ConnectionProfile Type is not supported"); ConnectionErrorFactory.ThrowConnectionException((int)ConnectionError.InvalidParameter); } return(new CellularProfile(profileHandle)); }
internal IntPtr CreateCellularProfile(ConnectionProfileType type, string keyword) { Log.Debug(Globals.LogTag, "CreateCellularProfile, " + type + ", " + keyword); if (keyword != null) { IntPtr handle = IntPtr.Zero; int ret = Interop.ConnectionProfile.Create((int)type, keyword, out handle); if ((ConnectionError)ret != ConnectionError.None) { Log.Error(Globals.LogTag, "It failed to Create profile, " + (ConnectionError)ret); ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.telephony"); ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); ConnectionErrorFactory.ThrowConnectionException(ret); } return(handle); } else { throw new ArgumentNullException("Keyword is null"); } }