Remove ping every
This commit is contained in:
2 files changed
+1
-53
No files matched your search
Generated
-16
@@ -194,21 +194,6 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b"
|
||||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10c2722795460108a7872e1cd933a85d6ec38abc4baecad51028f702da28889f"
|
||||
dependencies = [
|
||||
"crc-catalog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc-catalog"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.2.1"
|
||||
@@ -965,7 +950,6 @@ dependencies = [
|
||||
"assert_matches",
|
||||
"cfb-mode",
|
||||
"cookie-factory",
|
||||
"crc",
|
||||
"crc32fast",
|
||||
"crossbeam-channel 0.5.1",
|
||||
"env_logger",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::{BcCamera, Error, Result, RX_TIMEOUT};
|
||||
use super::{BcCamera, Result, RX_TIMEOUT};
|
||||
use crate::bc::model::*;
|
||||
|
||||
impl BcCamera {
|
||||
@@ -28,40 +28,4 @@ impl BcCamera {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Send a ping repeatedly
|
||||
pub fn ping_every(&self, milis: u64) -> Result<()> {
|
||||
let wait = std::time::Duration::from_millis(milis);
|
||||
|
||||
let connection = self.connection.as_ref().expect("Must be connected to ping");
|
||||
let sub_ping = connection.subscribe(MSG_ID_PING)?;
|
||||
|
||||
loop {
|
||||
let ping = Bc {
|
||||
meta: BcMeta {
|
||||
msg_id: MSG_ID_PING,
|
||||
channel_id: self.channel_id,
|
||||
msg_num: self.new_message_num(),
|
||||
stream_type: 0,
|
||||
response_code: 0,
|
||||
class: 0x6414,
|
||||
},
|
||||
body: BcBody::ModernMsg(ModernMsg {
|
||||
..Default::default()
|
||||
}),
|
||||
};
|
||||
|
||||
sub_ping.send(ping)?;
|
||||
|
||||
let reply = sub_ping.rx.recv_timeout(RX_TIMEOUT)?;
|
||||
|
||||
if reply.meta.response_code != 200 {
|
||||
return Err(Error::UnintelligibleReply {
|
||||
reply,
|
||||
why: "Camera responded with an error status code to the ping",
|
||||
});
|
||||
}
|
||||
std::thread::sleep(wait);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user