Android Open Source - MuseLogger Bluetooth Utils






From Project

Back to project page MuseLogger.

License

The source code is released under:

MIT License

If you think the Android project MuseLogger listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.chrisplus.muselogger;
//from  ww  w  . j  a v a  2 s . c  o m
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Set;
import java.util.UUID;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;

public class BluetoothUtils {

  public static Set<BluetoothDevice> findPaired() {

    BluetoothAdapter bluetoothAdapter = BluetoothAdapter
        .getDefaultAdapter();
    Set<BluetoothDevice> devices = bluetoothAdapter.getBondedDevices();

    if (devices == null || devices.isEmpty()) {
      return null;

    } else {
      return devices;
    }

  }

  public static boolean checkMusePaired() {
    Set<BluetoothDevice> devices = findPaired();

    if (devices == null || devices.isEmpty()) {
      return false;
    }

    for (BluetoothDevice device : devices) {
      if (device.getName().equalsIgnoreCase("muse")) {
        return true;
      }
    }

    return false;
  }

}




Java Source Code List

com.chrisplus.muselogger.BluetoothUtils.java
com.chrisplus.muselogger.MainActivity.java
com.chrisplus.muselogger.MuseConnector.java
com.chrisplus.muselogger.TaskUtils.java