#endif
#include <math.h>
+#include "libhpsdr.h"
+
#define NEW_PARSER
// IP stuff below
return vfo[active_receiver->id].frequency;
}
}
-// Looks up entry INDEX_NUM in the command structure and
-// returns the command string
-//
-void send_resp(int fd, char *msg) {
- if (rigctl_debug)
- g_print("RIGCTL: RESP=%s\n", msg);
- int length = strlen(msg);
- int written = 0;
-
- while (written < length) {
- written += write(fd, &msg[written], length - written);
- }
-}
//
// 2-25-17 - K5JAE - removed duplicate rigctl
g_mutex_lock(&mutex_a->m);
cat_control++;
if (rigctl_debug)
- g_print("RIGCTL: CTLA INC cat_contro=%d\n", cat_control);
+ g_print("RIGCTL: CTLA INC cat_control=%d\n", cat_control);
g_mutex_unlock(&mutex_a->m);
g_idle_add(ext_vfo_update, NULL);
-use std::os::fd::FromRawFd;
+use std::os::fd::{FromRawFd, IntoRawFd};
use std::{fs::File, io::Write};
use std::slice;
use libc::{write, c_int, c_char};
let mut f: File = unsafe { File::from_raw_fd(fd) };
let cstr = unsafe { std::ffi::CStr::from_ptr(msg) };
let buf: &[u8] = cstr.to_bytes();
+ println!("send_resp: {}", std::str::from_utf8(buf).unwrap());
let _ = f.write_all(buf);
+ let _ = f.into_raw_fd(); // this is so that fd is not closed
()
}