BluetoothAuthenticateDeviceEx 함수(bluetoothapis.h)

BluetoothAuthenticateDeviceEx 함수는 원격 Bluetooth 디바이스에 인증 요청을 보냅니다. 또한 이 함수를 사용하면 대역 외 데이터를 인증되는 디바이스에 대한 함수 호출로 전달할 수 있습니다.

참고 이 API는 Windows Vista SP2 및 Windows 7에서 지원됩니다.
 

구문

DWORD BluetoothAuthenticateDeviceEx(
  [in, optional] HWND                        hwndParentIn,
  [in, optional] HANDLE                      hRadioIn,
  [in, out]      BLUETOOTH_DEVICE_INFO       *pbtdiInout,
  [in, optional] PBLUETOOTH_OOB_DATA_INFO    pbtOobData,
  [in]           AUTHENTICATION_REQUIREMENTS authenticationRequirement
);

매개 변수

[in, optional] hwndParentIn

인증 마법사를 부모로 지정하는 창입니다. NULL이면 마법사가 바탕 화면에서 부모로 표시됩니다.

[in, optional] hRadioIn

유효한 로컬 라디오 핸들 또는 NULL입니다. NULL이면 모든 라디오가 시도됩니다. 라디오가 성공하면 호출이 성공합니다.

[in, out] pbtdiInout

인증되는 디바이스를 설명하는 BLUETOOTH_DEVICE_INFO 구조체에 대한 포인터입니다.

[in, optional] pbtOobData

이 API 호출과 함께 제공할 디바이스별 대역 외 데이터에 대한 포인터입니다. NULL이면 인증 프로세스를 계속하기 위해 UI가 표시됩니다. NULL이 아니면 UI가 표시되지 않습니다.

참고BluetoothRegisterForAuthenticationEx를 사용하여 콜백을 등록하면 UI가 표시되지 않습니다.
 

[in] authenticationRequirement

인증에 필요한 보호를 지정하는 BLUETOOTH_AUTHENTICATION_REQUIREMENTS 값입니다.

반환 값

성공적으로 완료되면 ERROR_SUCCESS 반환합니다. 는 실패 시 다음 오류 코드를 반환합니다.

반환 코드 설명
ERROR_CANCELLED
사용자가 작업을 중단했습니다.
ERROR_INVALID_PARAMETER
pbdti에 지정된 디바이스 구조가 잘못되었습니다.
ERROR_NO_MORE_ITEMS
pbtdi의 디바이스는 이미 인증된 것으로 표시되어 있습니다.

설명

pbtdilInOut으로 지정된 BLUETOOTH_DEVICE_INFO 구조체에는 인증할 디바이스의 주소가 포함되어야 합니다. pbtOobData 값이 NULL이 아니면 제공된 대역 외 데이터를 사용하여 원격 디바이스를 인증하려고 시도합니다.

다른 모든 유형의 인증의 경우 호출자는 BluetoothRegisterForAuthenticationEx 를 사용하여 인증 콜백을 등록한 다음 BluetoothSendAuthenticationResponseEx를 사용하여 관련 인증 방법에 응답해야 합니다.

예제

다음 예제 코드에서는 디바이스를 찾았고 BluetoothAuthenticateDeviceEx를 사용하여 인증 요청을 보냅니다.

PBLUETOOTH_DEVICE_INFO pDeviceInfo; 
HRESULT status;
HANDLE hEvent = NULL;

HRESULT WINAPI AuthenticateService(){

	status = BluetoothAuthenticateDeviceEx( NULL,
					        NULL,
					        pDeviceInfo,
					        NULL,
					        MITMProtectionNotRequired );

	if ( ERROR_INVALID_PARAMETER == status ) {
		// goto Cleanup;
		// ...
		// Take cleanup action here,
		// ...
	}
//
// Wait for the Authentication callback to return before trying to unregister the handle
// Use an infinite timeout since the handle to the function that sets the event is being
// deleted
//

	if ( WAIT_FAILED == WaitForSingleObject(hEvent, INFINITE) ) {
        	status = GetLastError();
        	// goto Cleanup;
		// ...
		// Take cleanup action here,
		// ...
	}

      return status;
}

요구 사항

요구 사항
지원되는 최소 클라이언트 WINDOWS XP SP2 [데스크톱 앱만 해당]
지원되는 최소 서버 지원되는 버전 없음
대상 플랫폼 Windows
헤더 bluetoothapis.h(Bthsdpdef.h, BluetoothAPIs.h 포함)
라이브러리 Bthprops.lib
DLL bthprops.cpl

추가 정보

BluetoothAuthenticateDevice