Buffer Interface
|
Acquire images into a circular buffer using a BitFlow frame grabber. More...
#include <CircularInterface.h>
Public Member Functions | |
CircularInterface (BFVOID) | |
CircularInterface (const BFU32 brdNumber) | |
CircularInterface (const BFU32 brdNumber, const BFU32 numBuffers, const BFU32 errorMode, const BFU32 options) | |
CircularInterface (const BFU32 brdNumber, const BFU32 numBuffers, const BFU32 errorMode, const BFU32 options, const BFSIZET alignment) | |
~CircularInterface (BFVOID) | |
BFVOID | setup (const BFU32 numBuffers, const BFU32 errorMode, const BFU32 options) |
BFVOID | setup (const BFU32 numBuffers, const BFU32 errorMode, const BFU32 options, const BFSIZET alignment) |
BFVOID | setup (PBFU32 *const pMemArray, const BFU32 numBuffers, const BFU32 errorMode, const BFU32 options) |
BFVOID | cleanup (BFVOID) |
BFVOID | cirControl (const BFU32 command, const BFU32 options) |
BFU32 | cirErrorWait (BFVOID) const |
BFRC | getCirError (BFVOID) |
BFU32 | waitDoneFrame (const BFU32 timeout, const PBiCirHandle CirHandle) const |
BFU32 | setBufferStatus (BiCirHandle &cirHandle, const BFU32 status) |
BFU32 | setBufferStatus (const BFU32 bufferNumber, const BFU32 status) |
BFU32 | getBufferStatus (BiCirHandle const &cirHandle) const |
BFU32 | getBufferStatus (const BFU32 bufferNumber) const |
Public Member Functions inherited from BufferAcquisition::BufferInterface | |
BufferInterface (BFVOID) | |
virtual | ~BufferInterface (BFVOID) |
BFVOID | open (const BFU32 brdNumber) |
BFVOID | open (const BFU32 brdNumber, const BFU32 options) |
BFVOID | open (const BFU32 brdNumber, std::string const &camFileName) |
BFVOID | open (const BFU32 brdNumber, const BFCHAR *const camFileName) |
BFVOID | open (const BFU32 brdNumber, std::string const &camFileName, const BFU32 options) |
BFVOID | open (const BFU32 brdNumber, const BFCHAR *const camFileName, const BFU32 options) |
BFVOID | openSWConnector (const BFU32 Switch, const BFU32 Connector) |
BFVOID | openSWConnector (const BFU32 Switch, const BFU32 Connector, const BFU32 options) |
BFVOID | close (BFVOID) |
Bd | getBoardHandle (BFVOID) const |
BFU32 | getBoardNumber (BFVOID) const |
BFVOID | getBoardSWConnector (BFU32 &Switch, BFU32 &Connector) |
BFSIZET | enumerateCameraModes (std::vector< std::string > &modes, std::vector< std::string > &descriptions=std::vector< std::string >()) const |
BFBOOL | enumerateCameraMode (const BFSIZET index, BFCHAR *const modeBuf, BFSIZET *const pModeSize, BFCHAR *const descBuf, BFSIZET *const pDescSize) const |
std::string | getCameraMode (BFVOID) const |
BFBOOL | getCameraMode (BFCHAR *const modeBuf, BFSIZET *const pModeSize) const |
BFVOID | setCameraMode (std::string const &modeName) |
BFVOID | setCameraMode (const BFCHAR *const modeName) |
BFVOID | setAcqFrameSize (const BFU32 XSize, const BFU32 YSize) |
BFVOID | setAcqROI (const BFU32 XOffset, const BFU32 YOffset, const BFU32 XSize, const BFU32 YSize) |
BFVOID | setExTriggerConnect (const CiTrigSelect trigger=CiTrigA, const BFU32 state=BFExTrigConnect) |
BFVOID | setExposureControl (const BFDOUBLE ExposurePeriod, const BFDOUBLE LineFramePeriod, const BFU32 TriggerMode, const BFBOOL AssertedHigh, const BFU32 OutputSignal) |
BFVOID | getExposureControl (BFDOUBLE &ExposurePeriod, BFDOUBLE &LineFramePeriod, BFU32 &TriggerMode, BFBOOL &AssertedHigh, BFU32 &OutputSignal) const |
PBFU32 * | getBufferArrayPointers (BFVOID) |
const PBFU32 * | getBufferArrayPointers (BFVOID) const |
BFU32 | getBrdInfo (const BFU32 brdInqVar) const |
BFU32 | getNumFramesCaptured (BFVOID) const |
BFU32 | getNumFramesMissed (BFVOID) const |
BFBOOL | getStartAcqFlag (BFVOID) const |
BFBOOL | getStopAcqFlag (BFVOID) const |
BFBOOL | getAbortAcqFlag (BFVOID) const |
BFBOOL | getPauseAcqFlag (BFVOID) const |
BFBOOL | getCleanupAcqFlag (BFVOID) const |
BFVOID | setTriggerMode (const BFU32 triggerMode=BiTrigFreeRun, const BFU32 trigPolarity=BiTrigAssertedHigh) |
BFU32 | getTriggerMode (BFVOID) const |
BFU32 | getTriggerPolarity (BFVOID) const |
BFVOID | issueSoftwareTrigger (const BFU32 trigMode=BiTrigAssertTrigA) |
BFU32 | showError (const BFU32 errorNum) const |
BFVOID | writeBuffer (PBFCHAR fileName, const BFSIZET fileNameSize, const BFU32 bufferNumber, const BFU32 options) const |
BFVOID | writeBuffer (std::string const &fileName, const BFU32 bufferNumber, const BFU32 options) const |
BFVOID | writeSeqBuffer (PBFCHAR fileName, const BFSIZET fileNameSize, const BFU32 firstBufNumber, const BFU32 numBufs, const BFU32 Options) const |
BFVOID | writeSeqBuffer (std::string const &fileName, const BFU32 firstBufNumber, const BFU32 numBufs, const BFU32 Options) const |
BFVOID | readSeqFile (std::string const &fileName, const BFU32 firstBufNumber, const BFU32 numBufs) |
BFVOID | readSeqFile (const BFCHAR *const fileName, const BFU32 firstBufNumber, const BFU32 numBufs) |
BFVOID | clearBuffers (BFVOID) |
std::string | getErrorText (const BFU32 errorNumber) const |
BFVOID | getErrorText (const BFU32 errorNumber, PBFCHAR errorText, const PBFU32 errorTextSize) const |
BFU32 | getBufferQueueSize (BFVOID) const |
BFVOID | setTimeout (const BFU32 TimeoutValue) |
BFVOID | loadCamFile (std::string const &camFileName) |
BFVOID | loadCamFile (const BFCHAR *const camFileName) |
BFVOID | unloadCamFile (BFVOID) |
BFU32 | cxpReadReg (const BFU32 address) const |
BFU32 | cxpReadReg (const BFU32 link, const BFU32 address) const |
BFVOID | cxpWriteReg (const BFU32 address, const BFU32 value) |
BFVOID | cxpWriteReg (const BFU32 link, const BFU32 address, const BFU32 value) |
BFSIZET | cxpReadData (const BFU32 address, const BFU32 bytesToRead, std::vector< BFU8 > &dataOut) const |
BFSIZET | cxpReadData (const BFU32 address, const BFU32 bytesToRead, BFU8 *const dataOut, const BFSIZET dataOutSize) const |
BFSIZET | cxpReadData (const BFU32 link, const BFU32 address, const BFU32 bytesToRead, std::vector< BFU8 > &dataOut) const |
BFSIZET | cxpReadData (const BFU32 link, const BFU32 address, const BFU32 bytesToRead, BFU8 *const dataOut, const BFSIZET dataOutSize) const |
BFVOID | cxpWriteData (const BFU32 address, std::vector< BFU8 > const &dataIn) |
BFVOID | cxpWriteData (const BFU32 address, const BFU8 *const dataIn, const BFSIZET dataInSize) |
BFVOID | cxpWriteData (const BFU32 link, const BFU32 address, std::vector< BFU8 > const &dataIn) |
BFVOID | cxpWriteData (const BFU32 link, const BFU32 address, const BFU8 *const dataIn, const BFSIZET dataInSize) |
std::string | bfRegName (const BFU32 RegId) const |
BFVOID | bfRegName (const BFU32 RegId, PBFCHAR nameBuf, const BFSIZET nameBufSize) const |
BFU32 | bfRegId (std::string const ®Name) const |
BFU32 | bfRegId (const BFCHAR *const regName) const |
BFU32 | bfRegPeek (const BFU32 RegId) const |
BFVOID | bfRegPoke (const BFU32 RegId, const BFU32 Value) |
BFBOOL | isBoardOpen (BFVOID) const |
BFBOOL | isBoardSetup (BFVOID) const |
BufferInterface::Properties const & | properties (void) const |
Additional Inherited Members | |
Static Public Member Functions inherited from BufferAcquisition::BufferInterface | |
static BFU32 | boardCount (BFVOID) |
static BFU32 | getMajorVersion (BFVOID) |
static BFU32 | getMinorVersion (BFVOID) |
Protected Attributes inherited from BufferAcquisition::BufferInterface | |
Bd | m_hBoard |
BIBA | m_BufferArray |
PBFCNF | m_pCam |
BFBOOL | isMemAssigned |
BFBOOL | isMemAllocated |
BFBOOL | isSetup |
BFBOOL | isOpen |
Acquire images into a circular buffer using a BitFlow frame grabber.
An interface to acquire images continuously in a circular buffer. In a circular acquisition continues indefinitely, until explicitly stopped.
CircularInterface::CircularInterface | ( | BFVOID | ) |
Initilizes a new CircularInterface object.
CircularInterface::CircularInterface | ( | const BFU32 | brdNumber | ) |
Initilizes a new CircularInterface object and opens the bitflow board.
[in] | brdNumber | - The board number to open. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BufferAcquisition::BufferInterface::open().
CircularInterface::CircularInterface | ( | const BFU32 | brdNumber, |
const BFU32 | numBuffers, | ||
const BFU32 | errorMode, | ||
const BFU32 | options | ||
) |
Initilizes a new CircularInterface object. Opens and sets up the board using attached camera file. When using this constructor, there is no need to call setup.
[in] | brdNumber | - The board number to open. |
[in] | numBuffers | - The number of buffers to create. |
[in] | errorMode | - The error mode to use when there are no buffers. available to acquire into. The error mode can be one of the following: CirErStop - Stop acquisition when no buffers are available. CirErIgnore - Overwrite buffers regardless of status. |
[in] | options | - Options for setup: NoResetOnError - Will not reset acquisition on overflow or hardware exception. AbortMissedFrame - If a frame is missed, acquisition will stop. DisableAqErrorSig - The overflow and hardware exception signals will not be created. Options can be ORed together. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BufferAcquisition::BufferInterface::close(), BufferAcquisition::BufferInterface::open(), and setup().
CircularInterface::CircularInterface | ( | const BFU32 | brdNumber, |
const BFU32 | numBuffers, | ||
const BFU32 | errorMode, | ||
const BFU32 | options, | ||
const BFSIZET | alignment | ||
) |
Initilizes a new CircularInterface object. Opens and sets up the board using attached camera file. When allocating the buffers, each buffer will be aligned by the specified alignment boundary. When using this constructor, there is no need to call setup.
[in] | brdNumber | - The board number to open. |
[in] | numBuffers | - The number of buffers to create. |
[in] | errorMode | - The error mode to use when there are no buffers. available to acquire into. The error mode can be one of the following: CirErStop - Stop acquisition when no buffers are available. CirErIgnore - Overwrite buffers regardless of status. |
[in] | options | - Options for setup: NoResetOnError - Will not reset acquisition on overflow or hardware exception. AbortMissedFrame - If a frame is missed, acquisition will stop. DisableAqErrorSig - The overflow and hardware exception signals will not be created. Options can be ORed together. |
[in] | alignment | - Allocate each buffer on this specified alignment boundary. The alignment value must be an integer power of 2. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BufferAcquisition::BufferInterface::close(), BufferAcquisition::BufferInterface::open(), and setup().
CircularInterface::~CircularInterface | ( | BFVOID | ) |
Cleanup resources when closing down
References BFNULL, cleanup(), BufferAcquisition::BufferInterface::close(), and BufferAcquisition::BufferInterface::m_hBoard.
Controls the circular acquisition system.
[in] | command | - Can be one of the following: BISTART - Starts acquisition. BISTOP - Stops acquisition after the current frame is acquired. BIABORT - Stops acquisition immediately. BIPAUSE - Pauses acquisition after the current frame is acquired. BIRESUME - Resumes acquisition after acquisition has been paused. |
[in] | options | - Can be one of the following: BIWait - Waits for the current command to be completed before returning. BIAsync - The method returns as soon as the command is issued. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_CIR_INVALID_CMD_SEQ, BI_OK, BIABORT, BISTOP, BiException::check(), BufferAcquisition::BufferInterface::m_BufferArray, and BufferAcquisition::BufferInterface::m_hBoard.
Returns when an acquisition error has occured or when the cleanup method has been called. This method is designed to be placed in a separate thread and will return when an error occurs. When the method returns, the error thread can take the appropriate action. This method only handles acquisition errors such as a FIFO overflow, acquisition timeout, and loss of sync. When cleanup is call this method will return BI_CIR_CLEANUP.
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_CALL_SETUP, BiException::check(), BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, and BufferAcquisition::BufferInterface::m_hBoard.
Shuts down current acquisition, kill all threads, and releases all resources allocated when instantiated. The setup method should be called before this function. Cleanup gets called from the desctructor so in most cases there will be no need for the user to call this method.
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BiException::check(), FALSE, BufferAcquisition::BufferInterface::isMemAllocated, BufferAcquisition::BufferInterface::isMemAssigned, BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, and BufferAcquisition::BufferInterface::m_hBoard.
Referenced by ~CircularInterface().
BFU32 CircularInterface::getBufferStatus | ( | BiCirHandle const & | cirHandle | ) | const |
Returns the current acquisition status for a buffer.
[in] | cirHandle | - The handle of the buffer to get status from. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_CALL_SETUP, BiException::check(), BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, and BufferAcquisition::BufferInterface::m_hBoard.
Returns the current acquisition status for a buffer.
[in] | bufferNumber | - The buffer number to get status from. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_CALL_SETUP, BiException::check(), BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, and BufferAcquisition::BufferInterface::m_hBoard.
Returns any errors on the error stack. If there are no errors on the error stack, BI_OK will be returned. This method does not require the use of a separate error thread. For single threaded applications, this method can be called frome time to time to check for error conditions.
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_CALL_SETUP, BiException::check(), BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, and BufferAcquisition::BufferInterface::m_hBoard.
BFU32 CircularInterface::setBufferStatus | ( | BiCirHandle & | cirHandle, |
const BFU32 | status | ||
) |
Changes the status of the buffer designated by CirHandle. The status can be changed to BIAVAILABLE or BIHOLD only. An error will be thrown if the status is anything but BIAVAILABLE or BIHOLD.
[in] | cirHandle | - The handle of the buffer to change status on. |
[in] | status | - The status to change the buffer too. Status can be one of the following: BIAVAILABLE - The buffer is available for acquisition. BIHOLD - The buffer is unavailable for acquisition. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_CALL_SETUP, BI_ERROR_MARK_HOLD, BI_OK, BiException::check(), BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, and BufferAcquisition::BufferInterface::m_hBoard.
Changes the status of the buffer designated by bufferNumber. The status can be changed to BIAVAILABLE or BIHOLD only. An error will be thrown if the status is anything but BIAVAILABLE or BIHOLD.
[in] | bufferNumber | - The buffer number to change status on. |
[in] | status | - The status to change the buffer too. Status can be one of the following: BIAVAILABLE - The buffer is available for acquisition. BIHOLD - The buffer is unavailable for acquisition. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_CALL_SETUP, BI_ERROR_MARK_HOLD, BI_OK, BiException::check(), BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, and BufferAcquisition::BufferInterface::m_hBoard.
BFVOID CircularInterface::setup | ( | const BFU32 | numBuffers, |
const BFU32 | errorMode, | ||
const BFU32 | options | ||
) |
Sets up the system for circular acquisition by allocating memory and setting up the board. The allocating of memory will be based on the x and y sizes along with the bit depth of the current attached camera file.
[in] | numBuffers | - The number of buffers to allocate. |
[in] | errorMode | - The error mode to use when there are no buffers available to acquire into. The error mode can be one of the following: CirErStop - Stop acquisition when no buffers are available. CirErIgnore - Overwrite buffers regardless of status. |
[in] | options | - Options for setup: NoResetOnError - Will not reset acquisition on overflow or hardware exception. AbortMissedFrame - If a frame is missed, acquisition will stop. DisableAqErrorSig - The overflow and hardware exception signals will not be created. Options can be ORed together. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_SETUP_TWICE, BI_OK, BiAqEngJ, BiException::check(), BufferAcquisition::BufferInterface::isMemAllocated, BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, BufferAcquisition::BufferInterface::m_hBoard, and TRUE.
Referenced by CircularInterface().
BFVOID CircularInterface::setup | ( | const BFU32 | numBuffers, |
const BFU32 | errorMode, | ||
const BFU32 | options, | ||
const BFSIZET | alignment | ||
) |
Sets up the system for circular acquisition by allocating memory and setting up the board. The allocating of memory will be based on the x and y sizes along with the bit depth of the current attached camera file. When allocating the buffers, each buffer will be aligned by the specified alignment boundary.
[in] | numBuffers | - The number of buffers to allocate. |
[in] | errorMode | - The error mode to use when there are no buffers available to acquire into. The error mode can be one of the following: CirErStop - Stop acquisition when no buffers are available. CirErIgnore - Overwrite buffers regardless of status. |
[in] | options | - Options for setup: NoResetOnError - Will not reset acquisition on overflow or hardware exception. AbortMissedFrame - If a frame is missed, acquisition will stop. DisableAqErrorSig - The overflow and hardware exception signals will not be created. Options can be ORed together. |
[in] | alignment | - Allocate each buffer on this specified alignment boundary. The alignment value must be an integer power of 2. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_SETUP_TWICE, BI_OK, BiAqEngJ, BiException::check(), BufferAcquisition::BufferInterface::isMemAllocated, BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, BufferAcquisition::BufferInterface::m_hBoard, and TRUE.
BFVOID CircularInterface::setup | ( | PBFU32 *const | pMemArray, |
const BFU32 | numBuffers, | ||
const BFU32 | errorMode, | ||
const BFU32 | options | ||
) |
Sets up the system for circular acquisition by using memory allocated by the user.
[in] | pMemArray | - A pointer to an array of pointers that point to each buffer allocated by the user. |
[in] | numBuffers | - The number of buffers allocated by the user. |
[in] | errorMode | - The error mode to use when there are no buffers available to acquire into. The error mode can be one of the following: CirErStop - Stop acquisition when no buffers are available. CirErIgnore - Overwrite buffers regardless of status. |
[in] | options | - Options for setup: NoResetOnError - Will not reset acquisition on overflow or hardware exception. AbortMissedFrame - If a frame is missed, acquisition will stop. DisableAqErrorSig - The overflow and hardware exception signals will not be created. Options can be ORed together. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_ERROR_SETUP_TWICE, BI_OK, BiAqEngJ, BiException::check(), BufferAcquisition::BufferInterface::isMemAssigned, BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, BufferAcquisition::BufferInterface::m_hBoard, and TRUE.
BFU32 CircularInterface::waitDoneFrame | ( | const BFU32 | timeout, |
const PBiCirHandle | cirHandle | ||
) | const |
Returns when a frame has been completly DMAed into memory. If this method is called after a frame has been captured into memory, the method returns immediately.
[in] | timeout | - The number of milliseconds to wait for the end of frame. |
[out] | cirHandle | - a pointer to a handle of the acquired buffer. The handle includes the following information: pBufData - A pointer to the image data buffer. FrameCount - The number of frames that have been acquired. TimeStamp - The time stamp of the acquired image. BufferNumber - The buffer number the image is in. NumLinesAcquired - Number of lines acquired. pNode - A pointer to the node in the linked list. |
BiException | - Use the showErrorMsg method to get information on the thrown exception. |
References BI_CANCEL_CIR_FRAME_DONE, BI_CIR_ABORTED, BI_CIR_STOPPED, BI_ERROR_CALL_SETUP, BI_OK, BiException::check(), BufferAcquisition::BufferInterface::isSetup, BufferAcquisition::BufferInterface::m_BufferArray, and BufferAcquisition::BufferInterface::m_hBoard.