Share via


NetworkOperatorTetheringManager.CreateFromConnectionProfile メソッド

定義

オーバーロード

CreateFromConnectionProfile(ConnectionProfile)

特定のプロファイルをパブリック インターフェイスとして使用し、プライベート インターフェイスとして Wi-Fi NetworkOperatorTetheringManager を作成します。

CreateFromConnectionProfile(ConnectionProfile, NetworkAdapter)

特定のプロファイルをパブリック インターフェイスとして使用し、特定の NetworkAdapter をプライベート インターフェイスとして使用して、NetworkOperatorTetheringManager を作成します。

CreateFromConnectionProfile(ConnectionProfile)

特定のプロファイルをパブリック インターフェイスとして使用し、プライベート インターフェイスとして Wi-Fi NetworkOperatorTetheringManager を作成します。

public:
 static NetworkOperatorTetheringManager ^ CreateFromConnectionProfile(ConnectionProfile ^ profile);
 static NetworkOperatorTetheringManager CreateFromConnectionProfile(ConnectionProfile const& profile);
/// [Windows.Foundation.Metadata.Overload("CreateFromConnectionProfile")]
 static NetworkOperatorTetheringManager CreateFromConnectionProfile(ConnectionProfile const& profile);
public static NetworkOperatorTetheringManager CreateFromConnectionProfile(ConnectionProfile profile);
[Windows.Foundation.Metadata.Overload("CreateFromConnectionProfile")]
public static NetworkOperatorTetheringManager CreateFromConnectionProfile(ConnectionProfile profile);
function createFromConnectionProfile(profile)
Public Shared Function CreateFromConnectionProfile (profile As ConnectionProfile) As NetworkOperatorTetheringManager

パラメーター

profile
ConnectionProfile

使用する接続プロファイル。

戻り値

結果のマネージャー オブジェクト。

属性

Windows の要件

アプリの機能
wiFiControl

注釈

以前のリリースでは、ネットワーク オペレーターからの特権アプリのみが NetworkOperatorTetheringManager オブジェクトを 作成し、それを使用してテザリングを制御できました。 このリリースでは、すべてのアプリで CreateFromConnectionProfile を呼び出してオブジェクトを作成できます。 ただし、呼び出しを成功させるには、アプリのマニフェストで適切な Wi-Fi 制御デバイス機能が宣言されている必要があります。 次の例は、wiFiControl 属性を持つ、必要な DeviceCapability タグを持つマニフェストの一部を示しています。

<Capabilities>
  <DeviceCapability Name="wiFiControl"/>
</Capabilities>

wiFiControl デバイスの機能がマニフェストで設定されていない場合、CreateFromConnectionProfile の呼び出しは例外をスローすることで失敗します。

コードでは、 GetTetheringCapabilityFromConnectionProfile を呼び出すことによって、実行時に機能が設定されているかどうかを判断できます。 DisabledBySystemCapability が返された場合、マニフェストは必要なデバイス機能を設定しません。 Enabled が返された場合でも、テザリング機能はアプリの制御や通知の外部でいつでも変更される可能性があるため、エラーと例外を処理するようにコードを記述する必要があることに注意してください。

こちらもご覧ください

適用対象

CreateFromConnectionProfile(ConnectionProfile, NetworkAdapter)

特定のプロファイルをパブリック インターフェイスとして使用し、特定の NetworkAdapter をプライベート インターフェイスとして使用して、NetworkOperatorTetheringManager を作成します。

public:
 static NetworkOperatorTetheringManager ^ CreateFromConnectionProfile(ConnectionProfile ^ profile, NetworkAdapter ^ adapter);
/// [Windows.Foundation.Metadata.Overload("CreateFromConnectionProfileWithTargetAdapter")]
 static NetworkOperatorTetheringManager CreateFromConnectionProfile(ConnectionProfile const& profile, NetworkAdapter const& adapter);
[Windows.Foundation.Metadata.Overload("CreateFromConnectionProfileWithTargetAdapter")]
public static NetworkOperatorTetheringManager CreateFromConnectionProfile(ConnectionProfile profile, NetworkAdapter adapter);
function createFromConnectionProfile(profile, adapter)
Public Shared Function CreateFromConnectionProfile (profile As ConnectionProfile, adapter As NetworkAdapter) As NetworkOperatorTetheringManager

パラメーター

profile
ConnectionProfile

使用する接続プロファイル。

adapter
NetworkAdapter

接続が共有されているネットワーク アダプター。 共有接続は、 NetworkOperatorTetheringManager によって制御されます。

戻り値

結果のマネージャー オブジェクト。

属性

Windows の要件

デバイス ファミリ
Windows 10 Anniversary Edition (10.0.14393.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v3.0 で導入)
アプリの機能
wiFiControl

注釈

以前のリリースでは、ネットワーク オペレーターからの特権アプリのみが NetworkOperatorTetheringManager オブジェクトを 作成し、それを使用してテザリングを制御できました。 このリリースでは、すべてのアプリで CreateFromConnectionProfile を呼び出してオブジェクトを作成できます。 ただし、呼び出しを成功させるには、アプリのマニフェストで適切な Wi-Fi 制御デバイス機能が宣言されている必要があります。 次の例は、wiFiControl 属性を持つ、必要な DeviceCapability タグを持つマニフェストの一部を示しています。

<Capabilities>
  <DeviceCapability Name="wiFiControl"/>
</Capabilities>

wiFiControl デバイスの機能がマニフェストで設定されていない場合、CreateFromConnectionProfile の呼び出しは例外をスローすることで失敗します。

コードでは、 GetTetheringCapabilityFromConnectionProfile を呼び出すことによって、実行時に機能が設定されているかどうかを判断できます。 DisabledBySystemCapability が返された場合、マニフェストは必要なデバイス機能を設定しません。 Enabled が返された場合でも、テザリング機能はアプリの制御や通知の外部でいつでも変更される可能性があるため、エラーと例外を処理するようにコードを記述する必要があることに注意してください。

こちらもご覧ください

適用対象