Spinnaker C++
2.6.0.0
Public Member Functions | Protected Member Functions | Friends | List of all members
CameraBase Class Reference

The base class for the camera object. More...

Inheritance diagram for CameraBase:
ICameraBase Camera

Public Member Functions

virtual ~CameraBase (void)
 Virtual Destructor. More...
 
void Init ()
 Init Connects to camera with read and write access, retrieves remote device and GUI XML and generates node map references. More...
 
void DeInit ()
 DeInit Disconnects camera port, resets camera back to read access and frees GenICam node map and GUI XML. More...
 
bool IsInitialized ()
 IsInitialized Checks if camera is initialized. More...
 
bool IsValid ()
 IsValid Checks a flag to determine if camera is still valid for use. More...
 
GenApi::INodeMapGetNodeMap () const
 GetNodeMap Gets a reference to the node map that is generated from a GenICam XML file. More...
 
GenApi::INodeMapGetTLDeviceNodeMap () const
 GetTLDeviceNodeMap Gets a reference to the node map that is generated from a GenICam XML file for the GenTL Device module. More...
 
GenApi::INodeMapGetTLStreamNodeMap () const
 GetTLStreamNodeMap Gets a reference to the node map that is generated from a GenICam XML file for the GenTL Stream module. More...
 
GenApi::EAccessMode GetAccessMode () const
 GetAccessMode Returns the access mode that the software has on the Camera. More...
 
void ReadPort (uint64_t iAddress, void *pBuffer, size_t iSize)
 
void WritePort (uint64_t iAddress, const void *pBuffer, size_t iSize)
 
void BeginAcquisition ()
 BeginAcquisition Starts the image acquisition engine. More...
 
void EndAcquisition ()
 EndAcquisition Stops the image acquisition engine. More...
 
BufferOwnership GetBufferOwnership () const
 GetBufferOwnership Gets data buffer ownership. More...
 
void SetBufferOwnership (const BufferOwnership mode)
 SetBufferOwnership Sets data buffer ownership. More...
 
uint64_t GetUserBufferCount () const
 GetUserBufferCount Gets the number of user memory buffers. More...
 
uint64_t GetUserBufferSize () const
 GetUserBufferSize Gets the size of one user memory buffer (in bytes). More...
 
uint64_t GetUserBufferTotalSize () const
 GetUserBufferTotalSize Gets the total size of all the user memory buffers (in bytes). More...
 
void SetUserBuffers (void *const pMemBuffers, uint64_t totalSize)
 SetUserBuffers Specify contiguous user allocated memory to use as data buffers. More...
 
void SetUserBuffers (void **const ppMemBuffers, const uint64_t bufferCount, const uint64_t bufferSize)
 SetUserBuffers Specify non-contiguous user allocated memory to use as data buffers. More...
 
ImagePtr GetNextImage (uint64_t grabTimeout=EVENT_TIMEOUT_INFINITE, uint64_t streamID=0)
 GetNextImage Gets the next image that was received by the transport layer. More...
 
GenICam::gcstring GetUniqueID ()
 GetUniqueID This returns a unique id string that identifies the camera. More...
 
bool IsStreaming () const
 IsStreaming Returns true if the camera is currently streaming or false if it is not. More...
 
GenICam::gcstring GetGuiXml () const
 Returns the GUI XML that can be passed into the Spinnaker GUI framework. More...
 
void RegisterEventHandler (EventHandler &evtHandlerToRegister)
 RegisterEventHandler(EventHandler &) Registers a specific event handler for the camera. More...
 
void RegisterEventHandler (EventHandler &evtHandlerToRegister, const GenICam::gcstring &eventName)
 RegisterEventHandler(EventHandler &, const GenICam::gcstring&) Registers a specific event handler for the camera. More...
 
void UnregisterEventHandler (EventHandler &evtHandlerToUnregister)
 UnregisterEventHandler Unregisters an event handler for the camera Event handlers should be unregistered first before calling camera DeInit(). More...
 
unsigned int GetNumImagesInUse ()
 GetNumImagesInUse Returns the number of images that are currently in use. More...
 
unsigned int GetNumDataStreams ()
 GetNumDataStreams Returns the number of streams that a device supports. More...
 
unsigned int DiscoverMaxPacketSize ()
 DiscoverMaxPacketSize Returns the largest packet size that can be safely used on the interface that device is connected to. More...
 
void ForceIP ()
 ForceIP Forces the camera to be on the same subnet as its corresponding interface. More...
 
- Public Member Functions inherited from ICameraBase
virtual ~ICameraBase (void)
 

Protected Member Functions

 CameraBase (void)
 Default constructor. More...
 
 CameraBase (const CameraBase &)
 Copy constructor. More...
 
CameraBaseoperator= (const CameraBase &)
 Assignment operator. More...
 
- Protected Member Functions inherited from ICameraBase
 ICameraBase ()
 
 ICameraBase (const ICameraBase &)
 
ICameraBaseoperator= (const ICameraBase &)
 

Friends

class InterfaceImpl
 

Additional Inherited Members

- Public Attributes inherited from ICameraBase
TransportLayerDevice TLDevice
 Gets vital camera information by connecting to the camera's bootstrap registers. More...
 
TransportLayerStream TLStream
 Gets information about the stream data by connecting to the camera's bootstrap registers. More...
 
- Protected Attributes inherited from ICameraBase
CameraBaseData * m_pCameraBaseData
 

Detailed Description

The base class for the camera object.

Constructor & Destructor Documentation

virtual ~CameraBase ( void  )
virtual

Virtual Destructor.

CameraBase ( void  )
protected

Default constructor.

CameraBase ( const CameraBase )
protected

Copy constructor.

Member Function Documentation

void BeginAcquisition ( )
virtual

BeginAcquisition Starts the image acquisition engine.

The camera must be initialized via a call to Init() before starting an acquisition.

See Also
Init()

Implements ICameraBase.

void DeInit ( )
virtual

DeInit Disconnects camera port, resets camera back to read access and frees GenICam node map and GUI XML.

Do not call more functions that access the remote device such as WritePort/ReadPort after calling DeInit(). Events should also be unregistered before calling camera DeInit(). Otherwise an exception will be thrown in the DeInit() call and require the user to unregister events before the camera can be re-initialized again.

See Also
Init()
UnregisterEventHandler(EventHandler & evtHandlerToUnregister)

Implements ICameraBase.

unsigned int DiscoverMaxPacketSize ( )
virtual

DiscoverMaxPacketSize Returns the largest packet size that can be safely used on the interface that device is connected to.

Returns
The maximum packet size returned.

Implements ICameraBase.

void EndAcquisition ( )
virtual

EndAcquisition Stops the image acquisition engine.

If EndAcquisition() is called without a prior call to BeginAcquisition() an error message "Camera is not started" will be thrown. All Images that were acquired using GetNextImage() need to be released first using image->Release() before calling EndAcquisition(). All buffers in the input pool and output queue will be discarded when EndAcquisition() is called.

See Also
Init()
BeginAcquisition()
GetNextImage( grabTimeout )
Image::Release()

Implements ICameraBase.

void ForceIP ( )
virtual

ForceIP Forces the camera to be on the same subnet as its corresponding interface.

Implements ICameraBase.

GenApi::EAccessMode GetAccessMode ( ) const
virtual

GetAccessMode Returns the access mode that the software has on the Camera.

The camera does not need to be initialized before calling this function.

See Also
Init()
Returns
An enumeration value indicating the access mode

Implements ICameraBase.

BufferOwnership GetBufferOwnership ( ) const
virtual

GetBufferOwnership Gets data buffer ownership.

The data buffers can be owned by System or User. If the system owns the buffers, the memory required for the buffers are allocated and freed by the library. If user owns the buffers, the user is responsible for allocating and ultimately freeing the memory. By default, data buffers are owned by the library.

See Also
SetBufferOwnership()
SetUserBuffers()
Returns
Buffer ownership (system or user)

Implements ICameraBase.

GenICam::gcstring GetGuiXml ( ) const
virtual

Returns the GUI XML that can be passed into the Spinnaker GUI framework.

Returns
GenICam::gcstring that represents the uncompressed GUI XML file

Implements ICameraBase.

ImagePtr GetNextImage ( uint64_t  grabTimeout = EVENT_TIMEOUT_INFINITE,
uint64_t  streamID = 0 
)
virtual

GetNextImage Gets the next image that was received by the transport layer.

This function will block indefinitely until an image arrives. Most cameras support one stream so the default streamID is 0 but if a camera supports multiple streams the user can input the streamID to select from which stream to grab images

See Also
Init()
BeginAcquisition()
EndAcquisition()
Parameters
grabTimeouta 64bit value that represents a timeout in milliseconds
streamIDThe stream to grab the image.
Returns
pointer to an Image object

Implements ICameraBase.

GenApi::INodeMap& GetNodeMap ( ) const
virtual

GetNodeMap Gets a reference to the node map that is generated from a GenICam XML file.

The camera must be initialized by a call to Init() first before a node map reference can be successfully acquired.

See Also
Init()
Returns
A reference to the INodeMap.

Implements ICameraBase.

unsigned int GetNumDataStreams ( )
virtual

GetNumDataStreams Returns the number of streams that a device supports.

Returns
The number of data streams

Implements ICameraBase.

unsigned int GetNumImagesInUse ( )
virtual

GetNumImagesInUse Returns the number of images that are currently in use.

Each of the images that are currently in use must be cleaned up with a call to image->Release() before calling system->ReleaseInstance().

Returns
The number of images that needs to be cleaned up.

Implements ICameraBase.

GenApi::INodeMap& GetTLDeviceNodeMap ( ) const
virtual

GetTLDeviceNodeMap Gets a reference to the node map that is generated from a GenICam XML file for the GenTL Device module.

The camera does not need to be initialized before acquiring this node map.

Returns
A reference to the INodeMap.

Implements ICameraBase.

GenApi::INodeMap& GetTLStreamNodeMap ( ) const
virtual

GetTLStreamNodeMap Gets a reference to the node map that is generated from a GenICam XML file for the GenTL Stream module.

The camera does not need to be initialized before acquiring this node map.

Returns
A reference to the INodeMap.

Implements ICameraBase.

GenICam::gcstring GetUniqueID ( )
virtual

GetUniqueID This returns a unique id string that identifies the camera.

This is the camera serial number.

Returns
string that uniquely identifies the camera (serial number)

Implements ICameraBase.

uint64_t GetUserBufferCount ( ) const
virtual

GetUserBufferCount Gets the number of user memory buffers.

This will throw an exception if user memory buffer has not been set. If the user memory is contiguous, this will throw an exception unless BeginAcquisition() has been called.

See Also
BeginAcquisition()
SetUserBuffers()
Returns
The number of user memory buffers

Implements ICameraBase.

uint64_t GetUserBufferSize ( ) const
virtual

GetUserBufferSize Gets the size of one user memory buffer (in bytes).

This will throw an exception if user memory buffer has not been set. If the user memory is contiguous, this will throw an exception unless BeginAcquisition() has been called. To prevent image tearing when working with USB3 cameras, the size of each buffer should be equal to: ((unsigned int) (bufferSize + 1024 - 1) / 1024) * 1024 where 1024 is the USB3 packet size.

See Also
BeginAcquisition()
SetUserBuffers()
Returns
The size of one user memory buffer (in bytes)

Implements ICameraBase.

uint64_t GetUserBufferTotalSize ( ) const
virtual

GetUserBufferTotalSize Gets the total size of all the user memory buffers (in bytes).

This will throw an exception if user memory buffer has not been set. The total size should be GetUserBufferSize() multiplied by GetUserBufferCount() or larger.

See Also
GetUserBufferCount()
GetUserBufferSize()
SetUserBuffers()
Returns
The total size of all the user memory buffers (in bytes)

Implements ICameraBase.

void Init ( )
virtual

Init Connects to camera with read and write access, retrieves remote device and GUI XML and generates node map references.

This function needs to be called before any camera related API calls such as BeginAcquisition(), EndAcquisition(), GetNodeMap(), GetNextImage().

See Also
BeginAcquisition()
EndAcquisition()
GetNodeMap()
GetNextImage()

Implements ICameraBase.

bool IsInitialized ( )
virtual

IsInitialized Checks if camera is initialized.

This function needs to return true in order to retrieve a valid NodeMap from the GetNodeMap() call.

See Also
GetNodeMap()
Returns
If camera is initialized or not

Implements ICameraBase.

bool IsStreaming ( ) const
virtual

IsStreaming Returns true if the camera is currently streaming or false if it is not.

See Also
Init()
Returns
returns true if camera is streaming and false otherwise.

Implements ICameraBase.

bool IsValid ( )
virtual

IsValid Checks a flag to determine if camera is still valid for use.

Returns
If camera is valid or not

Implements ICameraBase.

CameraBase& operator= ( const CameraBase )
protected

Assignment operator.

void ReadPort ( uint64_t  iAddress,
void *  pBuffer,
size_t  iSize 
)
virtual

Implements ICameraBase.

void RegisterEventHandler ( EventHandler evtHandlerToRegister)
virtual

RegisterEventHandler(EventHandler &) Registers a specific event handler for the camera.

The camera has to be initialized first with a call to Init() before registering handlers for events.

See Also
Init()
Parameters
evtHandlerToRegisterThe event handler to register for the camera

Implements ICameraBase.

void RegisterEventHandler ( EventHandler evtHandlerToRegister,
const GenICam::gcstring eventName 
)
virtual

RegisterEventHandler(EventHandler &, const GenICam::gcstring&) Registers a specific event handler for the camera.

See Also
Init()
Parameters
evtHandlerToRegisterThe event handler to register for the camera
eventNameThe event name to register

Implements ICameraBase.

void SetBufferOwnership ( const BufferOwnership  mode)
virtual

SetBufferOwnership Sets data buffer ownership.

The data buffers can be owned by System or User. If the system owns the buffers, the memory required for the buffers are allocated and freed by the library. If user owns the buffers, the user is responsible for allocating and ultimately freeing the memory. By default, data buffers are owned by the library.

See Also
GetBufferOwnership()
SetUserBuffers()
Parameters
modeSystem owned or User owned buffers

Implements ICameraBase.

void SetUserBuffers ( void *const  pMemBuffers,
uint64_t  totalSize 
)
virtual

SetUserBuffers Specify contiguous user allocated memory to use as data buffers.

To prevent image tearing when working with USB3 cameras, the size of each buffer should be equal to: ((unsigned int) (bufferSize + 1024 - 1) / 1024) * 1024 where 1024 is the USB3 packet size.

See Also
GetBufferOwnership()
SetBufferOwnership()
GetUserBufferCount()
GetUserBufferSize()
GetUserBufferTotalSize()
Parameters
pMemBuffersPointer to memory buffers to be written to
totalSizeThe total size of the memory allocated for the user buffers (in bytes)

Implements ICameraBase.

void SetUserBuffers ( void **const  ppMemBuffers,
const uint64_t  bufferCount,
const uint64_t  bufferSize 
)
virtual

SetUserBuffers Specify non-contiguous user allocated memory to use as data buffers.

Each pointer to a buffer must have enough memory to hold one image. To prevent image tearing when working with USB3 cameras, the size of each buffer should be equal to: ((unsigned int) (bufferSize + 1024 - 1) / 1024) * 1024 where 1024 is the USB3 packet size.

See Also
GetBufferOwnership()
SetBufferOwnership()
GetUserBufferCount()
GetUserBufferSize()
GetUserBufferTotalSize()
Parameters
ppMemBuffersPointer to pointers that each point to a single user memory buffer to be written to
bufferCountThe number of user memory buffers
bufferSizeThe size of the memory allocated for each user buffer (in bytes)

Implements ICameraBase.

void UnregisterEventHandler ( EventHandler evtHandlerToUnregister)
virtual

UnregisterEventHandler Unregisters an event handler for the camera Event handlers should be unregistered first before calling camera DeInit().

Otherwise an exception will be thrown in the DeInit() call and require the user to unregister event handlers before the camera can be re-initialized again.

See Also
DeInit()
Parameters
evtHandlerToUnregisterThe event handler to unregister from the camera

Implements ICameraBase.

void WritePort ( uint64_t  iAddress,
const void *  pBuffer,
size_t  iSize 
)
virtual

Implements ICameraBase.

Friends And Related Function Documentation

friend class InterfaceImpl
friend

The documentation for this class was generated from the following file:
Contact Support Spinnaker® SDK Programmer's Guide and API Reference