1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use crate::{ffi, Class};
use glib::translate::*;
glib::wrapper! {
/// A boxed object to express the identifier of timer device.
///
/// A [`DeviceId`][crate::DeviceId] is a boxed object to express the identifier of timer device. The
/// identifier mainly consists of the class of timer device. The other members; the numeric ID of
/// card, device, and subdevice are optional according to the class of timer device.
///
/// The object wraps `struct snd_timer_id` in UAPI of Linux sound subsystem.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DeviceId(Boxed<ffi::ALSATimerDeviceId>);
match fn {
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::alsatimer_device_id_get_type(), ptr as *mut _) as *mut ffi::ALSATimerDeviceId,
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::alsatimer_device_id_get_type(), ptr as *mut _),
type_ => || ffi::alsatimer_device_id_get_type(),
}
}
impl DeviceId {
/// Allocate and return an instance of [`DeviceId`][crate::DeviceId].
/// ## `class`
/// The class of device, one of [`Class`][crate::Class].
/// ## `card_id`
/// The numeric ID of relevant sound card.
/// ## `device_id`
/// The numeric ID of relevant device.
/// ## `subdevice_id`
/// The numeric ID of relevant subdevice.
///
/// # Returns
///
/// A [`DeviceId`][crate::DeviceId].
#[doc(alias = "alsatimer_device_id_new")]
pub fn new(class: Class, card_id: i32, device_id: i32, subdevice_id: i32) -> DeviceId {
unsafe {
from_glib_full(ffi::alsatimer_device_id_new(
class.into_glib(),
card_id,
device_id,
subdevice_id,
))
}
}
/// Get the numeric ID of sound card to which the device belongs.
///
/// # Returns
///
///
/// ## `card_id`
/// The numeric ID of sound card to which the timer belongs.
#[doc(alias = "alsatimer_device_id_get_card_id")]
#[doc(alias = "get_card_id")]
pub fn card_id(&self) -> i32 {
unsafe {
let mut card_id = std::mem::MaybeUninit::uninit();
ffi::alsatimer_device_id_get_card_id(self.to_glib_none().0, card_id.as_mut_ptr());
card_id.assume_init()
}
}
/// Get the class of timer.
///
/// # Returns
///
///
/// ## `class`
/// The class of timer, one of [`Class`][crate::Class].
#[doc(alias = "alsatimer_device_id_get_class")]
#[doc(alias = "get_class")]
pub fn class(&self) -> Class {
unsafe {
let mut class = std::mem::MaybeUninit::uninit();
ffi::alsatimer_device_id_get_class(self.to_glib_none().0, class.as_mut_ptr());
from_glib(class.assume_init())
}
}
/// Get the numeric ID of device to which the timer belongs.
///
/// # Returns
///
///
/// ## `device_id`
/// The numeric ID of device to which the timer belongs.
#[doc(alias = "alsatimer_device_id_get_device_id")]
#[doc(alias = "get_device_id")]
pub fn device_id(&self) -> i32 {
unsafe {
let mut device_id = std::mem::MaybeUninit::uninit();
ffi::alsatimer_device_id_get_device_id(self.to_glib_none().0, device_id.as_mut_ptr());
device_id.assume_init()
}
}
/// Get the numeric ID of subdevice to which the timer belongs.
///
/// # Returns
///
///
/// ## `subdevice_id`
/// The numeric ID of subdevice to which the timer belongs.
#[doc(alias = "alsatimer_device_id_get_subdevice_id")]
#[doc(alias = "get_subdevice_id")]
pub fn subdevice_id(&self) -> i32 {
unsafe {
let mut subdevice_id = std::mem::MaybeUninit::uninit();
ffi::alsatimer_device_id_get_subdevice_id(
self.to_glib_none().0,
subdevice_id.as_mut_ptr(),
);
subdevice_id.assume_init()
}
}
}
unsafe impl Send for DeviceId {}