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
// 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;
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
/// An interface to operate notification with quadlet message and time stamp.
///
/// Some of units supported by drivers in ALSA firewire stack have the function to notify quadlet
/// message and time stamp for specific purposes. The [`TimestampedQuadletNotification`][crate::TimestampedQuadletNotification] is an
/// interface to operate the notification.
///
/// ## Signals
///
///
/// #### `notified-at`
/// Emitted when the target unit transfers notification.
///
/// The value of @tstamp is unsigned 16 bit integer including higher 3 bits for three low order
/// bits of second field and the rest 13 bits for cycle field in the format of IEEE 1394
/// CYCLE_TIMER register.
///
/// Action
///
/// # Implements
///
/// [`TimestampedQuadletNotificationExt`][trait@crate::prelude::TimestampedQuadletNotificationExt]
#[doc(alias = "HitakiTimestampedQuadletNotification")]
pub struct TimestampedQuadletNotification(Interface<ffi::HitakiTimestampedQuadletNotification, ffi::HitakiTimestampedQuadletNotificationInterface>);
match fn {
type_ => || ffi::hitaki_timestamped_quadlet_notification_get_type(),
}
}
impl TimestampedQuadletNotification {
pub const NONE: Option<&'static TimestampedQuadletNotification> = None;
}
/// Trait containing all [`struct@TimestampedQuadletNotification`] methods.
///
/// # Implementors
///
/// [`SndFireface`][struct@crate::SndFireface], [`TimestampedQuadletNotification`][struct@crate::TimestampedQuadletNotification]
pub trait TimestampedQuadletNotificationExt: IsA<TimestampedQuadletNotification> + 'static {
/// Emitted when the target unit transfers notification.
///
/// The value of @tstamp is unsigned 16 bit integer including higher 3 bits for three low order
/// bits of second field and the rest 13 bits for cycle field in the format of IEEE 1394
/// CYCLE_TIMER register.
/// ## `message`
/// A quadlet message in notification.
/// ## `tstamp`
/// The isochronous cycle at which the request arrived.
#[doc(alias = "notified-at")]
fn connect_notified_at<F: Fn(&Self, u32, u32) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notified_at_trampoline<
P: IsA<TimestampedQuadletNotification>,
F: Fn(&P, u32, u32) + 'static,
>(
this: *mut ffi::HitakiTimestampedQuadletNotification,
message: std::ffi::c_uint,
tstamp: std::ffi::c_uint,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TimestampedQuadletNotification::from_glib_borrow(this).unsafe_cast_ref(),
message,
tstamp,
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notified-at".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notified_at_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn emit_notified_at(&self, message: u32, tstamp: u32) {
self.emit_by_name::<()>("notified-at", &[&message, &tstamp]);
}
}
impl<O: IsA<TimestampedQuadletNotification>> TimestampedQuadletNotificationExt for O {}