?>

Hard Copy World

HCW

Q&A

Home > Forum >

Q&A

블루투스에 관한 조언을 구합니다.

페이지 정보

작성자 원중윤 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 작성일15-05-09 15:36 조회3,936회 댓글3건

본문

안녕하세요 ?

빠른 출간을 기대 합니다.

안드로이드 4.31 의 bt_chat 앱 블루투스 종료시에

D/BluetoothManager(21416): stop                                                                                            
E/BluetoothManager(21416): disconnected                                                                                    
E/BluetoothManager(21416): java.io.IOException: bt socket closed, read return:                                           
 

위의 오류가 발생되는데 해결방안이 어떻게 되는지가 궁금 합니다.

감사합니다.

 

댓글목록

하드카피님의 댓글

하드카피 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 작성일

블루투스가 끊어졌는데 백그라운드 프로세서에서 read 동작을 했나봅니다. 타이밍 이슈같아요. IOException 처리만 해주면 될 것 같은데.. 혹 로그파일에서 에러나는 부분을 모두 긁어서 올려주실 수 있으신가요?

원중윤님의 댓글

원중윤 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 작성일

답변에 감사 들립니다.
BT Chat 런  블루투스 연결 완료 , 종료 의 로그 파일 입니다.

05-10 18:13:35.335: D/RetroWatchActivity(10705): # Activity - doStartService()
05-10 18:13:35.355: D/LLService(10705): # Service - onCreate() starts here
05-10 18:13:35.355: D/LLService(10705): # Service : initialize ---
05-10 18:13:35.360: D/LLService(10705): Service - setupBT()
05-10 18:13:35.360: D/LLService(10705): # Service - onStartCommand() starts here
05-10 18:13:35.360: D/LLService(10705): # Service - onBind()
05-10 18:13:35.530: D/RetroWatchActivity(10705): Activity - Service connected
05-10 18:13:35.530: D/RetroWatchActivity(10705): # Activity - initialize()
05-10 18:13:35.530: D/LLService(10705): Service --- connect to 00:19:01:21:35:79
05-10 18:13:35.530: D/BluetoothManager(10705): Connecting to: 00:19:01:21:35:79
05-10 18:13:35.530: I/BluetoothManager(10705): BEGIN mConnectThread
05-10 18:13:35.530: D/BluetoothManager(10705): setState() 0 -> 2
05-10 18:13:35.535: D/BluetoothUtils(10705): isSocketAllowedBySecurityPolicy start : device null
05-10 18:13:35.535: W/BluetoothAdapter(10705): getBluetoothService() called with no BluetoothManagerCallback
05-10 18:13:35.585: D/LLService(10705): Service - MESSAGE_STATE_CHANGE: 2
05-10 18:13:37.340: D/BluetoothManager(10705): connected
05-10 18:13:37.340: D/BluetoothManager(10705): create ConnectedThread
05-10 18:13:37.345: I/BluetoothManager(10705): BEGIN mConnectedThread
05-10 18:13:37.345: D/BluetoothManager(10705): setState() 2 -> 3
05-10 18:13:37.345: D/LLService(10705): Service - MESSAGE_DEVICE_NAME:
05-10 18:13:37.350: D/LLService(10705): Service - MESSAGE_STATE_CHANGE: 3
05-10 18:13:51.010: W/IInputConnectionWrapper(10705): showStatusIcon on inactive InputConnection
05-10 18:13:51.100: D/RetroWatchActivity(10705): # Activity - finalizeActivity()
05-10 18:13:51.100: D/RetroWatchActivity(10705): # Activity - doStopService()
05-10 18:13:51.100: D/LLService(10705): # Service : finalize ---
05-10 18:13:51.100: D/BluetoothManager(10705): stop
05-10 18:13:51.100: D/BluetoothManager(10705): setState() 3 -> 0
05-10 18:13:51.115: E/BluetoothManager(10705): disconnected
05-10 18:13:51.115: E/BluetoothManager(10705): java.io.IOException: bt socket closed, read return: -1
05-10 18:13:51.115: E/BluetoothManager(10705): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:872)
05-10 18:13:51.115: E/BluetoothManager(10705): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96)
05-10 18:13:51.115: E/BluetoothManager(10705): at java.io.InputStream.read(InputStream.java:163)
05-10 18:13:51.115: E/BluetoothManager(10705): at com.hardcopy.btchat.bluetooth.BluetoothManager$ConnectedThread.run(BluetoothManager.java:483)
05-10 18:13:51.115: D/BluetoothManager(10705): BluetoothManager :: connectionLost()
05-10 18:13:51.115: D/BluetoothManager(10705): setState() 0 -> 1
05-10 18:13:51.145: D/dalvikvm(10705): GC_EXPLICIT freed 355K, 21% free 11199K/14068K, paused 2ms+3ms, total 25ms
05-10 18:13:51.155: D/LLService(10705): Service - MESSAGE_STATE_CHANGE: 0
05-10 18:13:51.155: D/LLService(10705): Service - MESSAGE_STATE_CHANGE: 1
05-10 18:13:51.155: E/ActivityThread(10705): Activity com.hardcopy.btchat.MainActivity has leaked ServiceConnection com.hardcopy.btchat.MainActivity$1@430dd160 that was originally bound here
05-10 18:13:51.155: E/ActivityThread(10705): android.app.ServiceConnectionLeaked: Activity com.hardcopy.btchat.MainActivity has leaked ServiceConnection com.hardcopy.btchat.MainActivity$1@430dd160 that was originally bound here
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:979)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.ContextImpl.bindServiceAsUser(ContextImpl.java:1833)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.ContextImpl.bindService(ContextImpl.java:1821)
05-10 18:13:51.155: E/ActivityThread(10705): at android.content.ContextWrapper.bindService(ContextWrapper.java:503)
05-10 18:13:51.155: E/ActivityThread(10705): at com.hardcopy.btchat.MainActivity.doStartService(MainActivity.java:264)
05-10 18:13:51.155: E/ActivityThread(10705): at com.hardcopy.btchat.MainActivity.onCreate(MainActivity.java:131)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.Activity.performCreate(Activity.java:5372)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.ActivityThread.access$700(ActivityThread.java:165)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
05-10 18:13:51.155: E/ActivityThread(10705): at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 18:13:51.155: E/ActivityThread(10705): at android.os.Looper.loop(Looper.java:176)
05-10 18:13:51.155: E/ActivityThread(10705): at android.app.ActivityThread.main(ActivityThread.java:5455)
05-10 18:13:51.155: E/ActivityThread(10705): at java.lang.reflect.Method.invokeNative(Native Method)
05-10 18:13:51.155: E/ActivityThread(10705): at java.lang.reflect.Method.invoke(Method.java:525)
05-10 18:13:51.155: E/ActivityThread(10705): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209)
05-10 18:13:51.155: E/ActivityThread(10705): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025)
05-10 18:13:51.155: E/ActivityThread(10705): at dalvik.system.NativeStart.main(Native Method)
05-10 18:13:51.160: D/LLService(10705): # Service - onUnbind()
05-10 18:13:51.160: D/LLService(10705): # Service - onDestroy()
05-10 18:13:51.160: D/LLService(10705): # Service : finalize ---

하드카피님의 댓글

하드카피 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 작성일

05-10 18:13:51.115: E/BluetoothManager(10705): at com.hardcopy.btchat.bluetooth.BluetoothManager$ConnectedThread.run(BluetoothManager.java:483)

여기가 문제 같습니다. 혹 소스코드 수정, 재컴파일이 가능하시면 BluetoothManager.java:483 라인에 IOException 처리하도록 수정해주시면 됩니다.

하던일 마무리 되면 소스코드 수정해서 업데이트 해두겠습니다.