Skip to main content

onvif_server/generated/
types.rs

1// Auto-generated ONVIF type stubs — Phase 1 skeleton
2// Full XSD-derived codegen is a Phase 2+ concern.
3// These stubs satisfy INFRA-04 so Phase 2 can build against concrete types immediately.
4
5#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
6pub struct DeviceInfo {
7    pub manufacturer: String,
8    pub model: String,
9    pub firmware_version: String,
10    pub serial_number: String,
11    pub hardware_id: String,
12}
13
14#[derive(Debug, Clone, PartialEq)]
15pub enum ScopeDefinition {
16    Fixed,
17    Configurable,
18}
19
20#[derive(Debug, Clone)]
21pub struct Scope {
22    pub scope_def: ScopeDefinition,
23    pub scope_item: String,
24}
25
26#[derive(Debug, Clone)]
27pub struct HostnameInformation {
28    pub from_dhcp: bool,
29    pub name: Option<String>,
30}
31
32#[derive(Debug, Clone)]
33pub struct NetworkInterface {
34    pub token: String,
35    pub enabled: bool,
36    pub name: String,
37    pub hw_address: String,
38    pub mtu: u32,
39}
40
41/// A media profile as advertised by the ONVIF Media Service.
42///
43/// Implementations override [`crate::traits::MediaService::profiles`] to return
44/// their actual profiles. The default returns a single 1920×1080 H264 profile.
45#[derive(Debug, Clone)]
46pub struct MediaProfile {
47    /// Profile token referenced by GetStreamUri, GetSnapshotUri, and PTZ operations.
48    pub token: String,
49    /// Human-readable profile name.
50    pub name: String,
51    /// Source token for the VideoSourceConfiguration element.
52    pub video_source_token: String,
53    /// Frame width in pixels.
54    pub width: u32,
55    /// Frame height in pixels.
56    pub height: u32,
57    /// Encoder codec, e.g. `"H264"`, `"H265"`, `"JPEG"`.
58    pub encoding: String,
59    /// Target frame rate in frames per second.
60    pub framerate: u32,
61    /// Target bitrate in kbps.
62    pub bitrate: u32,
63}
64
65#[derive(Debug, Clone)]
66pub struct VideoSource {
67    pub token: String,
68    pub framerate: f32,
69    pub width: i32,
70    pub height: i32,
71}
72
73#[derive(Debug, Clone)]
74pub struct VideoSourceConfiguration {
75    pub token: String,
76    pub name: String,
77    pub source_token: String,
78    pub bounds_x: i32,
79    pub bounds_y: i32,
80    pub bounds_width: i32,
81    pub bounds_height: i32,
82}
83
84#[derive(Debug, Clone)]
85pub struct VideoEncoderConfiguration {
86    pub token: String,
87    pub name: String,
88    pub encoding: String,
89    pub width: i32,
90    pub height: i32,
91    pub framerate: i32,
92    pub bitrate: i32,
93}
94
95/// Returned by PTZService::get_status(). Handler serializes to nested PTZMoveStatus XML.
96#[derive(Debug, Clone)]
97pub struct PTZStatusResult {
98    pub pan_tilt_moving: bool,
99    pub zoom_moving: bool,
100}
101
102/// One PTZ preset returned by PTZService::get_presets(). Handler serializes to PTZPreset XML.
103#[derive(Debug, Clone)]
104pub struct PTZPreset {
105    pub token: String,
106    pub name: String,
107}
108
109/// Returned by ImagingService::get_imaging_settings(). Handler serializes to ImagingSettings XML.
110/// Only Some fields are emitted — None fields produce no XML element.
111#[derive(Debug, Clone, Default)]
112pub struct ImagingSettings {
113    pub brightness: Option<f32>,
114    pub color_saturation: Option<f32>,
115    pub contrast: Option<f32>,
116    pub sharpness: Option<f32>,
117    pub white_balance_cr_gain: Option<f32>,
118    pub white_balance_cb_gain: Option<f32>,
119}