Add the cellular discovery option

This commit is contained in:
QuantumEntangledAndy committed 2023-05-19 10:30:38 +07:00
1 parent 5e22a019e5
commit 2b0a0edf77
4 files changed
+26 -8

No files matched your search

+9
View File
@@ -145,6 +145,15 @@ In the `[[cameras]]` section of the toml.
Possible values are `local`, `remote`, `map`, `relay` later values implictly
enable prior methods.
#### Cellular
Cellular cameras should select `"cellular"` which only enables `map` and
`relay` since `local` and `remote` will always fail
```toml
discovery = "cellular"
```
### MQTT
To use mqtt you will to adjust your config file as such:
+11 -8
View File
@@ -139,14 +139,16 @@ impl BcCamera {
}
}
}
info!("{}: Trying TCP discovery", options.name);
for socket in sockets.drain(..) {
let channel_id: u8 = options.channel_id;
if let Ok(addr) = Discovery::check_tcp(socket, channel_id).await.map(|_| {
info!("{}: TCP Discovery success at {:?}", options.name, &socket);
socket
}) {
return Ok(CameraLocation::Tcp(addr));
if !sockets.is_empty() {
info!("{}: Trying TCP discovery", options.name);
for socket in sockets.drain(..) {
let channel_id: u8 = options.channel_id;
if let Ok(addr) = Discovery::check_tcp(socket, channel_id).await.map(|_| {
info!("{}: TCP Discovery success at {:?}", options.name, &socket);
socket
}) {
return Ok(CameraLocation::Tcp(addr));
}
}
}
}
@@ -176,6 +178,7 @@ impl BcCamera {
DiscoveryMethods::Remote => (true, true, false, false),
DiscoveryMethods::Map => (true, true, true, false),
DiscoveryMethods::Relay => (true, true, true, true),
DiscoveryMethods::Cellular => (false, false, true, true),
DiscoveryMethods::Debug => (false, false, false, true),
};
@@ -38,6 +38,10 @@ pub enum DiscoveryMethods {
/// **This also enabled `Local`, `Map` and `Remote` discovery**
#[serde(alias = "relay")]
Relay,
/// Cellular camera only support relay and map, by choosing this option
/// only those are tried
#[serde(alias = "cellular")]
Cellular,
#[doc(hidden)]
#[serde(alias = "debug")]
/// Used for debugging it is set to whatever the dev is currently testing
+2
View File
@@ -61,6 +61,8 @@ address = "192.168.1.187:9000"
# "remote" # Register our local ip address with reolink but only permit same network connections (useful if broadcast is not possible)
# "local" # Do not contact reolink servers at all. Rely soley on local UDP broadcast based discovery
#
# "cellular" # Cellular camera only support Relay and Map to speed up connecting to them this option will skip the local/remote
#
# discovery = "relay"
# Certain types of camera emit status messages (such as battery levels)