マックOS X /ブルートゥース:プログラムの簡単なペアリングを無効にしますか?

StackOverflow https://stackoverflow.com/questions/2213403

  •  19-09-2019
  •  | 
  •  

質問

開発ツールから

のBluetoothエクスプローラアプリ(/開発/アプリケーション/ユーティリティ/ブルートゥース/)あなたのデバイス上で簡単なペアリングをオフにすることができます。 (アプリ、選択したメニュー項目を実行します。「ローカルデバイス情報を見る>ユーティリティ」、および「シンプルペアリング」タブをクリックします)。

どのようにサードパーティ製アプリケーションがこれを行うのでしょうか?

役に立ちましたか?

解決

あなたには、いくつかの民間のものを使用して気にしない場合、あなたはこのようにそれを行うことができます:

typedef void* BluetoothHCIRequest;
OSStatus BluetoothHCIRequestCreate(BluetoothHCIRequest* outHandle, int timeOut, void* unknownOut, int alwaysZero);
void BluetoothHCIRequestDelete(BluetoothHCIRequest hciRequest);
OSStatus BluetoothHCIWriteSimplePairingMode(BluetoothHCIRequest hciRequest, BOOL onOff);

#define HCI_TIMEOUT (3000)


void SetSimplePairing(BOOL on)
{
    BluetoothHCIRequest hciRequest = nil;

    if ( BluetoothHCIRequestCreate(&hciRequest, HCI_TIMEOUT, nil, 0) == noErr && hciRequest )
    {
        OSStatus err = BluetoothHCIWriteSimplePairingMode(hciRequest, on);
        if (err)
        {
            NSLog(@"BluetoothHCIWriteSimplePairingMode: %d", err);
        }

        BluetoothHCIRequestDelete(hciRequest);
    }
    else
    {
        NSLog(@"BluetoothHCIRequestCreate failed");
    }
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top