// Path: EEG101/android/app/src/main/java/com/eeg_project/MainApplication.java
// public class MainApplication extends Application implements ReactApplication {
// 
//   // Global singleton Muse
//   public static Muse connectedMuse;
// 
//   // Global singleton event emitter
//   public static AppNativeEventEmitter eventEmitter;
// 
//   private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
//     @Override
//     public boolean getUseDeveloperSupport() {
//       return com.eeg_project.BuildConfig.DEBUG;
//     }
// 
//     // All packages for native libraries must be added to the array returned by this method
//     @Override
//     protected List<ReactPackage> getPackages() {
//       return Arrays.<ReactPackage>asList(
//           new MainReactPackage(),
//             new LottiePackage(),
//             new RNI18nPackage(),
//           new RCTTorchPackage(),
//           new SvgPackage(),
//           new EEGPackage()
//       );
//     }
//   };
// 
//   @Override
//   public ReactNativeHost getReactNativeHost() {
//       return mReactNativeHost;
//   }
// 
//   }


import android.bluetooth.BluetoothAdapter;
import android.os.Handler;
import android.os.HandlerThread;
import com.choosemuse.libmuse.ConnectionState;
import com.choosemuse.libmuse.Muse;
import com.choosemuse.libmuse.MuseConnectionListener;
import com.choosemuse.libmuse.MuseConnectionPacket;
import com.choosemuse.libmuse.MuseListener;
import com.choosemuse.libmuse.MuseManagerAndroid;
import com.eeg_project.MainApplication;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import java.util.List;
package com.eeg_project.components.connector;





// Handles connecting to the Muse headband

public class ConnectorModule extends ReactContextBaseJavaModule {

    // ----------------------------------------------------------
    // Variables

    private MuseManagerAndroid manager;
    private ConnectionListener connectionListener;
    private int museIndex = 0;
    private List<Muse> availableMuses;
    private Muse muse;
    private boolean isBluetoothEnabled;
    public Handler connectHandler;
    public HandlerThread connectThread;

    // grab reference to global singletons
// Path: EEG101/android/app/src/main/java/com/eeg_project/MainApplication.java
// public class MainApplication extends Application implements ReactApplication {
// 
//   // Global singleton Muse
//   public static Muse connectedMuse;
// 
//   // Global singleton event emitter
//   public static AppNativeEventEmitter eventEmitter;
// 
//   private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
//     @Override
//     public boolean getUseDeveloperSupport() {
//       return com.eeg_project.BuildConfig.DEBUG;
//     }
// 
//     // All packages for native libraries must be added to the array returned by this method
//     @Override
//     protected List<ReactPackage> getPackages() {
//       return Arrays.<ReactPackage>asList(
//           new MainReactPackage(),
//             new LottiePackage(),
//             new RNI18nPackage(),
//           new RCTTorchPackage(),
//           new SvgPackage(),
//           new EEGPackage()
//       );
//     }
//   };
// 
//   @Override
//   public ReactNativeHost getReactNativeHost() {
//       return mReactNativeHost;
//   }
// 
//   }


// Path: EEG101/android/app/src/main/java/com/eeg_project/components/connector/ConnectorModule.java
import android.bluetooth.BluetoothAdapter;
import android.os.Handler;
import android.os.HandlerThread;
import com.choosemuse.libmuse.ConnectionState;
import com.choosemuse.libmuse.Muse;
import com.choosemuse.libmuse.MuseConnectionListener;
import com.choosemuse.libmuse.MuseConnectionPacket;
import com.choosemuse.libmuse.MuseListener;
import com.choosemuse.libmuse.MuseManagerAndroid;
import com.eeg_project.MainApplication;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import java.util.List;

package com.eeg_project.components.connector;





// Handles connecting to the Muse headband

public class ConnectorModule extends ReactContextBaseJavaModule {

    // ----------------------------------------------------------
    // Variables

    private MuseManagerAndroid manager;
    private ConnectionListener connectionListener;
    private int museIndex = 0;
    private List<Muse> availableMuses;
    private Muse muse;
    private boolean isBluetoothEnabled;
    public Handler connectHandler;
    public HandlerThread connectThread;

    // grab reference to global singletons
    MainApplication appState;