SKKU-ESLAB / opel-alpha

Open Platform Event Logger (OPEL) Project
Other
3 stars 0 forks source link

Sensor viewer's Bluetooth communication failure #112

Closed RedCarrottt closed 7 years ago

RedCarrottt commented 7 years ago

When opening sensor viewer in OPEL Manager, Bluetooth communication with OPEL device seems to fail.

I guess that the failure occurs in Communication FW NIL, since the failure appeared after all the NILs had been upgraded to Node.js 4.0.0.

After I inspect the code of OPEL Manager, I found that there is a strong coupling between SensorViewer application and OPEL communicator. It can be another reason of the failure.

I think it should be handled in Alpha 2(#99).

[commManager] getMsg >> received msg : {"type":"1012"}
Received Msg : {"type":"1012"}
[appStatusManager] Fork & Run NativeApp:SensorViewer
Wait for next message
[appStatusManager] runNewApp full run Path : /home/redcarrottt/opel-alpha/bin/appManager/nativeJSApp/SensorViewer/index.js
[Module] Start dbus initializing
Convert : from 7982 to AHJIC
Total address : type='signal', interface='org.opel.AHJIC'
Dbus initializing complete
[commManager] getMsg >> received msg : {"type":"2012"}
Received Msg : {"type":"2012"}
Wait for next message
01-20 11:09:58.179 1957-1957/com.example.opel_manager D/ViewRootImpl: ViewPostImeInputStage processPointer 0
01-20 11:09:58.259 1957-1957/com.example.opel_manager D/ViewRootImpl: ViewPostImeInputStage processPointer 1
01-20 11:09:58.329 1957-1957/com.example.opel_manager I/Timeline: Timeline: Activity_launch_request id:com.example.opel_manager time:3036285
01-20 11:09:58.419 1957-1957/com.example.opel_manager W/ResourcesManager: getTopLevelResources: /data/app/com.example.opel_manager-2/base.apk / 1.0 running in com.example.opel_manager rsrc of package com.example.opel_manager
01-20 11:09:58.479 1957-1957/com.example.opel_manager D/CMFW: Connect
01-20 11:09:58.479 1957-1957/com.example.opel_manager D/Activity: performCreate Call Injection manager
01-20 11:09:58.479 1957-5022/com.example.opel_manager D/hi: go connect
01-20 11:09:58.489 1957-5022/com.example.opel_manager D/CMFW: Sensor Intf53656e73-6f72-2049-6e74-660000000000
01-20 11:09:58.489 1957-5022/com.example.opel_manager D/CMFW: Connecting to : 00:04:4B:5A:C6:63
01-20 11:09:58.499 1957-1957/com.example.opel_manager I/InjectionManager: dispatchOnViewCreated > Target : com.example.opel_manager.sensorView isFragment :false
01-20 11:09:58.499 1957-1957/com.example.opel_manager D/SendMsg: {"type":"1012"}
01-20 11:09:58.509 1957-1957/com.example.opel_manager D/BluetoothSocket: getOutputStream(): myUserId = 0
01-20 11:09:58.509 1957-1957/com.example.opel_manager D/cmfw_send_msg: payload_size = 16
01-20 11:09:58.509 1957-5022/com.example.opel_manager D/BluetoothUtils: isSocketAllowedBySecurityPolicy start : device null
01-20 11:09:58.509 1957-5022/com.example.opel_manager D/BluetoothSocket: connect(): myUserId = 0
01-20 11:09:58.509 1957-5022/com.example.opel_manager W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
01-20 11:09:58.509 1957-1957/com.example.opel_manager D/SecWifiDisplayUtil: Metadata value : SecSettings2
01-20 11:09:58.509 1957-1957/com.example.opel_manager D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{5daa0a5 I.E...... R.....ID 0,0-0,0}
01-20 11:09:58.539 1957-2030/com.example.opel_manager D/mali_winsys: new_window_surface returns 0x3000,  [1440x2560]-format:1
01-20 11:09:58.549 1957-1957/com.example.opel_manager I/InjectionManager: dispatchCreateOptionsMenu :com.example.opel_manager.sensorView
01-20 11:09:58.549 1957-1957/com.example.opel_manager I/InjectionManager: dispatchPrepareOptionsMenu :com.example.opel_manager.sensorView
01-20 11:09:58.589 1957-1957/com.example.opel_manager D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 96 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1
01-20 11:09:58.649 1957-1957/com.example.opel_manager I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@a6d7e9c time:3036600
01-20 11:09:58.809 1957-5022/com.example.opel_manager W/System.err: java.io.IOException: read failed, socket might closed or timeout, read ret: -1
01-20 11:09:58.809 1957-5022/com.example.opel_manager W/System.err:     at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:900)
01-20 11:09:58.809 1957-5022/com.example.opel_manager W/System.err:     at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:912)
01-20 11:09:58.809 1957-5022/com.example.opel_manager W/System.err:     at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:531)
01-20 11:09:58.809 1957-5022/com.example.opel_manager W/System.err:     at opel.android.comm.OpelSocket.connect(OpelSocket.java:172)
01-20 11:09:58.809 1957-5022/com.example.opel_manager W/System.err:     at opel.android.comm.OpelClient$ConnectThread.run(OpelClient.java:153)
01-20 11:09:58.809 1957-5022/com.example.opel_manager D/CMFW: Connected or Disconnected
01-20 11:09:58.809 1957-5022/com.example.opel_manager D/SensorViewer: Error Happens-1
01-20 11:09:58.809 1957-5022/com.example.opel_manager D/OPEL: CANCLE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
01-20 11:09:58.809 1957-5022/com.example.opel_manager D/CMFW: Connect
01-20 11:09:58.809 1957-5022/com.example.opel_manager D/hi: done connect
01-20 11:09:58.809 1957-5102/com.example.opel_manager D/hi: go connect
01-20 11:09:58.809 1957-5102/com.example.opel_manager D/CMFW: Sensor Intf53656e73-6f72-2049-6e74-660000000000
01-20 11:09:58.809 1957-5102/com.example.opel_manager D/CMFW: Connecting to : 00:04:4B:5A:C6:63
01-20 11:09:58.819 1957-5102/com.example.opel_manager D/BluetoothUtils: isSocketAllowedBySecurityPolicy start : device null
01-20 11:09:58.819 1957-5102/com.example.opel_manager D/BluetoothSocket: connect(): myUserId = 0
01-20 11:09:58.819 1957-5102/com.example.opel_manager W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
01-20 11:09:58.849 1957-1957/com.example.opel_manager V/ActivityThread: updateVisibility : ActivityRecord{eb64646 token=android.os.BinderProxy@cbd981 {com.example.opel_manager/com.example.opel_manager.MainActivity}} show : false
01-20 11:09:58.889 1957-5102/com.example.opel_manager W/System.err: java.io.IOException: read failed, socket might closed or timeout, read ret: -1
01-20 11:09:58.889 1957-5102/com.example.opel_manager W/System.err:     at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:900)
01-20 11:09:58.889 1957-5102/com.example.opel_manager W/System.err:     at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:912)
01-20 11:09:58.889 1957-5102/com.example.opel_manager W/System.err:     at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:531)
01-20 11:09:58.889 1957-5102/com.example.opel_manager W/System.err:     at opel.android.comm.OpelSocket.connect(OpelSocket.java:172)
01-20 11:09:58.889 1957-5102/com.example.opel_manager W/System.err:     at opel.android.comm.OpelClient$ConnectThread.run(OpelClient.java:153)
01-20 11:09:58.889 1957-5102/com.example.opel_manager D/CMFW: Connected or Disconnected
01-20 11:09:58.889 1957-5102/com.example.opel_manager D/SensorViewer: Error Happens-1
01-20 11:09:58.889 1957-5102/com.example.opel_manager D/OPEL: CANCLE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
RedCarrottt commented 7 years ago

This bug can be fixed after modularization of app/sys manager and OPEL manager renewal. Since they are the feature of Alpha 3, this issue is better to be handled in Alpha 4(#140).

RedCarrottt commented 7 years ago

After internal discussion with @esevan, we recalled that SensorViewer has coupling with every layers in OPEL Manager, App/Sys Framework and Sensor Framework. It is because P2P communication SW stack used in SensorViewer is implemented in old fashion. The SW stack can be replaced with newer sensor API.

Therefore, I will deprecate P2P communication stack coupled with SensorViewer, and replace it with sensor API.

RedCarrottt commented 7 years ago

해당 버그는 Alpha 4에서 App/Sys Manager와 OPEL Manager의 구조 개편을 통해 해결할 예정이었습니다만, 당장 Beta 1에서도 SensorViewer가 동작해야 하므로, 임시 방편으로 하드코딩하여 고칠 계획입니다.

Beta 1에서 하드코딩을 통해 버그를 해결하고, Alpha 4에서 OPEL Manager 구조 개편을 하도록 하겠습니다.

RedCarrottt commented 7 years ago

일단 Issue #132 가 진행되어야 근본적으로 문제가 해결되지만, 현재 하드코딩으로 일시적으로 해결되었습니다. (PR #161, #162) 따라서 해당 issue를 close합니다.