Problema de conexión Android Bluetooth LE

He trabajado con un dispositivo que no es realmente compatible con Google BLE y en su lugar utiliza Samsung BLE SDK para su conexión. He intentado usar el SDK de Google y puede conectar con éxito, pero inmediatamente desconectado con el estado 19 después de conectado en el cual no hay ninguna documentación de cuál es esta situación implica.

03-02 00:07:55.572 1181-1181/alex.jstylemod I/art﹕ Late-enabling -Xcheck:jni 03-02 00:07:55.861 1181-1181/alex.jstylemod D/BluetoothAdapter﹕ startLeScan(): null 03-02 00:07:55.931 1181-1201/alex.jstylemod D/BluetoothLeScanner﹕ onClientRegistered() - status=0 clientIf=5 03-02 00:07:55.949 1181-1208/alex.jstylemod D/OpenGLRenderer﹕ Render dirty regions requested: true 03-02 00:07:55.965 1181-1181/alex.jstylemod D/Atlas﹕ Validating map... 03-02 00:07:55.985 1181-1208/alex.jstylemod I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BF.1.1.04.04.02.162.107_msm8226_LA.BF.1.1__release_AU () OpenGL ES Shader Compiler Version: E031.25.01.03 Build Date: 10/28/14 Tue Local Branch: Remote Branch: quic/l_LNX.LA.3.6 Local Patches: NONE Reconstruct Branch: AU_LINUX_ANDROID_LA.BF.1.1.04.04.02.162.107 + cb93e16 + f50fe49 + d7c18e6 + 5b9a565 + 0f3a25d + 607156e + 75511aa + e4d16c0 + 686f3eb + 211a271 + dd281ee + NOTHING 03-02 00:07:55.988 1181-1208/alex.jstylemod I/OpenGLRenderer﹕ Initialized EGL, version 1.4 03-02 00:07:56.010 1181-1208/alex.jstylemod D/OpenGLRenderer﹕ Enabling debug mode 0 03-02 00:07:57.769 1181-1201/alex.jstylemod D/BluetoothLeScanner﹕ onScanResult() - ScanResult{mDevice=B4:99:4C:67:72:70, mScanRecord=ScanRecord [mAdvertiseFlags=6, mServiceUuids=[0000fff0-0000-1000-8000-00805f9b34fb], mManufacturerSpecificData={}, mServiceData={}, mTxPowerLevel=0, mDeviceName=JStyle 677270], mRssi=-80, mTimestampNanos=128983439815617} 03-02 00:08:05.868 1181-1181/alex.jstylemod D/BluetoothAdapter﹕ stopLeScan() 03-02 00:08:27.348 1181-1181/alex.jstylemod D/BluetoothAdapter﹕ stopLeScan() 03-02 00:08:27.354 1181-1181/alex.jstylemod D/BluetoothAdapter﹕ scan not started yet 03-02 00:08:27.357 1181-1181/alex.jstylemod D/BluetoothGatt﹕ connect() - device: B4:99:4C:67:72:70, auto: false 03-02 00:08:27.357 1181-1181/alex.jstylemod D/BluetoothGatt﹕ registerApp() 03-02 00:08:27.357 1181-1181/alex.jstylemod D/BluetoothGatt﹕ registerApp() - UUID=76c2195c-0afe-4660-8164-f5f81f6fdc0a 03-02 00:08:27.366 1181-1201/alex.jstylemod D/BluetoothGatt﹕ onClientRegistered() - status=0 clientIf=5 03-02 00:08:27.379 1181-1181/alex.jstylemod D/BLEService﹕ Trying to create connection with autoconnect enabled 03-02 00:08:28.038 1181-1202/alex.jstylemod D/BluetoothGatt﹕ onClientConnectionState() - status=0 clientIf=5 device=B4:99:4C:67:72:70 03-02 00:08:28.046 1181-1202/alex.jstylemod I/BLEService﹕ Connected to GATT server 03-02 00:08:28.769 1181-1201/alex.jstylemod D/BluetoothGatt﹕ onClientConnectionState() - status=19 clientIf=5 device=B4:99:4C:67:72:70 03-02 00:08:28.769 1181-1201/alex.jstylemod I/BLEService﹕ Disconnected from GATT Server 

He intentado usar el SDK de Samsung BLE para este dispositivo (supuestamente apoyado en la aplicación oficial) y golpeé una pared donde no puedo atar el adaptador de GATT con éxito. También no he podido depurar para averiguar qué está mal desde que el frasco borró la depuración del número de línea. He adjuntado el código fuente de mis aplicaciones.

 03-06 16:05:39.981 2965-2965/alex.jstylemod I/art﹕ Late-enabling -Xcheck:jni 03-06 16:05:40.010 2965-2975/alex.jstylemod I/art﹕ Ignoring second debugger -- accepting and dropping 03-06 16:05:40.021 2965-2975/alex.jstylemod I/art﹕ Debugger is no longer active 03-06 16:05:40.175 2965-2965/alex.jstylemod D/BluetoothAdapter﹕ startLeScan(): null 03-06 16:05:40.239 2965-2982/alex.jstylemod D/BluetoothLeScanner﹕ onClientRegistered() - status=0 clientIf=5 03-06 16:05:40.287 2965-2988/alex.jstylemod D/OpenGLRenderer﹕ Render dirty regions requested: true 03-06 16:05:40.301 2965-2965/alex.jstylemod D/Atlas﹕ Validating map... 03-06 16:05:40.353 2965-2988/alex.jstylemod I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BF.1.1.04.04.02.162.107_msm8226_LA.BF.1.1__release_AU () OpenGL ES Shader Compiler Version: E031.25.01.03 Build Date: 10/28/14 Tue Local Branch: Remote Branch: quic/l_LNX.LA.3.6 Local Patches: NONE Reconstruct Branch: AU_LINUX_ANDROID_LA.BF.1.1.04.04.02.162.107 + cb93e16 + f50fe49 + d7c18e6 + 5b9a565 + 0f3a25d + 607156e + 75511aa + e4d16c0 + 686f3eb + 211a271 + dd281ee + NOTHING 03-06 16:05:40.359 2965-2988/alex.jstylemod I/OpenGLRenderer﹕ Initialized EGL, version 1.4 03-06 16:05:40.409 2965-2988/alex.jstylemod D/OpenGLRenderer﹕ Enabling debug mode 0 03-06 16:05:41.210 2965-2982/alex.jstylemod D/BluetoothLeScanner﹕ onScanResult() - ScanResult{mDevice=B4:99:4C:67:72:70, mScanRecord=ScanRecord [mAdvertiseFlags=6, mServiceUuids=[0000fff0-0000-1000-8000-00805f9b34fb], mManufacturerSpecificData={}, mServiceData={}, mTxPowerLevel=0, mDeviceName=JStyle 677270], mRssi=-82, mTimestampNanos=532107906138682} 03-06 16:05:43.502 2965-2965/alex.jstylemod D/BluetoothAdapter﹕ startLeScan(): null 03-06 16:05:43.503 2965-2965/alex.jstylemod E/BluetoothAdapter﹕ LE Scan has already started 03-06 16:05:50.182 2965-2965/alex.jstylemod D/BluetoothAdapter﹕ stopLeScan() 03-06 16:05:53.506 2965-2965/alex.jstylemod D/BluetoothAdapter﹕ stopLeScan() 03-06 16:05:53.512 2965-2965/alex.jstylemod D/BluetoothAdapter﹕ scan not started yet 03-06 16:06:15.795 4053-4053/alex.jstylemod D/BluetoothAdapter﹕ startLeScan(): null 03-06 16:06:15.843 4053-4071/alex.jstylemod D/BluetoothLeScanner﹕ onClientRegistered() - status=0 clientIf=5 03-06 16:06:16.022 4053-4074/alex.jstylemod D/OpenGLRenderer﹕ Render dirty regions requested: true 03-06 16:06:16.038 4053-4053/alex.jstylemod D/Atlas﹕ Validating map... 03-06 16:06:16.065 4053-4074/alex.jstylemod I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BF.1.1.04.04.02.162.107_msm8226_LA.BF.1.1__release_AU () OpenGL ES Shader Compiler Version: E031.25.01.03 Build Date: 10/28/14 Tue Local Branch: Remote Branch: quic/l_LNX.LA.3.6 Local Patches: NONE Reconstruct Branch: AU_LINUX_ANDROID_LA.BF.1.1.04.04.02.162.107 + cb93e16 + f50fe49 + d7c18e6 + 5b9a565 + 0f3a25d + 607156e + 75511aa + e4d16c0 + 686f3eb + 211a271 + dd281ee + NOTHING 03-06 16:06:16.067 4053-4074/alex.jstylemod I/OpenGLRenderer﹕ Initialized EGL, version 1.4 03-06 16:06:16.093 4053-4074/alex.jstylemod D/OpenGLRenderer﹕ Enabling debug mode 0 03-06 16:06:17.320 4053-4072/alex.jstylemod D/BluetoothLeScanner﹕ onScanResult() - ScanResult{mDevice=B4:99:4C:67:72:70, mScanRecord=ScanRecord [mAdvertiseFlags=6, mServiceUuids=[0000fff0-0000-1000-8000-00805f9b34fb], mManufacturerSpecificData={}, mServiceData={}, mTxPowerLevel=0, mDeviceName=JStyle 677270], mRssi=-80, mTimestampNanos=532144013210126} 03-06 16:06:25.797 4053-4053/alex.jstylemod D/BluetoothAdapter﹕ stopLeScan() 03-06 16:08:44.455 4053-4065/alex.jstylemod I/art﹕ Debugger is active 03-06 16:08:55.660 4053-4053/alex.jstylemod I/Choreographer﹕ Skipped 264 frames! The application may be doing too much work on its main thread. 03-06 16:08:57.227 4053-4053/alex.jstylemod D/SamsungBLEService﹕ Calling Samsung BLE Service 03-06 16:08:57.488 4053-4053/alex.jstylemod W/ContextImpl﹕ Implicit intents with startService are not safe: Intent { act=com.samsung.android.sdk.bt.gatt.IBluetoothGatt } android.content.ContextWrapper.bindService:538 com.samsung.android.sdk.bt.gatt.BluetoothGatt.<init>:-1 com.samsung.android.sdk.bt.gatt.BluetoothGattAdapter.getProfileProxy:-1 03-06 16:08:57.498 4053-4053/alex.jstylemod E/BtGatt.BluetoothGatt﹕ Could not bind to Bluetooth Gatt Service 03-06 16:09:00.252 4053-4053/alex.jstylemod D/BluetoothAdapter﹕ stopLeScan() 03-06 16:09:00.259 4053-4053/alex.jstylemod D/BluetoothAdapter﹕ scan not started yet 

Fuente en el código de llamada Actividad

 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); handler = new Handler(); BluetoothSetting.checkBluetoothSetting(this); bluetoothAdapter = BluetoothSetting.getBluetoothAdapter(this,null); Intent gattServiceIntent = new Intent(this, SamsungBLEService.class); Set<BluetoothDevice> deviceSet = bluetoothAdapter.getBondedDevices(); //Intent gattServiceIntent = new Intent(this, BLEService.class); startService(gattServiceIntent); boolean bindResult = bindService(gattServiceIntent, serviceConnection,BIND_AUTO_CREATE); //setContentView(R.layout.activity_device_list); } 

Servicio

 @Override public void onCreate() { Log.d(TAG, "Calling Samsung BLE Service"); bluetoothAdapter = BluetoothSetting.getBluetoothAdapter(null,this); if(bluetoothGatt == null) BluetoothGattAdapter.getProfileProxy(this, serviceListener, BluetoothGattAdapter.GATT); } 

¿Podrías arrojar luz a esto? Sé que soy novato en Android Development.

Gracias

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.