* write_transaction * Assumes rig!=NULL, xml!=NULL, xml_len=total size of xml for response */
| 537 | * Assumes rig!=NULL, xml!=NULL, xml_len=total size of xml for response |
| 538 | */ |
| 539 | static int write_transaction(RIG *rig, char *xml, int xml_len) |
| 540 | { |
| 541 | |
| 542 | int try = rig->caps->retry; |
| 543 | |
| 544 | int retval = -RIG_EPROTO; |
| 545 | |
| 546 | hamlib_port_t *rp = RIGPORT(rig); |
| 547 | |
| 548 | ENTERFUNC; |
| 549 | |
| 550 | // This shouldn't ever happen...but just in case |
| 551 | // We need to avoid an empty write as rigctld replies with blank line |
| 552 | if (xml_len == 0) |
| 553 | { |
| 554 | rig_debug(RIG_DEBUG_ERR, "%s: len==0??\n", __func__); |
| 555 | RETURNFUNC(retval); |
| 556 | } |
| 557 | |
| 558 | // appears we can lose sync if we don't clear things out |
| 559 | // shouldn't be anything for us now anyways |
| 560 | rig_flush(rp); |
| 561 | |
| 562 | while (try-- >= 0 && retval != RIG_OK) |
| 563 | { |
| 564 | retval = write_block(rp, (unsigned char *) xml, strlen(xml)); |
| 565 | |
| 566 | if (retval < 0) |
| 567 | { |
| 568 | RETURNFUNC(-RIG_EIO); |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | RETURNFUNC(retval); |
| 573 | } |
| 574 | |
| 575 | static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value, |
| 576 | int value_len) |
no test coverage detected