Android Open Source - final_project_android Arduino Task






From Project

Back to project page final_project_android.

License

The source code is released under:

MIT License

If you think the Android project final_project_android 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 com.geminnu.hexagon;
//w  ww .j av  a2  s  .  co m
import java.util.TimerTask;

import android.util.Log;

public class ArduinoTask extends TimerTask {
  
  public final static int GETGLUCO = 0;
  public final static int GETBODYTEMP = 1;
  public final static int GETBLOODPRES = 2;
  public final static int GETPULSOX = 3;
  public final static int GETAIRFLOW = 4;
  public final static int GETGALVAN = 5;
  public final static int GETECG = 6;
  public final static int GETEMG = 7;
  public final static int GETPOSITION = 8;
  public final static int GETBATT = 9;
  public final static int GETAVAIL = 10;
  public final static int GETCONNE = 11;
  
  private MessageSender mMessage;
  private int mCase;
  private int mContainer;
  
  
  public ArduinoTask(MessageSender mSender, int mcase, int container) {
    this.mMessage = mSender;
    this.mCase = mcase;
    this.mContainer = container;
  }
  
  @Override
  public void run() {
    
    if(mContainer == ArduinoService.XML) {
      switch(mCase) {
        case 0:
          mMessage.onDataSend("0;0;0;0");
          break;
        case 1:
          mMessage.onDataSend("0;0;1;0");
          break;
        case 2:
          mMessage.onDataSend("0;0;2;0");
          break;
        case 3:
          mMessage.onDataSend("0;0;3;0");
          break;
        case 4:
          mMessage.onDataSend("0;0;4;0");
          break;
        case 5:
          mMessage.onDataSend("0;0;5;0");
          break;
        case 6:
          mMessage.onDataSend("0;0;6;0");
          break;
        case 7:
          mMessage.onDataSend("0;0;7;0");
          break;
        case 8:
          mMessage.onDataSend("0;0;8;0");
          break;
        case 9:
          mMessage.onDataSend("1;0;0;0");
          break;
        case 10:
          mMessage.onDataSend("1;0;10;0");
          break;
        case 11:
          mMessage.onDataSend("1;0;11;0");
          break;
      }
    } else {
      switch(mCase) {
        case 0:
          mMessage.onDataSend("0;0;0;1");
          break;
        case 1:
          mMessage.onDataSend("0;0;1;1");
          break;
        case 2:
          mMessage.onDataSend("0;0;2;1");
          break;
        case 3:
          mMessage.onDataSend("0;0;3;1");
          break;
        case 4:
          mMessage.onDataSend("0;0;4;1");
          break;
        case 5:
          mMessage.onDataSend("0;0;5;1");
          break;
        case 6:
          mMessage.onDataSend("0;0;6;1");
          break;
        case 7:
          mMessage.onDataSend("0;0;7;1");
          break;
        case 8:
          mMessage.onDataSend("0;0;8;1");
          break;
        case 9:
          mMessage.onDataSend("1;0;0;1");
          break;
        case 10:
          mMessage.onDataSend("1;0;10;1");
          break;
        case 11:
          mMessage.onDataSend("1;0;11;1");
          break;
      }
    }
    Log.d("Android Task", "hello from task");
  }
}




Java Source Code List

com.geminnu.hexagon.Alert.java
com.geminnu.hexagon.ArduinoMessage.java
com.geminnu.hexagon.ArduinoParser.java
com.geminnu.hexagon.ArduinoReceiver.java
com.geminnu.hexagon.ArduinoService.java
com.geminnu.hexagon.ArduinoStatusEventListener.java
com.geminnu.hexagon.ArduinoStatusEvent.java
com.geminnu.hexagon.ArduinoStatusManager.java
com.geminnu.hexagon.ArduinoStatus.java
com.geminnu.hexagon.ArduinoTask.java
com.geminnu.hexagon.ArduinoTransmitter.java
com.geminnu.hexagon.BioSensorEventListener.java
com.geminnu.hexagon.BioSensorEvent.java
com.geminnu.hexagon.BioSensorListenerItem.java
com.geminnu.hexagon.BioSensorManagerService.java
com.geminnu.hexagon.BioSensor.java
com.geminnu.hexagon.Bluetooth.java
com.geminnu.hexagon.CoordinatorActionListener.java
com.geminnu.hexagon.Coordinator.java
com.geminnu.hexagon.MainActivity.java
com.geminnu.hexagon.MessageListener.java
com.geminnu.hexagon.MessageSender.java
com.geminnu.hexagon.MySQLiteHelper.java
com.geminnu.hexagon.Profile.java
com.geminnu.hexagon.Reading.java
com.geminnu.hexagon.Wifi.java