aravis/auto/
fake_camera.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from ../gir-files
3// DO NOT EDIT
4
5use crate::{ffi, Buffer};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9/// [`FakeCamera`][crate::FakeCamera] is a class that simulate a real camera, which provides
10/// methods for the implementation of [`FakeDevice`][crate::FakeDevice] and [`FakeStream`][crate::FakeStream].
11///
12/// arv-fake-gv-camera is a GV camera simulator based on this class.
13///
14/// # Implements
15///
16/// [`trait@glib::ObjectExt`]
17	#[doc(alias = "ArvFakeCamera")]
18	pub struct FakeCamera(Object<ffi::ArvFakeCamera, ffi::ArvFakeCameraClass>);
19
20	match fn {
21		type_ => || ffi::arv_fake_camera_get_type(),
22	}
23}
24
25impl FakeCamera {
26	#[doc(alias = "arv_fake_camera_new")]
27	pub fn new(serial_number: &str) -> FakeCamera {
28		assert_initialized_main_thread!();
29		unsafe { from_glib_full(ffi::arv_fake_camera_new(serial_number.to_glib_none().0)) }
30	}
31
32	#[doc(alias = "arv_fake_camera_new_full")]
33	pub fn new_full(serial_number: &str, genicam_filename: &str) -> FakeCamera {
34		assert_initialized_main_thread!();
35		unsafe {
36			from_glib_full(ffi::arv_fake_camera_new_full(
37				serial_number.to_glib_none().0,
38				genicam_filename.to_glib_none().0,
39			))
40		}
41	}
42
43	#[doc(alias = "arv_fake_camera_check_and_acknowledge_software_trigger")]
44	pub fn check_and_acknowledge_software_trigger(&self) -> bool {
45		unsafe {
46			from_glib(ffi::arv_fake_camera_check_and_acknowledge_software_trigger(
47				self.to_glib_none().0,
48			))
49		}
50	}
51
52	/// Fill a buffer with data from the fake camera.
53	/// ## `buffer`
54	/// the [`Buffer`][crate::Buffer] to fill
55	///
56	/// # Returns
57	///
58	///
59	/// ## `packet_size`
60	/// the packet size
61	#[doc(alias = "arv_fake_camera_fill_buffer")]
62	pub fn fill_buffer(&self, buffer: &Buffer) -> u32 {
63		unsafe {
64			let mut packet_size = std::mem::MaybeUninit::uninit();
65			ffi::arv_fake_camera_fill_buffer(
66				self.to_glib_none().0,
67				buffer.to_glib_none().0,
68				packet_size.as_mut_ptr(),
69			);
70			packet_size.assume_init()
71		}
72	}
73
74	#[doc(alias = "arv_fake_camera_get_acquisition_status")]
75	#[doc(alias = "get_acquisition_status")]
76	pub fn acquisition_status(&self) -> u32 {
77		unsafe { ffi::arv_fake_camera_get_acquisition_status(self.to_glib_none().0) }
78	}
79
80	#[doc(alias = "arv_fake_camera_get_control_channel_privilege")]
81	#[doc(alias = "get_control_channel_privilege")]
82	pub fn control_channel_privilege(&self) -> u32 {
83		unsafe { ffi::arv_fake_camera_get_control_channel_privilege(self.to_glib_none().0) }
84	}
85
86	///
87	/// # Returns
88	///
89	/// the genicam XML description of the camera
90	///
91	/// ## `size`
92	/// the size of the returned XML string
93	#[doc(alias = "arv_fake_camera_get_genicam_xml")]
94	#[doc(alias = "get_genicam_xml")]
95	pub fn genicam_xml(&self) -> (glib::GString, usize) {
96		unsafe {
97			let mut size = std::mem::MaybeUninit::uninit();
98			let ret = from_glib_none(ffi::arv_fake_camera_get_genicam_xml(
99				self.to_glib_none().0,
100				size.as_mut_ptr(),
101			));
102			(ret, size.assume_init())
103		}
104	}
105
106	#[doc(alias = "arv_fake_camera_get_genicam_xml_url")]
107	#[doc(alias = "get_genicam_xml_url")]
108	pub fn genicam_xml_url(&self) -> Option<glib::GString> {
109		unsafe {
110			from_glib_none(ffi::arv_fake_camera_get_genicam_xml_url(
111				self.to_glib_none().0,
112			))
113		}
114	}
115
116	#[doc(alias = "arv_fake_camera_get_heartbeat_timeout")]
117	#[doc(alias = "get_heartbeat_timeout")]
118	pub fn heartbeat_timeout(&self) -> u32 {
119		unsafe { ffi::arv_fake_camera_get_heartbeat_timeout(self.to_glib_none().0) }
120	}
121
122	#[doc(alias = "arv_fake_camera_get_payload")]
123	#[doc(alias = "get_payload")]
124	pub fn payload(&self) -> usize {
125		unsafe { ffi::arv_fake_camera_get_payload(self.to_glib_none().0) }
126	}
127
128	///
129	/// # Returns
130	///
131	/// the sleep time for the next frame
132	///
133	/// ## `next_timestamp_us`
134	/// the timestamp for the next frame in microseconds
135	#[doc(alias = "arv_fake_camera_get_sleep_time_for_next_frame")]
136	#[doc(alias = "get_sleep_time_for_next_frame")]
137	pub fn sleep_time_for_next_frame(&self) -> (u64, u64) {
138		unsafe {
139			let mut next_timestamp_us = std::mem::MaybeUninit::uninit();
140			let ret = ffi::arv_fake_camera_get_sleep_time_for_next_frame(
141				self.to_glib_none().0,
142				next_timestamp_us.as_mut_ptr(),
143			);
144			(ret, next_timestamp_us.assume_init())
145		}
146	}
147
148	///
149	/// # Returns
150	///
151	/// the data stream [`gio::SocketAddress`][crate::gio::SocketAddress] for this camera
152	#[doc(alias = "arv_fake_camera_get_stream_address")]
153	#[doc(alias = "get_stream_address")]
154	pub fn stream_address(&self) -> Option<gio::SocketAddress> {
155		unsafe {
156			from_glib_full(ffi::arv_fake_camera_get_stream_address(
157				self.to_glib_none().0,
158			))
159		}
160	}
161
162	#[doc(alias = "arv_fake_camera_is_in_free_running_mode")]
163	pub fn is_in_free_running_mode(&self) -> bool {
164		unsafe {
165			from_glib(ffi::arv_fake_camera_is_in_free_running_mode(
166				self.to_glib_none().0,
167			))
168		}
169	}
170
171	#[doc(alias = "arv_fake_camera_is_in_software_trigger_mode")]
172	pub fn is_in_software_trigger_mode(&self) -> bool {
173		unsafe {
174			from_glib(ffi::arv_fake_camera_is_in_software_trigger_mode(
175				self.to_glib_none().0,
176			))
177		}
178	}
179
180	//#[doc(alias = "arv_fake_camera_read_memory")]
181	//pub fn read_memory(&self, address: u32, size: u32, buffer: /*Unimplemented*/Option<Basic: Pointer>) -> bool {
182	//    unsafe { TODO: call ffi:arv_fake_camera_read_memory() }
183	//}
184
185	/// ## `address`
186	/// the register address
187	///
188	/// # Returns
189	///
190	/// true if the read succeeded, false otherwise
191	///
192	/// ## `value`
193	/// the register value
194	#[doc(alias = "arv_fake_camera_read_register")]
195	pub fn read_register(&self, address: u32) -> Option<u32> {
196		unsafe {
197			let mut value = std::mem::MaybeUninit::uninit();
198			let ret = from_glib(ffi::arv_fake_camera_read_register(
199				self.to_glib_none().0,
200				address,
201				value.as_mut_ptr(),
202			));
203			if ret {
204				Some(value.assume_init())
205			} else {
206				None
207			}
208		}
209	}
210
211	#[doc(alias = "arv_fake_camera_set_control_channel_privilege")]
212	pub fn set_control_channel_privilege(&self, privilege: u32) {
213		unsafe {
214			ffi::arv_fake_camera_set_control_channel_privilege(self.to_glib_none().0, privilege);
215		}
216	}
217
218	#[doc(alias = "arv_fake_camera_set_inet_address")]
219	pub fn set_inet_address(&self, address: &impl IsA<gio::InetAddress>) {
220		unsafe {
221			ffi::arv_fake_camera_set_inet_address(
222				self.to_glib_none().0,
223				address.as_ref().to_glib_none().0,
224			);
225		}
226	}
227
228	#[doc(alias = "arv_fake_camera_set_trigger_frequency")]
229	pub fn set_trigger_frequency(&self, frequency: f64) {
230		unsafe {
231			ffi::arv_fake_camera_set_trigger_frequency(self.to_glib_none().0, frequency);
232		}
233	}
234
235	#[doc(alias = "arv_fake_camera_wait_for_next_frame")]
236	pub fn wait_for_next_frame(&self) {
237		unsafe {
238			ffi::arv_fake_camera_wait_for_next_frame(self.to_glib_none().0);
239		}
240	}
241
242	//#[doc(alias = "arv_fake_camera_write_memory")]
243	//pub fn write_memory(&self, address: u32, size: u32, buffer: /*Unimplemented*/Option<Basic: Pointer>) -> bool {
244	//    unsafe { TODO: call ffi:arv_fake_camera_write_memory() }
245	//}
246
247	#[doc(alias = "arv_fake_camera_write_register")]
248	pub fn write_register(&self, address: u32, value: u32) -> bool {
249		unsafe {
250			from_glib(ffi::arv_fake_camera_write_register(
251				self.to_glib_none().0,
252				address,
253				value,
254			))
255		}
256	}
257}
258
259unsafe impl Send for FakeCamera {}