[ANDROID] Failed to connect using new connectivity API

Issue #40 closed
Michal Skrabacz created an issue
Received data: WB_DATAMSG_CLIENT_ON_GET_RESULT, type: 5, direct msg, msgLen: 20, reqId: 22016, size: 26
                         E  Error while receiving data
                         E  java.lang.NullPointerException: Attempt to invoke virtual method 'byte java.lang.Byte.byteValue()' on a null objec
                            t reference
                         E      at com.movesense.mds.internal.connectivity.Util.sfDecode(Util.java:147)
                         E      at com.movesense.mds.internal.connectivity.ConnectedDevice.getNextPacket(ConnectedDevice.java:78)
                         E      at com.movesense.mds.internal.connectivity.BleManager.dataAvailable(BleManager.java:436)
                         E      at com.movesense.mds.internal.connectivity.BleManager.access$900(BleManager.java:39)
                         E      at com.movesense.mds.internal.connectivity.BleManager$3$1.call(BleManager.java:154)
                         E      at com.movesense.mds.internal.connectivity.BleManager$3$1.call(BleManager.java:151)
                         E      at rx.internal.util.ActionSubscriber.onNext(ActionSubscriber.java:39)
                         E      at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:134)
                         E      at rx.internal.operators.OnSubscribeOnAssembly$OnAssemblySubscriber.onNext(OnSubscribeOnAssembly.java:124)
                         E      at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:395)
                         E      at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:355)
                         E      at rx.internal.operators.OperatorMerge$InnerSubscriber.onNext(OperatorMerge.java:846)
                         E      at rx.internal.operators.OnSubscribeOnAssembly$OnAssemblySubscriber.onNext(OnSubscribeOnAssembly.java:124)
                         E      at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91)
                         E      at rx.observers.SerializedSubscriber.onNext(SerializedSubscriber.java:94)
                         E      at rx.internal.operators.OperatorTakeUntil$1.onNext(OperatorTakeUntil.java:45)
                         E      at rx.internal.operators.OnSubscribeOnAssembly$OnAssemblySubscriber.onNext(OnSubscribeOnAssembly.java:124)
                         E      at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
                         E      at rx.internal.operators.OnSubscribeOnAssembly$OnAssemblySubscriber.onNext(OnSubscribeOnAssembly.java:124)
                         E      at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.onNext(OnSubscribeFilter.java:76)
                         E      at rx.internal.operators.OnSubscribeOnAssembly$OnAssemblySubscriber.onNext(OnSubscribeOnAssembly.java:124)
                         E      at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:224)
                         E      at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
                         E      at rx.internal.schedulers.ExecutorScheduler$ExecutorSchedulerWorker.run(ExecutorScheduler.java:107)
                         E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                         E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                         E      at java.lang.Thread.run(Thread.java:818)
                         D  sendCb(10000001), 23 bytes

Comments (7)

  1. martin

    i have a similar issue - the connectivity-API will try to connect to the device- which does, however, not have any address information:

    11-09 15:03:36.464 13410-13410/com.example.martin.qd D/Mds: mdsConnectionListener onNotification: {"Body": {"DeviceInfo": {"Mode": 5, "SwVersion": "0.6.0", "hw": "UNKNOWN", "brandName": null, "sw": "0.6.0", "pcbaSerial": "UNKNOWN", "hwCompatibilityId": "C", "design": null, "serial": "ECKID711D5C3", "variant": "Unknown", "productName": "SmartSensor2", "additionalVersionInfo": null, "apiLevel": "1", "Name": "SmartSensor2", "manufacturerName": "Suunto", "Serial": "ECKID711D5C3", "addressInfo": null, "Description": "Movesense ECKID711D5C3"}, "Serial": "ECKID711D5C3", "Connection": {"UUID": "10000002", "Type": "BLE"}}, "Response": {"Status": 201}, "Uri": "suunto://MDS/ConnectedDevices", "Method": "POST"}
    11-09 15:03:36.464 13410-13410/com.example.martin.qd V/Mds:  - connected: true
    11-09 15:03:36.464 13410-13410/com.example.martin.qd V/Mds:  - disconnected: false
    11-09 15:03:36.464 13410-13410/com.example.martin.qd V/Mds:  - status: 201
    11-09 15:03:36.464 13410-13410/com.example.martin.qd V/Mds:  - serial: ECKID711D5C3
    11-09 15:03:36.464 13410-13410/com.example.martin.qd E/Mds: Error parsing connection notification: 
                                                                org.json.JSONException: Value null at addressInfo of type org.json.JSONObject$1 cannot be converted to JSONArray
                                                                    at org.json.JSON.typeMismatch(JSON.java:100)
                                                                    at org.json.JSONObject.getJSONArray(JSONObject.java:588)
                                                                    at com.movesense.mds.Mds$2.onNotification(Mds.java:107)
                                                                    at com.movesense.mds.internal.operation.MdsNotificationHandler$1.run(MdsNotificationHandler.java:25)
                                                                    at android.os.Handler.handleCallback(Handler.java:739)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                    at android.os.Looper.loop(Looper.java:148)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    

    using the latest mdslib-1.6.0(1)-release

    UPDATE: i get the same exception when using the connectivity-API sample application ...

  2. Karol Baran Account Deactivated

    Hey. ConnectivityAPI should be almost copy / paste from Android Example App. Unfortunately I'm not the author of this sample and looks like something is missing.

    I will check this.

  3. Petri Lipponen

    @martin-vl Your log shows that you are using really old firmware on the sensor (0.6.0). There have been some changes with the /Info response since then and the new connectivity code does not support the old format. Please update your sensors to the latest suitable app using the sampleapp. You can find the update packages in here. Just choose the sample app you want on the sensor. In case you have your own app, please update to the latest movesense-device-lib, since there are a lot of fixes and changes.

  4. Log in to comment