gi-wireplumber-0.5.14: GI/Wp/Objects/Link.hs
{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}
-- | Copyright : Will Thompson and Iñaki García Etxebarria
-- License : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
--
-- The WpLink class allows accessing the properties and methods of a PipeWire link object (struct pw_link).
-- A WpLink is constructed internally when a new link appears on the PipeWire registry and it is made available through the WpObjectManager API. Alternatively, a WpLink can also be constructed using 'GI.Wp.Objects.Link.linkNewFromFactory', which creates a new link object on the remote PipeWire server by calling into a factory.
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Wp.Objects.Link
(
-- * Exported types
Link(..) ,
IsLink ,
toLink ,
-- * Methods
-- |
--
-- === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [abortActivation]("GI.Wp.Objects.Object#g:method:abortActivation"), [activate]("GI.Wp.Objects.Object#g:method:activate"), [activateClosure]("GI.Wp.Objects.Object#g:method:activateClosure"), [activateFinish]("GI.Wp.Objects.Object#g:method:activateFinish"), [bind]("GI.Wp.Objects.GlobalProxy#g:method:bind"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [deactivate]("GI.Wp.Objects.Object#g:method:deactivate"), [enumParams]("GI.Wp.Interfaces.PipewireObject#g:method:enumParams"), [enumParamsFinish]("GI.Wp.Interfaces.PipewireObject#g:method:enumParamsFinish"), [enumParamsSync]("GI.Wp.Interfaces.PipewireObject#g:method:enumParamsSync"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [newPropertiesIterator]("GI.Wp.Interfaces.PipewireObject#g:method:newPropertiesIterator"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [requestDestroy]("GI.Wp.Objects.GlobalProxy#g:method:requestDestroy"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [testActiveFeatures]("GI.Wp.Objects.Object#g:method:testActiveFeatures"), [testSupportedFeatures]("GI.Wp.Objects.Object#g:method:testSupportedFeatures"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [updateFeatures]("GI.Wp.Objects.Object#g:method:updateFeatures"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
--
-- ==== Getters
-- [getActiveFeatures]("GI.Wp.Objects.Object#g:method:getActiveFeatures"), [getBoundId]("GI.Wp.Objects.Proxy#g:method:getBoundId"), [getCore]("GI.Wp.Objects.Object#g:method:getCore"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getGlobalProperties]("GI.Wp.Objects.GlobalProxy#g:method:getGlobalProperties"), [getId]("GI.Wp.Objects.Object#g:method:getId"), [getInterfaceType]("GI.Wp.Objects.Proxy#g:method:getInterfaceType"), [getLinkedObjectIds]("GI.Wp.Objects.Link#g:method:getLinkedObjectIds"), [getNativeInfo]("GI.Wp.Interfaces.PipewireObject#g:method:getNativeInfo"), [getParamInfo]("GI.Wp.Interfaces.PipewireObject#g:method:getParamInfo"), [getPermissions]("GI.Wp.Objects.GlobalProxy#g:method:getPermissions"), [getProperties]("GI.Wp.Interfaces.PipewireObject#g:method:getProperties"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getPwProxy]("GI.Wp.Objects.Proxy#g:method:getPwProxy"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getState]("GI.Wp.Objects.Link#g:method:getState"), [getSupportedFeatures]("GI.Wp.Objects.Object#g:method:getSupportedFeatures").
--
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setParam]("GI.Wp.Interfaces.PipewireObject#g:method:setParam"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setPwProxy]("GI.Wp.Objects.Proxy#g:method:setPwProxy").
#if defined(ENABLE_OVERLOADING)
ResolveLinkMethod ,
#endif
-- ** getLinkedObjectIds #method:getLinkedObjectIds#
#if defined(ENABLE_OVERLOADING)
LinkGetLinkedObjectIdsMethodInfo ,
#endif
linkGetLinkedObjectIds ,
-- ** getState #method:getState#
#if defined(ENABLE_OVERLOADING)
LinkGetStateMethodInfo ,
#endif
linkGetState ,
-- ** newFromFactory #method:newFromFactory#
linkNewFromFactory ,
-- * Properties
-- ** state #attr:state#
-- | /No description available in the introspection data./
#if defined(ENABLE_OVERLOADING)
LinkStatePropertyInfo ,
#endif
getLinkState ,
#if defined(ENABLE_OVERLOADING)
linkState ,
#endif
-- * Signals
-- ** stateChanged #signal:stateChanged#
LinkStateChangedCallback ,
#if defined(ENABLE_OVERLOADING)
LinkStateChangedSignalInfo ,
#endif
afterLinkStateChanged ,
onLinkStateChanged ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Wp.Callbacks as Wp.Callbacks
import {-# SOURCE #-} qualified GI.Wp.Enums as Wp.Enums
import {-# SOURCE #-} qualified GI.Wp.Flags as Wp.Flags
import {-# SOURCE #-} qualified GI.Wp.Interfaces.PipewireObject as Wp.PipewireObject
import {-# SOURCE #-} qualified GI.Wp.Objects.Conf as Wp.Conf
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.GlobalProxy as Wp.GlobalProxy
import {-# SOURCE #-} qualified GI.Wp.Objects.Object as Wp.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.ObjectManager as Wp.ObjectManager
import {-# SOURCE #-} qualified GI.Wp.Objects.Proxy as Wp.Proxy
import {-# SOURCE #-} qualified GI.Wp.Objects.SpaType as Wp.SpaType
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.IteratorMethods as Wp.IteratorMethods
import {-# SOURCE #-} qualified GI.Wp.Structs.ObjectInterest as Wp.ObjectInterest
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaPod as Wp.SpaPod
#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Wp.Enums as Wp.Enums
import {-# SOURCE #-} qualified GI.Wp.Interfaces.PipewireObject as Wp.PipewireObject
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.GlobalProxy as Wp.GlobalProxy
import {-# SOURCE #-} qualified GI.Wp.Objects.Object as Wp.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.Proxy as Wp.Proxy
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties
#endif
-- | Memory-managed wrapper type.
newtype Link = Link (SP.ManagedPtr Link)
deriving (Eq)
instance SP.ManagedPtrNewtype Link where
toManagedPtr (Link p) = p
foreign import ccall "wp_link_get_type"
c_wp_link_get_type :: IO B.Types.GType
instance B.Types.TypedObject Link where
glibType = c_wp_link_get_type
instance B.Types.GObject Link
-- | Type class for types which can be safely cast to t'Link', for instance with `toLink`.
class (SP.GObject o, O.IsDescendantOf Link o) => IsLink o
instance (SP.GObject o, O.IsDescendantOf Link o) => IsLink o
instance O.HasParentTypes Link
type instance O.ParentTypes Link = '[Wp.GlobalProxy.GlobalProxy, Wp.Proxy.Proxy, Wp.Object.Object, GObject.Object.Object, Wp.PipewireObject.PipewireObject]
-- | Cast to t'Link', for types for which this is known to be safe. For general casts, use 'Data.GI.Base.ManagedPtr.castTo'.
toLink :: (MIO.MonadIO m, IsLink o) => o -> m Link
toLink = MIO.liftIO . B.ManagedPtr.unsafeCastTo Link
-- | Convert t'Link' to and from t'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Link) where
gvalueGType_ = c_wp_link_get_type
gvalueSet_ gv P.Nothing = B.GValue.set_object gv (FP.nullPtr :: FP.Ptr Link)
gvalueSet_ gv (P.Just obj) = B.ManagedPtr.withManagedPtr obj (B.GValue.set_object gv)
gvalueGet_ gv = do
ptr <- B.GValue.get_object gv :: IO (FP.Ptr Link)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject Link ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveLinkMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveLinkMethod "abortActivation" o = Wp.Object.ObjectAbortActivationMethodInfo
ResolveLinkMethod "activate" o = Wp.Object.ObjectActivateMethodInfo
ResolveLinkMethod "activateClosure" o = Wp.Object.ObjectActivateClosureMethodInfo
ResolveLinkMethod "activateFinish" o = Wp.Object.ObjectActivateFinishMethodInfo
ResolveLinkMethod "bind" o = Wp.GlobalProxy.GlobalProxyBindMethodInfo
ResolveLinkMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveLinkMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveLinkMethod "deactivate" o = Wp.Object.ObjectDeactivateMethodInfo
ResolveLinkMethod "enumParams" o = Wp.PipewireObject.PipewireObjectEnumParamsMethodInfo
ResolveLinkMethod "enumParamsFinish" o = Wp.PipewireObject.PipewireObjectEnumParamsFinishMethodInfo
ResolveLinkMethod "enumParamsSync" o = Wp.PipewireObject.PipewireObjectEnumParamsSyncMethodInfo
ResolveLinkMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveLinkMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveLinkMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveLinkMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveLinkMethod "newPropertiesIterator" o = Wp.PipewireObject.PipewireObjectNewPropertiesIteratorMethodInfo
ResolveLinkMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveLinkMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveLinkMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveLinkMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveLinkMethod "requestDestroy" o = Wp.GlobalProxy.GlobalProxyRequestDestroyMethodInfo
ResolveLinkMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveLinkMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveLinkMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveLinkMethod "testActiveFeatures" o = Wp.Object.ObjectTestActiveFeaturesMethodInfo
ResolveLinkMethod "testSupportedFeatures" o = Wp.Object.ObjectTestSupportedFeaturesMethodInfo
ResolveLinkMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveLinkMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveLinkMethod "updateFeatures" o = Wp.Object.ObjectUpdateFeaturesMethodInfo
ResolveLinkMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveLinkMethod "getActiveFeatures" o = Wp.Object.ObjectGetActiveFeaturesMethodInfo
ResolveLinkMethod "getBoundId" o = Wp.Proxy.ProxyGetBoundIdMethodInfo
ResolveLinkMethod "getCore" o = Wp.Object.ObjectGetCoreMethodInfo
ResolveLinkMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveLinkMethod "getGlobalProperties" o = Wp.GlobalProxy.GlobalProxyGetGlobalPropertiesMethodInfo
ResolveLinkMethod "getId" o = Wp.Object.ObjectGetIdMethodInfo
ResolveLinkMethod "getInterfaceType" o = Wp.Proxy.ProxyGetInterfaceTypeMethodInfo
ResolveLinkMethod "getLinkedObjectIds" o = LinkGetLinkedObjectIdsMethodInfo
ResolveLinkMethod "getNativeInfo" o = Wp.PipewireObject.PipewireObjectGetNativeInfoMethodInfo
ResolveLinkMethod "getParamInfo" o = Wp.PipewireObject.PipewireObjectGetParamInfoMethodInfo
ResolveLinkMethod "getPermissions" o = Wp.GlobalProxy.GlobalProxyGetPermissionsMethodInfo
ResolveLinkMethod "getProperties" o = Wp.PipewireObject.PipewireObjectGetPropertiesMethodInfo
ResolveLinkMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveLinkMethod "getPwProxy" o = Wp.Proxy.ProxyGetPwProxyMethodInfo
ResolveLinkMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveLinkMethod "getState" o = LinkGetStateMethodInfo
ResolveLinkMethod "getSupportedFeatures" o = Wp.Object.ObjectGetSupportedFeaturesMethodInfo
ResolveLinkMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveLinkMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveLinkMethod "setParam" o = Wp.PipewireObject.PipewireObjectSetParamMethodInfo
ResolveLinkMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveLinkMethod "setPwProxy" o = Wp.Proxy.ProxySetPwProxyMethodInfo
ResolveLinkMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveLinkMethod t Link, O.OverloadedMethod info Link p) => OL.IsLabel t (Link -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveLinkMethod t Link, O.OverloadedMethod info Link p, R.HasField t Link p) => R.HasField t Link p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveLinkMethod t Link, O.OverloadedMethodInfo info Link) => OL.IsLabel t (O.MethodProxy info Link) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
-- signal Link::state-changed
-- | /No description available in the introspection data./
type LinkStateChangedCallback =
Wp.Enums.LinkState
-> Wp.Enums.LinkState
-> IO ()
type C_LinkStateChangedCallback =
Ptr Link -> -- object
CInt ->
CInt ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_LinkStateChangedCallback`.
foreign import ccall "wrapper"
mk_LinkStateChangedCallback :: C_LinkStateChangedCallback -> IO (FunPtr C_LinkStateChangedCallback)
wrap_LinkStateChangedCallback ::
GObject a => (a -> LinkStateChangedCallback) ->
C_LinkStateChangedCallback
wrap_LinkStateChangedCallback gi'cb gi'selfPtr object p0 _ = do
let object' = (toEnum . fromIntegral) object
let p0' = (toEnum . fromIntegral) p0
B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self) object' p0'
-- | Connect a signal handler for the [stateChanged](#signal:stateChanged) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
--
-- @
-- 'Data.GI.Base.Signals.on' link #stateChanged callback
-- @
--
--
onLinkStateChanged :: (IsLink a, MonadIO m) => a -> ((?self :: a) => LinkStateChangedCallback) -> m SignalHandlerId
onLinkStateChanged obj cb = liftIO $ do
let wrapped self = let ?self = self in cb
let wrapped' = wrap_LinkStateChangedCallback wrapped
wrapped'' <- mk_LinkStateChangedCallback wrapped'
connectSignalFunPtr obj "state-changed" wrapped'' SignalConnectBefore Nothing
-- | Connect a signal handler for the [stateChanged](#signal:stateChanged) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
--
-- @
-- 'Data.GI.Base.Signals.after' link #stateChanged callback
-- @
--
--
--
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
--
afterLinkStateChanged :: (IsLink a, MonadIO m) => a -> ((?self :: a) => LinkStateChangedCallback) -> m SignalHandlerId
afterLinkStateChanged obj cb = liftIO $ do
let wrapped self = let ?self = self in cb
let wrapped' = wrap_LinkStateChangedCallback wrapped
wrapped'' <- mk_LinkStateChangedCallback wrapped'
connectSignalFunPtr obj "state-changed" wrapped'' SignalConnectAfter Nothing
#if defined(ENABLE_OVERLOADING)
data LinkStateChangedSignalInfo
instance SignalInfo LinkStateChangedSignalInfo where
type HaskellCallbackType LinkStateChangedSignalInfo = LinkStateChangedCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_LinkStateChangedCallback cb
cb'' <- mk_LinkStateChangedCallback cb'
connectSignalFunPtr obj "state-changed" cb'' connectMode detail
dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Wp.Objects.Link::state-changed"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-Link.html#g:signal:stateChanged"})
#endif
-- VVV Prop "state"
-- Type: TInterface (Name {namespace = "Wp", name = "LinkState"})
-- Flags: [PropertyReadable]
-- Nullable: (Nothing,Nothing)
-- | Get the value of the “@state@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
--
-- @
-- 'Data.GI.Base.Attributes.get' link #state
-- @
getLinkState :: (MonadIO m, IsLink o) => o -> m Wp.Enums.LinkState
getLinkState obj = MIO.liftIO $ B.Properties.getObjectPropertyEnum obj "state"
#if defined(ENABLE_OVERLOADING)
data LinkStatePropertyInfo
instance AttrInfo LinkStatePropertyInfo where
type AttrAllowedOps LinkStatePropertyInfo = '[ 'AttrGet]
type AttrBaseTypeConstraint LinkStatePropertyInfo = IsLink
type AttrSetTypeConstraint LinkStatePropertyInfo = (~) ()
type AttrTransferTypeConstraint LinkStatePropertyInfo = (~) ()
type AttrTransferType LinkStatePropertyInfo = ()
type AttrGetType LinkStatePropertyInfo = Wp.Enums.LinkState
type AttrLabel LinkStatePropertyInfo = "state"
type AttrOrigin LinkStatePropertyInfo = Link
attrGet = getLinkState
attrSet = undefined
attrPut = undefined
attrTransfer _ = undefined
attrConstruct = undefined
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Wp.Objects.Link.state"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-Link.html#g:attr:state"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Link
type instance O.AttributeList Link = LinkAttributeList
type LinkAttributeList = ('[ '("activeFeatures", Wp.Object.ObjectActiveFeaturesPropertyInfo), '("boundId", Wp.Proxy.ProxyBoundIdPropertyInfo), '("core", Wp.Object.ObjectCorePropertyInfo), '("factoryName", Wp.GlobalProxy.GlobalProxyFactoryNamePropertyInfo), '("globalProperties", Wp.GlobalProxy.GlobalProxyGlobalPropertiesPropertyInfo), '("id", Wp.Object.ObjectIdPropertyInfo), '("nativeInfo", Wp.PipewireObject.PipewireObjectNativeInfoPropertyInfo), '("paramInfo", Wp.PipewireObject.PipewireObjectParamInfoPropertyInfo), '("permissions", Wp.GlobalProxy.GlobalProxyPermissionsPropertyInfo), '("properties", Wp.PipewireObject.PipewireObjectPropertiesPropertyInfo), '("pwProxy", Wp.Proxy.ProxyPwProxyPropertyInfo), '("state", LinkStatePropertyInfo), '("supportedFeatures", Wp.Object.ObjectSupportedFeaturesPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
linkState :: AttrLabelProxy "state"
linkState = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Link = LinkSignalList
type LinkSignalList = ('[ '("bound", Wp.Proxy.ProxyBoundSignalInfo), '("error", Wp.Proxy.ProxyErrorSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("paramsChanged", Wp.PipewireObject.PipewireObjectParamsChangedSignalInfo), '("pwProxyCreated", Wp.Proxy.ProxyPwProxyCreatedSignalInfo), '("pwProxyDestroyed", Wp.Proxy.ProxyPwProxyDestroyedSignalInfo), '("stateChanged", LinkStateChangedSignalInfo)] :: [(Symbol, DK.Type)])
#endif
-- method Link::new_from_factory
-- method type : Constructor
-- Args: [ Arg
-- { argCName = "core"
-- , argType = TInterface Name { namespace = "Wp" , name = "Core" }
-- , argCType = Just "WpCore*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the wireplumber core"
-- , sinceVersion = Nothing
-- }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- , Arg
-- { argCName = "factory_name"
-- , argType = TBasicType TUTF8
-- , argCType = Just "const gchar*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText =
-- Just "the pipewire factory name to construct the link"
-- , sinceVersion = Nothing
-- }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- , Arg
-- { argCName = "properties"
-- , argType =
-- TInterface Name { namespace = "Wp" , name = "Properties" }
-- , argCType = Just "WpProperties*"
-- , direction = DirectionIn
-- , mayBeNull = True
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the properties to pass to the factory"
-- , sinceVersion = Nothing
-- }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferEverything
-- }
-- ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Link" })
-- throws : False
-- Skip return : False
foreign import ccall "wp_link_new_from_factory" wp_link_new_from_factory ::
Ptr Wp.Core.Core -> -- core : TInterface (Name {namespace = "Wp", name = "Core"})
CString -> -- factory_name : TBasicType TUTF8
Ptr Wp.Properties.Properties -> -- properties : TInterface (Name {namespace = "Wp", name = "Properties"})
IO (Ptr Link)
-- | Constructs a link on the PipeWire server by asking the remote factory /@factoryName@/ to create it.
--
--
-- Because of the nature of the PipeWire protocol, this operation completes asynchronously at some point in the future. In order to find out when this is done, you should call 'GI.Wp.Objects.Object.objectActivate', requesting at least WP_PROXY_FEATURE_BOUND. When this feature is ready, the link is ready for use on the server. If the link cannot be created, this activation operation will fail.
linkNewFromFactory ::
(B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
a
-- ^ /@core@/: the wireplumber core
-> T.Text
-- ^ /@factoryName@/: the pipewire factory name to construct the link
-> Maybe (Wp.Properties.Properties)
-- ^ /@properties@/: the properties to pass to the factory
-> m (Maybe Link)
-- ^ __Returns:__ the new link or NULL if the core is not connected and therefore the link cannot be created
linkNewFromFactory core factoryName properties = liftIO $ do
core' <- unsafeManagedPtrCastPtr core
factoryName' <- textToCString factoryName
maybeProperties <- case properties of
Nothing -> return FP.nullPtr
Just jProperties -> do
jProperties' <- B.ManagedPtr.disownBoxed jProperties
return jProperties'
result <- wp_link_new_from_factory core' factoryName' maybeProperties
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Link) result'
return result''
touchManagedPtr core
whenJust properties touchManagedPtr
freeMem factoryName'
return maybeResult
#if defined(ENABLE_OVERLOADING)
#endif
-- method Link::get_linked_object_ids
-- method type : OrdinaryMethod
-- Args: [ Arg
-- { argCName = "self"
-- , argType = TInterface Name { namespace = "Wp" , name = "Link" }
-- , argCType = Just "WpLink*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the link" , sinceVersion = Nothing }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- , Arg
-- { argCName = "output_node"
-- , argType = TBasicType TUInt32
-- , argCType = Just "guint32*"
-- , direction = DirectionOut
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the bound id of the output (source) node"
-- , sinceVersion = Nothing
-- }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferEverything
-- }
-- , Arg
-- { argCName = "output_port"
-- , argType = TBasicType TUInt32
-- , argCType = Just "guint32*"
-- , direction = DirectionOut
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the bound id of the output (source) port"
-- , sinceVersion = Nothing
-- }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferEverything
-- }
-- , Arg
-- { argCName = "input_node"
-- , argType = TBasicType TUInt32
-- , argCType = Just "guint32*"
-- , direction = DirectionOut
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the bound id of the input (sink) node"
-- , sinceVersion = Nothing
-- }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferEverything
-- }
-- , Arg
-- { argCName = "input_port"
-- , argType = TBasicType TUInt32
-- , argCType = Just "guint32*"
-- , direction = DirectionOut
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the bound id of the input (sink) port"
-- , sinceVersion = Nothing
-- }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferEverything
-- }
-- ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False
foreign import ccall "wp_link_get_linked_object_ids" wp_link_get_linked_object_ids ::
Ptr Link -> -- self : TInterface (Name {namespace = "Wp", name = "Link"})
Ptr Word32 -> -- output_node : TBasicType TUInt32
Ptr Word32 -> -- output_port : TBasicType TUInt32
Ptr Word32 -> -- input_node : TBasicType TUInt32
Ptr Word32 -> -- input_port : TBasicType TUInt32
IO ()
-- | Retrieves the ids of the objects that are linked by this link.
--
--
-- Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
linkGetLinkedObjectIds ::
(B.CallStack.HasCallStack, MonadIO m, IsLink a) =>
a
-- ^ /@self@/: the link
-> m ((Word32, Word32, Word32, Word32))
linkGetLinkedObjectIds self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
outputNode <- allocMem :: IO (Ptr Word32)
outputPort <- allocMem :: IO (Ptr Word32)
inputNode <- allocMem :: IO (Ptr Word32)
inputPort <- allocMem :: IO (Ptr Word32)
wp_link_get_linked_object_ids self' outputNode outputPort inputNode inputPort
outputNode' <- peek outputNode
outputPort' <- peek outputPort
inputNode' <- peek inputNode
inputPort' <- peek inputPort
touchManagedPtr self
freeMem outputNode
freeMem outputPort
freeMem inputNode
freeMem inputPort
return (outputNode', outputPort', inputNode', inputPort')
#if defined(ENABLE_OVERLOADING)
data LinkGetLinkedObjectIdsMethodInfo
instance (signature ~ (m ((Word32, Word32, Word32, Word32))), MonadIO m, IsLink a) => O.OverloadedMethod LinkGetLinkedObjectIdsMethodInfo a signature where
overloadedMethod = linkGetLinkedObjectIds
instance O.OverloadedMethodInfo LinkGetLinkedObjectIdsMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Wp.Objects.Link.linkGetLinkedObjectIds",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-Link.html#v:linkGetLinkedObjectIds"
})
#endif
-- method Link::get_state
-- method type : OrdinaryMethod
-- Args: [ Arg
-- { argCName = "self"
-- , argType = TInterface Name { namespace = "Wp" , name = "Link" }
-- , argCType = Just "WpLink*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the link" , sinceVersion = Nothing }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- , Arg
-- { argCName = "error"
-- , argType = TBasicType TUTF8
-- , argCType = Just "const gchar**"
-- , direction = DirectionOut
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the error" , sinceVersion = Nothing }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "LinkState" })
-- throws : False
-- Skip return : False
foreign import ccall "wp_link_get_state" wp_link_get_state ::
Ptr Link -> -- self : TInterface (Name {namespace = "Wp", name = "Link"})
Ptr CString -> -- error : TBasicType TUTF8
IO CInt
-- | Gets the current state of the link.
--
-- /Since: 0.4.11/
linkGetState ::
(B.CallStack.HasCallStack, MonadIO m, IsLink a) =>
a
-- ^ /@self@/: the link
-> m ((Wp.Enums.LinkState, T.Text))
-- ^ __Returns:__ the current state of the link
linkGetState self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
error_ <- callocMem :: IO (Ptr CString)
result <- wp_link_get_state self' error_
let result' = (toEnum . fromIntegral) result
error_' <- peek error_
error_'' <- cstringToText error_'
touchManagedPtr self
freeMem error_
return (result', error_'')
#if defined(ENABLE_OVERLOADING)
data LinkGetStateMethodInfo
instance (signature ~ (m ((Wp.Enums.LinkState, T.Text))), MonadIO m, IsLink a) => O.OverloadedMethod LinkGetStateMethodInfo a signature where
overloadedMethod = linkGetState
instance O.OverloadedMethodInfo LinkGetStateMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Wp.Objects.Link.linkGetState",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-Link.html#v:linkGetState"
})
#endif