Compare commits

..

No commits in common. "master" and "v0.1.0" have entirely different histories.

7 changed files with 31 additions and 238 deletions

225
Cargo.lock generated
View file

@ -28,15 +28,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "aho-corasick"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [
"memchr",
]
[[package]]
name = "async-trait"
version = "0.1.74"
@ -87,12 +78,6 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "block-buffer"
version = "0.10.4"
@ -134,9 +119,7 @@ name = "clrigctl"
version = "0.1.0"
dependencies = [
"config",
"env_logger",
"home",
"log",
"quick-xml",
"reqwest",
"serde",
@ -223,35 +206,12 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "env_logger"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece"
dependencies = [
"humantime",
"is-terminal",
"log",
"regex",
"termcolor",
]
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -379,7 +339,7 @@ version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
dependencies = [
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -416,12 +376,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "hyper"
version = "0.14.27"
@ -486,17 +440,6 @@ version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
[[package]]
name = "is-terminal"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
"hermit-abi",
"rustix",
"windows-sys 0.48.0",
]
[[package]]
name = "itoa"
version = "1.0.9"
@ -541,12 +484,6 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
[[package]]
name = "lock_api"
version = "0.4.11"
@ -598,7 +535,7 @@ checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0"
dependencies = [
"libc",
"wasi",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -666,7 +603,7 @@ dependencies = [
"libc",
"redox_syscall",
"smallvec",
"windows-targets 0.48.5",
"windows-targets",
]
[[package]]
@ -772,38 +709,9 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 1.3.2",
"bitflags",
]
[[package]]
name = "regex"
version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "reqwest"
version = "0.11.22"
@ -855,7 +763,7 @@ dependencies = [
"libc",
"spin",
"untrusted",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -865,7 +773,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a"
dependencies = [
"base64 0.13.1",
"bitflags 1.3.2",
"bitflags",
"serde",
]
@ -885,19 +793,6 @@ version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]]
name = "rustix"
version = "0.38.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a"
dependencies = [
"bitflags 2.4.1",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "rustls"
version = "0.21.9"
@ -1046,7 +941,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
dependencies = [
"libc",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -1072,7 +967,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
"bitflags 1.3.2",
"bitflags",
"core-foundation",
"system-configuration-sys",
]
@ -1087,15 +982,6 @@ dependencies = [
"libc",
]
[[package]]
name = "termcolor"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.50"
@ -1147,7 +1033,7 @@ dependencies = [
"signal-hook-registry",
"socket2 0.5.5",
"tokio-macros",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -1394,15 +1280,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
@ -1415,16 +1292,7 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.0",
"windows-targets",
]
[[package]]
@ -1433,28 +1301,13 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
dependencies = [
"windows_aarch64_gnullvm 0.52.0",
"windows_aarch64_msvc 0.52.0",
"windows_i686_gnu 0.52.0",
"windows_i686_msvc 0.52.0",
"windows_x86_64_gnu 0.52.0",
"windows_x86_64_gnullvm 0.52.0",
"windows_x86_64_msvc 0.52.0",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
@ -1463,84 +1316,42 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "winreg"
version = "0.50.0"
@ -1548,7 +1359,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
"cfg-if",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]

View file

@ -1,19 +1,15 @@
[package]
name = "clrigctl"
version = "0.2.0"
version = "0.1.0"
edition = "2021"
authors = ["Martin Brodbeck <dg2smb@darc.de>"]
[dependencies]
config = { version = "0.13.4", features = ["yaml"] }
env_logger = "0.10.1"
home = "0.5.5"
log = "0.4.20"
quick-xml = { version = "0.31.0", features = ["serde", "serialize"] }
reqwest = { version = "0.11.22", default-features = false, features = ["json", "rustls-tls"] }
serde = { version = "1.0.193", features = ["serde_derive"] }
serde_derive = "1.0.193"
tokio = { version = "1.34.0", features = ["full"] }
[profile.release]
strip = "symbols"

View file

@ -16,8 +16,6 @@ $ cargo build --release
$ cp target/release/clrigctl ~/.local/bin/
```
**Alternatively**, you can also download the binary packages that are attached to the releases. I provide them for both, x86_64 as well as aarch64 (Raspberry Pi, 64 bit).
Copy the example config file `clrigctl.toml` to `$HOME/.config/` and adapt it to your needs.
```
# This is an example config file. Please edit it to your needs
@ -56,7 +54,7 @@ After a `systemctl --user daemon-reload` you can enable (and start) the service
clrigctl then running in the background. It will just do nothing if there is no Flrig instance running.
## Feedback welcome
Any feedback is very welcome. Please let me know whether the program was useful for you or if there are perhaps any suggestions or bugs. You can reach me on Matrix Chat [@nnmcm:darc.de](https://matrix.to/#/@nnmcm:darc.de), via the Fediverse [@DG2SMB@social.darc.de](https://social.darc.de/@dg2smb) or just plain old E-Mail [dg2smb@darc.de](mailto:dg2smb@darc.de).
Any feedback is very welcome. Please let me know whether the program was useful for you or if there are perhaps any suggestions or bugs. You can reach me on Matrix Chat (**@nnmcm:darc.de**), via the Fediverse (**@DG2SMB@social.darc.de**) or just plain old E-Mail [dg2smb@darc.de](mailto:dg2smb@darc.de).
73
Martin, DG2SMB

View file

@ -7,7 +7,7 @@ pub struct RadioData {
pub radio: String,
pub frequency: String,
pub mode: String,
//pub power: String,
pub power: String,
}
#[tokio::main]

View file

@ -1,6 +1,5 @@
use crate::cloudlog::RadioData;
use log::debug;
use quick_xml::events::Event;
use quick_xml::reader::Reader;
use reqwest::{self, header::CONTENT_TYPE, Error};
@ -9,7 +8,7 @@ use std::result::Result;
pub fn get_radio_data(fl_host: &str, fl_port: &str) -> Result<RadioData, Error> {
let cmd_freq = "rig.get_vfo";
let cmd_mode = "rig.get_mode";
let cmd_power = "rig.get_power"; // Currently not used.
let cmd_power = "rig.get_power";
let client = reqwest::Client::new();
@ -21,14 +20,12 @@ pub fn get_radio_data(fl_host: &str, fl_port: &str) -> Result<RadioData, Error>
let mode = parse_xml(&mode);
let power = parse_xml(&power);
debug!("freq: {freq} --- mode: {mode} --- power: {power} (unused)");
let radio_data = RadioData {
key: String::from(""),
radio: String::from(""),
frequency: freq,
mode,
//power,
mode: mode,
power: power,
};
Ok(radio_data)

View file

@ -2,28 +2,20 @@ mod cloudlog;
mod flrig;
mod settings;
use log::debug;
use std::{process, thread, time::Duration};
use std::{thread, time::Duration};
use crate::cloudlog::RadioData;
use settings::Settings;
fn main() {
env_logger::init();
debug!("clrigctl started.\n");
let settings = Settings::new().unwrap_or_else(|err| {
eprintln!("Could not read settings: {}", err);
process::exit(1)
});
let settings = Settings::new().expect("Could not read settings.");
let mut radio_data_current = RadioData {
key: settings.cloudlog.key,
radio: settings.cloudlog.identifier,
frequency: String::from(""),
mode: String::from(""),
//power: String::from(&settings.power),
frequency: String::from("14017000"),
mode: String::from("CW"),
power: String::from("5"),
};
let mut changes_detected = false;
@ -40,12 +32,12 @@ fn main() {
if radio_data_current.frequency != radio_data_new.frequency
|| radio_data_current.mode != radio_data_new.mode
//|| radio_data_current.power != radio_data_new.power
|| radio_data_current.power != radio_data_new.power
{
changes_detected = true;
radio_data_current.frequency = radio_data_new.frequency;
radio_data_current.mode = radio_data_new.mode;
//radio_data_current.power = radio_data_new.power;
radio_data_current.power = radio_data_new.power;
}
if changes_detected {

View file

@ -22,7 +22,6 @@ pub struct Flrig {
pub struct Settings {
pub cloudlog: Cloudlog,
pub flrig: Flrig,
//pub power: String,
}
impl Settings {