从开发工具蓝牙浏览器的应用程序(/开发/应用/工具/蓝牙/),可以关闭简易配对您的设备上。 (运行程序,选择菜单项:“工具>获取本地设备信息”,并点击“简易配对”选项卡上)。

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

有帮助吗?

解决方案

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

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