| 401 | } |
| 402 | |
| 403 | long |
| 404 | MainWindow::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 | |
| 434 | long |
| 435 | MainWindow::onGetFeatureReport(FXObject *sender, FXSelector sel, void *ptr) |
nothing calls this directly
no test coverage detected