Compare commits
5
Commits
master
...
feat/visitor
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa12f8f761 | ||
|
|
474aaea7d2 | ||
|
|
8d1b8e0dcb | ||
|
|
457eac24df | ||
|
|
559d5b0731 |
No files matched your search
@@ -31,7 +31,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-22.04, windows-2022, macos-12, macos-14] # macos-14+ is arm64
|
os: [ubuntu-22.04, windows-2022, macos-13, macos-14] # macos-14+ is arm64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
name: Checkout onto ${{ runner.os }}
|
name: Checkout onto ${{ runner.os }}
|
||||||
@@ -86,7 +86,7 @@ jobs:
|
|||||||
- if: runner.os == 'macOS'
|
- if: runner.os == 'macOS'
|
||||||
name: Install macOS deps
|
name: Install macOS deps
|
||||||
run: |
|
run: |
|
||||||
curl -L 'https://gstreamer.freedesktop.org/data/pkg/osx/1.20.4/gstreamer-1.0-devel-1.20.4-universal.pkg' -o "$(pwd)/gstreamer-devel.pkg"
|
curl -L 'https://gstreamer.freedesktop.org/data/pkg/osx/1.24.11/gstreamer-1.0-devel-1.24.11-universal.pkg' -o "$(pwd)/gstreamer-devel.pkg"
|
||||||
sudo installer -verbose -pkg "$(pwd)/gstreamer-devel.pkg" -target /
|
sudo installer -verbose -pkg "$(pwd)/gstreamer-devel.pkg" -target /
|
||||||
PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
||||||
PKG_CONFIG_GSTREAMER_1_0_PREFIX="/Library/Frameworks/GStreamer.framework/Versions/1.0"
|
PKG_CONFIG_GSTREAMER_1_0_PREFIX="/Library/Frameworks/GStreamer.framework/Versions/1.0"
|
||||||
@@ -366,7 +366,7 @@ jobs:
|
|||||||
- name: Download Macos
|
- name: Download Macos
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: release-macos-12
|
name: release-macos-13
|
||||||
path: neolink_macos_intel
|
path: neolink_macos_intel
|
||||||
- name: Download Macos arm64
|
- name: Download Macos arm64
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
|||||||
@@ -243,6 +243,20 @@ Status Messages:
|
|||||||
pir status
|
pir status
|
||||||
- `/status/motion` Contains the motion detection alarm status. `on` for motion
|
- `/status/motion` Contains the motion detection alarm status. `on` for motion
|
||||||
and `off` for still, only published when `enable_moton` is true in the config
|
and `off` for still, only published when `enable_moton` is true in the config
|
||||||
|
- `/status/visitor` Contains the visitor detection status, which occurs when a
|
||||||
|
doorbell is pressed.
|
||||||
|
- `/status/ai` Contains the ai detection status, which occurs when a
|
||||||
|
the camera's internal ai detects something. The value is `person/car/other`
|
||||||
|
- `/status/ai/person` Contains the ai detection status of the last person,
|
||||||
|
which occurs when a the camera's internal ai detects a person.
|
||||||
|
- `/status/ai/car` Contains the ai detection status of the last car, which
|
||||||
|
occurs when a the camera's internal ai detects a car.
|
||||||
|
- `/status/ai/other` Contains the ai detection status from the camera, which
|
||||||
|
occurs when a the camera's internal ai detects something.
|
||||||
|
|
||||||
|
(This is a placeholder until I can fiquire out everything that the camera
|
||||||
|
can detect. If you have list for me please open an issue with it, I don't
|
||||||
|
have a cam with AI to check myself)
|
||||||
- `/status/ptz/preset` Sent in reply to a `/query/ptz/preset` an XML encoded
|
- `/status/ptz/preset` Sent in reply to a `/query/ptz/preset` an XML encoded
|
||||||
version of the PTZ presets
|
version of the PTZ presets
|
||||||
- `/status/preview` a base64 encoded camera image updated every 2s. Not
|
- `/status/preview` a base64 encoded camera image updated every 2s. Not
|
||||||
@@ -325,6 +339,14 @@ enable_motion = false # motion detection
|
|||||||
# (limited battery drain since it
|
# (limited battery drain since it
|
||||||
# is a passive listening connection)
|
# is a passive listening connection)
|
||||||
#
|
#
|
||||||
|
enable_visitor = false # visitor press for doorbell camera
|
||||||
|
# (limited battery drain since it
|
||||||
|
# is a passive listening connection)
|
||||||
|
#
|
||||||
|
enable_ai = false # report detected ai by the camera
|
||||||
|
# (limited battery drain since it
|
||||||
|
# is a passive listening connection)
|
||||||
|
#
|
||||||
enable_light = false # flood lights only available on some camera
|
enable_light = false # flood lights only available on some camera
|
||||||
# (limited battery drain since it
|
# (limited battery drain since it
|
||||||
# is a passive listening connection)
|
# is a passive listening connection)
|
||||||
|
|||||||
@@ -633,11 +633,15 @@ pub struct AlarmEvent {
|
|||||||
/// The channel the event occured on. Usually zero unless from an NVR
|
/// The channel the event occured on. Usually zero unless from an NVR
|
||||||
#[serde(rename = "channelId")]
|
#[serde(rename = "channelId")]
|
||||||
pub channel_id: u8,
|
pub channel_id: u8,
|
||||||
/// Motion status. Known values are `"MD"` or `"none"`
|
/// Motion status. Known values are `"MD"` or `"none"` or `"visitor"`
|
||||||
pub status: String,
|
pub status: String,
|
||||||
/// AI status. Known values are `"people"` or `"none"`
|
/// AI status. Known values are `"people"` or `"none"`
|
||||||
#[serde(rename = "AItype", skip_serializing_if = "Option::is_none")]
|
#[serde(
|
||||||
pub ai_type: Option<String>,
|
rename = "AItype",
|
||||||
|
default = "ai_type_default",
|
||||||
|
skip_serializing_if = "ai_type_skip"
|
||||||
|
)]
|
||||||
|
pub ai_type: String,
|
||||||
/// The recording status. Known values `0` or `1`
|
/// The recording status. Known values `0` or `1`
|
||||||
pub recording: i32,
|
pub recording: i32,
|
||||||
/// The timestamp associated with the recording. `0` if not recording
|
/// The timestamp associated with the recording. `0` if not recording
|
||||||
@@ -645,6 +649,13 @@ pub struct AlarmEvent {
|
|||||||
pub timeStamp: i32,
|
pub timeStamp: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ai_type_default() -> String {
|
||||||
|
"none".to_string()
|
||||||
|
}
|
||||||
|
fn ai_type_skip(value: &String) -> bool {
|
||||||
|
value == "none"
|
||||||
|
}
|
||||||
|
|
||||||
/// The Ptz messages used to move the camera
|
/// The Ptz messages used to move the camera
|
||||||
#[derive(PartialEq, Default, Debug, Deserialize, Serialize)]
|
#[derive(PartialEq, Default, Debug, Deserialize, Serialize)]
|
||||||
pub struct PtzControl {
|
pub struct PtzControl {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ pub use credentials::*;
|
|||||||
pub use errors::Error;
|
pub use errors::Error;
|
||||||
pub use ledstate::LightState;
|
pub use ledstate::LightState;
|
||||||
pub use login::MaxEncryption;
|
pub use login::MaxEncryption;
|
||||||
pub use motion::{MotionData, MotionStatus};
|
pub use motion::{AiKind, MotionData, MotionEvents};
|
||||||
pub use pirstate::PirState;
|
pub use pirstate::PirState;
|
||||||
pub use ptz::Direction;
|
pub use ptz::Direction;
|
||||||
pub use pushinfo::PhoneType;
|
pub use pushinfo::PhoneType;
|
||||||
|
|||||||
@@ -5,25 +5,46 @@ use tokio::sync::mpsc::{channel, error::TryRecvError, Receiver};
|
|||||||
use tokio::task::JoinSet;
|
use tokio::task::JoinSet;
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
|
|
||||||
/// Motion Status that the callback can send
|
/// Motion Events that the callback can send
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub enum MotionStatus {
|
pub enum MotionEvents {
|
||||||
/// Sent when motion is first detected
|
/// Sent when motion is first detected
|
||||||
Start(Instant),
|
Start(Instant),
|
||||||
/// Sent when motion stops
|
/// Sent when motion stops
|
||||||
Stop(Instant),
|
Stop(Instant),
|
||||||
|
/// Sent when a doorbell is pressed
|
||||||
|
Vistor(Instant),
|
||||||
|
/// Sent when an AI is recieved
|
||||||
|
Ai(Instant, AiKind),
|
||||||
/// Sent when an Alarm about something other than motion was received
|
/// Sent when an Alarm about something other than motion was received
|
||||||
NoChange(Instant),
|
NoChange(Instant),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug)]
|
||||||
|
/// The kinds of objects the AI can detect
|
||||||
|
pub enum AiKind {
|
||||||
|
/// A person
|
||||||
|
Person,
|
||||||
|
/// A car
|
||||||
|
Car,
|
||||||
|
/// Something else, open a PR to fix with actual thing
|
||||||
|
Other,
|
||||||
|
}
|
||||||
|
|
||||||
/// A handle on current motion related events comming from the camera
|
/// A handle on current motion related events comming from the camera
|
||||||
///
|
///
|
||||||
/// When this object is dropped the motion events are stopped
|
/// When this object is dropped the motion events are stopped
|
||||||
pub struct MotionData {
|
pub struct MotionData {
|
||||||
handle: JoinSet<Result<()>>,
|
handle: JoinSet<Result<()>>,
|
||||||
cancel: CancellationToken,
|
cancel: CancellationToken,
|
||||||
rx: Receiver<Result<MotionStatus>>,
|
rx: Receiver<Result<MotionEvents>>,
|
||||||
last_update: MotionStatus,
|
history: MotionHistory,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MotionHistory {
|
||||||
|
motion: MotionEvents,
|
||||||
|
visitor: MotionEvents,
|
||||||
|
ai: MotionEvents,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MotionData {
|
impl MotionData {
|
||||||
@@ -33,10 +54,10 @@ impl MotionData {
|
|||||||
/// An error is raised if the motion connection to the camera is dropped
|
/// An error is raised if the motion connection to the camera is dropped
|
||||||
pub fn motion_detected(&mut self) -> Result<Option<bool>> {
|
pub fn motion_detected(&mut self) -> Result<Option<bool>> {
|
||||||
self.consume_motion_events()?;
|
self.consume_motion_events()?;
|
||||||
Ok(match &self.last_update {
|
Ok(match &self.history.motion {
|
||||||
MotionStatus::Start(_) => Some(true),
|
MotionEvents::Start(_) => Some(true),
|
||||||
MotionStatus::Stop(_) => Some(false),
|
MotionEvents::Stop(_) => Some(false),
|
||||||
MotionStatus::NoChange(_) => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,44 +67,64 @@ impl MotionData {
|
|||||||
/// An error is raised if the motion connection to the camera is dropped
|
/// An error is raised if the motion connection to the camera is dropped
|
||||||
pub fn motion_detected_within(&mut self, duration: Duration) -> Result<Option<bool>> {
|
pub fn motion_detected_within(&mut self, duration: Duration) -> Result<Option<bool>> {
|
||||||
self.consume_motion_events()?;
|
self.consume_motion_events()?;
|
||||||
Ok(match &self.last_update {
|
Ok(match &self.history.motion {
|
||||||
MotionStatus::Start(_) => Some(true),
|
MotionEvents::Start(_) => Some(true),
|
||||||
MotionStatus::Stop(time) => Some((Instant::now() - *time) < duration),
|
MotionEvents::Stop(time) => Some((Instant::now() - *time) < duration),
|
||||||
MotionStatus::NoChange(_) => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Consume the motion events diretly
|
/// Consume all the motion events on the queue and update the history
|
||||||
///
|
///
|
||||||
/// An error is raised if the motion connection to the camera is dropped
|
/// An error is raised if the motion connection to the camera is dropped
|
||||||
pub fn consume_motion_events(&mut self) -> Result<Vec<MotionStatus>> {
|
pub fn consume_motion_events(&mut self) -> Result<()> {
|
||||||
let mut results: Vec<MotionStatus> = vec![];
|
while self.try_recv()?.is_some() {
|
||||||
loop {
|
// Tight loop....
|
||||||
match self.rx.try_recv() {
|
// Should not be many of such messages in the queue though
|
||||||
Ok(motion) => results.push(motion?),
|
}
|
||||||
Err(TryRecvError::Empty) => break,
|
Ok(())
|
||||||
Err(e) => return Err(Error::from(e)),
|
}
|
||||||
|
|
||||||
|
fn update_history(&mut self, latest_event: &MotionEvents) {
|
||||||
|
match latest_event {
|
||||||
|
MotionEvents::Start(_) => {
|
||||||
|
self.history.motion = *latest_event;
|
||||||
}
|
}
|
||||||
|
MotionEvents::Stop(_) => {
|
||||||
|
self.history.motion = *latest_event;
|
||||||
|
}
|
||||||
|
MotionEvents::Vistor(_) => {
|
||||||
|
self.history.visitor = *latest_event;
|
||||||
|
}
|
||||||
|
MotionEvents::Ai(_, _) => {
|
||||||
|
self.history.ai = *latest_event;
|
||||||
|
}
|
||||||
|
MotionEvents::NoChange(_) => {}
|
||||||
}
|
}
|
||||||
if let Some(last) = results.last() {
|
}
|
||||||
self.last_update = *last;
|
|
||||||
|
/// Try to recv a new motion event on the pipeline
|
||||||
|
pub fn try_recv(&mut self) -> Result<Option<MotionEvents>> {
|
||||||
|
match self.rx.try_recv() {
|
||||||
|
Ok(motion) => {
|
||||||
|
let motion = motion?;
|
||||||
|
self.update_history(&motion);
|
||||||
|
Ok(Some(motion))
|
||||||
|
}
|
||||||
|
Err(TryRecvError::Empty) => Ok(None),
|
||||||
|
Err(e) => Err(Error::from(e)),
|
||||||
}
|
}
|
||||||
Ok(results)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Await a new motion event
|
/// Await a new motion event
|
||||||
///
|
pub async fn recv(&mut self) -> Result<Option<MotionEvents>> {
|
||||||
///
|
match self.rx.recv().await {
|
||||||
pub async fn next_motion(&mut self) -> Result<MotionStatus> {
|
Some(motion) => {
|
||||||
let motions = self.consume_motion_events()?;
|
let motion = motion?;
|
||||||
if let Some(last) = motions.last() {
|
self.update_history(&motion);
|
||||||
Ok(*last)
|
Ok(Some(motion))
|
||||||
} else if let Some(moition) = self.rx.recv().await {
|
}
|
||||||
let moition = moition?;
|
None => Ok(None),
|
||||||
self.last_update = moition;
|
|
||||||
Ok(moition)
|
|
||||||
} else {
|
|
||||||
Err(Error::Other("Motion dropped"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,10 +132,10 @@ impl MotionData {
|
|||||||
///
|
///
|
||||||
/// It must be stopped for at least the given duration
|
/// It must be stopped for at least the given duration
|
||||||
pub async fn await_stop(&mut self, duration: Duration) -> Result<()> {
|
pub async fn await_stop(&mut self, duration: Duration) -> Result<()> {
|
||||||
let motions = self.consume_motion_events()?;
|
self.consume_motion_events()?;
|
||||||
let mut last_motion = motions.last().copied();
|
let mut last_motion = self.history.motion;
|
||||||
loop {
|
loop {
|
||||||
if let Some(MotionStatus::Stop(time)) = last_motion {
|
if let MotionEvents::Stop(time) = last_motion {
|
||||||
// In stop state
|
// In stop state
|
||||||
if duration.is_zero() || (Instant::now() - time) > duration {
|
if duration.is_zero() || (Instant::now() - time) > duration {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@@ -105,22 +146,37 @@ impl MotionData {
|
|||||||
_ = tokio::time::sleep(remaining_sleep) => {None},
|
_ = tokio::time::sleep(remaining_sleep) => {None},
|
||||||
v = async {
|
v = async {
|
||||||
loop {
|
loop {
|
||||||
match self.next_motion().await {
|
match self.recv().await {
|
||||||
n @ Ok(MotionStatus::Start(_)) => {return n;},
|
n @ Ok(Some(MotionEvents::Start(_))) => {return n;},
|
||||||
|
n @ Ok(None) => {return n;} // End of data
|
||||||
n @ Err(_) => {return n;},
|
n @ Err(_) => {return n;},
|
||||||
_ => {continue;}
|
_ => {continue;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} => {Some(v)}
|
} => {Some(v)}
|
||||||
};
|
};
|
||||||
if let Some(v) = result {
|
match result {
|
||||||
v?;
|
Some(Ok(None)) => {
|
||||||
} else {
|
// Camera has dropped motion
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
}
|
||||||
|
Some(Ok(Some(_))) => {
|
||||||
|
// continue to next data
|
||||||
|
}
|
||||||
|
Some(Err(e)) => return Err(e),
|
||||||
|
None => {
|
||||||
|
// Timeout occured motion stopped
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
last_motion = Some(self.next_motion().await?);
|
if let Some(next_motion) = self.recv().await? {
|
||||||
|
last_motion = next_motion;
|
||||||
|
} else {
|
||||||
|
// Camera had dropped motion
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,10 +184,10 @@ impl MotionData {
|
|||||||
///
|
///
|
||||||
/// The motion must have a minimum duration as given
|
/// The motion must have a minimum duration as given
|
||||||
pub async fn await_start(&mut self, duration: Duration) -> Result<()> {
|
pub async fn await_start(&mut self, duration: Duration) -> Result<()> {
|
||||||
let motions = self.consume_motion_events()?;
|
self.consume_motion_events()?;
|
||||||
let mut last_motion = motions.last().copied();
|
let mut last_motion = self.history.motion;
|
||||||
loop {
|
loop {
|
||||||
if let Some(MotionStatus::Start(time)) = last_motion {
|
if let MotionEvents::Start(time) = last_motion {
|
||||||
// In start state
|
// In start state
|
||||||
if duration.is_zero() || (Instant::now() - time) > duration {
|
if duration.is_zero() || (Instant::now() - time) > duration {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@@ -141,22 +197,37 @@ impl MotionData {
|
|||||||
_ = tokio::time::sleep(duration - (Instant::now() - time)) => {None},
|
_ = tokio::time::sleep(duration - (Instant::now() - time)) => {None},
|
||||||
v = async {
|
v = async {
|
||||||
loop {
|
loop {
|
||||||
match self.next_motion().await {
|
match self.recv().await {
|
||||||
n @ Ok(MotionStatus::Stop(_)) => {return n;},
|
n @ Ok(Some(MotionEvents::Stop(_))) => {return n;},
|
||||||
|
n @ Ok(None) => {return n;} // End of data
|
||||||
n @ Err(_) => {return n;},
|
n @ Err(_) => {return n;},
|
||||||
_ => {continue;}
|
_ => {continue;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} => {Some(v)}
|
} => {Some(v)}
|
||||||
};
|
};
|
||||||
if let Some(v) = result {
|
match result {
|
||||||
v?;
|
Some(Ok(None)) => {
|
||||||
} else {
|
// Camera has dropped motion
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
}
|
||||||
|
Some(Ok(Some(_))) => {
|
||||||
|
// conitnue to next data
|
||||||
|
}
|
||||||
|
Some(Err(e)) => return Err(e),
|
||||||
|
None => {
|
||||||
|
// Timeout occured motion started
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
last_motion = Some(self.next_motion().await?);
|
if let Some(next_motion) = self.recv().await? {
|
||||||
|
last_motion = next_motion;
|
||||||
|
} else {
|
||||||
|
// Camera had dropped motion
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -225,7 +296,7 @@ impl BcCamera {
|
|||||||
loop {
|
loop {
|
||||||
tokio::task::yield_now().await;
|
tokio::task::yield_now().await;
|
||||||
let msg = sub.recv().await;
|
let msg = sub.recv().await;
|
||||||
let status = match msg {
|
let status_list = match msg {
|
||||||
Ok(motion_msg) => {
|
Ok(motion_msg) => {
|
||||||
if let BcBody::ModernMsg(ModernMsg {
|
if let BcBody::ModernMsg(ModernMsg {
|
||||||
payload:
|
payload:
|
||||||
@@ -236,36 +307,51 @@ impl BcCamera {
|
|||||||
..
|
..
|
||||||
}) = motion_msg.body
|
}) = motion_msg.body
|
||||||
{
|
{
|
||||||
let mut result = MotionStatus::NoChange(Instant::now());
|
let mut result = vec![];
|
||||||
for alarm_event in &alarm_event_list.alarm_events {
|
for alarm_event in &alarm_event_list.alarm_events {
|
||||||
if alarm_event.channel_id == channel_id {
|
if alarm_event.channel_id == channel_id {
|
||||||
if alarm_event.status != "none"
|
if alarm_event.status == "visitor" {
|
||||||
|| alarm_event
|
result.push(MotionEvents::Vistor(Instant::now()));
|
||||||
.ai_type
|
} else if alarm_event.status == "MD" {
|
||||||
.as_ref()
|
result.push(MotionEvents::Start(Instant::now()));
|
||||||
.map(|ai_type| ai_type != "none")
|
} else if alarm_event.ai_type != "none" {
|
||||||
.unwrap_or(false)
|
result.push(MotionEvents::Ai(Instant::now(),
|
||||||
{
|
match alarm_event.ai_type.as_ref() {
|
||||||
result = MotionStatus::Start(Instant::now());
|
"person" | "people" | "human" => AiKind::Person,
|
||||||
break;
|
"car" | "vehicle" => AiKind::Car,
|
||||||
|
_ => AiKind::Other,
|
||||||
|
}
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
result = MotionStatus::Stop(Instant::now());
|
result.push(MotionEvents::Stop(Instant::now()));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(result)
|
Ok(result)
|
||||||
} else {
|
} else {
|
||||||
Ok(MotionStatus::NoChange(Instant::now()))
|
Ok(vec![])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// On connection drop we stop
|
// On connection drop we stop
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
};
|
};
|
||||||
|
|
||||||
if tx.send(status).await.is_err() {
|
match status_list {
|
||||||
// Motion reciever has been dropped
|
Ok(mut status_list) => {
|
||||||
break;
|
for status in status_list.drain(..) {
|
||||||
|
if tx.send(Ok(status)).await.is_err() {
|
||||||
|
// Motion reciever has been dropped
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
|
// Err from camera
|
||||||
|
if tx.send(Err(e)).await.is_err() {
|
||||||
|
// Motion reciever has been dropped
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -277,7 +363,11 @@ impl BcCamera {
|
|||||||
handle: set,
|
handle: set,
|
||||||
cancel,
|
cancel,
|
||||||
rx,
|
rx,
|
||||||
last_update: MotionStatus::NoChange(Instant::now()),
|
history: MotionHistory {
|
||||||
|
motion: MotionEvents::NoChange(Instant::now()),
|
||||||
|
visitor: MotionEvents::NoChange(Instant::now()),
|
||||||
|
ai: MotionEvents::NoChange(Instant::now()),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-2
@@ -15,10 +15,9 @@ use tokio::{
|
|||||||
};
|
};
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
|
|
||||||
use super::{MdState, NeoCamCommand, NeoCamThreadState, Permit};
|
use super::{AiState, MdState, NeoCamCommand, NeoCamThreadState, Permit, VisitorState};
|
||||||
use crate::{config::CameraConfig, AnyResult, Result};
|
use crate::{config::CameraConfig, AnyResult, Result};
|
||||||
use neolink_core::bc_protocol::BcCamera;
|
use neolink_core::bc_protocol::BcCamera;
|
||||||
|
|
||||||
#[cfg(feature = "gstreamer")]
|
#[cfg(feature = "gstreamer")]
|
||||||
mod gst;
|
mod gst;
|
||||||
|
|
||||||
@@ -238,6 +237,22 @@ impl NeoInstance {
|
|||||||
Ok(instance_rx.await?)
|
Ok(instance_rx.await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn visitor(&self) -> Result<WatchReceiver<VisitorState>> {
|
||||||
|
let (instance_tx, instance_rx) = oneshot();
|
||||||
|
self.camera_control
|
||||||
|
.send(NeoCamCommand::Visitor(instance_tx))
|
||||||
|
.await?;
|
||||||
|
Ok(instance_rx.await?)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn ai(&self) -> Result<WatchReceiver<AiState>> {
|
||||||
|
let (instance_tx, instance_rx) = oneshot();
|
||||||
|
self.camera_control
|
||||||
|
.send(NeoCamCommand::Ai(instance_tx))
|
||||||
|
.await?;
|
||||||
|
Ok(instance_rx.await?)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) async fn config(&self) -> Result<WatchReceiver<CameraConfig>> {
|
pub(crate) async fn config(&self) -> Result<WatchReceiver<CameraConfig>> {
|
||||||
let (instance_tx, instance_rx) = oneshot();
|
let (instance_tx, instance_rx) = oneshot();
|
||||||
self.camera_control
|
self.camera_control
|
||||||
|
|||||||
+76
-8
@@ -15,7 +15,7 @@ use tokio_util::sync::CancellationToken;
|
|||||||
|
|
||||||
use super::NeoInstance;
|
use super::NeoInstance;
|
||||||
use crate::{AnyResult, Result};
|
use crate::{AnyResult, Result};
|
||||||
use neolink_core::bc_protocol::MotionStatus;
|
use neolink_core::bc_protocol::{AiKind, MotionEvents};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@@ -25,8 +25,26 @@ pub(crate) enum MdState {
|
|||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub(crate) enum VisitorState {
|
||||||
|
Visted(Instant),
|
||||||
|
Unknown,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub(crate) enum AiState {
|
||||||
|
Person(Instant),
|
||||||
|
Car(Instant),
|
||||||
|
Other(Instant),
|
||||||
|
Unknown,
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) struct NeoCamMdThread {
|
pub(crate) struct NeoCamMdThread {
|
||||||
md_watcher: Arc<WatchSender<MdState>>,
|
md_watcher: Arc<WatchSender<MdState>>,
|
||||||
|
visitor_watcher: Arc<WatchSender<VisitorState>>,
|
||||||
|
ai_watcher: Arc<WatchSender<AiState>>,
|
||||||
md_request_rx: MpscReceiver<MdRequest>,
|
md_request_rx: MpscReceiver<MdRequest>,
|
||||||
cancel: CancellationToken,
|
cancel: CancellationToken,
|
||||||
instance: NeoInstance,
|
instance: NeoInstance,
|
||||||
@@ -39,8 +57,17 @@ impl NeoCamMdThread {
|
|||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let (md_watcher, _) = watch(MdState::Unknown);
|
let (md_watcher, _) = watch(MdState::Unknown);
|
||||||
let md_watcher = Arc::new(md_watcher);
|
let md_watcher = Arc::new(md_watcher);
|
||||||
|
|
||||||
|
let (visitor_watcher, _) = watch(VisitorState::Unknown);
|
||||||
|
let visitor_watcher = Arc::new(visitor_watcher);
|
||||||
|
|
||||||
|
let (ai_watcher, _) = watch(AiState::Unknown);
|
||||||
|
let ai_watcher = Arc::new(ai_watcher);
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
md_watcher,
|
md_watcher,
|
||||||
|
visitor_watcher,
|
||||||
|
ai_watcher,
|
||||||
md_request_rx,
|
md_request_rx,
|
||||||
cancel: CancellationToken::new(),
|
cancel: CancellationToken::new(),
|
||||||
instance,
|
instance,
|
||||||
@@ -50,6 +77,8 @@ impl NeoCamMdThread {
|
|||||||
pub(crate) async fn run(&mut self) -> Result<()> {
|
pub(crate) async fn run(&mut self) -> Result<()> {
|
||||||
let thread_cancel = self.cancel.clone();
|
let thread_cancel = self.cancel.clone();
|
||||||
let watcher = self.md_watcher.clone();
|
let watcher = self.md_watcher.clone();
|
||||||
|
let visitor_watcher = self.visitor_watcher.clone();
|
||||||
|
let ai_watcher = self.ai_watcher.clone();
|
||||||
let md_instance = self.instance.clone();
|
let md_instance = self.instance.clone();
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = thread_cancel.cancelled() => {
|
_ = thread_cancel.cancelled() => {
|
||||||
@@ -58,11 +87,21 @@ impl NeoCamMdThread {
|
|||||||
v = async {
|
v = async {
|
||||||
while let Some(request) = self.md_request_rx.recv().await {
|
while let Some(request) = self.md_request_rx.recv().await {
|
||||||
match request {
|
match request {
|
||||||
MdRequest::Get {
|
MdRequest::Md {
|
||||||
sender
|
sender
|
||||||
} => {
|
} => {
|
||||||
let _ = sender.send(self.md_watcher.subscribe());
|
let _ = sender.send(self.md_watcher.subscribe());
|
||||||
},
|
},
|
||||||
|
MdRequest::Visitor {
|
||||||
|
sender
|
||||||
|
} => {
|
||||||
|
let _ = sender.send(self.visitor_watcher.subscribe());
|
||||||
|
},
|
||||||
|
MdRequest::Ai {
|
||||||
|
sender
|
||||||
|
} => {
|
||||||
|
let _ = sender.send(self.ai_watcher.subscribe());
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -71,23 +110,46 @@ impl NeoCamMdThread {
|
|||||||
loop {
|
loop {
|
||||||
let r: AnyResult<()> = md_instance.run_passive_task(|cam| {
|
let r: AnyResult<()> = md_instance.run_passive_task(|cam| {
|
||||||
let watcher = watcher.clone();
|
let watcher = watcher.clone();
|
||||||
|
let visitor_watcher = visitor_watcher.clone();
|
||||||
|
let ai_watcher = ai_watcher.clone();
|
||||||
Box::pin(
|
Box::pin(
|
||||||
async move {
|
async move {
|
||||||
let mut md = cam.listen_on_motion().await.with_context(|| "Error in getting MD listen_on_motion")?;
|
let mut md = cam.listen_on_motion().await.with_context(|| "Error in getting MD listen_on_motion")?;
|
||||||
loop {
|
loop {
|
||||||
let event = md.next_motion().await.with_context(|| "Error in getting MD next_motion")?;
|
let event = md.recv().await.with_context(|| "Error in getting MD next_motion")?.ok_or(anyhow::anyhow!("MD connection was dropped"))?;
|
||||||
match event {
|
match event {
|
||||||
MotionStatus::Start(at) => {
|
MotionEvents::Start(at) => {
|
||||||
watcher.send_replace(
|
watcher.send_replace(
|
||||||
MdState::Start(at.into())
|
MdState::Start(at.into())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
MotionStatus::Stop(at) => {
|
MotionEvents::Stop(at) => {
|
||||||
watcher.send_replace(
|
watcher.send_replace(
|
||||||
MdState::Stop(at.into())
|
MdState::Stop(at.into())
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
MotionStatus::NoChange(_) => {},
|
MotionEvents::Vistor(at) => {
|
||||||
|
visitor_watcher.send_replace(
|
||||||
|
VisitorState::Visted(at.into())
|
||||||
|
);
|
||||||
|
},
|
||||||
|
MotionEvents::Ai(at, kind) => {
|
||||||
|
ai_watcher.send_replace(
|
||||||
|
match kind {
|
||||||
|
AiKind::Person => {
|
||||||
|
AiState::Person(at.into())
|
||||||
|
}
|
||||||
|
AiKind::Car => {
|
||||||
|
AiState::Car(at.into())
|
||||||
|
}
|
||||||
|
AiKind::Other => {
|
||||||
|
AiState::Other(at.into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +172,13 @@ impl Drop for NeoCamMdThread {
|
|||||||
|
|
||||||
/// Used to pass messages to the MdThread
|
/// Used to pass messages to the MdThread
|
||||||
pub(crate) enum MdRequest {
|
pub(crate) enum MdRequest {
|
||||||
Get {
|
Md {
|
||||||
sender: OneshotSender<WatchReceiver<MdState>>,
|
sender: OneshotSender<WatchReceiver<MdState>>,
|
||||||
},
|
},
|
||||||
|
Visitor {
|
||||||
|
sender: OneshotSender<WatchReceiver<VisitorState>>,
|
||||||
|
},
|
||||||
|
Ai {
|
||||||
|
sender: OneshotSender<WatchReceiver<AiState>>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
+19
-3
@@ -20,8 +20,8 @@ use tokio_stream::wrappers::ReceiverStream;
|
|||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
MdRequest, MdState, NeoCamMdThread, NeoCamThread, NeoCamThreadState, NeoInstance, Permit,
|
AiState, MdRequest, MdState, NeoCamMdThread, NeoCamThread, NeoCamThreadState, NeoInstance,
|
||||||
UseCounter,
|
Permit, UseCounter, VisitorState,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "pushnoti")]
|
#[cfg(feature = "pushnoti")]
|
||||||
use super::{PnRequest, PushNoti};
|
use super::{PnRequest, PushNoti};
|
||||||
@@ -33,6 +33,8 @@ pub(crate) enum NeoCamCommand {
|
|||||||
HangUp,
|
HangUp,
|
||||||
Instance(OneshotSender<Result<NeoInstance>>),
|
Instance(OneshotSender<Result<NeoInstance>>),
|
||||||
Motion(OneshotSender<WatchReceiver<MdState>>),
|
Motion(OneshotSender<WatchReceiver<MdState>>),
|
||||||
|
Visitor(OneshotSender<WatchReceiver<VisitorState>>),
|
||||||
|
Ai(OneshotSender<WatchReceiver<AiState>>),
|
||||||
Config(OneshotSender<WatchReceiver<CameraConfig>>),
|
Config(OneshotSender<WatchReceiver<CameraConfig>>),
|
||||||
Disconnect(OneshotSender<()>),
|
Disconnect(OneshotSender<()>),
|
||||||
Connect(OneshotSender<()>),
|
Connect(OneshotSender<()>),
|
||||||
@@ -109,7 +111,21 @@ impl NeoCam {
|
|||||||
}
|
}
|
||||||
NeoCamCommand::Motion(sender) => {
|
NeoCamCommand::Motion(sender) => {
|
||||||
md_request_tx.send(
|
md_request_tx.send(
|
||||||
MdRequest::Get {
|
MdRequest::Md {
|
||||||
|
sender,
|
||||||
|
}
|
||||||
|
).await?;
|
||||||
|
},
|
||||||
|
NeoCamCommand::Visitor(sender) => {
|
||||||
|
md_request_tx.send(
|
||||||
|
MdRequest::Visitor {
|
||||||
|
sender,
|
||||||
|
}
|
||||||
|
).await?;
|
||||||
|
},
|
||||||
|
NeoCamCommand::Ai(sender) => {
|
||||||
|
md_request_tx.send(
|
||||||
|
MdRequest::Ai {
|
||||||
sender,
|
sender,
|
||||||
}
|
}
|
||||||
).await?;
|
).await?;
|
||||||
|
|||||||
@@ -235,6 +235,10 @@ pub(crate) struct MqttConfig {
|
|||||||
#[serde(default = "default_true")]
|
#[serde(default = "default_true")]
|
||||||
pub(crate) enable_motion: bool,
|
pub(crate) enable_motion: bool,
|
||||||
#[serde(default = "default_true")]
|
#[serde(default = "default_true")]
|
||||||
|
pub(crate) enable_visitor: bool,
|
||||||
|
#[serde(default = "default_true")]
|
||||||
|
pub(crate) enable_ai: bool,
|
||||||
|
#[serde(default = "default_true")]
|
||||||
pub(crate) enable_light: bool,
|
pub(crate) enable_light: bool,
|
||||||
#[serde(default = "default_true")]
|
#[serde(default = "default_true")]
|
||||||
pub(crate) enable_battery: bool,
|
pub(crate) enable_battery: bool,
|
||||||
@@ -303,6 +307,8 @@ const fn default_false() -> bool {
|
|||||||
fn default_mqtt() -> MqttConfig {
|
fn default_mqtt() -> MqttConfig {
|
||||||
MqttConfig {
|
MqttConfig {
|
||||||
enable_motion: true,
|
enable_motion: true,
|
||||||
|
enable_visitor: true,
|
||||||
|
enable_ai: true,
|
||||||
enable_light: true,
|
enable_light: true,
|
||||||
enable_battery: true,
|
enable_battery: true,
|
||||||
battery_update: 2000,
|
battery_update: 2000,
|
||||||
|
|||||||
+75
-9
@@ -77,7 +77,7 @@ mod discovery;
|
|||||||
mod mqttc;
|
mod mqttc;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
common::{MdState, NeoInstance, NeoReactor},
|
common::{AiState, MdState, NeoInstance, NeoReactor, VisitorState},
|
||||||
config::Config,
|
config::Config,
|
||||||
AnyResult,
|
AnyResult,
|
||||||
};
|
};
|
||||||
@@ -303,14 +303,14 @@ async fn listen_on_camera(camera: NeoInstance, mqtt_instance: MqttInstance) -> R
|
|||||||
.await
|
.await
|
||||||
.with_context(|| format!("Failed to publish status for {}", camera_name))?;
|
.with_context(|| format!("Failed to publish status for {}", camera_name))?;
|
||||||
let _drop_message = mqtt_instance.last_will("status", "disconnected").await?;
|
let _drop_message = mqtt_instance.last_will("status", "disconnected").await?;
|
||||||
mqtt_instance
|
// mqtt_instance
|
||||||
.send_message("status/motion", "unknown", true)
|
// .send_message("status/motion", "unknown", true)
|
||||||
.await
|
// .await
|
||||||
.with_context(|| format!("Failed to publish motion unknown for {}", camera_name))?;
|
// .with_context(|| format!("Failed to publish motion unknown for {}", camera_name))?;
|
||||||
mqtt_instance
|
// mqtt_instance
|
||||||
.send_message("status/notification", "unknown", true)
|
// .send_message("status/notification", "unknown", true)
|
||||||
.await
|
// .await
|
||||||
.with_context(|| format!("Failed to publish push notification unknown for {}", camera_name))?;
|
// .with_context(|| format!("Failed to publish push notification unknown for {}", camera_name))?;
|
||||||
let _drop_message2 = mqtt_instance.last_will("status/motion", "unknown").await?;
|
let _drop_message2 = mqtt_instance.last_will("status/motion", "unknown").await?;
|
||||||
|
|
||||||
if let Some(discovery_config) = config.discovery.as_ref() {
|
if let Some(discovery_config) = config.discovery.as_ref() {
|
||||||
@@ -331,6 +331,12 @@ async fn listen_on_camera(camera: NeoInstance, mqtt_instance: MqttInstance) -> R
|
|||||||
let camera_motion = camera.clone();
|
let camera_motion = camera.clone();
|
||||||
let mqtt_motion = mqtt_instance.resubscribe().await?;
|
let mqtt_motion = mqtt_instance.resubscribe().await?;
|
||||||
|
|
||||||
|
let camera_visitor = camera.clone();
|
||||||
|
let mqtt_visitor = mqtt_instance.resubscribe().await?;
|
||||||
|
|
||||||
|
let camera_ai = camera.clone();
|
||||||
|
let mqtt_ai = mqtt_instance.resubscribe().await?;
|
||||||
|
|
||||||
#[cfg(feature = "pushnoti")]
|
#[cfg(feature = "pushnoti")]
|
||||||
let camera_pn = camera.clone();
|
let camera_pn = camera.clone();
|
||||||
#[cfg(feature = "pushnoti")]
|
#[cfg(feature = "pushnoti")]
|
||||||
@@ -476,6 +482,66 @@ async fn listen_on_camera(camera: NeoInstance, mqtt_instance: MqttInstance) -> R
|
|||||||
}?;
|
}?;
|
||||||
}
|
}
|
||||||
}, if config.enable_motion => v,
|
}, if config.enable_motion => v,
|
||||||
|
// Handle the visitor messages
|
||||||
|
v = async {
|
||||||
|
let mut vis = camera_visitor.visitor().await?;
|
||||||
|
loop {
|
||||||
|
let v = async {
|
||||||
|
vis.changed().await.with_context(|| {
|
||||||
|
format!("{}: ViaStart Watch Dropped", camera_name)
|
||||||
|
})?;
|
||||||
|
vis.wait_for(|state| matches!(state, VisitorState::Visted(_))).await.with_context(|| {
|
||||||
|
format!("{}: ViaStart Watch Dropped", camera_name)
|
||||||
|
})?;
|
||||||
|
mqtt_visitor.send_message("status/visitor", "visitor", true).await.with_context(|| {
|
||||||
|
format!("{}: Failed to publish visitor", camera_name)
|
||||||
|
})?;
|
||||||
|
AnyResult::Ok(())
|
||||||
|
}.await;
|
||||||
|
match v.map_err(|e| e.downcast::<neolink_core::Error>()) {
|
||||||
|
Err(Ok(neolink_core::Error::UnintelligibleReply{..})) => futures::future::pending().await,
|
||||||
|
Ok(()) => AnyResult::Ok(()),
|
||||||
|
Err(Ok(e)) => Err(e.into()),
|
||||||
|
Err(Err(e)) => Err(e),
|
||||||
|
}?;
|
||||||
|
}
|
||||||
|
}, if config.enable_visitor => v,
|
||||||
|
// Handle the ai messages
|
||||||
|
v = async {
|
||||||
|
let mut ai = camera_ai.ai().await?;
|
||||||
|
loop {
|
||||||
|
let v = async {
|
||||||
|
let ai_kind = {
|
||||||
|
ai.changed().await.with_context(|| {
|
||||||
|
format!("{}: AiStart Watch Dropped", camera_name)
|
||||||
|
})?;
|
||||||
|
let ai_state = ai.wait_for(|state| !matches!(state, AiState::Unknown)).await.with_context(|| {
|
||||||
|
format!("{}: AiStart Watch Dropped", camera_name)
|
||||||
|
})?;
|
||||||
|
match &*ai_state {
|
||||||
|
AiState::Person(_) => "person",
|
||||||
|
AiState::Car(_) => "car",
|
||||||
|
AiState::Other(_) => "other",
|
||||||
|
AiState::Unknown => unreachable!(),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mqtt_ai.send_message("status/ai", ai_kind, true).await.with_context(|| {
|
||||||
|
format!("{}: Failed to publish ai msg", camera_name)
|
||||||
|
})?;
|
||||||
|
mqtt_ai.send_message(&format!("status/ai/{}", ai_kind), ai_kind, true).await.with_context(|| {
|
||||||
|
format!("{}: Failed to publish ai sub msg", camera_name)
|
||||||
|
})?;
|
||||||
|
AnyResult::Ok(())
|
||||||
|
}.await;
|
||||||
|
match v.map_err(|e| e.downcast::<neolink_core::Error>()) {
|
||||||
|
Err(Ok(neolink_core::Error::UnintelligibleReply{..})) => futures::future::pending().await,
|
||||||
|
Ok(()) => AnyResult::Ok(()),
|
||||||
|
Err(Ok(e)) => Err(e.into()),
|
||||||
|
Err(Err(e)) => Err(e),
|
||||||
|
}?;
|
||||||
|
}
|
||||||
|
}, if config.enable_ai => v,
|
||||||
// Handle the SNAP (image preview)
|
// Handle the SNAP (image preview)
|
||||||
v = async {
|
v = async {
|
||||||
let mut wait = IntervalStream::new({
|
let mut wait = IntervalStream::new({
|
||||||
|
|||||||
+1
-1
@@ -122,7 +122,7 @@ struct MqttBackend<'a> {
|
|||||||
cancel: CancellationToken,
|
cancel: CancellationToken,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MqttBackend<'a> {
|
impl MqttBackend<'_> {
|
||||||
async fn run(&mut self) -> AnyResult<()> {
|
async fn run(&mut self) -> AnyResult<()> {
|
||||||
log::trace!("Run MQTT Server");
|
log::trace!("Run MQTT Server");
|
||||||
let mut mqttoptions = MqttOptions::new(
|
let mut mqttoptions = MqttOptions::new(
|
||||||
|
|||||||
Reference in new issue
Block a user