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

'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.
-}

module GI.Gst.Objects.Device
    ( 

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


 -- * Methods
-- ** createElement #method:createElement#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceCreateElementMethodInfo           ,
#endif
    deviceCreateElement                     ,


-- ** getCaps #method:getCaps#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceGetCapsMethodInfo                 ,
#endif
    deviceGetCaps                           ,


-- ** getDeviceClass #method:getDeviceClass#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceGetDeviceClassMethodInfo          ,
#endif
    deviceGetDeviceClass                    ,


-- ** getDisplayName #method:getDisplayName#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceGetDisplayNameMethodInfo          ,
#endif
    deviceGetDisplayName                    ,


-- ** getProperties #method:getProperties#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceGetPropertiesMethodInfo           ,
#endif
    deviceGetProperties                     ,


-- ** hasClasses #method:hasClasses#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceHasClassesMethodInfo              ,
#endif
    deviceHasClasses                        ,


-- ** hasClassesv #method:hasClassesv#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceHasClassesvMethodInfo             ,
#endif
    deviceHasClassesv                       ,


-- ** reconfigureElement #method:reconfigureElement#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceReconfigureElementMethodInfo      ,
#endif
    deviceReconfigureElement                ,




 -- * Properties
-- ** caps #attr:caps#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceCapsPropertyInfo                  ,
#endif
    constructDeviceCaps                     ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    deviceCaps                              ,
#endif
    getDeviceCaps                           ,


-- ** deviceClass #attr:deviceClass#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceDeviceClassPropertyInfo           ,
#endif
    constructDeviceDeviceClass              ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    deviceDeviceClass                       ,
#endif
    getDeviceDeviceClass                    ,


-- ** displayName #attr:displayName#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DeviceDisplayNamePropertyInfo           ,
#endif
    constructDeviceDisplayName              ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    deviceDisplayName                       ,
#endif
    getDeviceDisplayName                    ,


-- ** properties #attr:properties#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DevicePropertiesPropertyInfo            ,
#endif
    constructDeviceProperties               ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    deviceProperties                        ,
#endif
    getDeviceProperties                     ,




 -- * Signals
-- ** removed #signal:removed#
    C_DeviceRemovedCallback                 ,
    DeviceRemovedCallback                   ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 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

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
    

class GObject o => IsDevice o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Device a) =>
    IsDevice a
#endif
instance IsDevice Device
instance Gst.Object.IsObject Device
instance GObject.Object.IsObject Device

toDevice :: (MonadIO m, IsDevice o) => o -> m Device
toDevice = liftIO . unsafeCastTo Device

noDevice :: Maybe Device
noDevice = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 "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 "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDeviceMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    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 "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) => O.IsLabelProxy t (Device -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDeviceMethod t Device, O.MethodInfo info Device p) => O.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

#endif

-- signal Device::removed
type DeviceRemovedCallback =
    IO ()

noDeviceRemovedCallback :: Maybe DeviceRemovedCallback
noDeviceRemovedCallback = Nothing

type C_DeviceRemovedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_DeviceRemovedCallback :: C_DeviceRemovedCallback -> IO (FunPtr C_DeviceRemovedCallback)

genClosure_DeviceRemoved :: DeviceRemovedCallback -> IO Closure
genClosure_DeviceRemoved cb = do
    let cb' = wrap_DeviceRemovedCallback cb
    mk_DeviceRemovedCallback cb' >>= newCClosure


wrap_DeviceRemovedCallback ::
    DeviceRemovedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_DeviceRemovedCallback _cb _ _ = do
    _cb 


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

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)

getDeviceCaps :: (MonadIO m, IsDevice o) => o -> m (Maybe Gst.Caps.Caps)
getDeviceCaps obj = liftIO $ getObjectPropertyBoxed obj "caps" Gst.Caps.Caps

constructDeviceCaps :: (IsDevice o) => Gst.Caps.Caps -> IO (GValueConstruct o)
constructDeviceCaps val = constructObjectPropertyBoxed "caps" (Just val)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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)

getDeviceDeviceClass :: (MonadIO m, IsDevice o) => o -> m (Maybe T.Text)
getDeviceDeviceClass obj = liftIO $ getObjectPropertyString obj "device-class"

constructDeviceDeviceClass :: (IsDevice o) => T.Text -> IO (GValueConstruct o)
constructDeviceDeviceClass val = constructObjectPropertyString "device-class" (Just val)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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)

getDeviceDisplayName :: (MonadIO m, IsDevice o) => o -> m (Maybe T.Text)
getDeviceDisplayName obj = liftIO $ getObjectPropertyString obj "display-name"

constructDeviceDisplayName :: (IsDevice o) => T.Text -> IO (GValueConstruct o)
constructDeviceDisplayName val = constructObjectPropertyString "display-name" (Just val)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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)

getDeviceProperties :: (MonadIO m, IsDevice o) => o -> m (Maybe Gst.Structure.Structure)
getDeviceProperties obj = liftIO $ getObjectPropertyBoxed obj "properties" Gst.Structure.Structure

constructDeviceProperties :: (IsDevice o) => Gst.Structure.Structure -> IO (GValueConstruct o)
constructDeviceProperties val = constructObjectPropertyBoxed "properties" (Just val)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
deviceCaps :: AttrLabelProxy "caps"
deviceCaps = AttrLabelProxy

deviceDeviceClass :: AttrLabelProxy "deviceClass"
deviceDeviceClass = AttrLabelProxy

deviceDisplayName :: AttrLabelProxy "displayName"
deviceDisplayName = AttrLabelProxy

deviceProperties :: AttrLabelProxy "properties"
deviceProperties = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 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
    checkUnexpectedReturnNULL "deviceCreateElement" result
    result' <- (wrapObject Gst.Element.Element) result
    touchManagedPtr device
    freeMem maybeName
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DeviceCreateElementMethodInfo
instance (signature ~ (Maybe (T.Text) -> m 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 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'
    checkUnexpectedReturnNULL "deviceGetCaps" result
    result' <- (wrapBoxed Gst.Caps.Caps) result
    touchManagedPtr device
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DeviceGetCapsMethodInfo
instance (signature ~ (m 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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 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'
    checkUnexpectedReturnNULL "deviceGetProperties" result
    result' <- (wrapBoxed Gst.Structure.Structure) result
    touchManagedPtr device
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DeviceGetPropertiesMethodInfo
instance (signature ~ (m 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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DeviceReconfigureElementMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsDevice a, Gst.Element.IsElement b) => O.MethodInfo DeviceReconfigureElementMethodInfo a signature where
    overloadedMethod _ = deviceReconfigureElement

#endif