コード例 #1
0
  /** Make a simple graph of the data that is being plotted by the currently selected device. */
  private void plotData() {
    if (isDeviceConnected()) {
      if (!isDeviceStreaming()) serviceshim.startStreaming(btAddress);

      Intent graphIntent = new Intent(ShimmerDevicesMenu.this, ShimmerGraphActivity.class);
      graphIntent.putExtra("Bluetooth Address", btAddress);
      startActivity(graphIntent);
    } else
      Toast.makeText(ShimmerDevicesMenu.this, " Must connect device first", Toast.LENGTH_SHORT)
          .show();
  }
コード例 #2
0
  /**
   * This function gets called when the user hits the 'Start Streaming' button on the menu of this
   * activity. This will start the logging of the data coming frmo the specific shimmer device that
   * this menu is made for
   */
  private void startStreaming() {
    if (isDeviceConnected()) {
      if (!isDeviceStreaming()) {
        serviceshim.startStreaming(btAddress);
        Log.d(logName, "ShimmerDevicesMenu: " + devicename + " started streaming");
      } else
        Toast.makeText(
                ShimmerDevicesMenu.this, devicename + " is already streaming", Toast.LENGTH_SHORT)
            .show();

    } // end if is the device is connected
    else
      Toast.makeText(ShimmerDevicesMenu.this, " Must Connect a Device first", Toast.LENGTH_SHORT)
          .show();

    SystemClock.sleep(100);
    updateInterface();
  }