Mac OS X/Bluetooth : 프로그래밍 방식으로 간단한 페어링을 비활성화합니까?
-
19-09-2019 - |
문제
Dev 도구 (/개발자/애플리케이션/유틸리티/Bluetooth/)의 Bluetooth Explorer 앱을 사용하면 장치에서 간단한 페어링을 해제 할 수 있습니다. (앱 실행, 메뉴 항목 : "유틸리티> 로컬 장치 정보 가져 오기"를 선택하고 "간단한 페어링"탭을 클릭하십시오).
제 3 자 애플리케이션은 어떻게 이렇게합니까?
해결책
개인 물건을 사용하는 것이 마음에 들지 않으면 다음과 같이 할 수 있습니다.
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");
}
}
제휴하지 않습니다 StackOverflow