app/src/main/java/com/michael/bci/BciReceiver.java
void startReceiverThread(BciService bciService) {

        bciService.receiverThreadRunning = true;

        //CONSIDER Runnable runnable = new Runnable()
        new Thread("receiver") {
            public void run() {
                //Create BCIReceiver Object Instance
                BciReceiver BciReceiverMain = new BciReceiver();

                byte[] readData = new byte[TRANSFER_SIZE];

                while (bciService.receiverThreadRunning) {

                    synchronized (lockObj) {
                        /* Retrieves the number of bytes available to read from the FT_Device driver Rx buffer */
                        int bytesAvailable = bciService.ftDevice.getQueueStatus();
                        //Log.d(TAG, "bytesAvailable 1 " + bytesAvailable);

                        /* If bytes available then pass the bytes available info to the ReadQueue Method */
                        if (bytesAvailable > 0) {
                            BciReceiverMain.ReadQueue(readData, bytesAvailable, bciService);
                        }
                    }
                }

                Log.d(TAG, "receiver thread stopped.");
            }
        }.start();
    }
/* Method to create thread which will receive and process data from the OpenBCI Cyton Board */
Method to create thread which will receive and process data from the OpenBCI Cyton Board
Method to create thread which will receive and process data from the OpenBCI Cyton Board
void startReceiverThread(BciService bciService) {
        bciService.receiverThreadRunning = true;
        new Thread("receiver") {
            public void run() {
                BciReceiver BciReceiverMain = new BciReceiver();
                byte[] readData = new byte[TRANSFER_SIZE];
                while (bciService.receiverThreadRunning) {
                    synchronized (lockObj) {
                        /* Retrieves the number of bytes available to read from the FT_Device driver Rx buffer */
                        int bytesAvailable = bciService.ftDevice.getQueueStatus();
                        /* If bytes available then pass the bytes available info to the ReadQueue Method */
                        if (bytesAvailable > 0) {
                            BciReceiverMain.ReadQueue(readData, bytesAvailable, bciService);
                        }
                    }
                }
                Log.d(TAG, "receiver thread stopped.");
            }
        }.start();
    }
void startReceiverThread ( BciService bciService ) { bciService . receiverThreadRunning = true ; new Thread ( "receiver" ) { public void run ( ) { BciReceiver BciReceiverMain = new BciReceiver ( ) ; byte [ ] readData = new byte [ TRANSFER_SIZE ] ; while ( bciService . receiverThreadRunning ) { synchronized ( lockObj ) { /* Retrieves the number of bytes available to read from the FT_Device driver Rx buffer */ int bytesAvailable = bciService . ftDevice . getQueueStatus ( ) ; /* If bytes available then pass the bytes available info to the ReadQueue Method */ if ( bytesAvailable > 0 ) { BciReceiverMain . ReadQueue ( readData , bytesAvailable , bciService ) ; } } } Log . d ( TAG , "receiver thread stopped." ) ; } } . start ( ) ; }
Method to create thread which will receive and process data from the OpenBCI Cyton Board
Method to create thread which will receive and process data from the OpenBCI Cyton Board
//CONSIDER Runnable runnable = new Runnable() //Create BCIReceiver Object Instance //Log.d(TAG, "bytesAvailable 1 " + bytesAvailable);