Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cec02e3c2 | ||
|
|
4a94a2ddb2 | ||
|
|
459c9255ad |
No files matched your search
Generated
+2
-2
@@ -1663,7 +1663,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "neolink"
|
name = "neolink"
|
||||||
version = "0.6.2"
|
version = "0.6.3-rc.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-stream",
|
"async-stream",
|
||||||
@@ -1701,7 +1701,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "neolink_core"
|
name = "neolink_core"
|
||||||
version = "0.6.2"
|
version = "0.6.3-rc.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"assert_matches",
|
"assert_matches",
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "neolink"
|
name = "neolink"
|
||||||
description = "A standards-compliant bridge to Reolink IP cameras"
|
description = "A standards-compliant bridge to Reolink IP cameras"
|
||||||
version = "0.6.2"
|
version = "0.6.3-rc.1"
|
||||||
authors = ["George Hilliard <thirtythreeforty@gmail.com>", "Andrew King <sheepchaan@gmail.com>"]
|
authors = ["George Hilliard <thirtythreeforty@gmail.com>", "Andrew King <sheepchaan@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
@@ -31,7 +31,7 @@ heck = "0.4.1"
|
|||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
log = { version = "0.4.17", features = [ "release_max_level_debug" ] }
|
log = { version = "0.4.17", features = [ "release_max_level_debug" ] }
|
||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
neolink_core = { path = "crates/core", version = "0.6.2" }
|
neolink_core = { path = "crates/core", version = "0.6.3-rc.1" }
|
||||||
regex = "1.7.3"
|
regex = "1.7.3"
|
||||||
rumqttc = "0.22.0"
|
rumqttc = "0.22.0"
|
||||||
serde = { version = "1.0.160", features = ["derive"] }
|
serde = { version = "1.0.160", features = ["derive"] }
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ Avaliable features are:
|
|||||||
- `pt`: This adds a selection of buttons to control the pan and tilt of the
|
- `pt`: This adds a selection of buttons to control the pan and tilt of the
|
||||||
camera
|
camera
|
||||||
- `battery`: This adds a battery level sensor to home assistant
|
- `battery`: This adds a battery level sensor to home assistant
|
||||||
|
- `siren`: Adds a siren button to home assistant
|
||||||
|
|
||||||
### Pause
|
### Pause
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "neolink_core"
|
name = "neolink_core"
|
||||||
description = "Core services and structure for Reolink IP cameras"
|
description = "Core services and structure for Reolink IP cameras"
|
||||||
version = "0.6.2"
|
version = "0.6.3-rc.1"
|
||||||
authors = ["George Hilliard <thirtythreeforty@gmail.com>", "Andrew King <sheepchaan@gmail.com>"]
|
authors = ["George Hilliard <thirtythreeforty@gmail.com>", "Andrew King <sheepchaan@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ env_logger = "0.10.0"
|
|||||||
fcm-push-listener = "2.0.1"
|
fcm-push-listener = "2.0.1"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
log = { version = "0.4.17", features = [ "release_max_level_debug" ] }
|
log = { version = "0.4.17", features = [ "release_max_level_debug" ] }
|
||||||
neolink_core = { path = "../core", version = "0.6.2" }
|
neolink_core = { path = "../core", version = "0.6.3-rc.1" }
|
||||||
regex = "1.8.1"
|
regex = "1.8.1"
|
||||||
serde = "1.0.163"
|
serde = "1.0.163"
|
||||||
tokio = { version = "1.28.1", features = ["full"] }
|
tokio = { version = "1.28.1", features = ["full"] }
|
||||||
|
|||||||
@@ -261,10 +261,16 @@ impl NeoInstance {
|
|||||||
Ok(instance_rx.await?)
|
Ok(instance_rx.await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn push_notifications(&self) -> Result<WatchReceiver<Option<PushNoti>>> {
|
pub(crate) async fn uid(&self) -> Result<String> {
|
||||||
let uid = self
|
let (reply_tx, reply_rx) = oneshot();
|
||||||
.run_task(|cam| Box::pin(async move { Ok(cam.uid().await?) }))
|
self.camera_control
|
||||||
|
.send(NeoCamCommand::GetUid(reply_tx))
|
||||||
.await?;
|
.await?;
|
||||||
|
Ok(reply_rx.await?)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn push_notifications(&self) -> Result<WatchReceiver<Option<PushNoti>>> {
|
||||||
|
let uid = self.uid().await?;
|
||||||
let (instance_tx, instance_rx) = oneshot();
|
let (instance_tx, instance_rx) = oneshot();
|
||||||
self.camera_control
|
self.camera_control
|
||||||
.send(NeoCamCommand::PushNoti(instance_tx))
|
.send(NeoCamCommand::PushNoti(instance_tx))
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ pub(crate) enum NeoCamCommand {
|
|||||||
State(OneshotSender<NeoCamThreadState>),
|
State(OneshotSender<NeoCamThreadState>),
|
||||||
GetPermit(OneshotSender<Permit>),
|
GetPermit(OneshotSender<Permit>),
|
||||||
PushNoti(OneshotSender<WatchReceiver<Option<PushNoti>>>),
|
PushNoti(OneshotSender<WatchReceiver<Option<PushNoti>>>),
|
||||||
|
GetUid(OneshotSender<String>),
|
||||||
}
|
}
|
||||||
/// The underlying camera binding
|
/// The underlying camera binding
|
||||||
pub(crate) struct NeoCam {
|
pub(crate) struct NeoCam {
|
||||||
@@ -62,6 +63,7 @@ impl NeoCam {
|
|||||||
let (stream_request_tx, stream_request_rx) = mpsc(100);
|
let (stream_request_tx, stream_request_rx) = mpsc(100);
|
||||||
let (md_request_tx, md_request_rx) = mpsc(100);
|
let (md_request_tx, md_request_rx) = mpsc(100);
|
||||||
let (state_tx, state_rx) = watch(NeoCamThreadState::Connected);
|
let (state_tx, state_rx) = watch(NeoCamThreadState::Connected);
|
||||||
|
let (uid_tx, uid_rx) = watch(config.camera_uid.clone());
|
||||||
|
|
||||||
let set = JoinSet::new();
|
let set = JoinSet::new();
|
||||||
let users = UseCounter::new().await;
|
let users = UseCounter::new().await;
|
||||||
@@ -175,6 +177,14 @@ impl NeoCam {
|
|||||||
}
|
}
|
||||||
).await?;
|
).await?;
|
||||||
},
|
},
|
||||||
|
NeoCamCommand::GetUid(sender) => {
|
||||||
|
let mut uid_rx = uid_rx.clone();
|
||||||
|
tokio::task::spawn(async move {
|
||||||
|
let uid = uid_rx.wait_for(|v| v.is_some()).await?.clone().unwrap();
|
||||||
|
let _ = sender.send(uid);
|
||||||
|
AnyResult::Ok(())
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log::debug!("Control thread Senders dropped");
|
log::debug!("Control thread Senders dropped");
|
||||||
@@ -275,6 +285,26 @@ impl NeoCam {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This thread will update the UID by asking the camera.
|
||||||
|
// We cache this in the uid_rx
|
||||||
|
let uid_instance = instance.clone();
|
||||||
|
let uid_cancel = me.cancel.clone();
|
||||||
|
me.set.spawn(async move {
|
||||||
|
tokio::select! {
|
||||||
|
_ = uid_cancel.cancelled() => {
|
||||||
|
AnyResult::Ok(())
|
||||||
|
},
|
||||||
|
v = async {
|
||||||
|
let uid = uid_instance.run_task(|cam| Box::pin(async move {
|
||||||
|
let uid = cam.uid().await?;
|
||||||
|
Ok(uid)
|
||||||
|
})).await?;
|
||||||
|
uid_tx.send_replace(Some(uid));
|
||||||
|
AnyResult::Ok(())
|
||||||
|
} => v,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Handles push notifications
|
// Handles push notifications
|
||||||
let pn_root_instance = instance.subscribe().await?;
|
let pn_root_instance = instance.subscribe().await?;
|
||||||
let pn_cancel = me.cancel.clone();
|
let pn_cancel = me.cancel.clone();
|
||||||
|
|||||||
+1
-1
@@ -565,7 +565,7 @@ async fn listen_on_camera(camera: NeoInstance, mqtt_instance: MqttInstance) -> R
|
|||||||
} => v,
|
} => v,
|
||||||
// Handle the floodlight task activation
|
// Handle the floodlight task activation
|
||||||
v = async {
|
v = async {
|
||||||
let flt_status = camera_floodlight_tasks.run_task(|cam| Box::pin(async move {
|
let flt_status = camera_floodlight_tasks.run_passive_task(|cam| Box::pin(async move {
|
||||||
Ok(cam.is_flightlight_tasks_enabled().await?)
|
Ok(cam.is_flightlight_tasks_enabled().await?)
|
||||||
})).await;
|
})).await;
|
||||||
if flt_status.is_err() {
|
if flt_status.is_err() {
|
||||||
|
|||||||
Reference in new issue
Block a user