Skip to content

pylon/Device.h#

Low Level API: Definition of IPylonDevice.

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
interface Pylon::IDevice
Low Level API: The interface implemented by all device objects.
interface Pylon::IPylonDevice
Low Level API: Interface for camera objects.

Source code#

//-----------------------------------------------------------------------------
//  Basler pylon SDK
//  Copyright (c) 2006-2022 Basler AG
//  http://www.baslerweb.com
//  Author:  Hartmut Nebelung
//-----------------------------------------------------------------------------
#ifndef __DEVICE_H__
#define __DEVICE_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <pylon/Platform.h>

#ifdef _MSC_VER
#   pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */

#include <GenICamFwd.h>
#include <Base/GCException.h>
#include <pylon/stdinclude.h>
#include <pylon/PylonBase.h>
#include <pylon/WaitObject.h>
#include <pylon/WaitObjects.h>  // for backward compatibility reasons
#include <pylon/DeviceInfo.h>
#include <pylon/EventAdapter.h>
#include <pylon/Callback.h>
#include <pylon/DeviceAccessMode.h>

namespace Pylon
{

    interface IStreamGrabber;
    interface IEventGrabber;
    interface IChunkParser;
    interface ISelfReliantChunkParser;
    interface IPylonDevice;

    typedef Pylon::Callback1<IPylonDevice*> DeviceCallback;
    typedef void* DeviceCallbackHandle;

    class CDeviceInfo;
    // -------------------------------------------------------------------------
    // interface IDevice
    // -------------------------------------------------------------------------
    interface PUBLIC_INTERFACE IDevice
    {


        virtual void Open( AccessModeSet mode = (Stream | Control | Event) ) = 0;


        virtual void Close() = 0;


        virtual bool IsOpen() const = 0;

        virtual AccessModeSet AccessMode( void ) const = 0;

        virtual const CDeviceInfo& GetDeviceInfo() const = 0;
    };

    // ---------------------------------------------------------------------
    // interface IPylonDevice
    // ---------------------------------------------------------------------
    interface PUBLIC_INTERFACE IPylonDevice : public IDevice
    {
    public:

        virtual uint32_t GetNumStreamGrabberChannels() const = 0;


        virtual IStreamGrabber* GetStreamGrabber( uint32_t index ) = 0;


        virtual IEventGrabber* GetEventGrabber() = 0;


        virtual GenApi::INodeMap* GetNodeMap() = 0;


        virtual GenApi::INodeMap* GetTLNodeMap() = 0;

        virtual Pylon::IChunkParser* CreateChunkParser() = 0;


        virtual void DestroyChunkParser( Pylon::IChunkParser* pChunkParser ) = 0;

        virtual IEventAdapter* CreateEventAdapter() = 0;

        virtual void DestroyEventAdapter( IEventAdapter* ) = 0;

        virtual ISelfReliantChunkParser* CreateSelfReliantChunkParser() = 0;

        virtual void DestroySelfReliantChunkParser( ISelfReliantChunkParser* ) = 0;


        virtual DeviceCallbackHandle RegisterRemovalCallback( DeviceCallback& d ) = 0;


        virtual bool DeregisterRemovalCallback( DeviceCallbackHandle h ) = 0;

    };


#ifdef _MSC_VER
#pragma warning ( push )
#pragma warning( disable : 4239 ) // nonstandard extension used
#endif

    template<class Function>
    DeviceCallbackHandle RegisterRemovalCallback( IPylonDevice* pDevice, Function f )
    {
        if (NULL == pDevice)
            throw RUNTIME_EXCEPTION( "Failed to register removal callback, invalid device object." );
        DeviceCallback cb( make_FunctionCallback<Function, Pylon::Callback1<IPylonDevice*>, IPylonDevice* >( f ) );
        return pDevice->RegisterRemovalCallback( cb );
    }

    template<class Client, class Member>
    DeviceCallbackHandle RegisterRemovalCallback( IPylonDevice* pDevice, Client& c, Member m )
    {
        if (NULL == pDevice)
            throw RUNTIME_EXCEPTION( "Failed to register removal callback, invalid device object." );
        DeviceCallback x( make_MemberFunctionCallback<Client, Member, DeviceCallback, IPylonDevice*>( c, m ) );
        return pDevice->RegisterRemovalCallback( x );
    }
#ifdef _MSC_VER
#pragma warning ( pop )
#endif


}

#ifdef _MSC_VER
#   pragma pack(pop)
#endif /* _MSC_VER */

#endif //__DEVICE_H__

Updated on 27 July 2022 at 19:03:47