IT | Computer/안드로이드

안드로이드 Bluetooth 연결

바람난후제 2015. 12. 6. 02:28
반응형

1. Bluetooth 프로토콜 지원: SDP, HID

- Low Power Energy 지원

2. Bluetooth Permission in AndroidManifest.xml

3. BluetoothAdapter를 생성하여 활성화

4. Querying paired devices

- 주변 스캔하여 블루트스 장치 주소 확인

5. 3 Threads (Service 형태)

1) AcceptThread: 특정 주소와 UUID로 연결 대기

2) ConnectThread: 폰에서 타 장비로 연결할 경우, 연결 요청

- BluetoothDevice 객체: 수신한 주소, Pairing된 정보

- BluetoothSocket: 해당 장비와 소켓 연결

3) ConnectedThread: 연결 완료 후, 실제 데이터 교환

- 항상 수신 대기

- 송신은 특정 함수로 전송: mmOutStream.write(data)

 

* Other Device Connection Issues

1. USB Serial Communication

- Log 메시지 출력을 위한 포트를 활용, USB OTG(On-The-Go) 제공

2. JNI (Java Native Interface)

- Native code(.c)의 디바이스 드라이버 사용시에 적용

- Android NDK (Native Development Kit) 다운 후 컴파일 하여 사용

- Driver에 있는 함수 형태를 Android 프로젝트에 함수 이름만 연결

3. 기타

- Wi-Fi P2P, NFC, SIP

반응형