| 432 | } |
| 433 | |
| 434 | long |
| 435 | MainWindow::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 | |
| 472 | long |
| 473 | MainWindow::onClear(FXObject *sender, FXSelector sel, void *ptr) |
nothing calls this directly
no test coverage detected