4 Commits

Author SHA1 Message Date
mattbk
796035ac59 Fix command. 2025-10-21 21:13:48 -05:00
mattbk
b14f4eee6a Add detail. 2025-10-21 21:12:51 -05:00
mattbk
5cd273a476 Update readme. 2025-10-21 21:10:43 -05:00
mattbk
a62cb8630b Use alternative spothole URL if desired. 2025-10-19 21:57:14 -05:00
2 changed files with 50 additions and 4 deletions

View File

@@ -57,6 +57,30 @@ mwtchahrd -i <IP> -p <PORT> [-c <CHANNEL>] [-d] [-u]
- `-u, --ui_only`
Only display frames with a UI payload. When this flag is set, frames that are not UI are skipped.
- `-b, --uip <UIP>`
Send UDP to what IP address (e.g. 127.0.0.1) [default: 127.0.0.1].
- `-k, --uport <UPORT>`
Send UDP to what port (e.g. 8000; 55555 disables UDP) [default: 55555].
- `-s, --spotter <SPOTTER>`
Spotter callsign (e.g. W1CDN).
- `-o, --spothole`
Spot UI frames to a Spothole server.
- `-O, --spothole-alt <SPOTHOLE_ALT>`
Provide a different URL than https://spothole.app/api/v1/spot.
- `-f, --freq <FREQ>`
Spotting frequency [default: 14105000].
- `-h, --help`
Print help.
- `-V, --version`
Print version.
## Examples
### Monitoring All Frames
@@ -83,6 +107,14 @@ Monitor only UI frames:
mwtchahrd -i 127.0.0.1 -p 8000 -u
```
### Spotting to [Spothole.app](https://spothole.app) API
Sends only UI frames and mode is hardcoded as `PKT`. Spot from callsign `W1CDN` and report fixed frequency 14.105 MHz:
```bash
mwtchahrd --ip 192.168.0.6 --port 8000 --spotter W1CDN --spothole --freq 14105000
```
## Code Overview
- **Validation Functions:**

View File

@@ -64,10 +64,14 @@ struct Cli {
#[arg(short = 's', long)]
spotter: Option<String>,
/// Spot UI frames to Spothole
/// Spot UI frames to a Spothole server
#[arg(short = 'o', long, default_value_t = false)]
spothole: bool,
/// Provide a different URL than https://spothole.app/api/v1/spot
#[arg(short = 'O', long)]
spothole_alt: Option<String>,
/// Spotting frequency
#[arg(short = 'f', long, default_value_t = 14105000)]
freq: u32,
@@ -374,6 +378,13 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
let timestamp = Local::now().format("%H:%M:%S").to_string();
let spotter = &cli.spotter;
let freq = &cli.freq;
//let spothole_alt = &cli.spothole_alt;
// If user provides an alternate Spothole URL, use that one
let spothole_url = match &cli.spothole_alt {
Some(spothole_alt) => spothole_alt,
None => &"https://spothole.app/api/v1/spot".to_string(),
};
// Filter and compute the text from the payload only once.
let text = filter_text(&frame.payload);
@@ -417,6 +428,9 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
// --data '{"dx_call":"M0TRT","time":1760019539, "freq":14200000,
// "comment":"Test spot please ignore", "de_call":"M0TRT"}' https://spothole.app/api/v1/spot
println!("spothole_url: {}", spothole_url);
// POST JSON
let packet = json!({
"dx_call": &source,
@@ -429,7 +443,7 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
"time": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(),
});
let client = reqwest::blocking::Client::new();
let res = client.post("https://spothole.app/api/v1/spot")
let res = client.post(spothole_url)
.json(&packet)
.send();
println!("res = {res:?}");