Open IvanTerrito opened 6 years ago
Hi Ivan,
Which board/Fw are you using? What did you do after the node connection? Do you have any message in the LogCat console?
Thanks Giovanni
I'm using a sample board: STEVAL-STLCX01V1
I'm going to copy here all my class. It is a Service:
package com.it.baraka.services;
import android.Manifest;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.location.LocationManager;
import android.os.Handler;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import com.crashlytics.android.Crashlytics;
import com.it.baraka.NodeArrayAdapter;
import com.st.BlueSTSDK.Feature;
import com.st.BlueSTSDK.Features.FeatureAccelerationEvent;
import com.st.BlueSTSDK.Features.Field;
import com.st.BlueSTSDK.Manager;
import com.st.BlueSTSDK.Node;
import java.util.List;
/**
* Created by ivanterrito on 15/02/17.
*/
public class BLUETOOTH_Service_Network extends Service {
FeatureAccelerationEvent featureAccelerationEvent;
//TODO COMMENT NEXT LINE
int test = -2;
public static final String TAG = "BLUET_Service_Network";
Intent intent;
public static final String BROADCAST_ACTION = "com.it.baraka.BLUETOOTH_Service_Network.getOrientation";
private void sendOrientation() {
Log.d(TAG, "entered sendOrientation");
intent.putExtra("isConnected", isConnected);
intent.putExtra("orientation", ORIENTATION);
intent.putExtra("timestamp", O_TIMESTAMP);
sendBroadcast(intent);
}
boolean gotFeatures = false;
Handler handler;
String ORIENTATION = "";
String O_TIMESTAMP = "";
String GESTURE = "empty";
String ACCELEROMETER_EVENTS = "empty";
String TEMPERATURE = "empty";
String PRESSURE = "empty";
String MAGNETOMETER = "empty";
String GYROSCOPE = "empty";
String ACCELEROMETER = "empty";
String MIC_LEVEL = "empty";
int TIMEOUTMS = 1000 * 20; // 20 seconds
/**
* node that will stream the data
*/
private Node mNode;
public boolean receivingDatas = false;
public boolean isConnected = false;
/**
* class used for manage the ble adapter and that will keep the list of the discovered device
*/
Manager mManager;
//Manager.ManagerListener managerListener;
private Manager.ManagerListener listener = new Manager.ManagerListener() {
@Override
public void onDiscoveryChange(Manager m, boolean enabled) {
Log.d(TAG, "onDiscoveryChange() - enabled: " + enabled);
}
@Override
public void onNodeDiscovered(Manager m, Node node) {
Log.d(TAG, "onNodeDiscovered - TAG: " + node.getTag());
Log.d(TAG, "onNodeDiscovered - paired_tag: " + getPref("paired_tag", getApplicationContext()));
//mManager.stopDiscovery();
}
};
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
Log.d(TAG, "onCreate");
try {
mManager = Manager.getSharedInstance();
mManager.addListener(listener);
handler = new Handler(); // new handler
handler.postDelayed(runnable, 0); // 20 seconds
} catch (Exception e) {
e.printStackTrace();
}
intent = new Intent(BROADCAST_ACTION);
}
private Runnable runnable = new Runnable() {
@Override
public void run() {
/* my set of codes for repeated work */
checkBluetooth();
handler.postDelayed(this, 1000 * 5); // 5 seconds
}
};
private void checkBluetooth() {
Log.d(TAG, "checkBluetooth()");
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
// Device does not support Bluetooth
Log.d(TAG, "Device does not support Bluetooth");
if(mManager != null) {
//mManager.stopDiscovery();
//mNode = mManager.getSharedInstance().getNodeWithTag(getPref("paired_tag", getApplicationContext()));
if (mNode != null) {
if (mNode.isConnected()) {
mNode.disconnect();
}
}
}
} else {
if (!mBluetoothAdapter.isEnabled()) {
// Bluetooth is not enabled :)
Log.d(TAG, "Bluetooth is not enabled");
receivingDatas = false;
isConnected = false;
if(mManager != null) {
//mManager.stopDiscovery();
//mNode = mManager.getSharedInstance().getNodeWithTag(getPref("paired_tag", getApplicationContext()));
if (mNode != null) {
if (mNode.isConnected()) {
mNode.disconnect();
}
}
}
} else {
Log.d(TAG, "Bluetooth is enabled");
if (getPref("paired_tag", getApplicationContext()) != null && getPref("paired_tag", getApplicationContext()).length() > 0
&& getPref("paired_name", getApplicationContext()) != null && getPref("paired_name", getApplicationContext()).length() > 0) {
Log.d(TAG, "Paired tag: " + getPref("paired_tag", getApplicationContext()));
Log.d(TAG, "Paired name: " + getPref("paired_name", getApplicationContext()));
if(mManager != null) {
Log.d(TAG, "mManager != null");
mManager.startDiscovery();
mNode = mManager.getSharedInstance().getNodeWithTag(getPref("paired_tag", getApplicationContext()));
if(mNode != null) {
Log.d(TAG, "mNode != null");
if(!mNode.isConnected()) {
Log.d(TAG, "!mNode.isConnected()");
isConnected = true;
gotFeatures = false;
mNode.connect(getApplicationContext());
mNode.addNodeStateListener(new Node.NodeStateListener() {
@Override
public void onStateChange(Node node, Node.State newState, Node.State prevState) {
Log.d(TAG,"onStateChange - Node.State: " + newState.name());
}
});
}
else{
Log.i(TAG,"Device already connected");
if(!gotFeatures) {
captureEvents();
}
else{
//TODO COMMENT NEXT LINE
//captureEvents();
}
}
//mManager.stopDiscovery();
}
else{
Log.d(TAG, "mNode == null");
receivingDatas = false;
isConnected = false;
gotFeatures = false;
mManager.startDiscovery();
}
}
}
else {
Log.d(TAG, "No paired device found");
receivingDatas = false;
isConnected = false;
if(mManager != null) {
//mManager.stopDiscovery();
//mNode = mManager.getSharedInstance().getNodeWithTag(getPref("paired_tag", getApplicationContext()));
if (mNode != null) {
if (mNode.isConnected()) {
mNode.disconnect();
}
}
}
}
}
}
sendOrientation(); // update connection status
}
void captureEvents() {
Log.d(TAG,"captureEvents()");
try {
if(mNode.getFeature(FeatureAccelerationEvent.class) != null) {
featureAccelerationEvent = mNode.getFeature(FeatureAccelerationEvent.class);
if(featureAccelerationEvent != null){
featureAccelerationEvent.setEnable(true);
featureAccelerationEvent.addFeatureListener(new FeatureAccelerationEvent.FeatureAccelerationEventListener() {
@Override
public void onDetectableEventChange(FeatureAccelerationEvent f, FeatureAccelerationEvent.DetectableEvent event, boolean newStatus) {
Log.d(TAG,"onDetectableEventChange - event: " + event + " / status: " + newStatus);
}//onDetectableEventChange
@Override
public void onUpdate(Feature f, Feature.Sample sample) {
Log.d("FeatureAccelerationEvent", "onUpdate()");
int event = FeatureAccelerationEvent.getAccelerationEvent(sample);
int eventType = FeatureAccelerationEvent.extractOrientationEvent(event);
Log.d("FeatureAccelerationEvent", "event: " + event);
Log.d("FeatureAccelerationEvent", "eventType: " + eventType);
if(event == 3) { // ruota a destra
ORIENTATION = "1";
sendOrientation();
}
else if(event == 1) { // ruota a sinistra
ORIENTATION = "-1";
sendOrientation();
}
else{
ORIENTATION = String.valueOf(event);
sendOrientation();
}
}//on update
});//FeatureAccelerationEventListener
featureAccelerationEvent.detectEvent(FeatureAccelerationEvent.DetectableEvent.ORIENTATION, true);
mNode.enableNotification(featureAccelerationEvent);
Log.d(TAG, "captureEvents() - Rotazione attiva");
}
else{
Log.d(TAG, "captureEvents() - Rotazione non attiva");
}
}
else {
Log.d(TAG, "captureEvents() - Feature not found");
}
}
catch (Exception e) {
e.printStackTrace();
Crashlytics.logException(e);
}
gotFeatures = true;
}
private boolean checkAdapterAndPermission() {
/* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (enableLocationService()) {
if (checkBlePermission())
return true;
else
return false;
}
else
return false;
}
else */
return true;
}//checkAdapterAndPermission
private boolean enableLocationService() {
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
boolean providerEnabled = lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER) | lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!providerEnabled)
return true;
else
return false;
}
/**
* check to have the permission needed for start a bluetooth scanning
* @return true if we have ti false if we ask for it
*/
private boolean checkBlePermission(){
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
return false;
else
return true;
}//checkBlePermission
@Override
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "onDestroy");
if(mNode != null)
mNode.disconnect();
Intent j = new Intent(getApplicationContext(), BLUETOOTH_Service_Network.class);
startService(j);
/*if(locationManagerNetwork != null){
//noinspection MissingPermission
locationManagerNetwork.removeUpdates(listenerNetwork);
}*/
//if (mGoogleApiClient.isConnected()) {
// LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
// mGoogleApiClient.disconnect();
//}
}
//SHARED PREFERENCES
public static void putPref(String key, String value, Context context) {
SharedPreferences prefs = context.getSharedPreferences("Settings", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putString(key, value).apply();
}
public static String getPref(String key, Context context) {
SharedPreferences preferences = context.getSharedPreferences("Settings", Context.MODE_PRIVATE);
return preferences.getString(key, null);
}
}
And here is the relevant section of the LogCat:
03-29 14:50:52.130 428-2989/com.it.baraka D/BLUET_Service_Network: onDiscoveryChange() - enabled: true
03-29 14:50:52.132 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:52.132 428-428/com.it.baraka D/BluetoothLeScanner: Start Scan
03-29 14:50:52.135 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:52.138 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:52.146 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:52.146 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:52.253 428-1035/com.it.baraka D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7 mClientIf=0
03-29 14:50:52.310 428-507/com.it.baraka V/FA: Activity resumed, time: 521562188
03-29 14:50:52.328 428-428/com.it.baraka D/ViewRootImpl@24fd2b4[ScanActivity]: MSG_WINDOW_FOCUS_CHANGED 1
03-29 14:50:52.330 428-428/com.it.baraka V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@8a464e nm : com.it.baraka ic=null
03-29 14:50:52.330 428-428/com.it.baraka I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
03-29 14:50:52.339 428-428/com.it.baraka D/InputTransport: Input channel constructed: fd=83
03-29 14:50:52.773 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:52.773 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:52.799 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:52.799 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:52.815 428-428/com.it.baraka I/com.st.BlueSTSDK.Node: Name: BM2V220
TxPower: 0
Address: C0:7A:17:31:43:48
Feature Mask: 0x4CF40402
Protocol Version: 0x1
03-29 14:50:52.816 428-2989/com.it.baraka D/BLUET_Service_Network: onNodeDiscovered - TAG: C0:7A:17:31:43:48
03-29 14:50:52.816 428-2991/com.it.baraka D/ScanActivityonNodeDiscovered: node.getTag: C0:7A:17:31:43:48
03-29 14:50:52.816 428-2989/com.it.baraka D/BLUET_Service_Network: onNodeDiscovered - paired_tag: null
03-29 14:50:52.819 428-433/com.it.baraka I/art: Do partial code cache collection, code=23KB, data=29KB
03-29 14:50:52.820 428-433/com.it.baraka I/art: After code cache collection, code=23KB, data=29KB
03-29 14:50:52.820 428-433/com.it.baraka I/art: Increasing code cache capacity to 128KB
03-29 14:50:52.825 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:52.826 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:52.830 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:52.835 428-428/com.it.baraka D/AbsListView: onsize change
03-29 14:50:52.839 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:52.839 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:52.894 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:52.895 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:53.185 428-428/com.it.baraka D/BLUET_Service_Network: checkBluetooth()
03-29 14:50:53.186 428-428/com.it.baraka D/BLUET_Service_Network: Bluetooth is enabled
03-29 14:50:53.186 428-428/com.it.baraka D/BLUET_Service_Network: No paired device found
03-29 14:50:53.186 428-428/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 14:50:54.077 428-428/com.it.baraka D/ViewRootImpl@24fd2b4[ScanActivity]: ViewPostImeInputStage processPointer 0
03-29 14:50:54.187 428-428/com.it.baraka D/ViewRootImpl@24fd2b4[ScanActivity]: ViewPostImeInputStage processPointer 1
03-29 14:50:54.198 428-428/com.it.baraka D/ScanActivity: bluetoothStartService
03-29 14:50:54.199 428-428/com.it.baraka D/ScanActivity: test permissionsToAsk.size: 0
03-29 14:50:54.199 428-428/com.it.baraka D/ScanActivity: test permissionsNotAsk.size: 0
03-29 14:50:54.199 428-428/com.it.baraka D/ScanActivity: non serve nessun permesso
03-29 14:50:54.199 428-428/com.it.baraka D/ScanActivity: enable_BLUETOOTH_Service()
03-29 14:50:54.224 428-428/com.it.baraka D/ViewRootImpl@24fd2b4[ScanActivity]: MSG_WINDOW_FOCUS_CHANGED 0
03-29 14:50:54.226 428-507/com.it.baraka V/FA: Recording user engagement, ms: 1919
03-29 14:50:54.228 428-507/com.it.baraka V/FA: Activity paused, time: 521564107
03-29 14:50:54.232 428-507/com.it.baraka D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=1919, firebase_screen_class(_sc)=ScanActivity, firebase_screen_id(_si)=-2898521176110268152}]
03-29 14:50:54.273 428-428/com.it.baraka V/FA: onActivityCreated
03-29 14:50:54.300 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.301 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.305 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.314 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.315 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.316 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.319 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.320 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.320 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.338 428-507/com.it.baraka V/FA: Activity resumed, time: 521564215
03-29 14:50:54.342 428-507/com.it.baraka D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=ScanActivity, firebase_previous_id(_pi)=-2898521176110268152, firebase_screen_class(_sc)=Access, firebase_screen_id(_si)=-2898521176110268151}]
03-29 14:50:54.354 428-428/com.it.baraka D/InputTransport: Input channel constructed: fd=107
03-29 14:50:54.354 428-428/com.it.baraka D/ViewRootImpl@90789e5[Access]: setView = DecorView@76dd2c8[Access] touchMode=true
03-29 14:50:54.378 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.382 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.401 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.404 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.406 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.409 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.417 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.420 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.422 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.424 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.426 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.428 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.429 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.431 428-428/com.it.baraka D/TextView: setTypeface with style : 0
03-29 14:50:54.473 428-619/com.it.baraka D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000, [1080x1920]-format:1
03-29 14:50:54.541 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:54.542 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:54.593 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:54.593 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:54.608 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:54.608 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:54.611 428-428/com.it.baraka D/ViewRootImpl@90789e5[Access]: MSG_RESIZED_REPORT: ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
03-29 14:50:54.611 428-428/com.it.baraka D/ViewRootImpl@90789e5[Access]: MSG_WINDOW_FOCUS_CHANGED 1
03-29 14:50:54.614 428-428/com.it.baraka V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@b2e287b nm : com.it.baraka ic=com.android.internal.widget.EditableInputConnection@d1ee698
03-29 14:50:54.614 428-428/com.it.baraka I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
03-29 14:50:54.617 428-428/com.it.baraka D/InputTransport: Input channel constructed: fd=108
03-29 14:50:54.617 428-428/com.it.baraka D/InputTransport: Input channel destroyed: fd=83
03-29 14:50:54.640 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:54.641 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:54.645 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:54.645 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:54.840 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:54.842 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:54.845 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:54.846 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:54.846 428-428/com.it.baraka D/BluetoothLeScanner: Stop Scan
03-29 14:50:54.851 428-2991/com.it.baraka D/BLUET_Service_Network: onDiscoveryChange() - enabled: false
03-29 14:50:54.854 428-428/com.it.baraka D/ViewRootImpl@24fd2b4[ScanActivity]: dispatchDetachedFromWindow
03-29 14:50:54.860 428-428/com.it.baraka D/InputTransport: Input channel destroyed: fd=93
03-29 14:50:56.552 428-428/com.it.baraka D/ViewRootImpl@90789e5[Access]: ViewPostImeInputStage processPointer 0
03-29 14:50:56.626 428-428/com.it.baraka D/ViewRootImpl@90789e5[Access]: ViewPostImeInputStage processPointer 1
03-29 14:50:58.186 428-428/com.it.baraka D/BLUET_Service_Network: checkBluetooth()
03-29 14:50:58.188 428-428/com.it.baraka D/BLUET_Service_Network: Bluetooth is enabled
03-29 14:50:58.189 428-428/com.it.baraka D/BLUET_Service_Network: Paired tag: C0:7A:17:31:43:48
03-29 14:50:58.189 428-428/com.it.baraka D/BLUET_Service_Network: Paired name: BM2V220
03-29 14:50:58.189 428-428/com.it.baraka D/BLUET_Service_Network: mManager != null
03-29 14:50:58.192 428-2989/com.it.baraka D/BLUET_Service_Network: onDiscoveryChange() - enabled: true
03-29 14:50:58.193 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:58.197 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:58.197 428-428/com.it.baraka D/BluetoothLeScanner: Start Scan
03-29 14:50:58.199 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:58.201 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:58.205 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:58.206 428-428/com.it.baraka D/BluetoothAdapter: STATE_ON
03-29 14:50:58.333 428-443/com.it.baraka D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7 mClientIf=0
03-29 14:50:58.341 428-428/com.it.baraka D/BLUET_Service_Network: mNode != null
03-29 14:50:58.341 428-428/com.it.baraka D/BLUET_Service_Network: !mNode.isConnected()
03-29 14:50:58.341 428-428/com.it.baraka D/NodeStateListener: BM2V220 Idle->Connecting
03-29 14:50:58.347 428-428/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 14:50:58.370 428-428/com.it.baraka D/BluetoothGatt: connect() - device: C0:7A:17:31:43:XX, auto: false
03-29 14:50:58.370 428-428/com.it.baraka D/BluetoothAdapter: isSecureModeEnabled
03-29 14:50:58.371 428-428/com.it.baraka D/BluetoothGatt: registerApp()
03-29 14:50:58.371 428-428/com.it.baraka D/BluetoothGatt: registerApp() - UUID=1c034921-5f7b-4072-8bf0-571d539cee52
03-29 14:50:58.476 428-1035/com.it.baraka D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8
03-29 14:50:59.363 428-507/com.it.baraka V/FA: Inactivity, disconnecting from the service
03-29 14:50:59.365 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:59.365 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:59.391 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:59.391 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:59.392 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:59.392 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:59.392 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:59.392 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:59.468 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:50:59.468 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:50:59.543 428-1035/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=8 device=C0:7A:17:31:43:XX
03-29 14:50:59.569 428-1035/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 0 newState: 2 boundState:10
03-29 14:50:59.881 428-428/com.it.baraka D/BluetoothGatt: discoverServices() - device: C0:7A:17:31:43:XX
03-29 14:51:00.161 428-1035/com.it.baraka D/BluetoothGatt: onClientConnParamsChanged() - Device=C0:7A:17:31:43:XX interval=15 status=0
03-29 14:51:00.293 428-449/com.it.baraka D/BluetoothGatt: onClientConnParamsChanged() - Device=C0:7A:17:31:43:XX interval=6 status=0
03-29 14:51:00.827 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:00.832 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:00.833 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:00.866 428-443/com.it.baraka D/BluetoothGatt: onSearchComplete() = Device=C0:7A:17:31:43:XX Status=0
03-29 14:51:00.870 428-443/com.it.baraka D/com.st.BlueSTSDK.Node: onServicesDiscovered status:0 boundState:10
03-29 14:51:00.932 428-443/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Connected
03-29 14:51:00.932 428-443/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connected
03-29 14:51:00.932 428-443/com.it.baraka D/BluetoothGatt: onClientConnParamsChanged() - Device=C0:7A:17:31:43:XX interval=15 status=0
03-29 14:51:00.934 428-428/com.it.baraka D/BluetoothGatt: setCharacteristicNotification() - uuid: 00000002-000f-11e1-ac36-0002a5d5c51b enable: true
03-29 14:51:02.378 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:02.378 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:02.418 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:02.425 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:02.425 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:02.428 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:02.428 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:02.485 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:02.485 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:03.353 428-428/com.it.baraka D/BLUET_Service_Network: checkBluetooth()
03-29 14:51:03.355 428-428/com.it.baraka D/BLUET_Service_Network: Bluetooth is enabled
03-29 14:51:03.355 428-428/com.it.baraka D/BLUET_Service_Network: Paired tag: C0:7A:17:31:43:48
03-29 14:51:03.356 428-428/com.it.baraka D/BLUET_Service_Network: Paired name: BM2V220
03-29 14:51:03.356 428-428/com.it.baraka D/BLUET_Service_Network: mManager != null
03-29 14:51:03.357 428-428/com.it.baraka D/BLUET_Service_Network: mNode != null
03-29 14:51:03.358 428-428/com.it.baraka I/BLUET_Service_Network: Device already connected
03-29 14:51:03.358 428-428/com.it.baraka D/BLUET_Service_Network: captureEvents()
03-29 14:51:03.361 428-428/com.it.baraka D/BLUET_Service_Network: captureEvents() - Rotazione attiva
03-29 14:51:03.361 428-428/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 14:51:03.370 428-428/com.it.baraka D/BluetoothGatt: setCharacteristicNotification() - uuid: 00000400-0001-11e1-ac36-0002a5d5c51b enable: true
03-29 14:51:03.447 428-3068/com.it.baraka D/BLUET_Service_Network: onDetectableEventChange - event: Orientation / status: true
03-29 14:51:03.449 428-3068/com.it.baraka D/FeatureAccelerationEvent: onUpdate()
03-29 14:51:03.450 428-3068/com.it.baraka D/FeatureAccelerationEvent: event: 5
03-29 14:51:03.450 428-3068/com.it.baraka D/FeatureAccelerationEvent: eventType: 5
03-29 14:51:03.450 428-3068/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 14:51:03.950 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:03.951 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:03.977 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:03.977 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:03.984 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:03.984 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:04.055 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:04.055 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:04.102 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:04.102 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:04.107 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:04.107 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:05.618 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:05.625 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:05.625 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:05.629 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:05.629 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:05.642 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:05.642 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:05.729 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:05.741 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:05.741 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:05.749 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:05.749 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:07.198 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:07.198 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:07.225 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:07.236 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:07.236 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:07.244 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:07.245 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:07.300 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:07.300 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:08.364 428-428/com.it.baraka D/BLUET_Service_Network: checkBluetooth()
03-29 14:51:08.366 428-428/com.it.baraka D/BLUET_Service_Network: Bluetooth is enabled
03-29 14:51:08.367 428-428/com.it.baraka D/BLUET_Service_Network: Paired tag: C0:7A:17:31:43:48
03-29 14:51:08.368 428-428/com.it.baraka D/BLUET_Service_Network: Paired name: BM2V220
03-29 14:51:08.368 428-428/com.it.baraka D/BLUET_Service_Network: mManager != null
03-29 14:51:08.371 428-428/com.it.baraka D/BLUET_Service_Network: mNode != null
03-29 14:51:08.371 428-428/com.it.baraka I/BLUET_Service_Network: Device already connected
03-29 14:51:08.371 428-428/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 14:51:08.795 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:08.795 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:08.821 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:08.832 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:08.832 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:08.846 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:08.846 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:08.892 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:08.892 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:08.936 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:08.944 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:08.944 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:10.342 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:10.355 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:10.355 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:10.365 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:10.365 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:10.374 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:10.374 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:11.823 428-443/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=8 device=C0:7A:17:31:43:XX
03-29 14:51:11.833 428-443/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 8 newState: 0 boundState:10
03-29 14:51:11.834 428-443/com.it.baraka D/BluetoothGatt: close()
03-29 14:51:11.838 428-443/com.it.baraka D/BluetoothGatt: unregisterApp() - mClientIf=8
03-29 14:51:11.842 428-443/com.it.baraka E/com.st.BlueSTSDK.Node: Error connecting to the node:BM2V220
03-29 14:51:11.881 428-443/com.it.baraka D/NodeStateListener: BM2V220 Connected->Dead
03-29 14:51:11.882 428-443/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 14:51:11.996 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:12.005 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:12.005 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:12.016 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:12.016 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:12.034 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:12.034 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:13.374 428-428/com.it.baraka D/BLUET_Service_Network: checkBluetooth()
03-29 14:51:13.376 428-428/com.it.baraka D/BLUET_Service_Network: Bluetooth is enabled
03-29 14:51:13.376 428-428/com.it.baraka D/BLUET_Service_Network: Paired tag: C0:7A:17:31:43:48
03-29 14:51:13.376 428-428/com.it.baraka D/BLUET_Service_Network: Paired name: BM2V220
03-29 14:51:13.376 428-428/com.it.baraka D/BLUET_Service_Network: mManager != null
03-29 14:51:13.378 428-428/com.it.baraka D/BLUET_Service_Network: mNode != null
03-29 14:51:13.378 428-428/com.it.baraka D/BLUET_Service_Network: !mNode.isConnected()
03-29 14:51:13.379 428-428/com.it.baraka D/NodeStateListener: BM2V220 Dead->Connecting
03-29 14:51:13.379 428-428/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 14:51:13.383 428-428/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 14:51:13.390 428-428/com.it.baraka D/BluetoothGatt: connect() - device: C0:7A:17:31:43:XX, auto: false
03-29 14:51:13.390 428-428/com.it.baraka D/BluetoothAdapter: isSecureModeEnabled
03-29 14:51:13.391 428-428/com.it.baraka D/BluetoothGatt: registerApp()
03-29 14:51:13.392 428-428/com.it.baraka D/BluetoothGatt: registerApp() - UUID=38f2890e-b3cb-460d-ab71-3a70aa8e369c
03-29 14:51:13.502 428-449/com.it.baraka D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8
03-29 14:51:15.145 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:15.145 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:15.230 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:15.236 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:15.236 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:15.242 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:15.242 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:15.259 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:15.259 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:16.844 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:16.845 428-443/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:18.385 428-428/com.it.baraka D/BLUET_Service_Network: checkBluetooth()
03-29 14:51:18.389 428-428/com.it.baraka D/BLUET_Service_Network: Bluetooth is enabled
03-29 14:51:18.390 428-428/com.it.baraka D/BLUET_Service_Network: Paired tag: C0:7A:17:31:43:48
03-29 14:51:18.390 428-428/com.it.baraka D/BLUET_Service_Network: Paired name: BM2V220
03-29 14:51:18.390 428-428/com.it.baraka D/BLUET_Service_Network: mManager != null
03-29 14:51:18.393 428-428/com.it.baraka D/BLUET_Service_Network: mNode != null
03-29 14:51:18.397 428-428/com.it.baraka D/BLUET_Service_Network: !mNode.isConnected()
03-29 14:51:18.399 428-428/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Connecting
03-29 14:51:18.399 428-428/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 14:51:18.399 428-428/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 14:51:18.399 428-428/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 14:51:18.400 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:18.400 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:18.406 428-428/com.it.baraka D/BluetoothGatt: connect() - device: C0:7A:17:31:43:XX, auto: false
03-29 14:51:18.407 428-428/com.it.baraka D/BluetoothAdapter: isSecureModeEnabled
03-29 14:51:18.408 428-428/com.it.baraka D/BluetoothGatt: registerApp()
03-29 14:51:18.408 428-428/com.it.baraka D/BluetoothGatt: registerApp() - UUID=03f28aaa-9d5c-4d47-9ccb-59d014074d91
03-29 14:51:18.418 428-443/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:18.427 428-449/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:18.427 428-449/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:18.432 428-1035/com.it.baraka D/ScanRecord: parseFromBytes
03-29 14:51:18.433 428-1035/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 14:51:18.517 428-443/com.it.baraka D/BluetoothGatt: onClientRegistered() - status=0 clientIf=9
03-29 14:51:18.549 428-449/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=8 device=C0:7A:17:31:43:XX
03-29 14:51:18.549 428-1035/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=9 device=C0:7A:17:31:43:XX
03-29 14:51:18.556 428-449/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 133 newState: 0 boundState:10
03-29 14:51:18.556 428-449/com.it.baraka D/BluetoothGatt: close()
03-29 14:51:18.556 428-1035/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 133 newState: 0 boundState:10
03-29 14:51:18.556 428-1035/com.it.baraka D/BluetoothGatt: close()
03-29 14:51:18.557 428-449/com.it.baraka D/BluetoothGatt: unregisterApp() - mClientIf=9
03-29 14:51:18.558 428-1035/com.it.baraka D/BluetoothGatt: unregisterApp() - mClientIf=9
03-29 14:51:18.560 428-449/com.it.baraka E/com.st.BlueSTSDK.Node: Error connecting to the node:BM2V220
03-29 14:51:18.563 428-1035/com.it.baraka W/System.err: java.lang.IllegalArgumentException: Receiver not registered: com.st.BlueSTSDK.Node$8@8361734
03-29 14:51:18.565 428-449/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Dead
03-29 14:51:18.565 428-449/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 14:51:18.566 428-449/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 14:51:18.566 428-449/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 14:51:18.566 428-1035/com.it.baraka W/System.err: at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1054)
03-29 14:51:18.566 428-1035/com.it.baraka W/System.err: at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1376)
03-29 14:51:18.566 428-1035/com.it.baraka W/System.err: at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:659)
03-29 14:51:18.566 428-1035/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node$5.onStateChange(Node.java:754)
03-29 14:51:18.566 428-1035/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node.updateNodeStatus(Node.java:916)
03-29 14:51:18.567 428-1035/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node$GattNodeConnection.onConnectionStateChange(Node.java:248)
03-29 14:51:18.567 428-1035/com.it.baraka W/System.err: at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:229)
03-29 14:51:18.567 428-1035/com.it.baraka W/System.err: at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:70)
03-29 14:51:18.567 428-1035/com.it.baraka W/System.err: at android.os.Binder.execTransact(Binder.java:573)
03-29 14:51:18.567 428-1035/com.it.baraka D/NodeStateListener: BM2V220 Dead->Dead
03-29 14:51:18.567 428-1035/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 14:51:18.567 428-1035/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 14:51:18.567 428-1035/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
the BlueMicrosystem 2.2 is quite old firmware.. you should update it.
by the way could be that you call 2 times connect? (first time at: 03-29 14:51:13.379, second time at minute: 14:51:18.399) the bluetooth stack is quite fragile, if you do 2 things at the time it breaks, and you have the generic status 133 ( 03-29 14:51:18.556 ).
The only way, that I know, to recover an status 133 is to avoid to go in that state :)
instead of using the handler with the self posting runnable you should use the listeners.
create a manager listener that start the connection when find the correct node
create a node listener that enable the notification when the node is connect and re connect if the node disconnect (like here)
create a feature listener that send the broadcast when the orientation change.
Said this, I don't know why your SensorTile disconnect and did not connect again in 5seconds..
Giovanni
I do not try to connect in those lines. Those are SDK's Logs. I check every 5 seconds for bluetooth, i need to reconnect every single time the bluetooth is ON, then i check if the mNode is != null and if it's not connected, ONLY in that case i look again for the device with mManager.getSharedInstance().getNodeWithTag("MY TAG DEVICE"); and call connect() function.
So I don't think the problem is on the flow... And yes the strangest thing is that it can't reconnect again, i must disconnect alimentation and reconnect again.
Do you have something more to suggest to me?
look this line:
03-29 14:51:18.399 428-428/com.it.baraka D/NodeStateListener: BM2V220 Connecting-Connecting 03-29 14:51:18.399 428-428/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting 03-29 14:51:18.399 428-428/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
do you know why are you printing 2 times the "onStateChange" line?
look to this line:
if(mNode != null) {
Log.d(TAG, "mNode != null");
if(!mNode.isConnected()) {
Log.d(TAG, "!mNode.isConnected()");
isConnected = true;
gotFeatures = false;
mNode.connect(getApplicationContext());
mNode.addNodeStateListener(new Node.NodeStateListener() {
@Override
public void onStateChange(Node node, Node.State newState, Node.State prevState) {
Log.d(TAG,"onStateChange - Node.State: " + newState.name());
}
});
}
your current state is "connecting" from this line:
03-29 14:51:13.379 428-428/com.it.baraka D/NodeStateListener: BM2V220 Dead->Connecting
so the isConnected return false, you call connect and you add a second listener that print the state change for the second time..
Can you use the BlueMS app or the example app and see if you have the same behaviours?
ps: I'm able to recognise the differences between logs and code lines ;)
So.. should i declare the listener globally and add and remove later calling the variable, or just adding once?
The "problem" is that i need to keep on the time based handler.
I changed my code with the 1st case, calling remove and after add just for some tests, and it have again the same problems:
03-29 18:04:14.292 31601-31601/com.it.baraka D/BLUET_Service_Network: checkBluetooth()
03-29 18:04:14.293 31601-31601/com.it.baraka D/BLUET_Service_Network: Bluetooth is enabled
03-29 18:04:14.293 31601-31601/com.it.baraka D/BLUET_Service_Network: Paired tag: C0:7A:17:31:43:48
03-29 18:04:14.293 31601-31601/com.it.baraka D/BLUET_Service_Network: Paired name: BM2V220
03-29 18:04:14.293 31601-31601/com.it.baraka D/BLUET_Service_Network: mManager != null
03-29 18:04:14.295 31601-31601/com.it.baraka D/BLUET_Service_Network: mNode != null
03-29 18:04:14.296 31601-31601/com.it.baraka I/BLUET_Service_Network: Device already connected
03-29 18:04:14.296 31601-31601/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 18:04:14.646 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:14.646 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:14.678 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:14.679 31601-302/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:14.694 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:14.694 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:14.771 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:14.782 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:14.782 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:14.784 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:14.784 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:14.787 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:14.787 31601-302/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:14.817 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:14.817 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:14.821 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:14.821 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:15.479 31601-31614/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=7 device=C0:7A:17:31:43:XX
03-29 18:04:15.494 31601-31614/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 8 newState: 0 boundState:10
03-29 18:04:15.494 31601-31614/com.it.baraka D/BluetoothGatt: close()
03-29 18:04:15.497 31601-31614/com.it.baraka D/BluetoothGatt: unregisterApp() - mClientIf=7
03-29 18:04:15.502 31601-31614/com.it.baraka E/com.st.BlueSTSDK.Node: Error connecting to the node:BM2V220
03-29 18:04:15.588 31601-31614/com.it.baraka D/NodeStateListener: BM2V220 Connected->Dead
03-29 18:04:15.588 31601-31614/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 18:04:15.588 31601-31614/com.it.baraka D/NodeStateListener: BM2V220 Dead->Connecting
03-29 18:04:15.588 31601-31614/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 18:04:15.607 31601-31601/com.it.baraka D/BluetoothGatt: connect() - device: C0:7A:17:31:43:XX, auto: false
03-29 18:04:15.607 31601-31601/com.it.baraka D/BluetoothAdapter: isSecureModeEnabled
03-29 18:04:15.608 31601-31601/com.it.baraka D/BluetoothGatt: registerApp()
03-29 18:04:15.609 31601-31601/com.it.baraka D/BluetoothGatt: registerApp() - UUID=2ded7f1f-75b2-4d5c-9c80-66aa41dc19ad
03-29 18:04:15.715 31601-302/com.it.baraka D/BluetoothGatt: onClientRegistered() - status=0 clientIf=7
03-29 18:04:16.259 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:16.269 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:16.269 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:16.272 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:16.272 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:16.372 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:16.372 31601-302/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:16.380 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:16.384 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:16.384 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:16.389 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:16.389 31601-302/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:17.853 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:17.950 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:17.954 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:17.955 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:17.969 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:17.969 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:17.971 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:17.982 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:17.982 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:17.989 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:17.989 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:19.297 31601-31601/com.it.baraka D/BLUET_Service_Network: checkBluetooth()
03-29 18:04:19.301 31601-31601/com.it.baraka D/BLUET_Service_Network: Bluetooth is enabled
03-29 18:04:19.301 31601-31601/com.it.baraka D/BLUET_Service_Network: Paired tag: C0:7A:17:31:43:48
03-29 18:04:19.302 31601-31601/com.it.baraka D/BLUET_Service_Network: Paired name: BM2V220
03-29 18:04:19.302 31601-31601/com.it.baraka D/BLUET_Service_Network: mManager != null
03-29 18:04:19.305 31601-31601/com.it.baraka D/BLUET_Service_Network: mNode != null
03-29 18:04:19.305 31601-31601/com.it.baraka D/BLUET_Service_Network: !mNode.isConnected()
03-29 18:04:19.306 31601-31601/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Connecting
03-29 18:04:19.306 31601-31601/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 18:04:19.307 31601-31601/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 18:04:19.318 31601-31601/com.it.baraka D/BluetoothGatt: connect() - device: C0:7A:17:31:43:XX, auto: false
03-29 18:04:19.319 31601-31601/com.it.baraka D/BluetoothAdapter: isSecureModeEnabled
03-29 18:04:19.321 31601-31601/com.it.baraka D/BluetoothGatt: registerApp()
03-29 18:04:19.322 31601-31601/com.it.baraka D/BluetoothGatt: registerApp() - UUID=3826fd5a-2ff1-45ed-9673-c1d3cff67a73
03-29 18:04:19.432 31601-31613/com.it.baraka D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8
03-29 18:04:19.470 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:19.471 31601-302/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:19.501 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:19.502 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:19.515 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:19.515 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:20.732 31601-31613/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=7 device=C0:7A:17:31:43:XX
03-29 18:04:20.733 31601-302/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=8 device=C0:7A:17:31:43:XX
03-29 18:04:20.740 31601-31613/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 133 newState: 0 boundState:10
03-29 18:04:20.741 31601-31613/com.it.baraka D/BluetoothGatt: close()
03-29 18:04:20.741 31601-302/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 133 newState: 0 boundState:10
03-29 18:04:20.742 31601-302/com.it.baraka D/BluetoothGatt: close()
03-29 18:04:20.742 31601-31613/com.it.baraka D/BluetoothGatt: unregisterApp() - mClientIf=8
03-29 18:04:20.742 31601-302/com.it.baraka D/BluetoothGatt: unregisterApp() - mClientIf=8
03-29 18:04:20.745 31601-31613/com.it.baraka E/com.st.BlueSTSDK.Node: Error connecting to the node:BM2V220
03-29 18:04:20.748 31601-302/com.it.baraka W/System.err: java.lang.IllegalArgumentException: Receiver not registered: com.st.BlueSTSDK.Node$8@ed8d506
03-29 18:04:20.749 31601-31613/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Dead
03-29 18:04:20.750 31601-31613/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 18:04:20.750 31601-31613/com.it.baraka D/NodeStateListener: BM2V220 Dead->Connecting
03-29 18:04:20.750 31601-31613/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 18:04:20.752 31601-302/com.it.baraka W/System.err: at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1054)
03-29 18:04:20.752 31601-302/com.it.baraka W/System.err: at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1376)
03-29 18:04:20.752 31601-302/com.it.baraka W/System.err: at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:659)
03-29 18:04:20.753 31601-302/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node$5.onStateChange(Node.java:754)
03-29 18:04:20.753 31601-302/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node.updateNodeStatus(Node.java:916)
03-29 18:04:20.753 31601-302/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node$GattNodeConnection.onConnectionStateChange(Node.java:248)
03-29 18:04:20.753 31601-302/com.it.baraka W/System.err: at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:229)
03-29 18:04:20.753 31601-302/com.it.baraka W/System.err: at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:70)
03-29 18:04:20.753 31601-302/com.it.baraka W/System.err: at android.os.Binder.execTransact(Binder.java:573)
03-29 18:04:20.753 31601-302/com.it.baraka D/NodeStateListener: BM2V220 Dead->Dead
03-29 18:04:20.753 31601-302/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 18:04:20.754 31601-302/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Connecting
03-29 18:04:20.754 31601-302/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 18:04:20.760 31601-31601/com.it.baraka D/BluetoothGatt: connect() - device: C0:7A:17:31:43:XX, auto: false
03-29 18:04:20.761 31601-31601/com.it.baraka D/BluetoothAdapter: isSecureModeEnabled
03-29 18:04:20.762 31601-31601/com.it.baraka D/BluetoothGatt: registerApp()
03-29 18:04:20.763 31601-31601/com.it.baraka D/BluetoothGatt: registerApp() - UUID=83aa9b3f-ab7a-4f97-b47e-9a61671fa377
03-29 18:04:20.869 31601-31613/com.it.baraka D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8
03-29 18:04:20.872 31601-31601/com.it.baraka D/BluetoothGatt: connect() - device: C0:7A:17:31:43:XX, auto: false
03-29 18:04:20.872 31601-31601/com.it.baraka D/BluetoothAdapter: isSecureModeEnabled
03-29 18:04:20.873 31601-31601/com.it.baraka D/BluetoothGatt: registerApp()
03-29 18:04:20.873 31601-31601/com.it.baraka D/BluetoothGatt: registerApp() - UUID=a96e3b31-f350-4297-99c2-9e2e39ca8b8d
03-29 18:04:20.981 31601-302/com.it.baraka D/BluetoothGatt: onClientRegistered() - status=0 clientIf=9
03-29 18:04:21.092 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:21.092 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:21.102 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:21.110 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:21.110 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:21.114 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:21.114 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:21.192 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:21.193 31601-302/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:22.708 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:22.708 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:22.730 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:22.730 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:22.756 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:22.756 31601-302/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:24.311 31601-31601/com.it.baraka D/BLUET_Service_Network: checkBluetooth()
03-29 18:04:24.312 31601-31601/com.it.baraka D/BLUET_Service_Network: Bluetooth is enabled
03-29 18:04:24.313 31601-31601/com.it.baraka D/BLUET_Service_Network: Paired tag: C0:7A:17:31:43:48
03-29 18:04:24.313 31601-31601/com.it.baraka D/BLUET_Service_Network: Paired name: BM2V220
03-29 18:04:24.313 31601-31601/com.it.baraka D/BLUET_Service_Network: mManager != null
03-29 18:04:24.315 31601-31601/com.it.baraka D/BLUET_Service_Network: mNode != null
03-29 18:04:24.315 31601-31601/com.it.baraka D/BLUET_Service_Network: !mNode.isConnected()
03-29 18:04:24.315 31601-31601/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Connecting
03-29 18:04:24.315 31601-31601/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 18:04:24.316 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:24.316 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:24.316 31601-31601/com.it.baraka D/BLUET_Service_Network: entered sendOrientation
03-29 18:04:24.323 31601-31601/com.it.baraka D/BluetoothGatt: connect() - device: C0:7A:17:31:43:XX, auto: false
03-29 18:04:24.323 31601-31601/com.it.baraka D/BluetoothAdapter: isSecureModeEnabled
03-29 18:04:24.324 31601-31601/com.it.baraka D/BluetoothGatt: registerApp()
03-29 18:04:24.324 31601-31601/com.it.baraka D/BluetoothGatt: registerApp() - UUID=9817f9b2-ca7e-490b-991a-d49aec9b38d0
03-29 18:04:24.346 31601-302/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:24.353 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:24.353 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:24.361 31601-31613/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:24.361 31601-31613/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:24.431 31601-302/com.it.baraka D/BluetoothGatt: onClientRegistered() - status=0 clientIf=10
03-29 18:04:25.880 31601-31614/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:25.880 31601-31614/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:25.884 31601-31613/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=8 device=C0:7A:17:31:43:XX
03-29 18:04:25.884 31601-302/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=9 device=C0:7A:17:31:43:XX
03-29 18:04:25.886 31601-31614/com.it.baraka D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=10 device=C0:7A:17:31:43:XX
03-29 18:04:25.891 31601-302/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 133 newState: 0 boundState:10
03-29 18:04:25.891 31601-302/com.it.baraka D/BluetoothGatt: close()
03-29 18:04:25.893 31601-302/com.it.baraka D/BluetoothGatt: unregisterApp() - mClientIf=10
03-29 18:04:25.893 31601-31614/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 133 newState: 0 boundState:10
03-29 18:04:25.893 31601-31614/com.it.baraka D/BluetoothGatt: close()
03-29 18:04:25.893 31601-31613/com.it.baraka D/com.st.BlueSTSDK.Node: Node: BM2V220 Status: 133 newState: 0 boundState:10
03-29 18:04:25.893 31601-31613/com.it.baraka D/BluetoothGatt: close()
03-29 18:04:25.894 31601-31614/com.it.baraka D/BluetoothGatt: unregisterApp() - mClientIf=10
03-29 18:04:25.896 31601-302/com.it.baraka E/com.st.BlueSTSDK.Node: Error connecting to the node:BM2V220
03-29 18:04:25.897 31601-31613/com.it.baraka D/BluetoothGatt: unregisterApp() - mClientIf=0
03-29 18:04:25.897 31601-31614/com.it.baraka W/System.err: java.lang.IllegalArgumentException: Receiver not registered: com.st.BlueSTSDK.Node$8@6b12d1d
03-29 18:04:25.897 31601-31614/com.it.baraka W/System.err: at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1054)
03-29 18:04:25.897 31601-31614/com.it.baraka W/System.err: at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1376)
03-29 18:04:25.897 31601-31614/com.it.baraka W/System.err: at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:659)
03-29 18:04:25.897 31601-302/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Dead
03-29 18:04:25.897 31601-31614/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node$5.onStateChange(Node.java:754)
03-29 18:04:25.897 31601-302/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 18:04:25.898 31601-302/com.it.baraka D/NodeStateListener: BM2V220 Dead->Connecting
03-29 18:04:25.898 31601-31614/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node.updateNodeStatus(Node.java:916)
03-29 18:04:25.898 31601-302/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 18:04:25.898 31601-31614/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node$GattNodeConnection.onConnectionStateChange(Node.java:248)
03-29 18:04:25.898 31601-31614/com.it.baraka W/System.err: at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:229)
03-29 18:04:25.898 31601-31614/com.it.baraka W/System.err: at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:70)
03-29 18:04:25.898 31601-31614/com.it.baraka W/System.err: at android.os.Binder.execTransact(Binder.java:573)
03-29 18:04:25.899 31601-31614/com.it.baraka D/NodeStateListener: BM2V220 Dead->Dead
03-29 18:04:25.899 31601-31614/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 18:04:25.899 31601-31614/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Connecting
03-29 18:04:25.899 31601-31614/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 18:04:25.900 31601-31613/com.it.baraka W/System.err: java.lang.IllegalArgumentException: Receiver not registered: com.st.BlueSTSDK.Node$8@6b12d1d
03-29 18:04:25.900 31601-31613/com.it.baraka W/System.err: at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1054)
03-29 18:04:25.900 31601-31613/com.it.baraka W/System.err: at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1376)
03-29 18:04:25.900 31601-31613/com.it.baraka W/System.err: at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:659)
03-29 18:04:25.900 31601-31613/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node$5.onStateChange(Node.java:754)
03-29 18:04:25.900 31601-31613/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node.updateNodeStatus(Node.java:916)
03-29 18:04:25.900 31601-31613/com.it.baraka W/System.err: at com.st.BlueSTSDK.Node$GattNodeConnection.onConnectionStateChange(Node.java:248)
03-29 18:04:25.900 31601-31613/com.it.baraka W/System.err: at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:229)
03-29 18:04:25.901 31601-31613/com.it.baraka W/System.err: at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:70)
03-29 18:04:25.901 31601-31613/com.it.baraka W/System.err: at android.os.Binder.execTransact(Binder.java:573)
03-29 18:04:25.901 31601-31613/com.it.baraka D/NodeStateListener: BM2V220 Dead->Dead
03-29 18:04:25.901 31601-31613/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Dead
03-29 18:04:25.901 31601-31613/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Connecting
03-29 18:04:25.901 31601-31613/com.it.baraka D/BLUET_Service_Network: onStateChange - Node.State: Connecting
03-29 18:04:25.906 31601-4520/com.it.baraka D/ScanRecord: parseFromBytes
03-29 18:04:25.906 31601-4520/com.it.baraka D/ScanRecord: first manudata for manu ID
03-29 18:04:25.918 31601-31601/com.it.baraka D/BluetoothGatt: connect() - device: C0:7A:17:31:43:XX, auto: false
03-29 18:04:25.919 31601-31601/com.it.baraka D/BluetoothAdapter: isSecureModeEnabled
I think you are still call connection when the node is connecting:
03-29 18:04:19.306 31601-31601/com.it.baraka D/NodeStateListener: BM2V220 Connecting->Connecting
can you use the BlueMS or the example app to see if the fw disconnect also with that applications?
Giovanni
I see that you are calling the method setEnable
the method should be protected, are you able to call it?
By the way it shouldn't have any effect. Look here to understand how to enable the notification
Sorry but it's all there. I don't use any more calls except what you can see there. In the code above there is all my use (again, in a Service started by a BroadcastReceiver)
Yes I call setEnable:
...
if(mNode.getFeature(FeatureAccelerationEvent.class) != null) {
featureAccelerationEvent = mNode.getFeature(FeatureAccelerationEvent.class);
if(featureAccelerationEvent != null){
featureAccelerationEvent.setEnable(true);
featureAccelerationEvent.addFeatureListener(new FeatureAccelerationEvent.FeatureAccelerationEventListener() {
...
Only here. I think it's right because I receive by Logs the gesture events.
For the previous question: It happened 1 time in 4/5 times in your application. I can't say if it was just a case. I am not able to use the code in the Example App Github's page because it is heavily grafted and not easy to rebuild.
try to enable swap the order of this lines:
featureAccelerationEvent.detectEvent(FeatureAccelerationEvent.DetectableEvent.ORIENTATION, true);
mNode.enableNotification(featureAccelerationEvent);
Thanks in advance. My problem is that I am able to connect the Node, but after a few seconds in goes in a cycle of two states:
State --> Connecting, State --> Dead
And repeat... infinitely. How could I to fix that?