More inner udp source timeout locations
This commit is contained in:
3 files changed
+37
-18
No files matched your search
@@ -219,6 +219,9 @@ Control messages:
|
||||
- `/control/ptz/preset [id]` Move the camera to a PTZ preset
|
||||
- `/control/ptz/assign [id] [name]` Set the current PTZ position to a preset ID
|
||||
and name
|
||||
- `/control/zoom (amount)` Zoom the camera to the specified amount. Example: 1.0
|
||||
for normal and 3.5 for 3.5x zoom factor. This only works on cameras that support
|
||||
zoom
|
||||
- `/control/pir [on|off]`
|
||||
- `control/wakeup (mins)` For cameras that are using `idle_disconnect` this will
|
||||
force a wakeup for at least the given minutes
|
||||
@@ -538,6 +541,15 @@ neolink ptz --config=config.toml CameraName preset 0
|
||||
neolink ptz --config=config.toml CameraName assign 0 PresetName
|
||||
```
|
||||
|
||||
To change the zoom level use the following:
|
||||
|
||||
```bash
|
||||
# Zoom the camera to 2.5x
|
||||
neolink ptz --config=config.toml CameraName zoom 2.5
|
||||
```
|
||||
|
||||
With 1.0 being normal and 2.5 being 2.5x zoom
|
||||
|
||||
## License
|
||||
|
||||
Neolink is free software, released under the GNU Affero General Public License
|
||||
|
||||
@@ -355,7 +355,7 @@ impl UdpPayloadInner {
|
||||
let packet = packet.ok_or(Error::DroppedConnection)??;
|
||||
recv_timeout.as_mut().reset(Instant::now() + Duration::from_secs(TIME_OUT));
|
||||
// let packet = socket_rx.next().await.ok_or(Error::DroppedConnection)??;
|
||||
socket_out_tx.send(packet).await?;
|
||||
tokio::time::timeout(tokio::time::Duration::from_millis(250), socket_out_tx.send(packet)).await.map_err(|_| Error::DroppedConnection)??;
|
||||
continue;
|
||||
},
|
||||
packet = socket_in_rx.next() => {
|
||||
@@ -369,8 +369,8 @@ impl UdpPayloadInner {
|
||||
// Seems to happen with network reconnects like over
|
||||
// a lossy cellular network
|
||||
log::debug!("Quick reconnect: Due to socket timeout");
|
||||
let stream = Arc::new(connect_try_port(inner.inner.get_ref().local_addr()?.port()).await?);
|
||||
inner = BcUdpSource::new_from_socket(stream, inner.addr).await?;
|
||||
let stream = Arc::new(tokio::time::timeout(tokio::time::Duration::from_millis(250), connect_try_port(inner.inner.get_ref().local_addr()?.port())).await.map_err(|_| Error::DroppedConnection)??);
|
||||
inner = tokio::time::timeout(tokio::time::Duration::from_millis(250), BcUdpSource::new_from_socket(stream, inner.addr)).await.map_err(|_| Error::DroppedConnection)??;
|
||||
|
||||
// Inform the camera that we are the same client
|
||||
//
|
||||
|
||||
+22
-15
@@ -374,24 +374,31 @@ async fn listen_on_camera(camera: NeoInstance, mqtt_instance: MqttInstance) -> R
|
||||
v = async {
|
||||
let (tx, mut rx) = mpsc(100);
|
||||
let v = tokio::select! {
|
||||
v = camera_floodlight.run_passive_task(|cam| {
|
||||
let tx = tx.clone();
|
||||
Box::pin(
|
||||
async move {
|
||||
let mut reciever = tokio_stream::wrappers::ReceiverStream::new(cam.listen_on_flightlight().await?);
|
||||
while let Some(flights) = reciever.next().await {
|
||||
for flight in flights.floodlight_status_list.iter() {
|
||||
if flight.status == 0 {
|
||||
tx.send(false).await?;
|
||||
} else {
|
||||
tx.send(true).await?;
|
||||
v = async {
|
||||
loop {
|
||||
let r = camera_floodlight.run_passive_task(|cam| {
|
||||
let tx = tx.clone();
|
||||
Box::pin(
|
||||
async move {
|
||||
let mut reciever = tokio_stream::wrappers::ReceiverStream::new(cam.listen_on_flightlight().await?);
|
||||
while let Some(flights) = reciever.next().await {
|
||||
for flight in flights.floodlight_status_list.iter() {
|
||||
if flight.status == 0 {
|
||||
tx.send(false).await?;
|
||||
} else {
|
||||
tx.send(true).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
AnyResult::Ok(())
|
||||
}
|
||||
}
|
||||
AnyResult::Ok(())
|
||||
)
|
||||
}).await;
|
||||
if r.is_err() {
|
||||
break r;
|
||||
}
|
||||
)
|
||||
}) => v,
|
||||
}
|
||||
} => v,
|
||||
v = async {
|
||||
while let Some(on) = rx.recv().await {
|
||||
if on {
|
||||
|
||||
Reference in new issue
Block a user