MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / onTimeout

Method onTimeout

lib/hidapi/testgui/test.cpp:479–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479long
480MainWindow::onTimeout(FXObject *sender, FXSelector sel, void *ptr)
481{
482 unsigned char buf[256];
483 int res = hid_read(connected_device, buf, sizeof(buf));
484
485 if (res > 0) {
486 FXString s;
487 s.format("Received %d bytes:\n", res);
488 for (int i = 0; i < res; i++) {
489 FXString t;
490 t.format("%02hhx ", buf[i]);
491 s += t;
492 if ((i+1) % 4 == 0)
493 s += " ";
494 if ((i+1) % 16 == 0)
495 s += "\n";
496 }
497 s += "\n";
498 input_text->appendText(s);
499 input_text->setBottomLine(INT_MAX);
500 }
501 if (res < 0) {
502 input_text->appendText("hid_read() returned error\n");
503 input_text->setBottomLine(INT_MAX);
504 }
505
506 getApp()->addTimeout(this, ID_TIMER,
507 5 * timeout_scalar /*5ms*/);
508 return 1;
509}
510
511long
512MainWindow::onMacTimeout(FXObject *sender, FXSelector sel, void *ptr)

Callers

nothing calls this directly

Calls 2

hid_readFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected