سؤال

يسمح لك تطبيق Bluetooth Explorer من أدوات Dev (/ المطور / التطبيقات / الأدوات المساعدة / 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