원격 물리적 장치의 어떤 이벤트가 수신 장치에서 ACTION_ACL_CONNECTED 및 ACTION_ACL_DISCONNECTED를 트리거하는지 알고 싶습니다. 내 테스트 결과는 말이되지 않습니다. 나는 서로 몇 데시 미터 내에서 여러 장치를 수집 한 : 실행하는 Android 3.1무엇이 BluetoothDevice.ACTION_ACL 브로드 캐스트를 트리거합니까?
I5500 전화를 실행
갤럭시 탭 P7500 안드로이드 2.2
블루투스 USB 동글
와 PC WINXP와 On/Off 버튼이있는 두 개의 헤드셋
먼저 Tab의 모든 장치와 수동으로 페어링합니다. PC와 휴대 전화는 다른 기기와 페어링되지 않지만 탭은 사용되지 않습니다. (어떤 방법 으로든 헤드셋 중 하나를 탭에서 찾을 수는 없지만 수동 또는 프로그래밍 방식으로 전화에서 쉽게 찾을 수 있습니다.) 그런 다음 ACL 브로드 캐스트를 수신하고 표시하는 검색을 시작하는 간단한 앱이 있습니다. 모든 장치가 활성화 된 탭에서
- startDiscovery() : 그리고 이것은 (같은 일을 할 때마다, 그 광기의 일관된)를 발생하는 경우 - PC가 유일한 장치가 PC에
- 안 블루투스를 찾을 수 있습니다 : - 탭
에 어떤 반응을 PC에 블루투스를 사용하지 : - 헤드셋 1 시간에 탭
전원에 어떤 반응 : - 탭
- 전원 끄기 헤드셋에 ACTION_ACL_CONNECTED : - 아니 반응 O를 N 헤드셋의 탭
전원을 다시 : - ACTION_ACL_DISCONNECTED 및 탭에 탭
안 블루투스에 연속으로 ACTION_ACL_CONNECTED : - 탭
에 아무 반응이 탭에 블루투스를 사용하지 : - 휴대 전화에서 탭
startDiscovery에 헤드셋 ACTION_ACL_CONNECTED은() : - 전화 만하지,691,363으로, 탭와 페어링되어 있지만 PC는 전화로 볼 수있는 유일한 장치210 PC. 그렇지 않으면 전화기는 탭에 응답하지 않는 헤드셋에만 반응합니다.
이 혼란에서 무엇을 만들까요? ACTION_ACL_CONNECT가 쌍을 이루고 범위 내에서 작동하는 경우에도 ACTION_ACL_CONNECT를 일으키는 장치에 의존 할 수 없습니까? 여기
는 브로드 캐스트 리시버 및 활동에서 onCreate의 방법이 있습니다,하지만 난이 코드에 대한 자세한 상관 기대하지 않는다 :BroadcastReceiver intentReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (device != null) {
name = device.getName();
Log.v(TAG, "Device=" + device.getName());
}
else {
name = "None";
}
if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) {
text1.setText(name + " connected " + (checkCounter++));
Log.v(TAG, "connected: " + device);
}
else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
text2.setText(name + " disconnected " + (checkCounter++));
Log.v(TAG, "disconnected: " + device);
}
else if (BluetoothDevice.ACTION_FOUND.equals(action)) {
text3.setText(name + " found " + (checkCounter++));
Log.v(TAG, "found: " + device + "");
}
else if (blueAdapter.ACTION_DISCOVERY_STARTED.equals(action)) {
text4.setText("Started " + (checkCounter++));
Log.v(TAG, "Discovery started");
}
else if (blueAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
text4.setText("Finished " + (checkCounter++));
Log.v(TAG, "Discovery finished");
}
}
};
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bluetoothlayout);
text1 = (TextView)findViewById(R.id.textView1);
text2 = (TextView)findViewById(R.id.textView2);
text3 = (TextView)findViewById(R.id.textView3);
text4 = (TextView)findViewById(R.id.textView4);
BluetoothDevice mw600 = blueAdapter.getRemoteDevice("58:17:0C:EB:C5:08");
BluetoothDevice bt500 = blueAdapter.getRemoteDevice("00:1D:43:00:C4:54");
BluetoothDevice galaxyTab = blueAdapter.getRemoteDevice("00:07:AB:6A:96:7D");
BluetoothDevice pcDongle = blueAdapter.getRemoteDevice("00:15:83:4D:8B:57");
intentFilter = new IntentFilter();
intentFilter.addAction(BluetoothDevice.ACTION_FOUND);
intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
intentFilter.addAction(blueAdapter.ACTION_DISCOVERY_STARTED);
intentFilter.addAction(blueAdapter.ACTION_DISCOVERY_FINISHED);
if (!isReceiverRegistered) {
registerReceiver(intentReceiver, intentFilter);
isReceiverRegistered = true;
}
if (!blueAdapter.isEnabled()) {
blueAdapter.enable();
}
blueAdapter.startDiscovery();
}
당신과 함께 있습니다. 10 초 후에 연결할 수 있습니다. –