/** * print the file header, with the node name the raw data and the feature field * * @param out stream where write the feature data * @param f feature that this close will dump */ protected void printHeader(Formatter out, Feature f) { Field fields[] = f.getFieldsDesc(); out.format("Log start on," + DATE_FORMAT_TO_HEADER.format(mStartLog) + "\n"); out.format("Feature," + f.getName() + "\n"); out.format("Nodes,"); if (mNodeList != null) for (Node n : mNodeList) out.format(n.getFriendlyName() + ", "); out.format("\n"); out.format( HOST_TIMESTAMP_COLUMN + " (ms)," + NODE_NAME_COLUMN + "," + NODE_TIMESTAMP_COLUMN + "," + "" + NODE_RAW_DATA_COLUMN + ","); for (Field field : fields) { out.format(field.getName()); String unit = field.getUnit(); if (unit != null && !unit.isEmpty()) out.format(" (%s)", field.getUnit()); out.format(","); } // for out.format("\n"); out.flush(); } // printHeader
/** * if the node is connected enable the gui otherwise attach a listener for do it when the node * connects */ @Override protected void onResume() { super.onResume(); if (mNode.isConnected()) { setUpConsoleService(mNode.getDebug()); } else mNode.addNodeStateListener(mNodeStateChangeListener); } // onResume
/** remove the listener that we add to the node and debug object */ @Override protected void onPause() { mNode.removeNodeStateListener(mNodeStateChangeListener); if (mDebugService != null) mDebugService.setDebugOutputListener(null); super.onPause(); } // onPause
@Override public void onStateChange(Node node, Node.State newState, Node.State prevState) { if (newState == Node.State.Connected) { setUpConsoleService(node.getDebug()); } else if (newState == Node.State.Dead) { DebugConsoleActivity.this.runOnUiThread( new Runnable() { @Override public void run() { Toast.makeText( DebugConsoleActivity.this, R.string.DebugNotAvailable, Toast.LENGTH_SHORT) .show(); } }); } // if-else } // onStateChange
/** * create an intent for start the activity that will log the information from the node * * @param c context used for create the intent * @param node note that will be used by the activity * @return intent for start this activity */ public static Intent getStartIntent(Context c, @NonNull Node node) { Intent i = new Intent(c, DebugConsoleActivity.class); i.putExtra(NODE_TAG, node.getTag()); i.putExtras(NodeContainerFragment.prepareArguments(node)); return i; }