title: Sometimes can't find the ble device
body: <p>I'm working on the Android-Ble develop .
  There is my problem:
  When the Ble device was disconnect the program will call .startLeScan(callback) to find Ble device and reconnect .
  But sometimes , the program tried to scan but it can't find any device.I guess it was caused by Ble protocol stack messed.
  Am I right? And if Ble protocol stack messed , so what happening will make the  Ble protocol stack mess?
  Can anybody give me some tips?Thanks.</p>
  
  <p>---There is scan code:</p>
  
  <pre><code>private void startBLEScan() {
      if (isBLEScanStarted) {
          return; 
      }else {
          isBLEScanStarted = true;
      }
      if (mBluetoothAdapter != null) {
          boolean startResult = mBluetoothAdapter.startLeScan(mLeScanCallback);
          System.out.println("BlueToothScan: startLeScan      "+startResult);
          startBLEScanTimeoutTimer(1000 * 60);   //When scan time reach 60s , stop scan and rescan after 5s.
      }
      else {
          System.out.println("BlueToothScan: adapter is null");
      }
  }
  </code></pre>
  
  <p>---There is gatt callback .OnConnectionStateChange:</p>
  
  <pre><code>@Override
      public void onConnectionStateChange(BluetoothGatt gatt, int status,
              int newState) {
              String intentAction;
              if (newState == BluetoothProfile.STATE_CONNECTED) {
                  intentAction = ACTION_GATT_CONNECTED;
                  mConnectionState = STATE_CONNECTED;
                  broadcastUpdate(intentAction);
                  try {
                      Thread.sleep(500);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
                  mBluetoothGatt.discoverServices();
              } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                  intentAction = ACTION_GATT_DISCONNECTED;
                  mConnectionState = STATE_DISCONNECTED;
                  if(mBluetoothGatt != null){
                      mBluetoothGatt.close();
                      mBluetoothGatt = null;
                  }
                  broadcastUpdate(intentAction);
              }
          }
  </code></pre>