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
// 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 for protocol of TASCAM FireWire series.
/// TASCAM FireWire series transfer image of device state by either isochronous or asynchronous
/// packets. The [`TascamProtocol`][crate::TascamProtocol] is an object interface for the image and the change of state
/// in the TASCAM FireWire protocol.
///
/// ## Signals
///
///
/// #### `changed`
/// Emitted when the part of image differed for the change of device state.
///
/// Action
///
/// # Implements
///
/// [`TascamProtocolExt`][trait@crate::prelude::TascamProtocolExt], [`TascamProtocolExtManual`][trait@crate::prelude::TascamProtocolExtManual]
#[doc(alias = "HitakiTascamProtocol")]
pub struct TascamProtocol(Interface<ffi::HitakiTascamProtocol, ffi::HitakiTascamProtocolInterface>);
match fn {
type_ => || ffi::hitaki_tascam_protocol_get_type(),
}
}
impl TascamProtocol {
pub const NONE: Option<&'static TascamProtocol> = None;
}
/// Trait containing the part of [`struct@TascamProtocol`] methods.
///
/// # Implementors
///
/// [`SndTascam`][struct@crate::SndTascam], [`TascamProtocol`][struct@crate::TascamProtocol]
pub trait TascamProtocolExt: IsA<TascamProtocol> + 'static {
/// Emitted when the part of image differed for the change of device state.
/// ## `index`
/// the numeric index on image of status and control info.
/// ## `before`
/// the value of info before changed.
/// ## `after`
/// the value of info after changed.
#[doc(alias = "changed")]
fn connect_changed<F: Fn(&Self, u32, u32, u32) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn changed_trampoline<
P: IsA<TascamProtocol>,
F: Fn(&P, u32, u32, u32) + 'static,
>(
this: *mut ffi::HitakiTascamProtocol,
index: std::ffi::c_uint,
before: std::ffi::c_uint,
after: std::ffi::c_uint,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TascamProtocol::from_glib_borrow(this).unsafe_cast_ref(),
index,
before,
after,
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"changed".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
changed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn emit_changed(&self, index: u32, before: u32, after: u32) {
self.emit_by_name::<()>("changed", &[&index, &before, &after]);
}
}
impl<O: IsA<TascamProtocol>> TascamProtocolExt for O {}