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

Method onGetFeatureReport

lib/hidapi/testgui/test.cpp:434–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434long
435MainWindow::onGetFeatureReport(FXObject *sender, FXSelector sel, void *ptr)
436{
437 char buf[256];
438 size_t len;
439
440 memset(buf, 0x0, sizeof(buf));
441 len = getDataFromTextField(get_feature_text, buf, sizeof(buf));
442
443 if (len != 1) {
444 FXMessageBox::error(this, MBOX_OK, "Too many numbers", "Enter only a single report number in the text field");
445 }
446
447 int res = hid_get_feature_report(connected_device, (unsigned char*)buf, sizeof(buf));
448 if (res < 0) {
449 FXMessageBox::error(this, MBOX_OK, "Error Getting Report", "Could not get feature report from device. Error reported was: %ls", hid_error(connected_device));
450 }
451
452 if (res > 0) {
453 FXString s;
454 s.format("Returned Feature Report. %d bytes:\n", res);
455 for (int i = 0; i < res; i++) {
456 FXString t;
457 t.format("%02hhx ", buf[i]);
458 s += t;
459 if ((i+1) % 4 == 0)
460 s += " ";
461 if ((i+1) % 16 == 0)
462 s += "\n";
463 }
464 s += "\n";
465 input_text->appendText(s);
466 input_text->setBottomLine(INT_MAX);
467 }
468
469 return 1;
470}
471
472long
473MainWindow::onClear(FXObject *sender, FXSelector sel, void *ptr)

Callers

nothing calls this directly

Calls 4

errorFunction · 0.50
hid_get_feature_reportFunction · 0.50
hid_errorFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected