Android Open Source - GraphIT Bluetooth Helper






From Project

Back to project page GraphIT.

License

The source code is released under:

Apache License

If you think the Android project GraphIT 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 org.cardioart.graphit;
// w w  w .  j a va 2s. c  om
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * Created by jirawat on 10/05/2014.
 */
public class BluetoothHelper {
    public static final int REQUEST_ENABLE_BT = 2718;

    private BluetoothAdapter mBluetoothAdapter;
    private Context context;

    public BluetoothHelper(Context mcontext) {
        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        this.context = mcontext;
        if (mBluetoothAdapter == null) {
            Log.d("Bluetooth", "Device didn't support bluetooth");
            System.exit(2);
        }
    }
    public void connectBluetooth() {
        if (mBluetoothAdapter.isEnabled() == false) {
            Intent enableBluetoothIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
            MainActivity mainActivity = (MainActivity) this.context;
            mainActivity.startActivityForResult(enableBluetoothIntent, REQUEST_ENABLE_BT);
        }
    }
}




Java Source Code List

org.cardioart.graphit.BluetoothHelper.java
org.cardioart.graphit.DeviceAdapter.java
org.cardioart.graphit.GraphActivity.java
org.cardioart.graphit.MainActivity.java
org.cardioart.graphit.PlotActivity.java
org.cardioart.graphit.SerialHelper.java