// Path: btutillib/src/main/java/com/devpaul/bluetoothutillib/abstracts/BaseBluetoothActivity.java
// public abstract class BaseBluetoothActivity extends Activity {
// 
//     /**
//      * Must be overriden witha  simple bluetooth listener.
//      * @return a SimpleBluetoothListener. Now you don't have to override all the methods!
//      */
//     public abstract SimpleBluetoothListener getSimpleBluetoothListener();
// 
//     /**
//      * The {@code SimpleBluetooth} object for this activity.
//      */
//     private SimpleBluetooth simpleBluetooth;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         simpleBluetooth = new SimpleBluetooth(this, getSimpleBluetoothListener());
//         if(simpleBluetooth.initializeSimpleBluetooth()) {
//             onBluetoothEnabled();
//         }
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//         if(resultCode == RESULT_OK && requestCode == BluetoothUtility.REQUEST_BLUETOOTH) {
//             onBluetoothEnabled();
//         } else if(resultCode == RESULT_OK && requestCode == BluetoothUtility.REQUEST_BLUETOOTH_SCAN) {
//             String macAddress = data.getStringExtra(DeviceDialog.DEVICE_DIALOG_DEVICE_ADDRESS_EXTRA);
//             onDeviceSelected(macAddress);
//         } else if(resultCode == RESULT_OK && requestCode == BluetoothUtility.REQUEST_MAKE_DEVICE_DISCOVERABLE) {
//             // device is discoverable now.
//         }
//         super.onActivityResult(requestCode, resultCode, data);
//     }
// 
//     /**
//      * This is always called by the activity and indicates that bluetooth is now enabled.
//      * By default the Activity will request for a scan of nearby devices.
//      */
//     public void onBluetoothEnabled() {
//         requestScan();
//     }
// 
//     /**
//      * This method is called after you call {#requestScan} and a device is selected from the list.
//      * By default, the activity will attempt to connect to the device.
//      * @param macAddress, the macAddress of the selected device.
//      */
//     public void onDeviceSelected(String macAddress) {
//         simpleBluetooth.connectToBluetoothDevice(macAddress);
//     }
// 
//     /**
//      * Sends data to the currently connected device.
//      * @param data the string to send to the device.
//      */
//     public void sendData(String data) {
//         simpleBluetooth.sendData(data);
//     }
// 
//     /**
//      * Call this to request a scan and connect to a device.
//      */
//     public void requestScan() {
//         simpleBluetooth.scan(BluetoothUtility.REQUEST_BLUETOOTH_SCAN);
//     }
// 
//     @Override
//     protected void onDestroy() {
//         super.onDestroy();
//         simpleBluetooth.endSimpleBluetooth();
//     }
// 
//     public SimpleBluetooth getSimpleBluetooth() {
//         return this.simpleBluetooth;
//     }
// 
// }
// 
// Path: btutillib/src/main/java/com/devpaul/bluetoothutillib/utils/SimpleBluetoothListener.java
// public abstract class SimpleBluetoothListener {
// 
//     public SimpleBluetoothListener() {
//         super();
//     }
// 
//     @Override
//     protected final Object clone() throws CloneNotSupportedException {
//         return super.clone();
//     }
// 
//     @Override
//     public final boolean equals(Object o) {
//         return super.equals(o);
//     }
// 
//     @Override
//     protected final void finalize() throws Throwable {
//         super.finalize();
//     }
// 
//     @Override
//     public final int hashCode() {
//         return super.hashCode();
//     }
// 
//     @Override
//     public final String toString() {
//         return super.toString();
//     }
// 
//     /**
//      * Called when bluetooth data is receieved.
//      * @param bytes the raw byte buffer
//      * @param data the data as a string.
//      */
//     public void onBluetoothDataReceived(byte[] bytes, String data) {
// 
//     }
// 
//     /**
//      * Called when a device is connected.
//      * @param device
//      */
//     public void onDeviceConnected(BluetoothDevice device) {
// 
//     }
// 
//     /**
//      * Called when a device is disconnected.
//      * @param device
//      */
//     public void onDeviceDisconnected(BluetoothDevice device) {
// 
//     }
// 
//     /**
//      * Called when discovery (scanning) is started.
//      */
//     public void onDiscoveryStarted() {
// 
//     }
// 
//     /**
//      * Called when discovery is finished.
//      */
//     public void onDiscoveryFinished() {
// 
//     }
// 
//     /**
//      * Called when a device is paired.
//      * @param device the paired device.
//      */
//     public void onDevicePaired(BluetoothDevice device) {
// 
//     }
// 
//     /**
//      * Called when a device is unpaired.
//      * @param device the unpaired device.
//      */
//     public void onDeviceUnpaired(BluetoothDevice device) {
// 
//     }
// 
//     /**
//      * Called when a request is made to connect to an A2dp device.
//      * @param bluetoothA2dp the a2dp device.
//      */
//     public void onBluetoothA2DPRequested(BluetoothA2dp bluetoothA2dp) {
// 
//     }
// }


import android.bluetooth.BluetoothDevice;
import android.os.Bundle;
import android.widget.Toast;
import com.devpaul.bluetoothutillib.abstracts.BaseBluetoothActivity;
import com.devpaul.bluetoothutillib.utils.SimpleBluetoothListener;
package com.devpaul.bluetoothutilitydemo;



/**
 * Created by Pauly D on 3/18/2015.
 */
public class TestActivity extends BaseBluetoothActivity {

    @Override
// Path: btutillib/src/main/java/com/devpaul/bluetoothutillib/abstracts/BaseBluetoothActivity.java
// public abstract class BaseBluetoothActivity extends Activity {
// 
//     /**
//      * Must be overriden witha  simple bluetooth listener.
//      * @return a SimpleBluetoothListener. Now you don't have to override all the methods!
//      */
//     public abstract SimpleBluetoothListener getSimpleBluetoothListener();
// 
//     /**
//      * The {@code SimpleBluetooth} object for this activity.
//      */
//     private SimpleBluetooth simpleBluetooth;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         simpleBluetooth = new SimpleBluetooth(this, getSimpleBluetoothListener());
//         if(simpleBluetooth.initializeSimpleBluetooth()) {
//             onBluetoothEnabled();
//         }
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//         if(resultCode == RESULT_OK && requestCode == BluetoothUtility.REQUEST_BLUETOOTH) {
//             onBluetoothEnabled();
//         } else if(resultCode == RESULT_OK && requestCode == BluetoothUtility.REQUEST_BLUETOOTH_SCAN) {
//             String macAddress = data.getStringExtra(DeviceDialog.DEVICE_DIALOG_DEVICE_ADDRESS_EXTRA);
//             onDeviceSelected(macAddress);
//         } else if(resultCode == RESULT_OK && requestCode == BluetoothUtility.REQUEST_MAKE_DEVICE_DISCOVERABLE) {
//             // device is discoverable now.
//         }
//         super.onActivityResult(requestCode, resultCode, data);
//     }
// 
//     /**
//      * This is always called by the activity and indicates that bluetooth is now enabled.
//      * By default the Activity will request for a scan of nearby devices.
//      */
//     public void onBluetoothEnabled() {
//         requestScan();
//     }
// 
//     /**
//      * This method is called after you call {#requestScan} and a device is selected from the list.
//      * By default, the activity will attempt to connect to the device.
//      * @param macAddress, the macAddress of the selected device.
//      */
//     public void onDeviceSelected(String macAddress) {
//         simpleBluetooth.connectToBluetoothDevice(macAddress);
//     }
// 
//     /**
//      * Sends data to the currently connected device.
//      * @param data the string to send to the device.
//      */
//     public void sendData(String data) {
//         simpleBluetooth.sendData(data);
//     }
// 
//     /**
//      * Call this to request a scan and connect to a device.
//      */
//     public void requestScan() {
//         simpleBluetooth.scan(BluetoothUtility.REQUEST_BLUETOOTH_SCAN);
//     }
// 
//     @Override
//     protected void onDestroy() {
//         super.onDestroy();
//         simpleBluetooth.endSimpleBluetooth();
//     }
// 
//     public SimpleBluetooth getSimpleBluetooth() {
//         return this.simpleBluetooth;
//     }
// 
// }
// 
// Path: btutillib/src/main/java/com/devpaul/bluetoothutillib/utils/SimpleBluetoothListener.java
// public abstract class SimpleBluetoothListener {
// 
//     public SimpleBluetoothListener() {
//         super();
//     }
// 
//     @Override
//     protected final Object clone() throws CloneNotSupportedException {
//         return super.clone();
//     }
// 
//     @Override
//     public final boolean equals(Object o) {
//         return super.equals(o);
//     }
// 
//     @Override
//     protected final void finalize() throws Throwable {
//         super.finalize();
//     }
// 
//     @Override
//     public final int hashCode() {
//         return super.hashCode();
//     }
// 
//     @Override
//     public final String toString() {
//         return super.toString();
//     }
// 
//     /**
//      * Called when bluetooth data is receieved.
//      * @param bytes the raw byte buffer
//      * @param data the data as a string.
//      */
//     public void onBluetoothDataReceived(byte[] bytes, String data) {
// 
//     }
// 
//     /**
//      * Called when a device is connected.
//      * @param device
//      */
//     public void onDeviceConnected(BluetoothDevice device) {
// 
//     }
// 
//     /**
//      * Called when a device is disconnected.
//      * @param device
//      */
//     public void onDeviceDisconnected(BluetoothDevice device) {
// 
//     }
// 
//     /**
//      * Called when discovery (scanning) is started.
//      */
//     public void onDiscoveryStarted() {
// 
//     }
// 
//     /**
//      * Called when discovery is finished.
//      */
//     public void onDiscoveryFinished() {
// 
//     }
// 
//     /**
//      * Called when a device is paired.
//      * @param device the paired device.
//      */
//     public void onDevicePaired(BluetoothDevice device) {
// 
//     }
// 
//     /**
//      * Called when a device is unpaired.
//      * @param device the unpaired device.
//      */
//     public void onDeviceUnpaired(BluetoothDevice device) {
// 
//     }
// 
//     /**
//      * Called when a request is made to connect to an A2dp device.
//      * @param bluetoothA2dp the a2dp device.
//      */
//     public void onBluetoothA2DPRequested(BluetoothA2dp bluetoothA2dp) {
// 
//     }
// }


// Path: app/src/main/java/com/devpaul/bluetoothutilitydemo/TestActivity.java
import android.bluetooth.BluetoothDevice;
import android.os.Bundle;
import android.widget.Toast;
import com.devpaul.bluetoothutillib.abstracts.BaseBluetoothActivity;
import com.devpaul.bluetoothutillib.utils.SimpleBluetoothListener;

package com.devpaul.bluetoothutilitydemo;



/**
 * Created by Pauly D on 3/18/2015.
 */
public class TestActivity extends BaseBluetoothActivity {

    @Override
    public SimpleBluetoothListener getSimpleBluetoothListener() {