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

Method onSendFeatureReport

lib/hidapi/testgui/test.cpp:403–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401}
402
403long
404MainWindow::onSendFeatureReport(FXObject *sender, FXSelector sel, void *ptr)
405{
406 char buf[256];
407 size_t data_len, len;
408 int textfield_len;
409
410 memset(buf, 0x0, sizeof(buf));
411 textfield_len = getLengthFromTextField(feature_len);
412 data_len = getDataFromTextField(feature_text, buf, sizeof(buf));
413
414 if (textfield_len < 0) {
415 FXMessageBox::error(this, MBOX_OK, "Invalid length", "Length field is invalid. Please enter a number in hex, octal, or decimal.");
416 return 1;
417 }
418
419 if (textfield_len > sizeof(buf)) {
420 FXMessageBox::error(this, MBOX_OK, "Invalid length", "Length field is too long.");
421 return 1;
422 }
423
424 len = (textfield_len)? textfield_len: data_len;
425
426 int res = hid_send_feature_report(connected_device, (const unsigned char*)buf, len);
427 if (res < 0) {
428 FXMessageBox::error(this, MBOX_OK, "Error Writing", "Could not send feature report to device. Error reported was: %ls", hid_error(connected_device));
429 }
430
431 return 1;
432}
433
434long
435MainWindow::onGetFeatureReport(FXObject *sender, FXSelector sel, void *ptr)

Callers

nothing calls this directly

Calls 3

errorFunction · 0.50
hid_send_feature_reportFunction · 0.50
hid_errorFunction · 0.50

Tested by

no test coverage detected