1

开发工具 (/Developer/Applications/Utilities/Bluetooth/) 中的蓝牙资源管理器应用程序允许您关闭设备上的简单配对。(运行应用程序,选择菜单项:“实用程序>获取本地设备信息”,然后单击“简单配对”选项卡)。

第三方应用程序将如何做到这一点?

4

1 回答 1

6

如果你不介意使用一些私人的东西,你可以这样做:

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");
    }
}
于 2010-02-06T15:06:12.840 回答