c로 작성된 BLUETOOTH 서버를 시작한 후.Android 응용 프로그램을 사용하여 Bluetooth 서비스를 찾을 수 없습니다.
https://github.com/RyanGlScott/BluetoothTest/blob/master/C%20BlueZ%20Server/bluez_server.c
이 명령의 출력이 지역 검색 sdptool입니다 :
....other services....
Service Name: AVRCP CT
Service RecHandle: 0x10005
Service Class ID List:
"AV Remote" (0x110e)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x103
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0100
/*MY SERVICE!!!*/
Service Name: Armatus Bluetooth server
Service Description: A HERMIT server that interfaces with the Armatus Android app
Service Provider: Armatus
Service RecHandle: 0x10006
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
Profile Descriptor List:
"Serial Port" (0x1101)
Version: 0x0100
....other services....
I'am는 안드로이드 응용 프로그램
// Create a BroadcastReceiver for ACTION_FOUND
private final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
// Whenever a remote Bluetooth device is found
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Get the BluetoothDevice object from the Intent
BluetoothDevice bluetoothDevice =
intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
// Add the name and address to an array adapter to show in a ListView
adapter.add(bluetoothDevice.getName() + "\n"
+ bluetoothDevice.getAddress());
if (bluetoothDevice.getName().equals("mint-0")) {
Log.d("tagmint0","bene bene");
try {
ParcelUuid[] uuids = (ParcelUuid[]) bluetoothDevice.getUuids();
for (ParcelUuid uuid : uuids) {
Log.d("x", "mintUUIDxx: " + uuid.getUuid().toString() + "\n");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
};
내 질문은
를 사용하여이 서비스를 찾기 위해 노력하고, sdptool browse local 명령을 사용하여 내 안드로이드 응용 프로그램이 내 서비스를 찾을 수없는 이유는 무엇입니까?이 안드로이드 응용 프로그램의 출력은 서버의 UUID를 포함하지 않습니다 당신이 볼 수 있듯이
mintUUIDxx: 0000111e-0000-1000-8000-00805f9b34fb
mintUUIDxx: 00001105-0000-1000-8000-00805f9b34fb
mintUUIDxx: 00001106-0000-1000-8000-00805f9b34fb
mintUUIDxx: 0000112d-0000-1000-8000-00805f9b34fb
mintUUIDxx: 0000110e-0000-1000-8000-00805f9b34fb
mintUUIDxx: 00001112-0000-1000-8000-00805f9b34fb
mintUUIDxx: 0000111f-0000-1000-8000-00805f9b34fb
mintUUIDxx: 00000000-0000-1000-8000-00805f9b34fb
에게 있습니다. 누군가 왜 나를 설명 할 수 있을까요?
와 bluez_server.c에 그 라인을 변경하여 사용 해보세요, 그래서 사용 이런 식으로 : 'bluetoothDevice.fetchUuidsWithSdp(); ParcelUuid [] uuids = (ParcelUuid []) bluetoothDevice.getUuids(); (ParcelUuid uuid : uuids) { Log.d ("x", "mintUUIDxx :"+ uuid.getUuid(). toString() + "\ n"); } 아무 것도 변경되지 않습니다. – Franconet
@Franconet 자신의 서비스의 UUID를 사용하여 기기에 연결을 시도 할 수 있습니다. 자세한 내용은 [여기] (http://stackoverflow.com/questions/25658426/android-bluetooth-fetchuuidswithsdp-does-not-return-all-uuids-on-some-devices)입니다. –