diff --git a/receiver/Cargo.lock b/receiver/Cargo.lock
index 6bd6822..f1b4890 100644
--- a/receiver/Cargo.lock
+++ b/receiver/Cargo.lock
@@ -446,6 +446,12 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
[[package]]
name = "libc"
version = "0.2.139"
@@ -611,6 +617,7 @@ dependencies = [
"pbkdf2",
"serde",
"serde_json",
+ "simulate",
"uuid",
]
@@ -685,6 +692,16 @@ dependencies = [
"sha2 0.9.9",
]
+[[package]]
+name = "simulate"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbee16431539949a38f46684d2cd31deeb822c12c5ef33fd6eb2e418987f5691"
+dependencies = [
+ "lazy_static",
+ "winapi",
+]
+
[[package]]
name = "slab"
version = "0.4.7"
diff --git a/receiver/Cargo.toml b/receiver/Cargo.toml
index f4a34bc..f67edd9 100644
--- a/receiver/Cargo.toml
+++ b/receiver/Cargo.toml
@@ -15,3 +15,4 @@ uuid = { version = "1.3.0", features = ["serde", "v4"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
enigo = "0.0.14"
+simulate = "0.3.0"
diff --git a/receiver/src/main.rs b/receiver/src/main.rs
index 5c1ed69..00138f6 100644
--- a/receiver/src/main.rs
+++ b/receiver/src/main.rs
@@ -1,12 +1,8 @@
-use std::{env, process, time::Duration, fmt::format};
-use enigo::KeyboardControllable;
use serde::{Deserialize, Serialize};
-use serde_json::Result;
+use std::time::Duration;
extern crate paho_mqtt as mqtt;
-const BROKER: &str = "tcp://broker.emqx.io:1883";
-
#[derive(Serialize, Deserialize, PartialEq)]
enum MqttMessageKind {
Time,
@@ -20,10 +16,11 @@ struct MqttMessage {
time: u32,
}
-fn init_mqtt(uri: &str, topic: &str) -> mqtt::Result<(mqtt::Client, mqtt::Receiver