2010-02-06 2 views
1

dev 도구 (/ 개발자/응용 프로그램/유틸리티/블루투스 /)의 블루투스 탐색기 앱을 사용하면 기기에서 단순 페어링을 사용 중지 할 수 있습니다. (응용 프로그램을 실행하고 "유틸리티> 로컬 장치 정보 가져 오기"메뉴 항목을 선택한 다음 "단순 쌍이"탭을 클릭하십시오).Mac OS X/Bluetooth : 간단한 페어링을 프로그래밍 방식으로 사용 중지 하시겠습니까?

어떻게 타사 응용 프로그램에서이 작업을 수행합니까? 당신은 몇 가지 개인 물건을 사용 괜찮다면

답변

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"); 
    } 
} 
+0

작동하는지, 감사합니다! –

관련 문제