提交 2d08b111 authored 作者: Serhij S's avatar Serhij S

rvideo feature

上级 6856dd47
[package] [package]
name = "roboplc" name = "roboplc"
version = "0.3.0" version = "0.3.1"
edition = "2021" edition = "2021"
authors = ["Serhij S. <div@altertech.com>"] authors = ["Serhij S. <div@altertech.com>"]
license = "Apache-2.0" license = "Apache-2.0"
...@@ -27,7 +27,7 @@ oneshot = { version = "0.1.6", default-features = false, features = ["std"] } ...@@ -27,7 +27,7 @@ oneshot = { version = "0.1.6", default-features = false, features = ["std"] }
pin-project = "1.1.5" pin-project = "1.1.5"
rmodbus = { version = "0.9.4", optional = true } rmodbus = { version = "0.9.4", optional = true }
roboplc-derive = { version = "0.3" } roboplc-derive = { version = "0.3" }
serde = { version = "1.0.197", features = ["derive", "rc"] } serde = { version = "1.0", features = ["derive", "rc"] }
serial = "0.4.0" serial = "0.4.0"
sysinfo = "0.29" sysinfo = "0.29"
thiserror = "1.0.57" thiserror = "1.0.57"
...@@ -45,14 +45,16 @@ metrics = { version = "0.22.3", optional = true } ...@@ -45,14 +45,16 @@ metrics = { version = "0.22.3", optional = true }
parking_lot_rt = "0.12.1" parking_lot_rt = "0.12.1"
snmp = { version = "0.2.2", optional = true } snmp = { version = "0.2.2", optional = true }
rtsc = "0.1.6" rtsc = "0.1.6"
rvideo = { version = "0.4", optional = true }
[features] [features]
eapi = ["eva-common", "eva-sdk", "busrt", "tokio", "hostname"] eapi = ["eva-common", "eva-sdk", "busrt", "tokio", "hostname"]
pipe = ["tokio/process", "tokio/io-util", "tokio/macros", "tokio/rt", "tokio/time"] pipe = ["tokio/process", "tokio/io-util", "tokio/macros", "tokio/rt", "tokio/time"]
rvideo = ["dep:rvideo"]
modbus = ["rmodbus"] modbus = ["rmodbus"]
openssl-vendored = ["busrt/openssl-vendored", "eva-common/openssl-vendored"] openssl-vendored = ["busrt/openssl-vendored", "eva-common/openssl-vendored"]
metrics = ["dep:metrics", "metrics-exporter-prometheus"] metrics = ["dep:metrics", "metrics-exporter-prometheus"]
full = ["eapi", "modbus", "metrics", "pipe"] full = ["eapi", "modbus", "metrics", "pipe", "rvideo"]
#default = ["modbus"] #default = ["modbus"]
[dev-dependencies] [dev-dependencies]
......
...@@ -44,7 +44,6 @@ struct Variables { ...@@ -44,7 +44,6 @@ struct Variables {
input: Input, input: Input,
} }
#[allow(clippy::struct_field_names)]
#[derive(WorkerOpts)] #[derive(WorkerOpts)]
struct Worker1 { struct Worker1 {
// Modbus server context and controller variables/data hub are not synchronized automatically, // Modbus server context and controller variables/data hub are not synchronized automatically,
......
...@@ -533,7 +533,7 @@ dependencies = [ ...@@ -533,7 +533,7 @@ dependencies = [
[[package]] [[package]]
name = "roboplc-cli" name = "roboplc-cli"
version = "0.1.20" version = "0.1.21"
dependencies = [ dependencies = [
"ansi_term", "ansi_term",
"clap", "clap",
......
...@@ -158,7 +158,6 @@ pub type ActionResult = std::result::Result<(), Box<dyn std::error::Error>>; ...@@ -158,7 +158,6 @@ pub type ActionResult = std::result::Result<(), Box<dyn std::error::Error>>;
type ActionHandlers<D, V> = Arc<BTreeMap<OID, ActionHandlerFn<D, V>>>; type ActionHandlers<D, V> = Arc<BTreeMap<OID, ActionHandlerFn<D, V>>>;
type BulkActionHandlers<D, V> = Arc<Vec<(OIDMask, ActionHandlerFn<D, V>)>>; type BulkActionHandlers<D, V> = Arc<Vec<(OIDMask, ActionHandlerFn<D, V>)>>;
#[allow(clippy::struct_field_names)]
struct Handlers<D, V> struct Handlers<D, V>
where where
D: DataDeliveryPolicy + Clone + Send + Sync + 'static, D: DataDeliveryPolicy + Clone + Send + Sync + 'static,
...@@ -185,7 +184,8 @@ where ...@@ -185,7 +184,8 @@ where
macro_rules! notify_running { macro_rules! notify_running {
() => { () => {
if let Ok(payload) = pack(&action.event_running()) { if let Ok(payload) = pack(&action.event_running()) {
let _ = tx.try_send(PushPayload::ActionState { topic, payload }); tx.try_send(PushPayload::ActionState { topic, payload })
.ok();
} }
}; };
} }
...@@ -476,7 +476,7 @@ where ...@@ -476,7 +476,7 @@ where
self.inner self.inner
.tx .tx
.try_send(PushPayload::DObj { .try_send(PushPayload::DObj {
name: name.clone(), name,
data: data.into_inner(), data: data.into_inner(),
}) })
.map_err(Into::into) .map_err(Into::into)
......
...@@ -9,11 +9,13 @@ use std::io::Cursor; ...@@ -9,11 +9,13 @@ use std::io::Cursor;
use crate::comm::{Client, Protocol}; use crate::comm::{Client, Protocol};
use crate::{Error, Result}; use crate::{Error, Result};
use binrw::{BinRead, BinWrite}; use binrw::{BinRead, BinWrite};
#[allow(clippy::module_name_repetitions)]
#[allow(clippy::module_name_repetitions, clippy::useless_attribute)]
pub use regs::{Kind as ModbusRegisterKind, Register as ModbusRegister}; pub use regs::{Kind as ModbusRegisterKind, Register as ModbusRegister};
use rmodbus::guess_response_frame_len; use rmodbus::guess_response_frame_len;
use rmodbus::{client::ModbusRequest as RModbusRequest, ModbusProto}; use rmodbus::{client::ModbusRequest as RModbusRequest, ModbusProto};
#[allow(clippy::module_name_repetitions)]
#[allow(clippy::module_name_repetitions, clippy::useless_attribute)]
pub use server::{ pub use server::{
AllowFn as ModbusServerAllowFn, ModbusServer, ModbusServerMapping, AllowFn as ModbusServerAllowFn, ModbusServer, ModbusServerMapping,
WritePermission as ModbusServerWritePermission, WritePermission as ModbusServerWritePermission,
......
...@@ -27,6 +27,7 @@ enum Server { ...@@ -27,6 +27,7 @@ enum Server {
Serial(SystemPort), Serial(SystemPort),
} }
#[allow(clippy::trivially_copy_pass_by_ref)]
fn handle_client< fn handle_client<
T: Read + Write, T: Read + Write,
const C: usize, const C: usize,
......
...@@ -204,6 +204,14 @@ pub fn suicide(delay: Duration, warn: bool) { ...@@ -204,6 +204,14 @@ pub fn suicide(delay: Duration, warn: bool) {
}; };
} }
#[cfg(feature = "rvideo")]
pub use rvideo;
#[cfg(feature = "rvideo")]
pub fn serve_rvideo() -> std::result::Result<(), rvideo::Error> {
rvideo::serve("0.0.0.0:3001").map_err(Into::into)
}
/// Returns [Prometheus metrics exporter /// Returns [Prometheus metrics exporter
/// builder](https://docs.rs/metrics-exporter-prometheus/) /// builder](https://docs.rs/metrics-exporter-prometheus/)
/// ///
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论