aravis 0.11.1

safe bindings for Aravis, a vision library for genicam based cameras
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from ../gir-files
// DO NOT EDIT

use crate::{ffi, Device};
use glib::{prelude::*, translate::*};

glib::wrapper! {
/// [`Interface`][crate::Interface] is an abstract base class for camera discovery. It maintains a
/// list of the available devices and helps to instantiate the corresponding
/// [`Device`][crate::Device] objects. If the user already knows the device id of the device, he should
/// not worry about this class and just use [`Camera::new()`][crate::Camera::new()] or
/// `arv_open_device()`.
///
/// This is an Abstract Base Class, you cannot instantiate it.
///
/// # Implements
///
/// [`InterfaceExt`][trait@crate::prelude::InterfaceExt], [`trait@glib::ObjectExt`]
	#[doc(alias = "ArvInterface")]
	pub struct Interface(Object<ffi::ArvInterface, ffi::ArvInterfaceClass>);

	match fn {
		type_ => || ffi::arv_interface_get_type(),
	}
}

impl Interface {
	pub const NONE: Option<&'static Interface> = None;
}

unsafe impl Send for Interface {}

mod sealed {
	pub trait Sealed {}
	impl<T: super::IsA<super::Interface>> Sealed for T {}
}

/// Trait containing all [`struct@Interface`] methods.
///
/// # Implementors
///
/// [`FakeInterface`][struct@crate::FakeInterface], [`GvInterface`][struct@crate::GvInterface], [`Interface`][struct@crate::Interface], [`UvInterface`][struct@crate::UvInterface]
pub trait InterfaceExt: IsA<Interface> + sealed::Sealed + 'static {
	#[doc(alias = "arv_interface_get_device_address")]
	#[doc(alias = "get_device_address")]
	fn device_address(&self, index: u32) -> Option<glib::GString> {
		unsafe {
			from_glib_none(ffi::arv_interface_get_device_address(
				self.as_ref().to_glib_none().0,
				index,
			))
		}
	}

	#[doc(alias = "arv_interface_get_device_id")]
	#[doc(alias = "get_device_id")]
	fn device_id(&self, index: u32) -> Option<glib::GString> {
		unsafe {
			from_glib_none(ffi::arv_interface_get_device_id(
				self.as_ref().to_glib_none().0,
				index,
			))
		}
	}

	#[cfg(feature = "v0_8_20")]
	#[cfg_attr(docsrs, doc(cfg(feature = "v0_8_20")))]
	#[doc(alias = "arv_interface_get_device_manufacturer_info")]
	#[doc(alias = "get_device_manufacturer_info")]
	fn device_manufacturer_info(&self, index: u32) -> Option<glib::GString> {
		unsafe {
			from_glib_none(ffi::arv_interface_get_device_manufacturer_info(
				self.as_ref().to_glib_none().0,
				index,
			))
		}
	}

	#[doc(alias = "arv_interface_get_device_model")]
	#[doc(alias = "get_device_model")]
	fn device_model(&self, index: u32) -> Option<glib::GString> {
		unsafe {
			from_glib_none(ffi::arv_interface_get_device_model(
				self.as_ref().to_glib_none().0,
				index,
			))
		}
	}

	#[doc(alias = "arv_interface_get_device_physical_id")]
	#[doc(alias = "get_device_physical_id")]
	fn device_physical_id(&self, index: u32) -> Option<glib::GString> {
		unsafe {
			from_glib_none(ffi::arv_interface_get_device_physical_id(
				self.as_ref().to_glib_none().0,
				index,
			))
		}
	}

	#[doc(alias = "arv_interface_get_device_protocol")]
	#[doc(alias = "get_device_protocol")]
	fn device_protocol(&self, index: u32) -> Option<glib::GString> {
		unsafe {
			from_glib_none(ffi::arv_interface_get_device_protocol(
				self.as_ref().to_glib_none().0,
				index,
			))
		}
	}

	#[doc(alias = "arv_interface_get_device_serial_nbr")]
	#[doc(alias = "get_device_serial_nbr")]
	fn device_serial_nbr(&self, index: u32) -> Option<glib::GString> {
		unsafe {
			from_glib_none(ffi::arv_interface_get_device_serial_nbr(
				self.as_ref().to_glib_none().0,
				index,
			))
		}
	}

	#[doc(alias = "arv_interface_get_device_vendor")]
	#[doc(alias = "get_device_vendor")]
	fn device_vendor(&self, index: u32) -> Option<glib::GString> {
		unsafe {
			from_glib_none(ffi::arv_interface_get_device_vendor(
				self.as_ref().to_glib_none().0,
				index,
			))
		}
	}

	#[doc(alias = "arv_interface_get_n_devices")]
	#[doc(alias = "get_n_devices")]
	fn n_devices(&self) -> u32 {
		unsafe { ffi::arv_interface_get_n_devices(self.as_ref().to_glib_none().0) }
	}

	#[doc(alias = "arv_interface_open_device")]
	fn open_device(&self, device_id: Option<&str>) -> Result<Device, glib::Error> {
		unsafe {
			let mut error = std::ptr::null_mut();
			let ret = ffi::arv_interface_open_device(
				self.as_ref().to_glib_none().0,
				device_id.to_glib_none().0,
				&mut error,
			);
			if error.is_null() {
				Ok(from_glib_full(ret))
			} else {
				Err(from_glib_full(error))
			}
		}
	}

	#[doc(alias = "arv_interface_update_device_list")]
	fn update_device_list(&self) {
		unsafe {
			ffi::arv_interface_update_device_list(self.as_ref().to_glib_none().0);
		}
	}
}

impl<O: IsA<Interface>> InterfaceExt for O {}