2014-04-24 2 views
5

Android에서 Bluetooth 프린터 목록을 얻는 방법은 무엇입니까?Android에서 Bluetooth 프린터 목록을 가져올 수 있습니까?

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); 
java.util.Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices(); 

는 이러한 장치에서 프린터 만 선택할 수 있습니다 :
다음 코드는 모든 블루투스 장치를 반환?

UPDATE : 내 프린터의 블루투스 클래스의
장치 클래스는 1664
입니다하지만 안드로이드 SDK 이러한 상수를 찾을 수 없습니다.
모든 블루투스 프린터에 디바이스 클래스 1664가 있습니까?

답변

7

이 질문은 이제 다소 오래되었지만이 정보가 필요한 모든 사람들에게 내 경험을 나누고 싶습니다.

getBluetoothClass()에 보조 장치 클래스 (getDeviceClass()) 및 major (getMajorDeviceClass())를 가져 와서 사용 가능한 클래스 번호와 비교할 수 있습니다. 1536은 이미징 장치를 나타내는 주요 클래스이며 프린터는 보조 장치 클래스로 1664으로 지정됩니다.

또한 클래스 생성이 온라인 디바이스 클래스 계산기를 사용할 수 있습니다 :

http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html

관련 문제