18 lines
476 B
Rust
18 lines
476 B
Rust
|
use anyhow;
|
||
|
|
||
|
use std::sync::mpsc::SyncSender;
|
||
|
use std::thread;
|
||
|
use std::time::Duration;
|
||
|
|
||
|
use crate::modem::Msg;
|
||
|
|
||
|
pub fn main(sender: SyncSender<Msg>) -> Result<(), anyhow::Error> {
|
||
|
println!("entering GPS sender loop ...");
|
||
|
for i in 0..20 {
|
||
|
println!("sending GPS message ({}) of 20 ...", i);
|
||
|
let _ = sender.send(Msg::Location("{\"lat\": 20.4322, \"long\": 44.5432}".to_string()))?;
|
||
|
thread::sleep(Duration::from_millis(2000));
|
||
|
}
|
||
|
Ok(())
|
||
|
}
|