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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// 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, FwIsoCtx, FwScode};
use glib::{prelude::*, translate::*};
glib::wrapper! {
/// An object to transmit isochronous packet for single channel.
///
/// [`FwIsoIt`][crate::FwIsoIt] transmits isochronous packets for single channel by IT context in 1394 OHCI.
/// The content of packet is split to two parts; context header and context payload in a manner of
/// Linux FireWire subsystem.
///
/// ## Signals
///
///
/// #### `interrupted`
/// Emitted when Linux FireWire subsystem generates interrupt event. There are three cases
/// for Linux FireWire subsystem to generate the event:
///
/// - When 1394 OHCI hardware generates hardware interrupt as a result of processing the
/// isochronous packet for the buffer chunk marked to generate hardware interrupt.
/// - When the number of isochronous packets sent since the last interrupt event reaches
/// one quarter of memory page size (usually 4,096 / 4 = 1,024 packets).
/// - When application calls [`FwIsoCtxExt::flush_completions()`][crate::prelude::FwIsoCtxExt::flush_completions()] explicitly.
///
///
/// <details><summary><h4>FwIsoCtx</h4></summary>
///
///
/// #### `stopped`
/// Emitted when isochronous context is stopped.
///
/// Action
/// </details>
///
/// # Implements
///
/// [`FwIsoItExt`][trait@crate::prelude::FwIsoItExt], [`FwIsoCtxExt`][trait@crate::prelude::FwIsoCtxExt], [`FwIsoItExtManual`][trait@crate::prelude::FwIsoItExtManual], [`FwIsoCtxExtManual`][trait@crate::prelude::FwIsoCtxExtManual]
#[doc(alias = "HinokoFwIsoIt")]
pub struct FwIsoIt(Object<ffi::HinokoFwIsoIt, ffi::HinokoFwIsoItClass>) @implements FwIsoCtx;
match fn {
type_ => || ffi::hinoko_fw_iso_it_get_type(),
}
}
impl FwIsoIt {
pub const NONE: Option<&'static FwIsoIt> = None;
/// Instantiate [`FwIsoIt`][crate::FwIsoIt] object and return the instance.
///
/// # Returns
///
/// an instance of [`FwIsoIt`][crate::FwIsoIt].
#[doc(alias = "hinoko_fw_iso_it_new")]
pub fn new() -> FwIsoIt {
unsafe { from_glib_full(ffi::hinoko_fw_iso_it_new()) }
}
}
impl Default for FwIsoIt {
fn default() -> Self {
Self::new()
}
}
/// Trait containing the part of [`struct@FwIsoIt`] methods.
///
/// # Implementors
///
/// [`FwIsoIt`][struct@crate::FwIsoIt]
pub trait FwIsoItExt: IsA<FwIsoIt> + 'static {
/// Allocate an IT context to 1394 OHCI hardware. A local node of the node corresponding to the
/// given path is used as the hardware, thus any path is accepted as long as process has enough
/// permission for the path.
/// ## `path`
/// A path to any Linux FireWire character device.
/// ## `scode`
/// A [`FwScode`][crate::FwScode] to indicate speed of isochronous communication.
/// ## `channel`
/// An isochronous channel to transfer, up to 63.
/// ## `header_size`
/// The number of bytes for header of IT context.
///
/// # Returns
///
/// TRUE if the overall operation finishes successful, otherwise FALSE.
#[doc(alias = "hinoko_fw_iso_it_allocate")]
fn allocate(
&self,
path: &str,
scode: FwScode,
channel: u32,
header_size: u32,
) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::hinoko_fw_iso_it_allocate(
self.as_ref().to_glib_none().0,
path.to_glib_none().0,
scode.into_glib(),
channel,
header_size,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
/// Map intermediate buffer to share payload of IT context with 1394 OHCI hardware.
/// ## `maximum_bytes_per_payload`
/// The number of bytes for payload of IT context.
/// ## `payloads_per_buffer`
/// The number of payloads of IT context in buffer.
///
/// # Returns
///
/// TRUE if the overall operation finishes successful, otherwise FALSE.
#[doc(alias = "hinoko_fw_iso_it_map_buffer")]
fn map_buffer(
&self,
maximum_bytes_per_payload: u32,
payloads_per_buffer: u32,
) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::hinoko_fw_iso_it_map_buffer(
self.as_ref().to_glib_none().0,
maximum_bytes_per_payload,
payloads_per_buffer,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
}
impl<O: IsA<FwIsoIt>> FwIsoItExt for O {}