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

Function writeRadio

src/microham.c:507–551  ·  view source on GitHub ↗

Send radio bytes to microHam device

Source from the content-addressed store, hash-verified

505// Send radio bytes to microHam device
506//
507static void writeRadio(const unsigned char *bytes, int len)
508{
509 unsigned char seq[4];
510 int i;
511
512 DEBUG("%10d:Send radio data: ", TIME);
513
514 for (i = 0; i < len; i++) { DEBUG(" %02x", (int) bytes[i]); }
515
516 DEBUG(".\n");
517
518 getlock();
519
520 for (i = 0; i < len; i++)
521 {
522 int ret;
523
524 seq[0] = 0x28;
525 seq[1] = 0x80 | bytes[i];
526 seq[2] = 0x80;
527 seq[3] = 0X80 | statusbyte;
528
529 if (statusbyte & 0x80)
530 {
531 seq[0] |= 0x01;
532 }
533
534 if (bytes[i] & 0x80)
535 {
536 seq[0] |= 0x04;
537 }
538
539 if ((ret = write(uh_device_fd, seq, 4)) < 4)
540 {
541 MYERROR("WriteRadio failed with %d\n", ret);
542
543 if (ret < 0)
544 {
545 perror("WriteRadioError:");
546 }
547 }
548 }
549
550 freelock();
551}
552#endif /* HAVE_SELECT */
553
554

Callers 1

read_deviceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected