Ejemplo n.º 1
0
 // Click one button
 public void click(View v) {
   Log.i(TAG, "BonitorActivity - click()");
   switch (v.getId()) {
     case R.id.btnSend: // Send data
       if (communicationThread != null) {
         // To Arduino
         String msg = txt.getText().toString();
         Log.v(TAG, "SEND -> " + msg);
         communicationThread.write(msg);
         // To Monitor
         // String aux = msgTotal;
         // msgTotal = msg + '\n';
         printMonitor(msg + '\n');
         // msgTotal = aux;
       }
       txt.setText("");
       break;
     case R.id.btnFreeze: // Freeze monitor
       if (((ToggleButton) v).isChecked()) {
         Log.v(TAG, "FREEZE");
         freeze = true;
       } else {
         Log.v(TAG, "NOT FREEZE");
         freeze = false;
       }
       break;
     case R.id.btnTopDown: // TopDown
       if (((ToggleButton) v).isChecked()) {
         topDown = true;
       } else {
         topDown = false;
       }
     case R.id.btnClean: // Clean monitor
       Log.v(TAG, "CLEAN MONITOR");
       linearLayout.removeAllViews();
       count = 0;
       break;
   }
 }