aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2024-01-04 19:45:28 +0900
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>2024-01-04 19:45:28 +0900
commit1f63fdcf1d865f52028b90405b34a2d87be4a08a (patch)
tree55c1975cf08390ac8d4f5aa6f2b93bad27bbbfe5
parentee5b2548e2613ded3eef00200f6557b1a0567b58 (diff)
downloadhinawa-rs-1f63fdcf1d865f52028b90405b34a2d87be4a08a.tar.gz
hinawa: regenerate API crate
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--README.rst4
-rw-r--r--hinawa/Cargo.toml5
-rw-r--r--hinawa/Gir.toml4
-rw-r--r--hinawa/README.md7
-rw-r--r--hinawa/src/auto/cycle_time.rs10
-rw-r--r--hinawa/src/auto/enums.rs245
-rw-r--r--hinawa/src/auto/fw_fcp.rs149
-rw-r--r--hinawa/src/auto/fw_node.rs228
-rw-r--r--hinawa/src/auto/fw_req.rs17
-rw-r--r--hinawa/src/auto/fw_resp.rs176
-rw-r--r--hinawa/src/auto/versions.txt4
-rw-r--r--hinawa/src/fw_fcp.rs22
-rw-r--r--hinawa/src/fw_node.rs15
-rw-r--r--hinawa/src/fw_req.rs23
-rw-r--r--hinawa/src/subclass/fw_fcp.rs9
-rw-r--r--hinawa/src/subclass/fw_node.rs2
-rw-r--r--hinawa/src/subclass/fw_req.rs12
-rw-r--r--hinawa/src/subclass/fw_resp.rs24
18 files changed, 632 insertions, 324 deletions
diff --git a/README.rst b/README.rst
index 6752af7..3f17e38 100644
--- a/README.rst
+++ b/README.rst
@@ -45,8 +45,8 @@ Dependencies
* FFI crate (``hinawa-sys``)
* ``libc`` >= 0.2
- * ``glib-sys`` >= 0.15
- * ``gobject-sys`` >= 0.15
+ * ``glib-sys`` >= 0.18
+ * ``gobject-sys`` >= 0.18
* API crate (`hinawa`)
diff --git a/hinawa/Cargo.toml b/hinawa/Cargo.toml
index d04492c..a47cceb 100644
--- a/hinawa/Cargo.toml
+++ b/hinawa/Cargo.toml
@@ -14,7 +14,8 @@ license = "MIT"
readme = "README.md"
repository = "https://git.kernel.org/pub/scm/libs/ieee1394/hinawa-rs.git/"
[package.metadata.docs.rs]
-features = ["dox"]
+rustc-args = ["--cfg", "docsrs"]
+rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
[lib]
name = "hinawa"
@@ -28,5 +29,3 @@ ffi = {package = "hinawa-sys", version = "0.9.1"}
gir-format-check = "^0.1"
[features]
-# To suppress linking to C library when generating documentation.
-dox = ["ffi/dox", "glib/dox"]
diff --git a/hinawa/Gir.toml b/hinawa/Gir.toml
index a34f355..bda8afb 100644
--- a/hinawa/Gir.toml
+++ b/hinawa/Gir.toml
@@ -55,10 +55,6 @@ manual_traits = ["FwReqExtManual"]
name = "responded"
manual = true
doc_trait_name = "FwReqExtManual"
- [[object.function]]
- name = "error_quark"
- manual = true
- doc_trait_name = "FwReqExtManual"
[[object]]
name = "Hinawa.FwResp"
diff --git a/hinawa/README.md b/hinawa/README.md
index 16b3afc..0ec3500 100644
--- a/hinawa/README.md
+++ b/hinawa/README.md
@@ -30,13 +30,6 @@ The hinawa crate is released under [MIT license](https://spdx.org/licenses/MIT.h
The hinawa crate depends on API crates provided by [gtk-rs project](https://gtk-rs.org/) for
type/object system, event loop, and dispacher.
-## Features
-
-* dox
-
- * Suppress detection of installed hinawa library. It's automatically enabled when generating
- documentation in docs.rs.
-
## Repository
The hinawa crate is maintained by Takashi Sakamoto for upstream of Linux FireWire subsystem.
diff --git a/hinawa/src/auto/cycle_time.rs b/hinawa/src/auto/cycle_time.rs
index 0ef9382..2d7bc08 100644
--- a/hinawa/src/auto/cycle_time.rs
+++ b/hinawa/src/auto/cycle_time.rs
@@ -47,8 +47,7 @@ impl CycleTime {
unsafe {
let mut clock_id = mem::MaybeUninit::uninit();
ffi::hinawa_cycle_time_get_clock_id(self.to_glib_none().0, clock_id.as_mut_ptr());
- let clock_id = clock_id.assume_init();
- clock_id
+ clock_id.assume_init()
}
}
@@ -65,8 +64,7 @@ impl CycleTime {
unsafe {
let mut raw = mem::MaybeUninit::uninit();
ffi::hinawa_cycle_time_get_raw(self.to_glib_none().0, raw.as_mut_ptr());
- let raw = raw.assume_init();
- raw
+ raw.assume_init()
}
}
@@ -92,9 +90,7 @@ impl CycleTime {
tv_sec.as_mut_ptr(),
tv_nsec.as_mut_ptr(),
);
- let tv_sec = tv_sec.assume_init();
- let tv_nsec = tv_nsec.assume_init();
- (tv_sec, tv_nsec)
+ (tv_sec.assume_init(), tv_nsec.assume_init())
}
}
}
diff --git a/hinawa/src/auto/enums.rs b/hinawa/src/auto/enums.rs
index ef8b566..fa42591 100644
--- a/hinawa/src/auto/enums.rs
+++ b/hinawa/src/auto/enums.rs
@@ -3,13 +3,7 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
-use glib::error::ErrorDomain;
-use glib::translate::*;
-use glib::value::FromValue;
-use glib::value::ToValue;
-use glib::Quark;
-use glib::StaticType;
-use glib::Type;
+use glib::{prelude::*, translate::*};
use std::fmt;
/// A set of error code for [`glib::Error`][crate::glib::Error] for operations in [`FwFcp`][crate::FwFcp].
@@ -23,6 +17,7 @@ pub enum FwFcpError {
/// The size of response is larger than expected.
#[doc(alias = "HINAWA_FW_FCP_ERROR_LARGE_RESP")]
LargeResp,
+ /// The transaction is aborted due to bus reset.
#[doc(alias = "HINAWA_FW_FCP_ERROR_ABORTED")]
Aborted,
#[doc(hidden)]
@@ -48,6 +43,7 @@ impl fmt::Display for FwFcpError {
impl IntoGlib for FwFcpError {
type GlibType = ffi::HinawaFwFcpError;
+ #[inline]
fn into_glib(self) -> ffi::HinawaFwFcpError {
match self {
Self::Timeout => ffi::HINAWA_FW_FCP_ERROR_TIMEOUT,
@@ -60,6 +56,7 @@ impl IntoGlib for FwFcpError {
#[doc(hidden)]
impl FromGlib<ffi::HinawaFwFcpError> for FwFcpError {
+ #[inline]
unsafe fn from_glib(value: ffi::HinawaFwFcpError) -> Self {
match value {
ffi::HINAWA_FW_FCP_ERROR_TIMEOUT => Self::Timeout,
@@ -70,44 +67,59 @@ impl FromGlib<ffi::HinawaFwFcpError> for FwFcpError {
}
}
-impl ErrorDomain for FwFcpError {
- fn domain() -> Quark {
+impl glib::error::ErrorDomain for FwFcpError {
+ #[inline]
+ fn domain() -> glib::Quark {
unsafe { from_glib(ffi::hinawa_fw_fcp_error_quark()) }
}
+ #[inline]
fn code(self) -> i32 {
self.into_glib()
}
+ #[inline]
+ #[allow(clippy::match_single_binding)]
fn from(code: i32) -> Option<Self> {
- match code {
- ffi::HINAWA_FW_FCP_ERROR_TIMEOUT => Some(Self::Timeout),
- ffi::HINAWA_FW_FCP_ERROR_LARGE_RESP => Some(Self::LargeResp),
- ffi::HINAWA_FW_FCP_ERROR_ABORTED => Some(Self::Aborted),
- value => Some(Self::__Unknown(value)),
+ match unsafe { from_glib(code) } {
+ value => Some(value),
}
}
}
impl StaticType for FwFcpError {
- fn static_type() -> Type {
+ #[inline]
+ #[doc(alias = "hinawa_fw_fcp_error_get_type")]
+ fn static_type() -> glib::Type {
unsafe { from_glib(ffi::hinawa_fw_fcp_error_get_type()) }
}
}
+impl glib::HasParamSpec for FwFcpError {
+ type ParamSpec = glib::ParamSpecEnum;
+ type SetValue = Self;
+ type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
+
+ fn param_spec_builder() -> Self::BuilderFn {
+ Self::ParamSpec::builder_with_default
+ }
+}
+
impl glib::value::ValueType for FwFcpError {
type Type = Self;
}
-unsafe impl<'a> FromValue<'a> for FwFcpError {
+unsafe impl<'a> glib::value::FromValue<'a> for FwFcpError {
type Checker = glib::value::GenericValueTypeChecker<Self>;
+ #[inline]
unsafe fn from_value(value: &'a glib::Value) -> Self {
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}
impl ToValue for FwFcpError {
+ #[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
@@ -116,11 +128,19 @@ impl ToValue for FwFcpError {
value
}
+ #[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
+impl From<FwFcpError> for glib::Value {
+ #[inline]
+ fn from(v: FwFcpError) -> Self {
+ ToValue::to_value(&v)
+ }
+}
+
/// A set of error code for [`glib::Error`][crate::glib::Error] for operations in [`FwNode`][crate::FwNode].
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
@@ -162,6 +182,7 @@ impl fmt::Display for FwNodeError {
impl IntoGlib for FwNodeError {
type GlibType = ffi::HinawaFwNodeError;
+ #[inline]
fn into_glib(self) -> ffi::HinawaFwNodeError {
match self {
Self::Disconnected => ffi::HINAWA_FW_NODE_ERROR_DISCONNECTED,
@@ -175,6 +196,7 @@ impl IntoGlib for FwNodeError {
#[doc(hidden)]
impl FromGlib<ffi::HinawaFwNodeError> for FwNodeError {
+ #[inline]
unsafe fn from_glib(value: ffi::HinawaFwNodeError) -> Self {
match value {
ffi::HINAWA_FW_NODE_ERROR_DISCONNECTED => Self::Disconnected,
@@ -186,45 +208,60 @@ impl FromGlib<ffi::HinawaFwNodeError> for FwNodeError {
}
}
-impl ErrorDomain for FwNodeError {
- fn domain() -> Quark {
+impl glib::error::ErrorDomain for FwNodeError {
+ #[inline]
+ fn domain() -> glib::Quark {
unsafe { from_glib(ffi::hinawa_fw_node_error_quark()) }
}
+ #[inline]
fn code(self) -> i32 {
self.into_glib()
}
+ #[inline]
+ #[allow(clippy::match_single_binding)]
fn from(code: i32) -> Option<Self> {
- match code {
- ffi::HINAWA_FW_NODE_ERROR_DISCONNECTED => Some(Self::Disconnected),
- ffi::HINAWA_FW_NODE_ERROR_OPENED => Some(Self::Opened),
- ffi::HINAWA_FW_NODE_ERROR_NOT_OPENED => Some(Self::NotOpened),
- ffi::HINAWA_FW_NODE_ERROR_FAILED => Some(Self::Failed),
- _ => Some(Self::Failed),
+ match unsafe { from_glib(code) } {
+ Self::__Unknown(_) => Some(Self::Failed),
+ value => Some(value),
}
}
}
impl StaticType for FwNodeError {
- fn static_type() -> Type {
+ #[inline]
+ #[doc(alias = "hinawa_fw_node_error_get_type")]
+ fn static_type() -> glib::Type {
unsafe { from_glib(ffi::hinawa_fw_node_error_get_type()) }
}
}
+impl glib::HasParamSpec for FwNodeError {
+ type ParamSpec = glib::ParamSpecEnum;
+ type SetValue = Self;
+ type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
+
+ fn param_spec_builder() -> Self::BuilderFn {
+ Self::ParamSpec::builder_with_default
+ }
+}
+
impl glib::value::ValueType for FwNodeError {
type Type = Self;
}
-unsafe impl<'a> FromValue<'a> for FwNodeError {
+unsafe impl<'a> glib::value::FromValue<'a> for FwNodeError {
type Checker = glib::value::GenericValueTypeChecker<Self>;
+ #[inline]
unsafe fn from_value(value: &'a glib::Value) -> Self {
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}
impl ToValue for FwNodeError {
+ #[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
@@ -233,11 +270,19 @@ impl ToValue for FwNodeError {
value
}
+ #[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
+impl From<FwNodeError> for glib::Value {
+ #[inline]
+ fn from(v: FwNodeError) -> Self {
+ ToValue::to_value(&v)
+ }
+}
+
/// A representation for rcode of asynchronous transaction on IEEE 1394 bus.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
@@ -307,6 +352,7 @@ impl fmt::Display for FwRcode {
impl IntoGlib for FwRcode {
type GlibType = ffi::HinawaFwRcode;
+ #[inline]
fn into_glib(self) -> ffi::HinawaFwRcode {
match self {
Self::Complete => ffi::HINAWA_FW_RCODE_COMPLETE,
@@ -327,6 +373,7 @@ impl IntoGlib for FwRcode {
#[doc(hidden)]
impl FromGlib<ffi::HinawaFwRcode> for FwRcode {
+ #[inline]
unsafe fn from_glib(value: ffi::HinawaFwRcode) -> Self {
match value {
ffi::HINAWA_FW_RCODE_COMPLETE => Self::Complete,
@@ -346,24 +393,38 @@ impl FromGlib<ffi::HinawaFwRcode> for FwRcode {
}
impl StaticType for FwRcode {
- fn static_type() -> Type {
+ #[inline]
+ #[doc(alias = "hinawa_fw_rcode_get_type")]
+ fn static_type() -> glib::Type {
unsafe { from_glib(ffi::hinawa_fw_rcode_get_type()) }
}
}
+impl glib::HasParamSpec for FwRcode {
+ type ParamSpec = glib::ParamSpecEnum;
+ type SetValue = Self;
+ type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
+
+ fn param_spec_builder() -> Self::BuilderFn {
+ Self::ParamSpec::builder_with_default
+ }
+}
+
impl glib::value::ValueType for FwRcode {
type Type = Self;
}
-unsafe impl<'a> FromValue<'a> for FwRcode {
+unsafe impl<'a> glib::value::FromValue<'a> for FwRcode {
type Checker = glib::value::GenericValueTypeChecker<Self>;
+ #[inline]
unsafe fn from_value(value: &'a glib::Value) -> Self {
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}
impl ToValue for FwRcode {
+ #[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
@@ -372,11 +433,19 @@ impl ToValue for FwRcode {
value
}
+ #[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
+impl From<FwRcode> for glib::Value {
+ #[inline]
+ fn from(v: FwRcode) -> Self {
+ ToValue::to_value(&v)
+ }
+}
+
/// A set of error code for [`glib::Error`][crate::glib::Error] for operations in [`FwReq`][crate::FwReq].
///
/// The actual value is equivalent to [`FwRcode`][crate::FwRcode].
@@ -444,6 +513,7 @@ impl fmt::Display for FwReqError {
impl IntoGlib for FwReqError {
type GlibType = ffi::HinawaFwReqError;
+ #[inline]
fn into_glib(self) -> ffi::HinawaFwReqError {
match self {
Self::ConflictError => ffi::HINAWA_FW_REQ_ERROR_CONFLICT_ERROR,
@@ -463,6 +533,7 @@ impl IntoGlib for FwReqError {
#[doc(hidden)]
impl FromGlib<ffi::HinawaFwReqError> for FwReqError {
+ #[inline]
unsafe fn from_glib(value: ffi::HinawaFwReqError) -> Self {
match value {
ffi::HINAWA_FW_REQ_ERROR_CONFLICT_ERROR => Self::ConflictError,
@@ -480,51 +551,59 @@ impl FromGlib<ffi::HinawaFwReqError> for FwReqError {
}
}
-impl ErrorDomain for FwReqError {
- fn domain() -> Quark {
+impl glib::error::ErrorDomain for FwReqError {
+ #[inline]
+ fn domain() -> glib::Quark {
unsafe { from_glib(ffi::hinawa_fw_req_error_quark()) }
}
+ #[inline]
fn code(self) -> i32 {
self.into_glib()
}
+ #[inline]
+ #[allow(clippy::match_single_binding)]
fn from(code: i32) -> Option<Self> {
- match code {
- ffi::HINAWA_FW_REQ_ERROR_CONFLICT_ERROR => Some(Self::ConflictError),
- ffi::HINAWA_FW_REQ_ERROR_DATA_ERROR => Some(Self::DataError),
- ffi::HINAWA_FW_REQ_ERROR_TYPE_ERROR => Some(Self::TypeError),
- ffi::HINAWA_FW_REQ_ERROR_ADDRESS_ERROR => Some(Self::AddressError),
- ffi::HINAWA_FW_REQ_ERROR_SEND_ERROR => Some(Self::SendError),
- ffi::HINAWA_FW_REQ_ERROR_CANCELLED => Some(Self::Cancelled),
- ffi::HINAWA_FW_REQ_ERROR_BUSY => Some(Self::Busy),
- ffi::HINAWA_FW_REQ_ERROR_GENERATION => Some(Self::Generation),
- ffi::HINAWA_FW_REQ_ERROR_NO_ACK => Some(Self::NoAck),
- ffi::HINAWA_FW_REQ_ERROR_INVALID => Some(Self::Invalid),
- value => Some(Self::__Unknown(value)),
+ match unsafe { from_glib(code) } {
+ value => Some(value),
}
}
}
impl StaticType for FwReqError {
- fn static_type() -> Type {
+ #[inline]
+ #[doc(alias = "hinawa_fw_req_error_get_type")]
+ fn static_type() -> glib::Type {
unsafe { from_glib(ffi::hinawa_fw_req_error_get_type()) }
}
}
+impl glib::HasParamSpec for FwReqError {
+ type ParamSpec = glib::ParamSpecEnum;
+ type SetValue = Self;
+ type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
+
+ fn param_spec_builder() -> Self::BuilderFn {
+ Self::ParamSpec::builder_with_default
+ }
+}
+
impl glib::value::ValueType for FwReqError {
type Type = Self;
}
-unsafe impl<'a> FromValue<'a> for FwReqError {
+unsafe impl<'a> glib::value::FromValue<'a> for FwReqError {
type Checker = glib::value::GenericValueTypeChecker<Self>;
+ #[inline]
unsafe fn from_value(value: &'a glib::Value) -> Self {
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}
impl ToValue for FwReqError {
+ #[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
@@ -533,11 +612,19 @@ impl ToValue for FwReqError {
value
}
+ #[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
+impl From<FwReqError> for glib::Value {
+ #[inline]
+ fn from(v: FwReqError) -> Self {
+ ToValue::to_value(&v)
+ }
+}
+
/// A set of error code for [`glib::Error`][crate::glib::Error] for operations in [`FwResp`][crate::FwResp].
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
@@ -575,6 +662,7 @@ impl fmt::Display for FwRespError {
impl IntoGlib for FwRespError {
type GlibType = ffi::HinawaFwRespError;
+ #[inline]
fn into_glib(self) -> ffi::HinawaFwRespError {
match self {
Self::Failed => ffi::HINAWA_FW_RESP_ERROR_FAILED,
@@ -587,6 +675,7 @@ impl IntoGlib for FwRespError {
#[doc(hidden)]
impl FromGlib<ffi::HinawaFwRespError> for FwRespError {
+ #[inline]
unsafe fn from_glib(value: ffi::HinawaFwRespError) -> Self {
match value {
ffi::HINAWA_FW_RESP_ERROR_FAILED => Self::Failed,
@@ -597,44 +686,60 @@ impl FromGlib<ffi::HinawaFwRespError> for FwRespError {
}
}
-impl ErrorDomain for FwRespError {
- fn domain() -> Quark {
+impl glib::error::ErrorDomain for FwRespError {
+ #[inline]
+ fn domain() -> glib::Quark {
unsafe { from_glib(ffi::hinawa_fw_resp_error_quark()) }
}
+ #[inline]
fn code(self) -> i32 {
self.into_glib()
}
+ #[inline]
+ #[allow(clippy::match_single_binding)]
fn from(code: i32) -> Option<Self> {
- match code {
- ffi::HINAWA_FW_RESP_ERROR_FAILED => Some(Self::Failed),
- ffi::HINAWA_FW_RESP_ERROR_RESERVED => Some(Self::Reserved),
- ffi::HINAWA_FW_RESP_ERROR_ADDR_SPACE_USED => Some(Self::AddrSpaceUsed),
- _ => Some(Self::Failed),
+ match unsafe { from_glib(code) } {
+ Self::__Unknown(_) => Some(Self::Failed),
+ value => Some(value),
}
}
}
impl StaticType for FwRespError {
- fn static_type() -> Type {
+ #[inline]
+ #[doc(alias = "hinawa_fw_resp_error_get_type")]
+ fn static_type() -> glib::Type {
unsafe { from_glib(ffi::hinawa_fw_resp_error_get_type()) }
}
}
+impl glib::HasParamSpec for FwRespError {
+ type ParamSpec = glib::ParamSpecEnum;
+ type SetValue = Self;
+ type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
+
+ fn param_spec_builder() -> Self::BuilderFn {
+ Self::ParamSpec::builder_with_default
+ }
+}
+
impl glib::value::ValueType for FwRespError {
type Type = Self;
}
-unsafe impl<'a> FromValue<'a> for FwRespError {
+unsafe impl<'a> glib::value::FromValue<'a> for FwRespError {
type Checker = glib::value::GenericValueTypeChecker<Self>;
+ #[inline]
unsafe fn from_value(value: &'a glib::Value) -> Self {
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}
impl ToValue for FwRespError {
+ #[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
@@ -643,11 +748,19 @@ impl ToValue for FwRespError {
value
}
+ #[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
+impl From<FwRespError> for glib::Value {
+ #[inline]
+ fn from(v: FwRespError) -> Self {
+ ToValue::to_value(&v)
+ }
+}
+
/// A representation for tcode of asynchronous transaction on IEEE 1394 bus.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
@@ -798,24 +911,38 @@ impl FromGlib<ffi::HinawaFwTcode> for FwTcode {
}
impl StaticType for FwTcode {
- fn static_type() -> Type {
+ #[inline]
+ #[doc(alias = "hinawa_fw_tcode_get_type")]
+ fn static_type() -> glib::Type {
unsafe { from_glib(ffi::hinawa_fw_tcode_get_type()) }
}
}
+impl glib::HasParamSpec for FwTcode {
+ type ParamSpec = glib::ParamSpecEnum;
+ type SetValue = Self;
+ type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
+
+ fn param_spec_builder() -> Self::BuilderFn {
+ Self::ParamSpec::builder_with_default
+ }
+}
+
impl glib::value::ValueType for FwTcode {
type Type = Self;
}
-unsafe impl<'a> FromValue<'a> for FwTcode {
+unsafe impl<'a> glib::value::FromValue<'a> for FwTcode {
type Checker = glib::value::GenericValueTypeChecker<Self>;
+ #[inline]
unsafe fn from_value(value: &'a glib::Value) -> Self {
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}
impl ToValue for FwTcode {
+ #[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
@@ -824,7 +951,15 @@ impl ToValue for FwTcode {
value
}
+ #[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
+
+impl From<FwTcode> for glib::Value {
+ #[inline]
+ fn from(v: FwTcode) -> Self {
+ ToValue::to_value(&v)
+ }
+}
diff --git a/hinawa/src/auto/fw_fcp.rs b/hinawa/src/auto/fw_fcp.rs
index b769820..861f2be 100644
--- a/hinawa/src/auto/fw_fcp.rs
+++ b/hinawa/src/auto/fw_fcp.rs
@@ -3,17 +3,13 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
-use crate::FwNode;
-use crate::FwResp;
-use glib::object::Cast;
-use glib::object::IsA;
-use glib::signal::connect_raw;
-use glib::signal::SignalHandlerId;
-use glib::translate::*;
-use std::boxed::Box as Box_;
-use std::fmt;
-use std::mem::transmute;
-use std::ptr;
+use crate::{FwNode, FwResp};
+use glib::{
+ prelude::*,
+ signal::{connect_raw, SignalHandlerId},
+ translate::*,
+};
+use std::{boxed::Box as Box_, fmt, mem::transmute, ptr};
glib::wrapper! {
/// A FCP transaction executor to node in IEEE 1394 bus.
@@ -27,6 +23,70 @@ glib::wrapper! {
/// Any of transaction frames should be aligned to 8 bit (1 byte). This class is an application of
/// [`FwReq`][crate::FwReq] / [`FwResp`][crate::FwResp].
///
+ /// ## Properties
+ ///
+ ///
+ /// #### `is-bound`
+ /// Whether this protocol is bound to any instance of HinawaFwNode.
+ ///
+ /// Readable
+ /// <details><summary><h4>FwResp</h4></summary>
+ ///
+ ///
+ /// #### `is-reserved`
+ /// Whether a range of address is reserved or not.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `offset`
+ /// The start offset of reserved address range.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `width`
+ /// The width of reserved address range.
+ ///
+ /// Readable
+ /// </details>
+ ///
+ /// ## Signals
+ ///
+ ///
+ /// #### `responded`
+ /// Emitted when the node transfers asynchronous packet as response for FCP and the process
+ /// successfully read the content of packet.
+ ///
+ /// The values 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.
+ ///
+ /// If the version of kernel ABI for Linux FireWire subsystem is less than 6, the value of
+ /// @tstamp argument has invalid value (=G_MAXUINT).
+ ///
+ ///
+ /// <details><summary><h4>FwResp</h4></summary>
+ ///
+ ///
+ /// #### `requested`
+ /// Emitted when any node transfers request subaction to local nodes within the address
+ /// range reserved in Linux system.
+ ///
+ /// The handler is expected to call [`FwRespExt::set_resp_frame()`][crate::prelude::FwRespExt::set_resp_frame()] with frame and return
+ /// [`FwRcode`][crate::FwRcode] for response subaction.
+ ///
+ /// 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.
+ ///
+ /// If the version of kernel ABI for Linux FireWire subsystem is less than 6, the value of
+ /// tstamp argument has invalid value (=G_MAXUINT). Furthermore, if the version is less than
+ /// 4, the src, dst, card, generation arguments have invalid value (=G_MAXUINT).
+ ///
+ ///
+ /// </details>
+ ///
/// # Implements
///
/// [`FwFcpExt`][trait@crate::prelude::FwFcpExt], [`FwRespExt`][trait@crate::prelude::FwRespExt], [`FwFcpExtManual`][trait@crate::prelude::FwFcpExtManual], [`FwRespExtManual`][trait@crate::prelude::FwRespExtManual]
@@ -58,12 +118,17 @@ impl Default for FwFcp {
}
}
-/// Trait containing the part of [`struct@FwFcp`] methods.
+mod sealed {
+ pub trait Sealed {}
+ impl<T: super::IsA<super::FwFcp>> Sealed for T {}
+}
+
+/// Trait containing all [`struct@FwFcp`] methods.
///
/// # Implementors
///
/// [`FwFcp`][struct@crate::FwFcp]
-pub trait FwFcpExt: 'static {
+pub trait FwFcpExt: IsA<FwFcp> + sealed::Sealed + 'static {
/// Start to listen to FCP responses.
/// ## `node`
/// A [`FwNode`][crate::FwNode].
@@ -72,43 +137,15 @@ pub trait FwFcpExt: 'static {
///
/// TRUE if the overall operation finishes successfully, otherwise FALSE.
#[doc(alias = "hinawa_fw_fcp_bind")]
- fn bind(&self, node: &impl IsA<FwNode>) -> Result<(), glib::Error>;
-
- /// Transfer command frame for FCP. When receiving response frame for FCP, `signal::FwFcp::responded`
- /// signal is emitted.
- /// ## `cmd`
- /// An array with elements for request byte data. The value of this
- /// argument should point to the array and immutable.
- /// ## `timeout_ms`
- /// The timeout to wait for response subaction of transaction for command frame.
- ///
- /// # Returns
- ///
- /// TRUE if the overall operation finishes successfully, otherwise FALSE.
- #[doc(alias = "hinawa_fw_fcp_command")]
- fn command(&self, cmd: &[u8], timeout_ms: u32) -> Result<(), glib::Error>;
-
- /// Stop to listen to FCP responses. Any pending transactions are forced to be aborted.
- #[doc(alias = "hinawa_fw_fcp_unbind")]
- fn unbind(&self);
-
- /// Whether this protocol is bound to any instance of HinawaFwNode.
- #[doc(alias = "is-bound")]
- fn is_bound(&self) -> bool;
-
- #[doc(alias = "is-bound")]
- fn connect_is_bound_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-}
-
-impl<O: IsA<FwFcp>> FwFcpExt for O {
fn bind(&self, node: &impl IsA<FwNode>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::hinawa_fw_fcp_bind(
+ let is_ok = ffi::hinawa_fw_fcp_bind(
self.as_ref().to_glib_none().0,
node.as_ref().to_glib_none().0,
&mut error,
);
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
@@ -117,17 +154,30 @@ impl<O: IsA<FwFcp>> FwFcpExt for O {
}
}
+ /// Transfer command frame for FCP. When receiving response frame for FCP, [`responded`][struct@crate::FwFcp#responded]
+ /// signal is emitted.
+ /// ## `cmd`
+ /// An array with elements for request byte data. The value of this
+ /// argument should point to the array and immutable.
+ /// ## `timeout_ms`
+ /// The timeout to wait for response subaction of transaction for command frame.
+ ///
+ /// # Returns
+ ///
+ /// TRUE if the overall operation finishes successfully, otherwise FALSE.
+ #[doc(alias = "hinawa_fw_fcp_command")]
fn command(&self, cmd: &[u8], timeout_ms: u32) -> Result<(), glib::Error> {
- let cmd_size = cmd.len() as usize;
+ let cmd_size = cmd.len() as _;
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::hinawa_fw_fcp_command(
+ let is_ok = ffi::hinawa_fw_fcp_command(
self.as_ref().to_glib_none().0,
cmd.to_glib_none().0,
cmd_size,
timeout_ms,
&mut error,
);
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
@@ -136,16 +186,21 @@ impl<O: IsA<FwFcp>> FwFcpExt for O {
}
}
+ /// Stop to listen to FCP responses. Any pending transactions are forced to be aborted.
+ #[doc(alias = "hinawa_fw_fcp_unbind")]
fn unbind(&self) {
unsafe {
ffi::hinawa_fw_fcp_unbind(self.as_ref().to_glib_none().0);
}
}
+ /// Whether this protocol is bound to any instance of HinawaFwNode.
+ #[doc(alias = "is-bound")]
fn is_bound(&self) -> bool {
- glib::ObjectExt::property(self.as_ref(), "is-bound")
+ ObjectExt::property(self.as_ref(), "is-bound")
}
+ #[doc(alias = "is-bound")]
fn connect_is_bound_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_is_bound_trampoline<P: IsA<FwFcp>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwFcp,
@@ -169,6 +224,8 @@ impl<O: IsA<FwFcp>> FwFcpExt for O {
}
}
+impl<O: IsA<FwFcp>> FwFcpExt for O {}
+
impl fmt::Display for FwFcp {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("FwFcp")
diff --git a/hinawa/src/auto/fw_node.rs b/hinawa/src/auto/fw_node.rs
index ce33b05..936f226 100644
--- a/hinawa/src/auto/fw_node.rs
+++ b/hinawa/src/auto/fw_node.rs
@@ -3,15 +3,12 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
-use glib::object::Cast;
-use glib::object::IsA;
-use glib::signal::connect_raw;
-use glib::signal::SignalHandlerId;
-use glib::translate::*;
-use std::boxed::Box as Box_;
-use std::fmt;
-use std::mem::transmute;
-use std::ptr;
+use glib::{
+ prelude::*,
+ signal::{connect_raw, SignalHandlerId},
+ translate::*,
+};
+use std::{boxed::Box as Box_, fmt, mem::transmute, ptr};
glib::wrapper! {
/// An event listener for node in IEEE 1394 bus.
@@ -19,6 +16,70 @@ glib::wrapper! {
/// [`FwNode`][crate::FwNode] listens to any events for an associated node in IEEE 1394 bus. Additionally,
/// it provides some methods to retrieve fundamental information about the bus.
///
+ /// ## Properties
+ ///
+ ///
+ /// #### `bus-manager-node-id`
+ /// Node ID of node which plays role of bus manager at current generation of bus topology.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `card-id`
+ /// The numeric index for 1394 OHCI hardware used for the communication with the node. The
+ /// value is stable against bus generation.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `generation`
+ /// Current generation of bus topology.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `ir-manager-node-id`
+ /// Node ID of node which plays role of isochronous resource manager at current generation
+ /// of bus topology.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `local-node-id`
+ /// Node ID of node which application uses to communicate to node associated to instance of
+ /// object at current generation of bus topology. In general, it is for 1394 OHCI hardware.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `node-id`
+ /// Node ID of node associated to instance of object at current generation of bus topology.
+ /// This parameter is effective after the association.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `root-node-id`
+ /// Node ID of root node in bus topology at current generation of bus topology.
+ ///
+ /// Readable
+ ///
+ /// ## Signals
+ ///
+ ///
+ /// #### `bus-update`
+ /// Emitted when IEEE 1394 bus is updated. Handlers can read current generation in the bus
+ /// via [`generation`][struct@crate::FwNode#generation] property.
+ ///
+ ///
+ ///
+ ///
+ /// #### `disconnected`
+ /// Emitted when the node is not available anymore in Linux system. It's preferable to call
+ /// `GObject::Object::unref()` immediately to release file descriptor.
+ ///
+ ///
+ ///
/// # Implements
///
/// [`FwNodeExt`][trait@crate::prelude::FwNodeExt], [`FwNodeExtManual`][trait@crate::prelude::FwNodeExtManual]
@@ -50,12 +111,17 @@ impl Default for FwNode {
}
}
-/// Trait containing the part of [`struct@FwNode`] methods.
+mod sealed {
+ pub trait Sealed {}
+ impl<T: super::IsA<super::FwNode>> Sealed for T {}
+}
+
+/// Trait containing all [`struct@FwNode`] methods.
///
/// # Implementors
///
/// [`FwNode`][struct@crate::FwNode]
-pub trait FwNodeExt: 'static {
+pub trait FwNodeExt: IsA<FwNode> + sealed::Sealed + 'static {
/// Create [`glib::Source`][crate::glib::Source] for `GLib::MainContext` to dispatch events for the node on
/// IEEE 1394 bus.
///
@@ -66,93 +132,16 @@ pub trait FwNodeExt: 'static {
/// ## `gsrc`
/// A [`glib::Source`][crate::glib::Source].
#[doc(alias = "hinawa_fw_node_create_source")]
- fn create_source(&self) -> Result<glib::Source, glib::Error>;
-
- /// Open Linux FireWire character device to operate node in IEEE 1394 bus.
- /// ## `path`
- /// A path to Linux FireWire character device
- /// ## `open_flag`
- /// The flag of `open(2)` system call. `O_RDONLY` is fulfilled internally.
- ///
- /// # Returns
- ///
- /// TRUE if the overall operation finishes successfully, otherwise FALSE.
- #[doc(alias = "hinawa_fw_node_open")]
- fn open(&self, path: &str, open_flag: i32) -> Result<(), glib::Error>;
-
- /// Node ID of node which plays role of bus manager at current generation of bus topology.
- #[doc(alias = "bus-manager-node-id")]
- fn bus_manager_node_id(&self) -> u32;
-
- /// The numeric index for 1394 OHCI hardware used for the communication with the node. The
- /// value is stable against bus generation.
- #[doc(alias = "card-id")]
- fn card_id(&self) -> u32;
-
- /// Current generation of bus topology.
- fn generation(&self) -> u32;
-
- /// Node ID of node which plays role of isochronous resource manager at current generation
- /// of bus topology.
- #[doc(alias = "ir-manager-node-id")]
- fn ir_manager_node_id(&self) -> u32;
-
- /// Node ID of node which application uses to communicate to node associated to instance of
- /// object at current generation of bus topology. In general, it is for 1394 OHCI hardware.
- #[doc(alias = "local-node-id")]
- fn local_node_id(&self) -> u32;
-
- /// Node ID of node associated to instance of object at current generation of bus topology.
- /// This parameter is effective after the association.
- #[doc(alias = "node-id")]
- fn node_id(&self) -> u32;
-
- /// Node ID of root node in bus topology at current generation of bus topology.
- #[doc(alias = "root-node-id")]
- fn root_node_id(&self) -> u32;
-
- /// Emitted when IEEE 1394 bus is updated. Handlers can read current generation in the bus
- /// via `property::FwNode::generation` property.
- #[doc(alias = "bus-update")]
- fn connect_bus_update<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- /// Emitted when the node is not available anymore in Linux system. It's preferable to call
- /// `GObject::Object::unref()` immediately to release file descriptor.
- #[doc(alias = "disconnected")]
- fn connect_disconnected<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- #[doc(alias = "bus-manager-node-id")]
- fn connect_bus_manager_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- #[doc(alias = "card-id")]
- fn connect_card_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- #[doc(alias = "generation")]
- fn connect_generation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- #[doc(alias = "ir-manager-node-id")]
- fn connect_ir_manager_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- #[doc(alias = "local-node-id")]
- fn connect_local_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- #[doc(alias = "node-id")]
- fn connect_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- #[doc(alias = "root-node-id")]
- fn connect_root_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-}
-
-impl<O: IsA<FwNode>> FwNodeExt for O {
fn create_source(&self) -> Result<glib::Source, glib::Error> {
unsafe {
let mut gsrc = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::hinawa_fw_node_create_source(
+ let is_ok = ffi::hinawa_fw_node_create_source(
self.as_ref().to_glib_none().0,
&mut gsrc,
&mut error,
);
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(from_glib_full(gsrc))
} else {
@@ -161,15 +150,26 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ /// Open Linux FireWire character device to operate node in IEEE 1394 bus.
+ /// ## `path`
+ /// A path to Linux FireWire character device
+ /// ## `open_flag`
+ /// The flag of `open(2)` system call. `O_RDONLY` is fulfilled internally.
+ ///
+ /// # Returns
+ ///
+ /// TRUE if the overall operation finishes successfully, otherwise FALSE.
+ #[doc(alias = "hinawa_fw_node_open")]
fn open(&self, path: &str, open_flag: i32) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::hinawa_fw_node_open(
+ let is_ok = ffi::hinawa_fw_node_open(
self.as_ref().to_glib_none().0,
path.to_glib_none().0,
open_flag,
&mut error,
);
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
@@ -178,34 +178,54 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ /// Node ID of node which plays role of bus manager at current generation of bus topology.
+ #[doc(alias = "bus-manager-node-id")]
fn bus_manager_node_id(&self) -> u32 {
- glib::ObjectExt::property(self.as_ref(), "bus-manager-node-id")
+ ObjectExt::property(self.as_ref(), "bus-manager-node-id")
}
+ /// The numeric index for 1394 OHCI hardware used for the communication with the node. The
+ /// value is stable against bus generation.
+ #[doc(alias = "card-id")]
fn card_id(&self) -> u32 {
- glib::ObjectExt::property(self.as_ref(), "card-id")
+ ObjectExt::property(self.as_ref(), "card-id")
}
+ /// Current generation of bus topology.
fn generation(&self) -> u32 {
- glib::ObjectExt::property(self.as_ref(), "generation")
+ ObjectExt::property(self.as_ref(), "generation")
}
+ /// Node ID of node which plays role of isochronous resource manager at current generation
+ /// of bus topology.
+ #[doc(alias = "ir-manager-node-id")]
fn ir_manager_node_id(&self) -> u32 {
- glib::ObjectExt::property(self.as_ref(), "ir-manager-node-id")
+ ObjectExt::property(self.as_ref(), "ir-manager-node-id")
}
+ /// Node ID of node which application uses to communicate to node associated to instance of
+ /// object at current generation of bus topology. In general, it is for 1394 OHCI hardware.
+ #[doc(alias = "local-node-id")]
fn local_node_id(&self) -> u32 {
- glib::ObjectExt::property(self.as_ref(), "local-node-id")
+ ObjectExt::property(self.as_ref(), "local-node-id")
}
+ /// Node ID of node associated to instance of object at current generation of bus topology.
+ /// This parameter is effective after the association.
+ #[doc(alias = "node-id")]
fn node_id(&self) -> u32 {
- glib::ObjectExt::property(self.as_ref(), "node-id")
+ ObjectExt::property(self.as_ref(), "node-id")
}
+ /// Node ID of root node in bus topology at current generation of bus topology.
+ #[doc(alias = "root-node-id")]
fn root_node_id(&self) -> u32 {
- glib::ObjectExt::property(self.as_ref(), "root-node-id")
+ ObjectExt::property(self.as_ref(), "root-node-id")
}
+ /// Emitted when IEEE 1394 bus is updated. Handlers can read current generation in the bus
+ /// via [`generation`][struct@crate::FwNode#generation] property.
+ #[doc(alias = "bus-update")]
fn connect_bus_update<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn bus_update_trampoline<P: IsA<FwNode>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwNode,
@@ -227,6 +247,9 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ /// Emitted when the node is not available anymore in Linux system. It's preferable to call
+ /// `GObject::Object::unref()` immediately to release file descriptor.
+ #[doc(alias = "disconnected")]
fn connect_disconnected<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn disconnected_trampoline<P: IsA<FwNode>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwNode,
@@ -248,6 +271,7 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ #[doc(alias = "bus-manager-node-id")]
fn connect_bus_manager_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_bus_manager_node_id_trampoline<
P: IsA<FwNode>,
@@ -273,6 +297,7 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ #[doc(alias = "card-id")]
fn connect_card_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_card_id_trampoline<P: IsA<FwNode>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwNode,
@@ -295,6 +320,7 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ #[doc(alias = "generation")]
fn connect_generation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_generation_trampoline<P: IsA<FwNode>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwNode,
@@ -317,6 +343,7 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ #[doc(alias = "ir-manager-node-id")]
fn connect_ir_manager_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_ir_manager_node_id_trampoline<
P: IsA<FwNode>,
@@ -342,6 +369,7 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ #[doc(alias = "local-node-id")]
fn connect_local_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_local_node_id_trampoline<
P: IsA<FwNode>,
@@ -367,6 +395,7 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ #[doc(alias = "node-id")]
fn connect_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_node_id_trampoline<P: IsA<FwNode>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwNode,
@@ -389,6 +418,7 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+ #[doc(alias = "root-node-id")]
fn connect_root_node_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_root_node_id_trampoline<P: IsA<FwNode>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwNode,
@@ -412,6 +442,8 @@ impl<O: IsA<FwNode>> FwNodeExt for O {
}
}
+impl<O: IsA<FwNode>> FwNodeExt for O {}
+
impl fmt::Display for FwNode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("FwNode")
diff --git a/hinawa/src/auto/fw_req.rs b/hinawa/src/auto/fw_req.rs
index b8b07ec..cc3745c 100644
--- a/hinawa/src/auto/fw_req.rs
+++ b/hinawa/src/auto/fw_req.rs
@@ -11,6 +11,23 @@ glib::wrapper! {
///
/// [`FwReq`][crate::FwReq] supports all types of transactions defiend in IEEE 1212.
///
+ /// ## Signals
+ ///
+ ///
+ /// #### `responded`
+ /// Emitted when the node transfers asynchronous packet as response subaction for the
+ /// transaction and the process successfully reads the content of packet from Linux firewire
+ /// subsystem.
+ ///
+ /// The values of @request_tstamp and @response_tstamp are 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.
+ ///
+ /// If the version of kernel ABI for Linux FireWire subsystem is less than 6, the
+ /// @request_tstamp and @response_tstamp argument has invalid value (=G_MAXUINT).
+ ///
+ ///
+ ///
/// # Implements
///
/// [`FwReqExtManual`][trait@crate::prelude::FwReqExtManual]
diff --git a/hinawa/src/auto/fw_resp.rs b/hinawa/src/auto/fw_resp.rs
index 697adca..633adb8 100644
--- a/hinawa/src/auto/fw_resp.rs
+++ b/hinawa/src/auto/fw_resp.rs
@@ -4,21 +4,58 @@
// DO NOT EDIT
use crate::FwNode;
-use glib::object::Cast;
-use glib::object::IsA;
-use glib::signal::connect_raw;
-use glib::signal::SignalHandlerId;
-use glib::translate::*;
-use std::boxed::Box as Box_;
-use std::fmt;
-use std::mem::transmute;
-use std::ptr;
+use glib::{
+ prelude::*,
+ signal::{connect_raw, SignalHandlerId},
+ translate::*,
+};
+use std::{boxed::Box as Box_, fmt, mem::transmute, ptr};
glib::wrapper! {
/// A transaction responder for request subaction initiated by node in IEEE 1394 bus.
///
/// [`FwResp`][crate::FwResp] responds to request subaction initiated by node in IEEE 1394 bus.
///
+ /// ## Properties
+ ///
+ ///
+ /// #### `is-reserved`
+ /// Whether a range of address is reserved or not.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `offset`
+ /// The start offset of reserved address range.
+ ///
+ /// Readable
+ ///
+ ///
+ /// #### `width`
+ /// The width of reserved address range.
+ ///
+ /// Readable
+ ///
+ /// ## Signals
+ ///
+ ///
+ /// #### `requested`
+ /// Emitted when any node transfers request subaction to local nodes within the address
+ /// range reserved in Linux system.
+ ///
+ /// The handler is expected to call [`FwRespExt::set_resp_frame()`][crate::prelude::FwRespExt::set_resp_frame()] with frame and return
+ /// [`FwRcode`][crate::FwRcode] for response subaction.
+ ///
+ /// 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.
+ ///
+ /// If the version of kernel ABI for Linux FireWire subsystem is less than 6, the value of
+ /// tstamp argument has invalid value (=G_MAXUINT). Furthermore, if the version is less than
+ /// 4, the src, dst, card, generation arguments have invalid value (=G_MAXUINT).
+ ///
+ ///
+ ///
/// # Implements
///
/// [`FwRespExt`][trait@crate::prelude::FwRespExt], [`FwRespExtManual`][trait@crate::prelude::FwRespExtManual]
@@ -50,18 +87,27 @@ impl Default for FwResp {
}
}
-/// Trait containing the part of [`struct@FwResp`] methods.
+mod sealed {
+ pub trait Sealed {}
+ impl<T: super::IsA<super::FwResp>> Sealed for T {}
+}
+
+/// Trait containing all [`struct@FwResp`] methods.
///
/// # Implementors
///
/// [`FwFcp`][struct@crate::FwFcp], [`FwResp`][struct@crate::FwResp]
-pub trait FwRespExt: 'static {
+pub trait FwRespExt: IsA<FwResp> + sealed::Sealed + 'static {
/// Stop listening to the address range in Linux system for local nodes.
#[doc(alias = "hinawa_fw_resp_release")]
- fn release(&self);
+ fn release(&self) {
+ unsafe {
+ ffi::hinawa_fw_resp_release(self.as_ref().to_glib_none().0);
+ }
+ }
/// Allocate an address range within Linux system for local nodes, each of which expresses 1394
- /// OHCI hardware. Once successful, `signal::FwResp::requested` signal will be emitted whenever any
+ /// OHCI hardware. Once successful, [`requested`][struct@crate::FwResp#requested] signal will be emitted whenever any
/// request subactions arrive at the 1394 OHCI hardware within the dedicated range.
///
/// The range is precisely reserved at the address specified by @addr with the size indicated by
@@ -78,10 +124,27 @@ pub trait FwRespExt: 'static {
///
/// TRUE if the overall operation finishes successfully, otherwise FALSE.
#[doc(alias = "hinawa_fw_resp_reserve")]
- fn reserve(&self, node: &impl IsA<FwNode>, addr: u64, width: u32) -> Result<(), glib::Error>;
+ fn reserve(&self, node: &impl IsA<FwNode>, addr: u64, width: u32) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::hinawa_fw_resp_reserve(
+ self.as_ref().to_glib_none().0,
+ node.as_ref().to_glib_none().0,
+ addr,
+ width,
+ &mut error,
+ );
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(())
+ } else {
+ Err(from_glib_full(error))
+ }
+ }
+ }
/// Allocate an address range within Linux system for local nodes, each of which expresses 1394
- /// OHCI hardware. Once successful, `signal::FwResp::requested` signal will be emitted whenever any
+ /// OHCI hardware. Once successful, [`requested`][struct@crate::FwResp#requested] signal will be emitted whenever any
/// request subactions arrive at the 1394 OHCI hardware within the dedicated range.
///
/// The range is reserved between the values specified by @region_start and @region_end with the size
@@ -105,69 +168,10 @@ pub trait FwRespExt: 'static {
region_start: u64,
region_end: u64,
width: u32,
- ) -> Result<(), glib::Error>;
-
- /// Register byte frame for the response subaction of transaction.
- /// ## `frame`
- /// a 8 bit array for response frame.
- #[doc(alias = "hinawa_fw_resp_set_resp_frame")]
- fn set_resp_frame(&self, frame: &[u8]);
-
- /// Whether a range of address is reserved or not.
- #[doc(alias = "is-reserved")]
- fn is_reserved(&self) -> bool;
-
- /// The start offset of reserved address range.
- fn offset(&self) -> u64;
-
- /// The width of reserved address range.
- fn width(&self) -> u32;
-
- #[doc(alias = "is-reserved")]
- fn connect_is_reserved_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- #[doc(alias = "offset")]
- fn connect_offset_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-
- #[doc(alias = "width")]
- fn connect_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
-}
-
-impl<O: IsA<FwResp>> FwRespExt for O {
- fn release(&self) {
- unsafe {
- ffi::hinawa_fw_resp_release(self.as_ref().to_glib_none().0);
- }
- }
-
- fn reserve(&self, node: &impl IsA<FwNode>, addr: u64, width: u32) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::hinawa_fw_resp_reserve(
- self.as_ref().to_glib_none().0,
- node.as_ref().to_glib_none().0,
- addr,
- width,
- &mut error,
- );
- if error.is_null() {
- Ok(())
- } else {
- Err(from_glib_full(error))
- }
- }
- }
-
- fn reserve_within_region(
- &self,
- node: &impl IsA<FwNode>,
- region_start: u64,
- region_end: u64,
- width: u32,
) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::hinawa_fw_resp_reserve_within_region(
+ let is_ok = ffi::hinawa_fw_resp_reserve_within_region(
self.as_ref().to_glib_none().0,
node.as_ref().to_glib_none().0,
region_start,
@@ -175,6 +179,7 @@ impl<O: IsA<FwResp>> FwRespExt for O {
width,
&mut error,
);
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
@@ -183,8 +188,12 @@ impl<O: IsA<FwResp>> FwRespExt for O {
}
}
+ /// Register byte frame for the response subaction of transaction.
+ /// ## `frame`
+ /// a 8 bit array for response frame.
+ #[doc(alias = "hinawa_fw_resp_set_resp_frame")]
fn set_resp_frame(&self, frame: &[u8]) {
- let length = frame.len() as usize;
+ let length = frame.len() as _;
unsafe {
ffi::hinawa_fw_resp_set_resp_frame(
self.as_ref().to_glib_none().0,
@@ -194,18 +203,23 @@ impl<O: IsA<FwResp>> FwRespExt for O {
}
}
+ /// Whether a range of address is reserved or not.
+ #[doc(alias = "is-reserved")]
fn is_reserved(&self) -> bool {
- glib::ObjectExt::property(self.as_ref(), "is-reserved")
+ ObjectExt::property(self.as_ref(), "is-reserved")
}
+ /// The start offset of reserved address range.
fn offset(&self) -> u64 {
- glib::ObjectExt::property(self.as_ref(), "offset")
+ ObjectExt::property(self.as_ref(), "offset")
}
+ /// The width of reserved address range.
fn width(&self) -> u32 {
- glib::ObjectExt::property(self.as_ref(), "width")
+ ObjectExt::property(self.as_ref(), "width")
}
+ #[doc(alias = "is-reserved")]
fn connect_is_reserved_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_is_reserved_trampoline<P: IsA<FwResp>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwResp,
@@ -228,6 +242,7 @@ impl<O: IsA<FwResp>> FwRespExt for O {
}
}
+ #[doc(alias = "offset")]
fn connect_offset_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_offset_trampoline<P: IsA<FwResp>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwResp,
@@ -250,6 +265,7 @@ impl<O: IsA<FwResp>> FwRespExt for O {
}
}
+ #[doc(alias = "width")]
fn connect_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_width_trampoline<P: IsA<FwResp>, F: Fn(&P) + 'static>(
this: *mut ffi::HinawaFwResp,
@@ -273,6 +289,8 @@ impl<O: IsA<FwResp>> FwRespExt for O {
}
}
+impl<O: IsA<FwResp>> FwRespExt for O {}
+
impl fmt::Display for FwResp {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("FwResp")
diff --git a/hinawa/src/auto/versions.txt b/hinawa/src/auto/versions.txt
index 4bb7a0b..369e893 100644
--- a/hinawa/src/auto/versions.txt
+++ b/hinawa/src/auto/versions.txt
@@ -1,3 +1,3 @@
-Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
+Generated by gir (https://github.com/gtk-rs/gir @ 23d7c100187c)
from
-from gir-files (https://github.com/gtk-rs/gir-files @ faebfb303ca6)
+from gir-files (https://github.com/gtk-rs/gir-files @ 6415239ef435)
diff --git a/hinawa/src/fw_fcp.rs b/hinawa/src/fw_fcp.rs
index a178689..486540b 100644
--- a/hinawa/src/fw_fcp.rs
+++ b/hinawa/src/fw_fcp.rs
@@ -7,7 +7,7 @@ use crate::*;
///
/// [`FwFcp`][struct@crate::FwFcp]
pub trait FwFcpExtManual {
- /// Transfer command frame for FCP. When receiving response frame for FCP, `signal::FwFcp::responded`
+ /// Transfer command frame for FCP. When receiving response frame for FCP, [`responded`][struct@crate::FwFcp#responded]
/// signal is emitted.
///
/// Each value of @tstamp is unsigned 16 bit integer including higher 3 bits for three low order bits
@@ -23,6 +23,8 @@ pub trait FwFcpExtManual {
///
/// # Returns
///
+ /// TRUE if the overall operation finishes successfully, otherwise FALSE.
+ ///
/// ## `tstamp`
/// The array with two elements for time stamps.
/// The first element is for the isochronous cycle at which the request arrived. The second
@@ -48,6 +50,10 @@ pub trait FwFcpExtManual {
/// the pointer to the array and immutable. The content of array is mutable.
/// ## `timeout_ms`
/// The timeout to wait for response transaction since command transactions finishes.
+ ///
+ /// # Returns
+ ///
+ /// TRUE if the overall operation finishes successfully, otherwise FALSE.
#[doc(alias = "hinawa_fw_fcp_avc_transaction")]
fn avc_transaction(
&self,
@@ -73,6 +79,8 @@ pub trait FwFcpExtManual {
///
/// # Returns
///
+ /// TRUE if the overall operation finishes successfully, otherwise FALSE.
+ ///
/// ## `tstamp`
/// The array with three elements for time
/// stamps. The first element is for the isochronous cycle at which the request was sent
@@ -120,7 +128,7 @@ impl<O: IsA<FwFcp>> FwFcpExtManual for O {
let mut tstamp = [0; 2];
let mut error = std::ptr::null_mut();
- let _ = ffi::hinawa_fw_fcp_command_with_tstamp(
+ let is_ok = ffi::hinawa_fw_fcp_command_with_tstamp(
self.as_ref().to_glib_none().0,
cmd_frame.as_ptr(),
cmd_frame.len(),
@@ -128,7 +136,7 @@ impl<O: IsA<FwFcp>> FwFcpExtManual for O {
timeout_ms,
&mut error,
);
-
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(tstamp)
} else {
@@ -147,7 +155,7 @@ impl<O: IsA<FwFcp>> FwFcpExtManual for O {
let mut resp_frame_size = resp_frame.len();
let mut error = std::ptr::null_mut();
- ffi::hinawa_fw_fcp_avc_transaction(
+ let is_ok = ffi::hinawa_fw_fcp_avc_transaction(
self.as_ref().to_glib_none().0,
cmd_frame.as_ptr(),
cmd_frame.len(),
@@ -156,7 +164,7 @@ impl<O: IsA<FwFcp>> FwFcpExtManual for O {
timeout_ms,
&mut error,
);
-
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
resp_frame.truncate(resp_frame_size);
Ok(())
@@ -177,7 +185,7 @@ impl<O: IsA<FwFcp>> FwFcpExtManual for O {
let mut tstamp = [0; 3];
let mut error = std::ptr::null_mut();
- let _ = ffi::hinawa_fw_fcp_avc_transaction_with_tstamp(
+ let is_ok = ffi::hinawa_fw_fcp_avc_transaction_with_tstamp(
self.as_ref().to_glib_none().0,
cmd_frame.as_ptr(),
cmd_frame.len(),
@@ -187,7 +195,7 @@ impl<O: IsA<FwFcp>> FwFcpExtManual for O {
timeout_ms,
&mut error,
);
-
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
resp_frame.truncate(resp_frame_size);
Ok(tstamp)
diff --git a/hinawa/src/fw_node.rs b/hinawa/src/fw_node.rs
index 4e2d6bf..e3721e5 100644
--- a/hinawa/src/fw_node.rs
+++ b/hinawa/src/fw_node.rs
@@ -11,10 +11,11 @@ pub trait FwNodeExtManual {
///
/// # Returns
///
+ /// TRUE if the overall operation finishes successfully, otherwise FALSE.
+ ///
/// ## `image`
/// The content of configuration ROM.
#[doc(alias = "hinawa_fw_node_get_config_rom")]
- #[doc(alias = "get_config_rom")]
fn config_rom(&self) -> Result<&[u8], glib::Error>;
/// Read current value of CYCLE_TIME register in 1394 OHCI hardware dedicated to communicate with
@@ -24,6 +25,10 @@ pub trait FwNodeExtManual {
/// CLOCK_MONOTONIC(1), and CLOCK_MONOTONIC_RAW(4) is available in UAPI of Linux kernel.
/// ## `cycle_time`
/// A [`CycleTime`][crate::CycleTime].
+ ///
+ /// # Returns
+ ///
+ /// TRUE if the overall operation finishes successfully, otherwise FALSE.
#[doc(alias = "hinawa_fw_node_read_cycle_time")]
fn read_cycle_time(&self, clock_id: i32, cycle_time: &mut CycleTime)
-> Result<(), glib::Error>;
@@ -36,13 +41,13 @@ impl<O: IsA<FwNode>> FwNodeExtManual for O {
let mut len = 0 as usize;
let mut error = std::ptr::null_mut();
- ffi::hinawa_fw_node_get_config_rom(
+ let is_ok = ffi::hinawa_fw_node_get_config_rom(
self.as_ref().to_glib_none().0,
&mut ptr,
&mut len,
&mut error,
);
-
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(std::slice::from_raw_parts(ptr, len))
} else {
@@ -59,13 +64,13 @@ impl<O: IsA<FwNode>> FwNodeExtManual for O {
unsafe {
let mut error = std::ptr::null_mut();
- let _ = ffi::hinawa_fw_node_read_cycle_time(
+ let is_ok = ffi::hinawa_fw_node_read_cycle_time(
self.as_ref().to_glib_none().0,
clock_id,
&mut cycle_time.to_glib_none_mut().0,
&mut error,
);
-
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
diff --git a/hinawa/src/fw_req.rs b/hinawa/src/fw_req.rs
index 9e6404d..fe611c5 100644
--- a/hinawa/src/fw_req.rs
+++ b/hinawa/src/fw_req.rs
@@ -9,7 +9,7 @@ use crate::*;
pub trait FwReqExtManual {
/// Execute request subaction of transaction to the given node according to given code. When the
/// response subaction arrives and running event dispatcher reads the contents,
- /// `signal::FwReq::responded` signal handler is called.
+ /// [`responded`][struct@crate::FwReq#responded] signal handler is called.
/// ## `node`
/// A [`FwNode`][crate::FwNode].
/// ## `tcode`
@@ -62,6 +62,8 @@ pub trait FwReqExtManual {
///
/// # Returns
///
+ /// TRUE if the overall operation finishes successfully, otherwise FALSE.
+ ///
/// ## `tstamp`
/// The array with two elements for time stamps.
/// The first element is for the isochronous cycle at which the request subaction was sent.
@@ -97,6 +99,10 @@ pub trait FwReqExtManual {
/// ## `timeout_ms`
/// The timeout to wait for response subaction of the transaction since request
/// subaction is initiated, in milliseconds.
+ ///
+ /// # Returns
+ ///
+ /// TRUE if the overall operation finishes successfully, otherwise FALSE.
#[doc(alias = "hinawa_fw_req_transaction")]
fn transaction<P: IsA<FwNode>>(
&self,
@@ -108,8 +114,7 @@ pub trait FwReqExtManual {
timeout_ms: u32,
) -> Result<(), glib::Error>;
-
- /// Emitted when the unit transfers asynchronous packet as response subaction for the
+ /// Emitted when the node transfers asynchronous packet as response subaction for the
/// transaction and the process successfully reads the content of packet from Linux firewire
/// subsystem.
///
@@ -147,7 +152,7 @@ impl<O: IsA<FwReq>> FwReqExtManual for O {
let mut frame_size = frame.len();
let mut error = std::ptr::null_mut();
- let _ = ffi::hinawa_fw_req_request(
+ let is_ok = ffi::hinawa_fw_req_request(
self.as_ref().to_glib_none().0,
node.as_ref().to_glib_none().0,
tcode.into_glib(),
@@ -157,7 +162,7 @@ impl<O: IsA<FwReq>> FwReqExtManual for O {
&mut frame_size,
&mut error,
);
-
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
@@ -180,7 +185,7 @@ impl<O: IsA<FwReq>> FwReqExtManual for O {
let mut tstamp = [0; 2];
let mut error = std::ptr::null_mut();
- let _ = ffi::hinawa_fw_req_transaction_with_tstamp(
+ let is_ok = ffi::hinawa_fw_req_transaction_with_tstamp(
self.as_ref().to_glib_none().0,
node.as_ref().to_glib_none().0,
tcode.into_glib(),
@@ -192,7 +197,7 @@ impl<O: IsA<FwReq>> FwReqExtManual for O {
timeout_ms,
&mut error,
);
-
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(tstamp)
} else {
@@ -214,7 +219,7 @@ impl<O: IsA<FwReq>> FwReqExtManual for O {
let mut frame_size = frame.len();
let mut error = std::ptr::null_mut();
- let _ = ffi::hinawa_fw_req_transaction(
+ let is_ok = ffi::hinawa_fw_req_transaction(
self.as_ref().to_glib_none().0,
node.as_ref().to_glib_none().0,
tcode.into_glib(),
@@ -225,7 +230,7 @@ impl<O: IsA<FwReq>> FwReqExtManual for O {
timeout_ms,
&mut error,
);
-
+ debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
diff --git a/hinawa/src/subclass/fw_fcp.rs b/hinawa/src/subclass/fw_fcp.rs
index 272007a..5b446e0 100644
--- a/hinawa/src/subclass/fw_fcp.rs
+++ b/hinawa/src/subclass/fw_fcp.rs
@@ -4,6 +4,15 @@ use super::*;
/// Trait which should be implemented by subclass of [`FwFcp`][crate::FwFcp].
pub trait FwFcpImpl: ObjectImpl + FwRespImpl {
+ /// Class closure for the [`responded`][struct@crate::FwFcp#responded] signal.
+ /// ## `generation`
+ /// The generation of bus topology.
+ /// ## `tstamp`
+ /// The time stamp at which the request subaction arrived for the response of FCP
+ /// transaction.
+ /// ## `frame`
+ /// The array with elements for byte
+ /// data in the response of Function Control Protocol.
fn responded(&self, fcp: &Self::Type, generation: u32, tstamp: u32, frame: &[u8]) {
self.parent_responded(fcp, generation, tstamp, frame)
}
diff --git a/hinawa/src/subclass/fw_node.rs b/hinawa/src/subclass/fw_node.rs
index aa402b0..ea7a52c 100644
--- a/hinawa/src/subclass/fw_node.rs
+++ b/hinawa/src/subclass/fw_node.rs
@@ -4,10 +4,12 @@ use super::*;
/// Trait which should be implemented by subclass of [`FwNode`][crate::FwNode].
pub trait FwNodeImpl: ObjectImpl {
+ /// Class closure for the [`bus-update`][struct@crate::FwNode#bus-update].
fn bus_update(&self, node: &Self::Type) {
self.parent_bus_update(node)
}
+ /// Class closure for the [`disconnected`][struct@crate::FwNode#disconnected].
fn disconnected(&self, node: &Self::Type) {
self.parent_disconnected(node)
}
diff --git a/hinawa/src/subclass/fw_req.rs b/hinawa/src/subclass/fw_req.rs
index 7dc77ea..c57d9f6 100644
--- a/hinawa/src/subclass/fw_req.rs
+++ b/hinawa/src/subclass/fw_req.rs
@@ -4,6 +4,18 @@ use super::*;
/// Trait which should be implemented by subclass of [`FwReq`][crate::FwReq].
pub trait FwReqImpl: ObjectImpl {
+ /// Class closure for the [`responded`][struct@crate::FwReq#responded] signal.
+ /// ## `rcode`
+ /// One of [`FwRcode`][crate::FwRcode].
+ /// ## `request_tstamp`
+ /// The isochronous cycle at which the request subaction was sent for the
+ /// transaction.
+ /// ## `response_tstamp`
+ /// The isochronous cycle at which the response subaction arrived for the
+ /// transaction.
+ /// ## `frame`
+ /// The array with elements for byte
+ /// data of the response subaction of transaction.
fn responded(
&self,
req: &Self::Type,
diff --git a/hinawa/src/subclass/fw_resp.rs b/hinawa/src/subclass/fw_resp.rs
index 36f77e0..9360518 100644
--- a/hinawa/src/subclass/fw_resp.rs
+++ b/hinawa/src/subclass/fw_resp.rs
@@ -4,6 +4,30 @@ use super::*;
/// Trait which should be implemented by subclass of [`FwResp`][crate::FwResp].
pub trait FwRespImpl: ObjectImpl {
+ /// Class closure for the [`requested`][struct@crate::FwResp#requested] signal.
+ /// ## `tcode`
+ /// One of [`FwTcode`][crate::FwTcode] enumerations
+ /// ## `offset`
+ /// The address offset at which the transaction arrives.
+ /// ## `src_node_id`
+ /// The node ID of source for the transaction.
+ /// ## `dst_node_id`
+ /// The node ID of destination for the transaction.
+ /// ## `card_id`
+ /// The index of card specific to 1394 OHCI hardware at which the request
+ /// subaction arrived.
+ /// ## `generation`
+ /// The generation of bus when the transaction is transferred.
+ /// ## `tstamp`
+ /// The time stamp at which the request arrived.
+ /// ## `frame`
+ /// The array with elements for byte
+ /// data.
+ ///
+ /// # Returns
+ ///
+ /// One of [`FwRcode`][crate::FwRcode] enumerations corresponding to rcodes defined in IEEE 1394
+ /// specification.
fn requested(
&self,
resp: &Self::Type,