1 use super::{BcCamera, Result, RX_TIMEOUT};
2 use crate::bc::model::*;
3 
4 impl BcCamera {
5     /// Ping the camera will either return Ok(()) which means a sucess reply
6     /// or error
ping(&self) -> Result<()>7     pub fn ping(&self) -> Result<()> {
8         let connection = self.connection.as_ref().expect("Must be connected to ping");
9         let sub_ping = connection.subscribe(MSG_ID_PING)?;
10 
11         let ping = Bc {
12             meta: BcMeta {
13                 msg_id: MSG_ID_PING,
14                 channel_id: self.channel_id,
15                 msg_num: self.new_message_num(),
16                 stream_type: 0,
17                 response_code: 0,
18                 class: 0x6414,
19             },
20             body: BcBody::ModernMsg(ModernMsg {
21                 ..Default::default()
22             }),
23         };
24 
25         sub_ping.send(ping)?;
26 
27         sub_ping.rx.recv_timeout(RX_TIMEOUT)?;
28 
29         Ok(())
30     }
31 }
32