industrial_protocols_kernel/sdk/
types.rs1use std::fmt::Debug;
10
11pub trait AddressLike: Clone + Debug + Send + Sync {}
12impl<T: Clone + Debug + Send + Sync> AddressLike for T {}
13
14pub trait ValueLike: Clone + Debug + Send + Sync {}
15impl<T: Clone + Debug + Send + Sync> ValueLike for T {}
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
18#[non_exhaustive]
19pub enum ProtocolCategory {
20 IndustrialEthernet,
21 Fieldbus,
22 IoTMessaging,
23 AutomotiveBus,
24 BuildingLighting,
25 HardwareBridge,
26 SystemBus,
27}
28
29#[derive(Debug, Clone)]
30pub struct DiscoveredDevice {
31 pub device_id: String,
32 pub protocol: String,
33 pub address: String,
34 pub metadata: std::collections::HashMap<String, String>,
35}
36
37#[derive(Debug, Clone)]
38pub struct HealthStatus {
39 pub state: HealthState,
40 pub latency_ms: u64,
41 pub last_seen: std::time::Instant,
42 pub details: String,
43}
44
45#[derive(Debug, Clone, Copy, PartialEq, Eq)]
46#[non_exhaustive]
47pub enum HealthState {
48 Healthy,
49 Degraded,
50 Unhealthy,
51 Unknown,
52}
53
54#[derive(Debug, Clone)]
55pub struct DiagnosticsReport {
56 pub device_id: String,
57 pub uptime_secs: Option<u64>,
58 pub error_count: u64,
59 pub last_error: Option<String>,
60 pub custom_fields: std::collections::HashMap<String, String>,
61}
62
63#[derive(Debug, Clone)]
64pub struct SubscriptionUpdate<Id = String> {
65 pub subscription_id: Id,
66 pub address: String,
67 pub value: String,
68 pub timestamp: std::time::Instant,
69}