Android Open Source - Bluetooth Thread Update_00






From Project

Back to project page Bluetooth.

License

The source code is released under:

GNU General Public License

If you think the Android project Bluetooth 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 beta.delux.ghostscanner;
//w ww  . j  a va 2  s.c  om
/**
 * Created by Technician on 5/25/14.
 */
public class ThreadUpdate_00 extends Thread {
   /*private boolean running = false;
   private HandlerBluetoothSPP btConn;
   private String tempMSG;

   // private int index;
   // private int[] testing = {90, 90, 110, 180, 90, 90, 70, 00};

   public ThreadUpdate_00(HandlerBluetoothSPP btConn, HandlerBluetooth btHandler) {
      this.btConn = btConn;

      running = true;
      ActivityMain.this.runOnUiThread(new Runnable() {
         public void run() {
            // Button btnConnect = (Button)
            // findViewById(R.id.btnConnect);
            // btnConnect.setText(R.string.button_disconnect);
         }
      });
   }

   public void run() {
      while (running)
         try {
            Thread.sleep(250);
            tempMSG = btConn.getMessage();
            if (!tempMSG.isEmpty()) {
               Log.d(TAG, "RCVD MESSAGE: " + tempMSG);
               decodeMessage(tempMSG);
            }

         } catch (InterruptedException interrupt) {
            Log.e(TAG, "sleep interrupted", interrupt);
            this.cancel();
         } catch (Exception e) {
            Log.e(TAG, "other thread exception", e);
            this.cancel();
         }

   }

   public void decodeMessage(final String inString) {
      ActivityMain.this.runOnUiThread(new Runnable() {
         int tempIndex = -1;
         char tempchar1, tempchar2;

         public void run() {
            try {
               tempIndex = inString.indexOf(0x21);
               if (tempIndex != -1) {
                  tempchar1 = inString.charAt(tempIndex + 1);
                  tempchar2 = inString.charAt(tempIndex + 2);

                  position = Integer.parseInt(Character.toString(tempchar1) + Character.toString(tempchar2)) - 1;
                  if (!OVERRIDE){
                     sbMeter.setProgress(position);
                  }
                  else{
                     if (position != sbMeter.getProgress())
                        sendPacket(getPacket());
                  }
                  ivNeedle.setRotation((position - 11)*6);
               }
            } catch (Exception e) {

            }

         }
      });
   }

   public void cancel() {
      running = false;
      ActivityMain.CONNECTED = false;
      ActivityMain.this.runOnUiThread(new Runnable() {
         public void run() {
            // Button btnConnect = (Button)
            // findViewById(R.id.btnConnect);
            // btnConnect.setText(R.string.button_connect);
         }
      });
      // btConn.stop();
   }*/
}




Java Source Code List

Android.Arduino.Bluetooth.AndroidArduino.java
Android.Arduino.Bluetooth.AndroidArduino.java
Android.Arduino.Bluetooth.BluetoothTest.java
Android.Arduino.Bluetooth.BluetoothTest.java
Android.Arduino.Bluetooth.BuildConfig.java
beta.ArduinoidBlue.ActivityMain.java
beta.delux.ghostscanner.ActivityMain.java
beta.delux.ghostscanner.FragmentAbout.java
beta.delux.ghostscanner.FragmentBluetooth.java
beta.delux.ghostscanner.FragmentLights.java
beta.delux.ghostscanner.FragmentMotors.java
beta.delux.ghostscanner.FragmentSolenoids.java
beta.delux.ghostscanner.FragmentSwitches.java
beta.delux.ghostscanner.HandlerBluetoothSPP.java
beta.delux.ghostscanner.HandlerBluetooth.java
beta.delux.ghostscanner.SimpleGhost.java
beta.delux.ghostscanner.ThreadUpdate_00.java
.blkuetoothconnect.java
.bluetoothExamplemainactivity.java
com.colecago.santa.AboutInfoActivity.java
com.colecago.santa.AboutInfoActivity.java
com.colecago.santa.BtHelperHandler.java
com.colecago.santa.BtHelperHandler.java
com.colecago.santa.BtSPPHelper.java
com.colecago.santa.BtSPPHelper.java
com.colecago.santa.BuildConfig.java
com.colecago.santa.DeviceListActivity.java
com.colecago.santa.DeviceListActivity.java
com.colecago.santa.MainActivity.java
com.colecago.santa.MainActivity.java
example.redux.bluetoothchat.BluetoothChatService.java
example.redux.bluetoothchat.BluetoothChatService.java
example.redux.bluetoothchat.BluetoothChat.java
example.redux.bluetoothchat.BluetoothChat.java
example.redux.bluetoothchat.DeviceListActivity.java
example.redux.bluetoothchat.DeviceListActivity.java
ghostscanner_00.ghostscanner.GhostScanner_00.java
ghostscanner_00.ghostscanner.MainActivity.java
heck.pinball.ghostscanner.AboutFragment.java
heck.pinball.ghostscanner.BluetoothFragment.java
heck.pinball.ghostscanner.BluetoothHandlerSPP.java
heck.pinball.ghostscanner.BluetoothHandler.java
heck.pinball.ghostscanner.BluetoothService.java
heck.pinball.ghostscanner.DeviceListActivity.java
heck.pinball.ghostscanner.LightsFragment.java
heck.pinball.ghostscanner.MainActivity.java
heck.pinball.ghostscanner.MotorsFragment.java
heck.pinball.ghostscanner.SolenoidsFragment.java
heck.pinball.ghostscanner.SwitchesFragment.java
heck.pinball.simpleghost.simpleghost.BluetoothActivity.java
heck.pinball.simpleghost.simpleghost.BluetoothActivity.java
heck.pinball.simpleghost.simpleghost.MainActivity.java
heck.pinball.simpleghost.simpleghost.MainActivity.java
.mainactivity.java