// 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::translate::*;

glib::wrapper! {
    /// A transaction executor to a node in IEEE 1394 bus.
    ///
    /// [`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]
    #[doc(alias = "HinawaFwReq")]
    pub struct FwReq(Object<ffi::HinawaFwReq, ffi::HinawaFwReqClass>);

    match fn {
        type_ => || ffi::hinawa_fw_req_get_type(),
    }
}

impl FwReq {
    pub const NONE: Option<&'static FwReq> = None;

    /// Instantiate [`FwReq`][crate::FwReq] object and return the instance.
    ///
    /// # Returns
    ///
    /// an instance of [`FwReq`][crate::FwReq].
    #[doc(alias = "hinawa_fw_req_new")]
    pub fn new() -> FwReq {
        unsafe { from_glib_full(ffi::hinawa_fw_req_new()) }
    }
}

impl Default for FwReq {
    fn default() -> Self {
        Self::new()
    }
}
