Fix typos in comments and code

This commit is contained in:
Espen Hovlandsdal committed 2024-03-14 10:24:16 -07:00
1 parent 4a94a2ddb2
commit 37f560cf66
28 files changed
+53 -53

No files matched your search

+6 -6
View File
@@ -33,7 +33,7 @@ features not yet in upstream master.
**Minor Features**:
- Improved error messages when missing gstreamer plugins
- Protocol more closely follows offical reolink format
- Protocol more closely follows official reolink format
- Possibly can handle more simulatenous connections
- More ways to connect to the camera. Including Relaying through reolink
servers
@@ -50,7 +50,7 @@ Install the latest [gstreamer](https://gstreamer.freedesktop.org/download/)
(1.20.5 as of writing this).
- **Windows**: ensure you install `full` when prompted in the MSI options.
- **Mac**: Install the dpkg version on the offical gstreamer website over
- **Mac**: Install the dpkg version on the official gstreamer website over
the brew version
- **Ubuntu/Debian**: These packages should work
@@ -269,7 +269,7 @@ reflected in the rtsp
These include changing the:
- Avaliable users
- Available users
```toml
[[users]]
@@ -284,7 +284,7 @@ These include changing the:
permitted_users = [ "me" ]
```
- Avaliable streams
- Available streams
```toml
[[cameras]]
@@ -324,7 +324,7 @@ enable_motion = false # motion detection
# (limited battery drain since it
# is a passive listening connection)
#
enable_light = false # flood lights only avaliable on some camera
enable_light = false # flood lights only available on some camera
# (limited battery drain since it
# is a passive listening connection)
#
@@ -355,7 +355,7 @@ must be manually specified.
features = ["floodlight"]
```
Avaliable features are:
Available features are:
- `floodlight`: This adds a light control to home assistant
- `camera`: This adds a camera preview to home assistant. It is only updated
+3 -3
View File
@@ -439,7 +439,7 @@ mod tests {
#[test]
// B800 seems to have a different header to the E1 and swann cameras
// the stream_type and message_num do not seem to set in the offical clients
// the stream_type and message_num do not seem to set in the official clients
//
// They also have extra streams
fn test_bc_b800_externstream() {
@@ -481,7 +481,7 @@ mod tests {
#[test]
// B800 seems to have a different header to the E1 and swann cameras
// the stream_type and message_num do not seem to set in the offical clients
// the stream_type and message_num do not seem to set in the official clients
//
// They also have extra streams
fn test_bc_b800_substream() {
@@ -523,7 +523,7 @@ mod tests {
#[test]
// B800 seems to have a different header to the E1 and swann cameras
// the stream_type and message_num do not seem to set in the offical clients
// the stream_type and message_num do not seem to set in the official clients
//
// They also have extra streams
fn test_bc_b800_mainstream() {
+8 -8
View File
@@ -91,10 +91,10 @@ pub struct BcXml {
/// Recieved on request for battery info
#[yaserde(rename = "BatteryInfo")]
pub battery_info: Option<BatteryInfo>,
/// Recieved on request for a users persmissions/capabilitoes
/// Recieved on request for a users permissions/capabilities
#[yaserde(rename = "AbilityInfo")]
pub ability_info: Option<AbilityInfo>,
/// Recieved on request for a users persmissions/capabilitoes
/// Recieved on request for a users permissions/capabilities
#[yaserde(rename = "PushInfo")]
pub push_info: Option<PushInfo>,
/// Recieved on request for a link type
@@ -112,7 +112,7 @@ pub struct BcXml {
/// The floodlight settings for automatically turning on/off on schedule/motion
#[yaserde(rename = "FloodlightTask")]
pub floodlight_task: Option<FloodlightTask>,
/// For geting the zoom anf focus of the camera
/// For getting the zoom and focus of the camera
#[yaserde(rename = "PtzZoomFocus")]
pub ptz_zoom_focus: Option<PtzZoomFocus>,
/// For zooming the camera
@@ -268,11 +268,11 @@ pub struct Extension {
/// XML Version
#[yaserde(attribute)]
pub version: String,
/// If the subsequent payload is binary this will be set to 1. Otherwise it is ommited
/// If the subsequent payload is binary this will be set to 1. Otherwise it is omitted
#[yaserde(rename = "binaryData")]
pub binary_data: Option<u32>,
/// Certain requests such `AbilitySupport` require to know which user this
/// ability support request is for (why camera dosen't know this based on who
/// ability support request is for (why camera doesn't know this based on who
/// is logged in is unknown... Possible security hole)
#[yaserde(rename = "userName")]
pub user_name: Option<String>,
@@ -497,7 +497,7 @@ pub struct TalkConfig {
/// audioStreamMode known values `"followVideoStream"`
#[yaserde(rename = "audioStreamMode")]
pub audio_stream_mode: String,
/// AudioConfig contans the details of the audio to follow
/// AudioConfig contains the details of the audio to follow
#[yaserde(rename = "audioConfig")]
pub audio_config: AudioConfig,
}
@@ -541,7 +541,7 @@ pub struct TalkAbility {
/// audioStreamModes known values `"followVideoStream"`
#[yaserde(rename = "audioStreamModeList")]
pub audio_stream_mode_list: Vec<AudioStreamModeList>,
/// AudioConfigs contans the details of the audio to follow
/// AudioConfigs contains the details of the audio to follow
#[yaserde(rename = "audioConfigList")]
pub audio_config_list: Vec<AudioConfigList>,
}
@@ -706,7 +706,7 @@ pub struct AbilityInfo {
pub image: Option<AbilityInfoToken>,
/// Video permissions
pub video: Option<AbilityInfoToken>,
/// Secutiry permissions
/// Security permissions
pub security: Option<AbilityInfoToken>,
/// Replay permissions
pub replay: Option<AbilityInfoToken>,
+1 -1
View File
@@ -30,7 +30,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
@@ -248,7 +248,7 @@ impl Discoverer {
tokio::select! {
v = async {
loop {
let (reply, addr) = reply.next().await.ok_or(Error::ConnectionUnavaliable)??;
let (reply, addr) = reply.next().await.ok_or(Error::ConnectionUnavailable)??;
if let Some(result) = map(reply, addr) {
return Ok(result);
}
+1 -1
View File
@@ -7,7 +7,7 @@ use std::convert::TryInto;
pub struct Credentials {
/// The username to login to the camera with
pub username: String,
/// The password to use for login. Some camera allow this to be ommited
/// The password to use for login. Some camera allow this to be omitted
pub password: Option<String>,
}
+3 -3
View File
@@ -36,8 +36,8 @@ pub enum Error {
},
/// Raised when the camera responds with a status code over than OK
#[error(display = "Camera responded with Service Unavaliable: {}", _0)]
CameraServiceUnavaliable(u16),
#[error(display = "Camera responded with Service Unavailable: {}", _0)]
CameraServiceUnavailable(u16),
/// Raised when the camera responds with a status code over than OK during login
#[error(display = "Camera responded with Err during login")]
@@ -115,7 +115,7 @@ pub enum Error {
/// Raised when the camera cannot be found
#[error(display = "Camera Not Findable")]
ConnectionUnavaliable,
ConnectionUnavailable,
/// Raised when the subscription id dropped too soon
#[error(display = "Dropped Subscriber")]
+2 -2
View File
@@ -129,7 +129,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
@@ -181,7 +181,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
Ok(())
+1 -1
View File
@@ -2,7 +2,7 @@ use super::{BcCamera, Result};
use crate::bc::model::*;
impl BcCamera {
/// Create a handller to respond to keep alive messages
/// Create a handler to respond to keep alive messages
/// These messages are sent by the camera so we listen to
/// a message ID rather than setting a message number and
/// responding to it
+1 -1
View File
@@ -29,7 +29,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
+1 -1
View File
@@ -27,7 +27,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
+3 -3
View File
@@ -39,10 +39,10 @@ impl BcCamera {
reties += 1;
continue;
} else {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
} else if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
} else {
// Valid message with response_code == 200
if let BcBody::ModernMsg(ModernMsg {
@@ -101,7 +101,7 @@ impl BcCamera {
{
let msg = reply?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcMeta {
+1 -1
View File
@@ -325,7 +325,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
+1 -1
View File
@@ -64,7 +64,7 @@ impl BcCamera {
sub.send(msg).await?;
let msg = sub.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
Ok(())
+1 -1
View File
@@ -39,7 +39,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
Ok(())
+2 -2
View File
@@ -41,7 +41,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
@@ -132,7 +132,7 @@ impl BcCamera {
}
} else {
// anything else is an error
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
// let binary_stream = sub_get.payload_stream();
+5 -5
View File
@@ -17,7 +17,7 @@ pub enum StreamKind {
Sub,
/// This stream represents a balance between SD and HD
///
/// It is only avaliable on some camera. If the camera dosen't
/// It is only available on some camera. If the camera doesn't
/// support it the stream will be the same as the SD stream
Extern,
}
@@ -155,7 +155,7 @@ impl BcCamera {
StreamKind::Extern => 0,
};
// Theses are the numbers used with the offical client
// Theses are the numbers used with the official client
// On an E1 and swann cameras:
// - mainStream always has a value of 0
// - subStream always has a value of 1
@@ -271,7 +271,7 @@ impl BcCamera {
msg_id: MSG_ID_VIDEO_STOP,
..
} = msg.meta {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
}
} => v,
@@ -313,7 +313,7 @@ impl BcCamera {
StreamKind::Extern => 0,
};
// Theses are the numbers used with the offical client
// Theses are the numbers used with the official client
// On an E1 and swann cameras:
// - mainStream always has a value of 0
// - subStream always has a value of 1
@@ -352,7 +352,7 @@ impl BcCamera {
let reply = sub_video.recv().await?;
if reply.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(reply.meta.response_code));
return Err(Error::CameraServiceUnavailable(reply.meta.response_code));
}
Ok(())
+1 -1
View File
@@ -27,7 +27,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
+1 -1
View File
@@ -26,7 +26,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
+1 -1
View File
@@ -33,7 +33,7 @@ impl BcCamera {
sub_get_general.send(get).await?;
let msg = sub_get_general.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
+1 -1
View File
@@ -25,7 +25,7 @@ impl BcCamera {
sub_get.send(get).await?;
let msg = sub_get.recv().await?;
if msg.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(msg.meta.response_code));
return Err(Error::CameraServiceUnavailable(msg.meta.response_code));
}
if let BcBody::ModernMsg(ModernMsg {
+1 -1
View File
@@ -27,7 +27,7 @@ impl BcCamera {
let modern_reply = sub_version.recv().await?;
if modern_reply.meta.response_code != 200 {
return Err(Error::CameraServiceUnavaliable(
return Err(Error::CameraServiceUnavailable(
modern_reply.meta.response_code,
));
}
+1 -1
View File
@@ -39,7 +39,7 @@ impl Decoder for BcMediaCodex {
type Item = BcMedia;
type Error = Error;
/// Since frames can cross EOF boundaries we overload this so it dosen't error if
/// Since frames can cross EOF boundaries we overload this so it doesn't error if
/// there are bytes left on the stream
fn decode_eof(&mut self, buf: &mut BytesMut) -> Result<Option<Self::Item>> {
match self.decode(buf)? {
+1 -1
View File
@@ -34,7 +34,7 @@ impl Decoder for BcUdpCodex {
type Item = BcUdp;
type Error = Error;
/// Since frames can cross EOF boundaries we overload this so it dosen't error if
/// Since frames can cross EOF boundaries we overload this so it doesn't error if
/// there are bytes left on the stream
// fn decode_eof(&mut self, buf: &mut BytesMut) -> Result<Option<Self::Item>> {
// match self.decode(buf)? {
+1 -1
View File
@@ -98,6 +98,6 @@ address = "192.168.1.245:9000"
# camera to connect to with by setting the `channel_id`
#
# By default channel_id = 0. Eg the first connected camera on the device
# **Note**: that unlike in the offical client the numbering starts from 0 not 1.
# **Note**: that unlike in the official client the numbering starts from 0 not 1.
# An 8 channel NVR would have channels 0 through 7
# channel_id = 0
+1 -1
View File
@@ -125,7 +125,7 @@ impl NeoInstance {
if let Err(e) = &r {
log::debug!("- Task Result: {e:?}");
}
if let Err(Some(neolink_core::Error::CameraServiceUnavaliable(400))) = r.as_ref().map_err(|e| e.downcast_ref::<neolink_core::Error>()) {
if let Err(Some(neolink_core::Error::CameraServiceUnavailable(400))) = r.as_ref().map_err(|e| e.downcast_ref::<neolink_core::Error>()) {
// Retryable without a reconnect
// Usually occurs when camera is starting up
// or the connection is initialising
+2 -2
View File
@@ -467,7 +467,7 @@ async fn listen_on_camera(camera: NeoInstance, mqtt_instance: MqttInstance) -> R
}).await;
let image = match image {
Err(e) => match e.downcast::<neolink_core::Error>() {
Ok(neolink_core::Error::CameraServiceUnavaliable(_)) => {
Ok(neolink_core::Error::CameraServiceUnavailable(_)) => {
log::debug!("Image not supported");
futures::future::pending().await
},
@@ -512,7 +512,7 @@ async fn listen_on_camera(camera: NeoInstance, mqtt_instance: MqttInstance) -> R
}).await;
let xml = match xml {
Err(e) => match e.downcast::<neolink_core::Error>() {
Ok(neolink_core::Error::CameraServiceUnavaliable(_)) => {
Ok(neolink_core::Error::CameraServiceUnavailable(_)) => {
log::debug!("Battery not supported");
futures::future::pending().await
},
+1 -1
View File
@@ -323,7 +323,7 @@ async fn stream_run(
log::debug!("Path: {}", path);
mounts.add_factory(path, factory.clone());
}
log::info!("{}: Avaliable at {}", name, paths.join(", "));
log::info!("{}: Available at {}", name, paths.join(", "));
let stream_cancel = CancellationToken::new();
let drop_guard = stream_cancel.clone().drop_guard();