MCPcopy Index your code
hub / github.com/arduino/Arduino / message

Method message

app/src/processing/app/SerialPlotter.java:392–472  ·  view source on GitHub ↗
(final String s)

Source from the content-addressed store, hash-verified

390 }
391
392 public void message(final String s) {
393 messageBuffer.append(s);
394 while (true) {
395 int linebreak = messageBuffer.indexOf("\n");
396 if (linebreak == -1) {
397 break;
398 }
399 xCount++;
400 String line = messageBuffer.substring(0, linebreak);
401 messageBuffer.delete(0, linebreak + 1);
402
403 line = line.trim();
404 if (line.length() == 0) {
405 // the line only contained trimmable characters
406 continue;
407 }
408 String[] parts = line.split("[, \t]+");
409 if(parts.length == 0) {
410 continue;
411 }
412
413 int validParts = 0;
414 int validLabels = 0;
415 for(int i = 0; i < parts.length; ++i) {
416 Double value = null;
417 String label = null;
418
419 // column formated name value pair
420 if(parts[i].contains(":")) {
421 // get label
422 String[] subString = parts[i].split("[:]+");
423
424 if(subString.length > 0) {
425 int labelLength = subString[0].length();
426
427 if(labelLength > 32) {
428 labelLength = 32;
429 }
430 label = subString[0].substring(0, labelLength);
431 } else {
432 label = "";
433 }
434
435 if(subString.length > 1) {
436 parts[i] = subString[1];
437 } else {
438 parts[i] = "";
439 }
440 }
441
442 try {
443 value = Double.valueOf(parts[i]);
444 } catch (NumberFormatException e) {
445 // ignored
446 }
447 //CSV header
448 if(label == null && value == null) {
449 label = parts[i];

Callers

nothing calls this directly

Calls 7

splitMethod · 0.80
sizeMethod · 0.80
addToUpdateBufferMethod · 0.80
getMethod · 0.65
deleteMethod · 0.45
valueOfMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected