{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

'GI.Gst.Objects.Device.Device' are objects representing a device, they contain
relevant metadata about the device, such as its class and the 'GI.Gst.Structs.Caps.Caps'
representing the media types it can produce or handle.

'GI.Gst.Objects.Device.Device' are created by 'GI.Gst.Objects.DeviceProvider.DeviceProvider' objects which can be
aggregated by 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor' objects.

/Since: 1.4/
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Gst.Objects.Device
    (

-- * Exported types
    Device(..)                              ,
    IsDevice                                ,
    toDevice                                ,
    noDevice                                ,


 -- * Methods
-- ** createElement #method:createElement#

#if ENABLE_OVERLOADING
    DeviceCreateElementMethodInfo           ,
#endif
    deviceCreateElement                     ,


-- ** getCaps #method:getCaps#

#if ENABLE_OVERLOADING
    DeviceGetCapsMethodInfo                 ,
#endif
    deviceGetCaps                           ,


-- ** getDeviceClass #method:getDeviceClass#

#if ENABLE_OVERLOADING
    DeviceGetDeviceClassMethodInfo          ,
#endif
    deviceGetDeviceClass                    ,


-- ** getDisplayName #method:getDisplayName#

#if ENABLE_OVERLOADING
    DeviceGetDisplayNameMethodInfo          ,
#endif
    deviceGetDisplayName                    ,


-- ** getProperties #method:getProperties#

#if ENABLE_OVERLOADING
    DeviceGetPropertiesMethodInfo           ,
#endif
    deviceGetProperties                     ,


-- ** hasClasses #method:hasClasses#

#if ENABLE_OVERLOADING
    DeviceHasClassesMethodInfo              ,
#endif
    deviceHasClasses                        ,


-- ** hasClassesv #method:hasClassesv#

#if ENABLE_OVERLOADING
    DeviceHasClassesvMethodInfo             ,
#endif
    deviceHasClassesv                       ,


-- ** reconfigureElement #method:reconfigureElement#

#if ENABLE_OVERLOADING
    DeviceReconfigureElementMethodInfo      ,
#endif
    deviceReconfigureElement                ,




 -- * Properties
-- ** caps #attr:caps#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DeviceCapsPropertyInfo                  ,
#endif
    constructDeviceCaps                     ,
#if ENABLE_OVERLOADING
    deviceCaps                              ,
#endif
    getDeviceCaps                           ,


-- ** deviceClass #attr:deviceClass#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DeviceDeviceClassPropertyInfo           ,
#endif
    constructDeviceDeviceClass              ,
#if ENABLE_OVERLOADING
    deviceDeviceClass                       ,
#endif
    getDeviceDeviceClass                    ,


-- ** displayName #attr:displayName#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DeviceDisplayNamePropertyInfo           ,
#endif
    constructDeviceDisplayName              ,
#if ENABLE_OVERLOADING
    deviceDisplayName                       ,
#endif
    getDeviceDisplayName                    ,


-- ** properties #attr:properties#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DevicePropertiesPropertyInfo            ,
#endif
    constructDeviceProperties               ,
#if ENABLE_OVERLOADING
    deviceProperties                        ,
#endif
    getDeviceProperties                     ,




 -- * Signals
-- ** removed #signal:removed#

    C_DeviceRemovedCallback                 ,
    DeviceRemovedCallback                   ,
#if ENABLE_OVERLOADING
    DeviceRemovedSignalInfo                 ,
#endif
    afterDeviceRemoved                      ,
    genClosure_DeviceRemoved                ,
    mk_DeviceRemovedCallback                ,
    noDeviceRemovedCallback                 ,
    onDeviceRemoved                         ,
    wrap_DeviceRemovedCallback              ,




    ) 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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.Element as Gst.Element
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.Structure as Gst.Structure

-- | Memory-managed wrapper type.
newtype Device = Device (ManagedPtr Device)
foreign import ccall "gst_device_get_type"
    c_gst_device_get_type :: IO GType

instance GObject Device where
    gobjectType = c_gst_device_get_type


-- | Type class for types which can be safely cast to `Device`, for instance with `toDevice`.
class (GObject o, O.IsDescendantOf Device o) => IsDevice o
instance (GObject o, O.IsDescendantOf Device o) => IsDevice o

instance O.HasParentTypes Device
type instance O.ParentTypes Device = '[Gst.Object.Object, GObject.Object.Object]

-- | Cast to `Device`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDevice :: (MonadIO m, IsDevice o) => o -> m Device
toDevice = liftIO . unsafeCastTo Device

-- | A convenience alias for `Nothing` :: `Maybe` `Device`.
noDevice :: Maybe Device
noDevice = Nothing

#if ENABLE_OVERLOADING
type family ResolveDeviceMethod (t :: Symbol) (o :: *) :: * where
    ResolveDeviceMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolveDeviceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDeviceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDeviceMethod "createElement" o = DeviceCreateElementMethodInfo
    ResolveDeviceMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolveDeviceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDeviceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDeviceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDeviceMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolveDeviceMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolveDeviceMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolveDeviceMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolveDeviceMethod "hasClasses" o = DeviceHasClassesMethodInfo
    ResolveDeviceMethod "hasClassesv" o = DeviceHasClassesvMethodInfo
    ResolveDeviceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDeviceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDeviceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDeviceMethod "reconfigureElement" o = DeviceReconfigureElementMethodInfo
    ResolveDeviceMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolveDeviceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDeviceMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolveDeviceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDeviceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDeviceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDeviceMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolveDeviceMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolveDeviceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDeviceMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolveDeviceMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolveDeviceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDeviceMethod "getCaps" o = DeviceGetCapsMethodInfo
    ResolveDeviceMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolveDeviceMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolveDeviceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDeviceMethod "getDeviceClass" o = DeviceGetDeviceClassMethodInfo
    ResolveDeviceMethod "getDisplayName" o = DeviceGetDisplayNameMethodInfo
    ResolveDeviceMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolveDeviceMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolveDeviceMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolveDeviceMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolveDeviceMethod "getProperties" o = DeviceGetPropertiesMethodInfo
    ResolveDeviceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDeviceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDeviceMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolveDeviceMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolveDeviceMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolveDeviceMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolveDeviceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDeviceMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveDeviceMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolveDeviceMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolveDeviceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDeviceMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDeviceMethod t Device, O.MethodInfo info Device p) => OL.IsLabel t (Device -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- signal Device::removed
{- |
/No description available in the introspection data./
-}
type DeviceRemovedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DeviceRemovedCallback`@.
noDeviceRemovedCallback :: Maybe DeviceRemovedCallback
noDeviceRemovedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DeviceRemovedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_DeviceRemovedCallback`.
foreign import ccall "wrapper"
    mk_DeviceRemovedCallback :: C_DeviceRemovedCallback -> IO (FunPtr C_DeviceRemovedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_DeviceRemoved :: MonadIO m => DeviceRemovedCallback -> m (GClosure C_DeviceRemovedCallback)
genClosure_DeviceRemoved cb = liftIO $ do
    let cb' = wrap_DeviceRemovedCallback cb
    mk_DeviceRemovedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `DeviceRemovedCallback` into a `C_DeviceRemovedCallback`.
wrap_DeviceRemovedCallback ::
    DeviceRemovedCallback ->
    C_DeviceRemovedCallback
wrap_DeviceRemovedCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@removed@” 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' device #removed callback
@
-}
onDeviceRemoved :: (IsDevice a, MonadIO m) => a -> DeviceRemovedCallback -> m SignalHandlerId
onDeviceRemoved obj cb = liftIO $ do
    let cb' = wrap_DeviceRemovedCallback cb
    cb'' <- mk_DeviceRemovedCallback cb'
    connectSignalFunPtr obj "removed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@removed@” 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' device #removed callback
@
-}
afterDeviceRemoved :: (IsDevice a, MonadIO m) => a -> DeviceRemovedCallback -> m SignalHandlerId
afterDeviceRemoved obj cb = liftIO $ do
    let cb' = wrap_DeviceRemovedCallback cb
    cb'' <- mk_DeviceRemovedCallback cb'
    connectSignalFunPtr obj "removed" cb'' SignalConnectAfter


-- VVV Prop "caps"
   -- Type: TInterface (Name {namespace = "Gst", name = "Caps"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@caps@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' device #caps
@
-}
getDeviceCaps :: (MonadIO m, IsDevice o) => o -> m (Maybe Gst.Caps.Caps)
getDeviceCaps obj = liftIO $ B.Properties.getObjectPropertyBoxed obj "caps" Gst.Caps.Caps

{- |
Construct a `GValueConstruct` with valid value for the “@caps@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDeviceCaps :: (IsDevice o) => Gst.Caps.Caps -> IO (GValueConstruct o)
constructDeviceCaps val = B.Properties.constructObjectPropertyBoxed "caps" (Just val)

#if ENABLE_OVERLOADING
data DeviceCapsPropertyInfo
instance AttrInfo DeviceCapsPropertyInfo where
    type AttrAllowedOps DeviceCapsPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DeviceCapsPropertyInfo = (~) Gst.Caps.Caps
    type AttrBaseTypeConstraint DeviceCapsPropertyInfo = IsDevice
    type AttrGetType DeviceCapsPropertyInfo = (Maybe Gst.Caps.Caps)
    type AttrLabel DeviceCapsPropertyInfo = "caps"
    type AttrOrigin DeviceCapsPropertyInfo = Device
    attrGet _ = getDeviceCaps
    attrSet _ = undefined
    attrConstruct _ = constructDeviceCaps
    attrClear _ = undefined
#endif

-- VVV Prop "device-class"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@device-class@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' device #deviceClass
@
-}
getDeviceDeviceClass :: (MonadIO m, IsDevice o) => o -> m (Maybe T.Text)
getDeviceDeviceClass obj = liftIO $ B.Properties.getObjectPropertyString obj "device-class"

{- |
Construct a `GValueConstruct` with valid value for the “@device-class@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDeviceDeviceClass :: (IsDevice o) => T.Text -> IO (GValueConstruct o)
constructDeviceDeviceClass val = B.Properties.constructObjectPropertyString "device-class" (Just val)

#if ENABLE_OVERLOADING
data DeviceDeviceClassPropertyInfo
instance AttrInfo DeviceDeviceClassPropertyInfo where
    type AttrAllowedOps DeviceDeviceClassPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DeviceDeviceClassPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint DeviceDeviceClassPropertyInfo = IsDevice
    type AttrGetType DeviceDeviceClassPropertyInfo = (Maybe T.Text)
    type AttrLabel DeviceDeviceClassPropertyInfo = "device-class"
    type AttrOrigin DeviceDeviceClassPropertyInfo = Device
    attrGet _ = getDeviceDeviceClass
    attrSet _ = undefined
    attrConstruct _ = constructDeviceDeviceClass
    attrClear _ = undefined
#endif

-- VVV Prop "display-name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@display-name@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' device #displayName
@
-}
getDeviceDisplayName :: (MonadIO m, IsDevice o) => o -> m (Maybe T.Text)
getDeviceDisplayName obj = liftIO $ B.Properties.getObjectPropertyString obj "display-name"

{- |
Construct a `GValueConstruct` with valid value for the “@display-name@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDeviceDisplayName :: (IsDevice o) => T.Text -> IO (GValueConstruct o)
constructDeviceDisplayName val = B.Properties.constructObjectPropertyString "display-name" (Just val)

#if ENABLE_OVERLOADING
data DeviceDisplayNamePropertyInfo
instance AttrInfo DeviceDisplayNamePropertyInfo where
    type AttrAllowedOps DeviceDisplayNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DeviceDisplayNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint DeviceDisplayNamePropertyInfo = IsDevice
    type AttrGetType DeviceDisplayNamePropertyInfo = (Maybe T.Text)
    type AttrLabel DeviceDisplayNamePropertyInfo = "display-name"
    type AttrOrigin DeviceDisplayNamePropertyInfo = Device
    attrGet _ = getDeviceDisplayName
    attrSet _ = undefined
    attrConstruct _ = constructDeviceDisplayName
    attrClear _ = undefined
#endif

-- VVV Prop "properties"
   -- Type: TInterface (Name {namespace = "Gst", name = "Structure"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@properties@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' device #properties
@
-}
getDeviceProperties :: (MonadIO m, IsDevice o) => o -> m (Maybe Gst.Structure.Structure)
getDeviceProperties obj = liftIO $ B.Properties.getObjectPropertyBoxed obj "properties" Gst.Structure.Structure

{- |
Construct a `GValueConstruct` with valid value for the “@properties@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDeviceProperties :: (IsDevice o) => Gst.Structure.Structure -> IO (GValueConstruct o)
constructDeviceProperties val = B.Properties.constructObjectPropertyBoxed "properties" (Just val)

#if ENABLE_OVERLOADING
data DevicePropertiesPropertyInfo
instance AttrInfo DevicePropertiesPropertyInfo where
    type AttrAllowedOps DevicePropertiesPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DevicePropertiesPropertyInfo = (~) Gst.Structure.Structure
    type AttrBaseTypeConstraint DevicePropertiesPropertyInfo = IsDevice
    type AttrGetType DevicePropertiesPropertyInfo = (Maybe Gst.Structure.Structure)
    type AttrLabel DevicePropertiesPropertyInfo = "properties"
    type AttrOrigin DevicePropertiesPropertyInfo = Device
    attrGet _ = getDeviceProperties
    attrSet _ = undefined
    attrConstruct _ = constructDeviceProperties
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList Device
type instance O.AttributeList Device = DeviceAttributeList
type DeviceAttributeList = ('[ '("caps", DeviceCapsPropertyInfo), '("deviceClass", DeviceDeviceClassPropertyInfo), '("displayName", DeviceDisplayNamePropertyInfo), '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo), '("properties", DevicePropertiesPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
deviceCaps :: AttrLabelProxy "caps"
deviceCaps = AttrLabelProxy

deviceDeviceClass :: AttrLabelProxy "deviceClass"
deviceDeviceClass = AttrLabelProxy

deviceDisplayName :: AttrLabelProxy "displayName"
deviceDisplayName = AttrLabelProxy

deviceProperties :: AttrLabelProxy "properties"
deviceProperties = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
data DeviceRemovedSignalInfo
instance SignalInfo DeviceRemovedSignalInfo where
    type HaskellCallbackType DeviceRemovedSignalInfo = DeviceRemovedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DeviceRemovedCallback cb
        cb'' <- mk_DeviceRemovedCallback cb'
        connectSignalFunPtr obj "removed" cb'' connectMode

type instance O.SignalList Device = DeviceSignalList
type DeviceSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("removed", DeviceRemovedSignalInfo)] :: [(Symbol, *)])

#endif

-- method Device::create_element
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "name of new element, or %NULL to automatically\ncreate a unique name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Element"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_device_create_element" gst_device_create_element ::
    Ptr Device ->                           -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gst.Element.Element)

{- |
Creates the element with all of the required parameters set to use
this device.

/Since: 1.4/
-}
deviceCreateElement ::
    (B.CallStack.HasCallStack, MonadIO m, IsDevice a) =>
    a
    {- ^ /@device@/: a 'GI.Gst.Objects.Device.Device' -}
    -> Maybe (T.Text)
    {- ^ /@name@/: name of new element, or 'Nothing' to automatically
create a unique name. -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ a new 'GI.Gst.Objects.Element.Element' configured to use
this device -}
deviceCreateElement device name = liftIO $ do
    device' <- unsafeManagedPtrCastPtr device
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    result <- gst_device_create_element device' maybeName
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Element.Element) result'
        return result''
    touchManagedPtr device
    freeMem maybeName
    return maybeResult

#if ENABLE_OVERLOADING
data DeviceCreateElementMethodInfo
instance (signature ~ (Maybe (T.Text) -> m (Maybe Gst.Element.Element)), MonadIO m, IsDevice a) => O.MethodInfo DeviceCreateElementMethodInfo a signature where
    overloadedMethod _ = deviceCreateElement

#endif

-- method Device::get_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Caps"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_device_get_caps" gst_device_get_caps ::
    Ptr Device ->                           -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    IO (Ptr Gst.Caps.Caps)

{- |
Getter for the 'GI.Gst.Structs.Caps.Caps' that this device supports.

/Since: 1.4/
-}
deviceGetCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsDevice a) =>
    a
    {- ^ /@device@/: a 'GI.Gst.Objects.Device.Device' -}
    -> m (Maybe Gst.Caps.Caps)
    {- ^ __Returns:__ The 'GI.Gst.Structs.Caps.Caps' supported by this device. Unref with
@/gst_caps_unref()/@ when done. -}
deviceGetCaps device = liftIO $ do
    device' <- unsafeManagedPtrCastPtr device
    result <- gst_device_get_caps device'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Caps.Caps) result'
        return result''
    touchManagedPtr device
    return maybeResult

#if ENABLE_OVERLOADING
data DeviceGetCapsMethodInfo
instance (signature ~ (m (Maybe Gst.Caps.Caps)), MonadIO m, IsDevice a) => O.MethodInfo DeviceGetCapsMethodInfo a signature where
    overloadedMethod _ = deviceGetCaps

#endif

-- method Device::get_device_class
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_device_get_device_class" gst_device_get_device_class ::
    Ptr Device ->                           -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    IO CString

{- |
Gets the \"class\" of a device. This is a \"\/\" separated list of
classes that represent this device. They are a subset of the
classes of the 'GI.Gst.Objects.DeviceProvider.DeviceProvider' that produced this device.

/Since: 1.4/
-}
deviceGetDeviceClass ::
    (B.CallStack.HasCallStack, MonadIO m, IsDevice a) =>
    a
    {- ^ /@device@/: a 'GI.Gst.Objects.Device.Device' -}
    -> m T.Text
    {- ^ __Returns:__ The device class. Free with 'GI.GLib.Functions.free' after use. -}
deviceGetDeviceClass device = liftIO $ do
    device' <- unsafeManagedPtrCastPtr device
    result <- gst_device_get_device_class device'
    checkUnexpectedReturnNULL "deviceGetDeviceClass" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr device
    return result'

#if ENABLE_OVERLOADING
data DeviceGetDeviceClassMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDevice a) => O.MethodInfo DeviceGetDeviceClassMethodInfo a signature where
    overloadedMethod _ = deviceGetDeviceClass

#endif

-- method Device::get_display_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_device_get_display_name" gst_device_get_display_name ::
    Ptr Device ->                           -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    IO CString

{- |
Gets the user-friendly name of the device.

/Since: 1.4/
-}
deviceGetDisplayName ::
    (B.CallStack.HasCallStack, MonadIO m, IsDevice a) =>
    a
    {- ^ /@device@/: a 'GI.Gst.Objects.Device.Device' -}
    -> m T.Text
    {- ^ __Returns:__ The device name. Free with 'GI.GLib.Functions.free' after use. -}
deviceGetDisplayName device = liftIO $ do
    device' <- unsafeManagedPtrCastPtr device
    result <- gst_device_get_display_name device'
    checkUnexpectedReturnNULL "deviceGetDisplayName" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr device
    return result'

#if ENABLE_OVERLOADING
data DeviceGetDisplayNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDevice a) => O.MethodInfo DeviceGetDisplayNameMethodInfo a signature where
    overloadedMethod _ = deviceGetDisplayName

#endif

-- method Device::get_properties
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_device_get_properties" gst_device_get_properties ::
    Ptr Device ->                           -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    IO (Ptr Gst.Structure.Structure)

{- |
Gets the extra properties of a device.

/Since: 1.6/
-}
deviceGetProperties ::
    (B.CallStack.HasCallStack, MonadIO m, IsDevice a) =>
    a
    {- ^ /@device@/: a 'GI.Gst.Objects.Device.Device' -}
    -> m (Maybe Gst.Structure.Structure)
    {- ^ __Returns:__ The extra properties or 'Nothing' when there are none.
         Free with 'GI.Gst.Structs.Structure.structureFree' after use. -}
deviceGetProperties device = liftIO $ do
    device' <- unsafeManagedPtrCastPtr device
    result <- gst_device_get_properties device'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Structure.Structure) result'
        return result''
    touchManagedPtr device
    return maybeResult

#if ENABLE_OVERLOADING
data DeviceGetPropertiesMethodInfo
instance (signature ~ (m (Maybe Gst.Structure.Structure)), MonadIO m, IsDevice a) => O.MethodInfo DeviceGetPropertiesMethodInfo a signature where
    overloadedMethod _ = deviceGetProperties

#endif

-- method Device::has_classes
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "classes", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a \"/\"-separated list of device classes to match, only match if\n all classes are matched", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_device_has_classes" gst_device_has_classes ::
    Ptr Device ->                           -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    CString ->                              -- classes : TBasicType TUTF8
    IO CInt

{- |
Check if /@device@/ matches all of the given classes

/Since: 1.4/
-}
deviceHasClasses ::
    (B.CallStack.HasCallStack, MonadIO m, IsDevice a) =>
    a
    {- ^ /@device@/: a 'GI.Gst.Objects.Device.Device' -}
    -> T.Text
    {- ^ /@classes@/: a \"\/\"-separated list of device classes to match, only match if
 all classes are matched -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@device@/ matches. -}
deviceHasClasses device classes = liftIO $ do
    device' <- unsafeManagedPtrCastPtr device
    classes' <- textToCString classes
    result <- gst_device_has_classes device' classes'
    let result' = (/= 0) result
    touchManagedPtr device
    freeMem classes'
    return result'

#if ENABLE_OVERLOADING
data DeviceHasClassesMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsDevice a) => O.MethodInfo DeviceHasClassesMethodInfo a signature where
    overloadedMethod _ = deviceHasClasses

#endif

-- method Device::has_classesv
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "classes", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a %NULL terminated array of classes\n  to match, only match if all classes are matched", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_device_has_classesv" gst_device_has_classesv ::
    Ptr Device ->                           -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    Ptr CString ->                          -- classes : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO CInt

{- |
Check if /@factory@/ matches all of the given classes

/Since: 1.4/
-}
deviceHasClassesv ::
    (B.CallStack.HasCallStack, MonadIO m, IsDevice a) =>
    a
    {- ^ /@device@/: a 'GI.Gst.Objects.Device.Device' -}
    -> [T.Text]
    {- ^ /@classes@/: a 'Nothing' terminated array of classes
  to match, only match if all classes are matched -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@device@/ matches. -}
deviceHasClassesv device classes = liftIO $ do
    device' <- unsafeManagedPtrCastPtr device
    classes' <- packZeroTerminatedUTF8CArray classes
    result <- gst_device_has_classesv device' classes'
    let result' = (/= 0) result
    touchManagedPtr device
    mapZeroTerminatedCArray freeMem classes'
    freeMem classes'
    return result'

#if ENABLE_OVERLOADING
data DeviceHasClassesvMethodInfo
instance (signature ~ ([T.Text] -> m Bool), MonadIO m, IsDevice a) => O.MethodInfo DeviceHasClassesvMethodInfo a signature where
    overloadedMethod _ = deviceHasClassesv

#endif

-- method Device::reconfigure_element
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "element", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_device_reconfigure_element" gst_device_reconfigure_element ::
    Ptr Device ->                           -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    Ptr Gst.Element.Element ->              -- element : TInterface (Name {namespace = "Gst", name = "Element"})
    IO CInt

{- |
Tries to reconfigure an existing element to use the device. If this
function fails, then one must destroy the element and create a new one
using 'GI.Gst.Objects.Device.deviceCreateElement'.

Note: This should only be implemented for elements can change their
device in the PLAYING state.

/Since: 1.4/
-}
deviceReconfigureElement ::
    (B.CallStack.HasCallStack, MonadIO m, IsDevice a, Gst.Element.IsElement b) =>
    a
    {- ^ /@device@/: a 'GI.Gst.Objects.Device.Device' -}
    -> b
    {- ^ /@element@/: a 'GI.Gst.Objects.Element.Element' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the element could be reconfigured to use this device,
'False' otherwise. -}
deviceReconfigureElement device element = liftIO $ do
    device' <- unsafeManagedPtrCastPtr device
    element' <- unsafeManagedPtrCastPtr element
    result <- gst_device_reconfigure_element device' element'
    let result' = (/= 0) result
    touchManagedPtr device
    touchManagedPtr element
    return result'

#if ENABLE_OVERLOADING
data DeviceReconfigureElementMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsDevice a, Gst.Element.IsElement b) => O.MethodInfo DeviceReconfigureElementMethodInfo a signature where
    overloadedMethod _ = deviceReconfigureElement

#endif