Bug fixes from merges
Using u8 for channel id throughtout Using simpler map_err Co-Authored-By: twistedddx <bits@live.com>
This commit is contained in:
1 parent
9604ecb29f
commit
a961829c63
5 files changed
+10
-28
No files matched your search
+2
-2
@@ -121,7 +121,7 @@ pub struct Preview {
|
||||
pub version: String,
|
||||
|
||||
#[yaserde(rename = "channelId")]
|
||||
pub channel_id: u32,
|
||||
pub channel_id: u8,
|
||||
pub handle: u32,
|
||||
#[yaserde(rename = "streamType")]
|
||||
pub stream_type: String,
|
||||
@@ -137,7 +137,7 @@ pub struct Extension {
|
||||
pub user_name: Option<String>,
|
||||
pub token: Option<String>,
|
||||
#[yaserde(rename = "channelId")]
|
||||
pub channel_id: Option<u32>,
|
||||
pub channel_id: Option<u8>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Default, Debug, YaDeserialize, YaSerialize)]
|
||||
|
||||
+4
-14
@@ -154,10 +154,7 @@ impl BcCamera {
|
||||
|
||||
sub_login.send(legacy_login)?;
|
||||
|
||||
let legacy_reply = sub_login.rx.recv_timeout(RX_TIMEOUT).map_err(|e| match e {
|
||||
std::sync::mpsc::RecvTimeoutError::Timeout => Error::TimeoutTimeout,
|
||||
std::sync::mpsc::RecvTimeoutError::Disconnected => Error::TimeoutDropped,
|
||||
})?;
|
||||
let legacy_reply = sub_login.rx.recv_timeout(RX_TIMEOUT)?;
|
||||
|
||||
let nonce;
|
||||
if let BcMeta {response_code: 0x01dd,..} = legacy_reply.meta {
|
||||
@@ -217,10 +214,7 @@ impl BcCamera {
|
||||
);
|
||||
|
||||
sub_login.send(modern_login)?;
|
||||
let modern_reply = sub_login.rx.recv_timeout(RX_TIMEOUT).map_err(|e| match e {
|
||||
std::sync::mpsc::RecvTimeoutError::Timeout => Error::TimeoutTimeout,
|
||||
std::sync::mpsc::RecvTimeoutError::Disconnected => Error::TimeoutDropped,
|
||||
})?;
|
||||
let modern_reply = sub_login.rx.recv_timeout(RX_TIMEOUT)?;
|
||||
|
||||
let device_info;
|
||||
match modern_reply.body {
|
||||
@@ -279,10 +273,7 @@ impl BcCamera {
|
||||
|
||||
sub_ping.send(ping)?;
|
||||
|
||||
sub_ping.rx.recv_timeout(RX_TIMEOUT).map_err(|e| match e {
|
||||
std::sync::mpsc::RecvTimeoutError::Timeout => Error::TimeoutTimeout,
|
||||
std::sync::mpsc::RecvTimeoutError::Disconnected => Error::TimeoutDropped,
|
||||
})?;
|
||||
sub_ping.rx.recv_timeout(RX_TIMEOUT)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -291,7 +282,6 @@ impl BcCamera {
|
||||
&self,
|
||||
data_outs: &mut GstOutputs,
|
||||
stream_name: &str,
|
||||
channel_id: u32,
|
||||
) -> Result<Never> {
|
||||
let connection = self
|
||||
.connection
|
||||
@@ -317,7 +307,7 @@ impl BcCamera {
|
||||
BcXml {
|
||||
preview: Some(Preview {
|
||||
version: xml_ver(),
|
||||
channel_id,
|
||||
channel_id: self.channel_id,
|
||||
handle: 0,
|
||||
stream_type: stream_name.to_string(),
|
||||
}),
|
||||
|
||||
+2
-10
@@ -24,11 +24,7 @@ impl BcCamera {
|
||||
sub_get_general.send(get)?;
|
||||
let msg = sub_get_general
|
||||
.rx
|
||||
.recv_timeout(RX_TIMEOUT)
|
||||
.map_err(|e| match e {
|
||||
std::sync::mpsc::RecvTimeoutError::Timeout => Error::TimeoutTimeout,
|
||||
std::sync::mpsc::RecvTimeoutError::Disconnected => Error::TimeoutDropped,
|
||||
})?;
|
||||
.recv_timeout(RX_TIMEOUT)?;
|
||||
|
||||
if let BcBody::ModernMsg(ModernMsg {
|
||||
payload:
|
||||
@@ -118,11 +114,7 @@ impl BcCamera {
|
||||
sub_set_general.send(set)?;
|
||||
let msg = sub_set_general
|
||||
.rx
|
||||
.recv_timeout(RX_TIMEOUT)
|
||||
.map_err(|e| match e {
|
||||
std::sync::mpsc::RecvTimeoutError::Timeout => Error::TimeoutTimeout,
|
||||
std::sync::mpsc::RecvTimeoutError::Disconnected => Error::TimeoutDropped,
|
||||
})?;
|
||||
.recv_timeout(RX_TIMEOUT)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ fn default_tls_client_auth() -> String {
|
||||
"none".to_string()
|
||||
}
|
||||
|
||||
fn default_channel_id() -> u32 {
|
||||
fn default_channel_id() -> u8 {
|
||||
0
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -246,7 +246,7 @@ fn camera_main(
|
||||
"{}: Starting video stream {}",
|
||||
camera_config.name, stream_name
|
||||
);
|
||||
camera.start_video(outputs, stream_name, camera_config.channel_id)
|
||||
camera.start_video(outputs, stream_name)
|
||||
})()
|
||||
.map_err(|err| CameraErr { connected, err })
|
||||
}
|
||||
Reference in new issue
Block a user