MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / icom_transaction

Function icom_transaction

rigs/icom/frame.c:518–556  ·  view source on GitHub ↗

* icom_transaction * * This function honors rigport.retry count. * * We assume that rig!=NULL, STATE(rig)!= NULL, payload!=NULL, data!=NULL, data_len!=NULL * Otherwise, you'll get a nice seg fault. You've been warned! * payload can be NULL if payload_len == 0 * subcmd can be equal to -1 (no subcmd wanted) * * return RIG_OK if transaction completed, * or a negative value otherwise indicat

Source from the content-addressed store, hash-verified

516 * or a negative value otherwise indicating the error.
517 */
518int icom_transaction(RIG *rig, int cmd, int subcmd,
519 const unsigned char *payload, int payload_len, unsigned char *data,
520 int *data_len)
521{
522 int retval, retry;
523
524 ENTERFUNC;
525 rig_debug(RIG_DEBUG_VERBOSE,
526 "%s: cmd=0x%02x, subcmd=0x%02x, payload_len=%d\n", __func__,
527 cmd, subcmd, payload_len);
528
529 retry = RIGPORT(rig)->retry;
530
531 do
532 {
533 retval = icom_one_transaction(rig, cmd, subcmd, payload, payload_len, data,
534 data_len);
535
536 // codes that make us return immediately
537 if (retval == RIG_OK || retval == -RIG_ERJCTED || retval == -RIG_BUSERROR)
538 {
539 break;
540 }
541
542 rig_debug(RIG_DEBUG_WARN, "%s: retry=%d: %s\n", __func__, retry,
543 rigerror(retval));
544
545 // On some serial errors we may need a bit of time
546 hl_usleep(100 * 1000); // pause just a bit
547 }
548 while (retry-- > 0);
549
550 if (retval != RIG_OK)
551 {
552 rig_debug(RIG_DEBUG_VERBOSE, "%s: failed: %s\n", __func__, rigerror(retval));
553 }
554
555 RETURNFUNC(retval);
556}
557
558/* used in read_icom_frame as end of block */
559static const char icom_block_end[2] = { FI, COL};

Callers 15

ic7300_get_parmFunction · 0.85
ic9700_set_vfoFunction · 0.85
xiegu_rig_openFunction · 0.85
x108g_set_pttFunction · 0.85
x108g_set_split_vfoFunction · 0.85
x108g_set_split_freqFunction · 0.85
x108g_set_split_modeFunction · 0.85
icom_get_usb_echo_offFunction · 0.85
icom_set_freq_x25Function · 0.85
icom_get_freq_x25Function · 0.85
icom_get_tx_freqFunction · 0.85
icom_set_freqFunction · 0.85

Calls 4

rig_debugFunction · 0.85
icom_one_transactionFunction · 0.85
rigerrorFunction · 0.85
hl_usleepFunction · 0.85

Tested by

no test coverage detected