Galaxy s6 Android LL:onConnectionStateChange返回me 133错误状态

Galaxy s6 Android LL:onConnectionStateChange返回me 133错误状态,android,bluetooth-lowenergy,samsung-mobile,android-bluetooth,android-ble,Android,Bluetooth Lowenergy,Samsung Mobile,Android Bluetooth,Android Ble,我开发了一个应用程序,它必须重新连接到安装在特定设备上的服务器应用程序。我已经在一些设备上测试了我的应用程序,但是在galaxy s6和棒棒糖上我遇到了一些问题 这是组合: client (peripherall) is installed on galaxy tab 10.1 kitkat server (central role) is installed on galaxy s6 with lollipop ok client (peripherall) is installed o

我开发了一个应用程序,它必须重新连接到安装在特定设备上的服务器应用程序。我已经在一些设备上测试了我的应用程序,但是在galaxy s6和棒棒糖上我遇到了一些问题

这是组合:

client (peripherall) is installed on galaxy tab 10.1 kitkat 
server (central role) is installed on galaxy s6 with lollipop 
ok

client (peripherall) is installed on galaxy nexus 6 lollipop
server (central role) is installed on galaxy s6 with lollipop 
ok

client (peripherall) is installed on galaxy s6 lollipop
server (central role) is installed on galaxy nexus 6 with lollipop 
not working
在最后一次组合中,连接函数返回me 133状态

这是我的代码:

public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
    super.onConnectionStateChange(gatt, status, newState);
    Log.d("connect", "status = " + status + " newState = " + newState);
....
Kitkat和棒棒糖有什么区别?我必须以不同的方式处理连接吗

public void new_automatization() {
    automatizationInProgress = true;
    Log.d("connect","new auto: si parte");
    this.init();
    Bluetooth.getMe().stopScan();
    final String MACaddress=getDataFromPreferences("address");
    final String keycode=getDataFromPreferences("unlockcode");  

    if(!Bluetooth.getMe().isScanning()) {
        Bluetooth.getMe().startScan(new Bluetooth.ScanCallback() {
            boolean deviceIsFound = false;

            @Override
            public void onDeviceFound(final BluetoothDevice device, int rssi,byte[] scanRecord) {
                Log.d("testAlpha","dentro onDeviceFound");
                if(device != null) {
                    String address=new String();                    
                    if(device.getName() != null) {  
                        Log.d("testAlpha","trovato name: "+device.getName()+"mac: "+device.getAddress());
                        address=device.getName();
                        if(address.equals(MACaddress)) {
                            Log.d("testAlpha","mi connetto a: "+device.getName()+"mac: "+device.getAddress());
                            Bluetooth.getMe().stopScan();//possiamo riconnetterci
                            deviceIsFound=true;
                            setDevice(device);
                            unlock(keycode);
                            automatizationInProgress = false;
                        }
                    }
                } else {
                    Log.i("connect","dentro onDeviceFound null");
                    search_ended=true;
                    sendMessage(DEVICE_NOT_FOUND);
                    automatizationInProgress = false;
                }   
            }
        });
    }
}
这是startscan和stopscan功能:

    @SuppressWarnings("deprecation")
    public boolean startScan(ScanCallback callback, final long timeout) {

        stopScan();         
        scanCallback = callback;
        /*
          if (isScanning()) {
            stopScan();
            return true;
          }
          scanCallback = callback;

        // Stops scanning after a pre-defined scan period (10s).
        stopTimer = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(timeout);
                } catch (InterruptedException e) {
                    Log.i("debug","interrupted");
                    return;
                }

                Log.i("debug","bluetooth: inizia lo stopscan()");

                if(!isScanning())
                    return;

                Log.i("debug","amgbluetooth: pre scansione");
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    BluetoothLeScanner scanner = bluetoothAdapter
                            .getBluetoothLeScanner();
                    scanner.stopScan(scanCallbackAfterLollipop);
                    scanning = false;
                } else {
                    bluetoothAdapter.stopLeScan(scanCallbackBeforeLollipop);
                    scanning = false;
                }
                Log.i("debug","amgbluetooth:stopTimer, invio null");

                if(!Thread.currentThread().isInterrupted())
                    scanCallback.onDeviceFound(null, 0, null);

            }
        });

        stopTimer.start();*/
        pippo.removeCallbacks(solPippo);
        pippo.postDelayed(solPippo, timeout);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

            Log.i("finalT","amgbluetooth: inizia lo startscan() LL");

            BluetoothLeScanner scanner = bluetoothAdapter.getBluetoothLeScanner();
            scanning = true;

            scanCallbackAfterLollipop = new ScanCallback() {
                @Override
                public void onScanResult(int callbackType, ScanResult result) {
                    super.onScanResult(callbackType, result);
                    Log.d("finalT", "Single Result: "+result.getDevice().getName());

                    processResult(result);
                    /*
                    scanCallback.onDeviceFound(result.getDevice(), result.getRssi(), result.getScanRecord().getBytes());*/
                }

                @Override
                public void onBatchScanResults(List<ScanResult> results) {
                    Log.d("finalT", "onBatchScanResults: "+results.size()+" results");
                    /*
                      for (ScanResult result : results) {
                          processResult(result);
                      }*/
                  }

                  @Override
                  public void onScanFailed(int errorCode) {
                      Log.w("finalT", "LE Scan Failed: "+errorCode);
                  }

                  private void processResult(ScanResult result) {
                        BluetoothDevice device = result.getDevice();
                        Log.i("finalT", "New LE Device: " + device.getName() + " @ " + result.getRssi());

                        scanCallback.onDeviceFound(result.getDevice(),
                                result.getRssi(), result.getScanRecord()
                                        .getBytes());

                        //stopScan();
                    }
                };

                ScanSettings settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_BALANCED).setReportDelay(0).build();
                scanner.flushPendingScanResults(scanCallbackAfterLollipop);
                scanner.startScan(null,settings,scanCallbackAfterLollipop);
                return true;
            } else {
                Log.i("finalT","amgbluetooth: inizia lo startscan() < LL");
                scanning = true;
                scanCallbackBeforeLollipop = new LeScanCallback() {

                @Override
                public void onLeScan(BluetoothDevice device, int rssi,
                        byte[] scanRecord) {

                    Log.i("finalT","device trovato: "+device.getName());
                    scanCallback.onDeviceFound(device, rssi, scanRecord);
                }
            };


            return bluetoothAdapter.startLeScan(scanCallbackBeforeLollipop);
        }
    }

    public void stopScan() {
        Log.i("debug1","stopScan()");
        if(isScanning()) {
            Log.i("debug","stopScan() inside if");
            //stopTimer.interrupt();
            pippo.removeCallbacks(solPippo);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                BluetoothLeScanner scanner = bluetoothAdapter.getBluetoothLeScanner();
                scanner.stopScan(scanCallbackAfterLollipop);
                scanning = false;
            } else {
                bluetoothAdapter.stopLeScan(scanCallbackBeforeLollipop);
                scanning = false;
            }
        }
    }
@SuppressWarnings(“弃用”)
公共布尔startScan(ScanCallback回调,最终长超时){
停止扫描();
scanCallback=回调;
/*
if(IsScaning()){
停止扫描();
返回true;
}
scanCallback=回调;
//在预定义的扫描周期(10秒)后停止扫描。
stopTimer=new线程(new Runnable()){
@凌驾
公开募捐{
试一试{
睡眠(超时);
}捕捉(中断异常e){
Log.i(“调试”、“中断”);
返回;
}
Log.i(“调试”,“蓝牙:Inziia lo stopscan()”);
如果(!IsScan())
返回;
Log.i(“调试”,“amgbluetooth:预扫描”);
if(Build.VERSION.SDK\u INT>=Build.VERSION\u code.LOLLIPOP){
蓝牙扫描仪=蓝牙适配器
.getBluetoothLeScanner();
扫描仪.停止扫描(棒棒糖后扫描);
扫描=假;
}否则{
bluetoothAdapter.stopLeScan(ScanCallbackbeforeOllipop);
扫描=假;
}
i(“调试”,“amgbluetooth:stopTimer,invio null”);
如果(!Thread.currentThread().isInterrupted())
scanCallback.onDeviceFound(null,0,null);
}
});
stopTimer.start()*/
移除回调(solPippo);
postDelayed(solPippo,超时);
if(Build.VERSION.SDK\u INT>=Build.VERSION\u code.LOLLIPOP){
Log.i(“final”,“amgbluetooth:inazia lo startscan()LL”);
BluetoothLeScanner scanner=bluetoothAdapter.getBluetoothLeScanner();
扫描=真;
scanCallbackAfterLollipop=new ScanCallback(){
@凌驾
公共void onScanResult(int callbackType、ScanResult){
super.onScanResult(回调类型、结果);
Log.d(“final”,“Single Result:+Result.getDevice().getName());
处理结果(result);
/*
scanCallback.onDeviceFound(result.getDevice()、result.getRssi()、result.getScanRecord().getBytes())*/
}
@凌驾
public void onBatchScanResults(列出结果){
Log.d(“final”,“onBatchScanResults:+results.size()+“results”);
/*
用于(扫描结果:结果){
处理结果(result);
}*/
}
@凌驾
公共无效OnScan失败(内部错误代码){
Log.w(“最终”,“LE扫描失败:”+错误代码);
}
私有void processResult(扫描结果){
BluetoothDevice=result.getDevice();
Log.i(“final”,“New LE Device:”+Device.getName()+“@”+result.getRssi());
scanCallback.onDeviceFound(result.getDevice(),
result.getRssi(),result.getScanRecord()
.getBytes());
//停止扫描();
}
};
ScanSettings settings=new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_BALANCED).setReportDelay(0.build();
扫描器。flushPendingScanResults(棒棒糖后扫描返回);
scanner.startScan(空,设置,scanCallbackAfterLollipop);
返回true;
}否则{
Log.i(“finalT”、“amgbluetooth:inazia lo startscan()=Build.VERSION\u code.LOLLIPOP){
BluetoothLeScanner scanner=bluetoothAdapter.getBluetoothLeScanner();
扫描仪.停止扫描(棒棒糖后扫描);
扫描=假;
}否则{
bluetoothAdapter.stopLeScan(ScanCallbackbeforeOllipop);
扫描=假;
}
}
}
unlock()
中,我调用connect函数


注意:我要连接的设备名称(nexus 6)在macaddress变量中

有更新吗?你能解决这个问题吗?很遗憾没有。。你也有同样的问题吗?是的,事实上只是S6。我已经试过Nexus(棒棒糖)了,
connectGatt
没有什么问题