Pleora Technologies Inc. eBUS SDK v6.2.8.5877 API



PvGenFile Class Reference

Allows reading/writing to files hosted on the device. More...

Public Member Functions

 PvGenFile ()
 Constructor.
 
virtual ~PvGenFile ()
 Destructor.
 
PvResult Open (PvGenParameterArray *aArray, const PvString &aFilename, PvGenOpenMode aMode)
 Opens a file through the GenICam interface. More...
 
PvResult Close ()
 Closes the PvGenFile. More...
 
bool IsOpened () const
 If the file object is opened or not. More...
 
PvResult WriteFrom (const PvString &aLocalFilename)
 Writes a complete local file to the opened device file. More...
 
PvResult ReadTo (const PvString &aLocalFilename)
 Reads a complete device file and writes it to a local file. More...
 
PvResult Write (const uint8_t *aBuffer, int64_t aLength, int64_t &aBytesWritten)
 Writes data to the opened device file. More...
 
PvResult Read (uint8_t *aBuffer, int64_t aLength, int64_t &aBytesRead)
 Reads data from the opened device file. More...
 
PvResult GetStatus (PvString &aStatus)
 Returns the status of the last operation on a PvGenFile. More...
 
PvString GetLastErrorMessage () const
 Used to retrieve string-based operation of the last operation on a PvGenFile. More...
 
PvResult GetProgress (int64_t &aCompleted, int64_t &aTotal)
 Returns progress about the current read or write operation. More...
 

Static Public Member Functions

static bool IsSupported (PvGenParameterArray *aArray)
 Static method used to query if a PvGenParameterArray supports file access. More...
 
static bool IsReadable (PvGenParameterArray *aArray, const PvString &aFilename)
 Returns true if a file defined by the GenICam interface can be read. More...
 
static bool IsWritable (PvGenParameterArray *aArray, const PvString &aFilename)
 Returns true if a file defined by the GenICam interface can be written. More...
 
static void GetFiles (PvGenParameterArray *aArray, PvStringList &aFiles)
 Returns all files currently supported by a GenICam interface. More...
 

Detailed Description

Allows reading/writing to files hosted on the device.

These files could be debug information, look-up tables, new firmware, configuration files, persistent configurations or just about anything.

Member Function Documentation

PvResult PvGenFile::Close ( )

Closes the PvGenFile.

Closes the PvGenFile, detaches the PvGenParameterArray.

Returns
Includes:
void PvGenFile::GetFiles ( PvGenParameterArray aArray,
PvStringList aFiles 
)
static

Returns all files currently supported by a GenICam interface.

Parameters
[in]aArrayThe GenICam parameter array.
[out]aFilesA string array that is filled with all available files.
PvString PvGenFile::GetLastErrorMessage ( ) const

Used to retrieve string-based operation of the last operation on a PvGenFile.

Use this method to retrieve detailed information about the last failed operation that returned PvResult::Code::GENERIC_ERROR.

EOFs and other status are not considered errors (PvResult::Code::OK is still returned) and are monitored through the GetStatus method.

Returns
Error message associated with the last non PvResult::Code::OK operation on a PvGenFile.
PvResult PvGenFile::GetProgress ( int64_t &  aCompleted,
int64_t &  aTotal 
)

Returns progress about the current read or write operation.

Parameters
[out]aCompletedHow many bytes have been read or written.
[out]aTotalTotal byte count for the read or write operation.
Returns
Includes:
PvResult PvGenFile::GetStatus ( PvString aStatus)

Returns the status of the last operation on a PvGenFile.

Last status of a read or write operation as provided by the device. The only enum entry guaranteed to be provided by all devices is "Success" and everything else is quality of implementation.

As an example, the reference GenApi implementation for files assumes end-of-file (EOF) if anything else other than "Success" is reported after a read or a write.

Open, Close, Read and Write operations can return PvResult::Code::OK but still show something else through GetStatus. The direct result code shows if the internal GenApi operation succeeded and the GetStatus shows the success or failure (or EOF) of the operation on the device.

Parameters
[out]aStatusLast status from a read or write operation.
Returns
Includes:
bool PvGenFile::IsOpened ( ) const

If the file object is opened or not.

Returns
True if it is opened and attached to a PvGenParameterArray, false if not.
bool PvGenFile::IsReadable ( PvGenParameterArray aArray,
const PvString aFilename 
)
static

Returns true if a file defined by the GenICam interface can be read.

Parameters
[in]aArrayThe GenICam parameter array.
[in]aFilenameThe file we are testing readability on.
Returns
True if the file exist and is readable.
bool PvGenFile::IsSupported ( PvGenParameterArray aArray)
static

Static method used to query if a PvGenParameterArray supports file access.

A PvGenParameterArray must support the following features in order to allow access to device files through GenICam:

Parameters
[in]aArrayThe eBUS SDK GenApi parameter array to test.
Returns
True if supported, false if not.
bool PvGenFile::IsWritable ( PvGenParameterArray aArray,
const PvString aFilename 
)
static

Returns true if a file defined by the GenICam interface can be written.

Parameters
[in]aArrayThe eBUS SDK GenApi parameter array.
[in]aFilenameThe file we are testing writability on.
Returns
True if the file exist and is writable.
PvResult PvGenFile::Open ( PvGenParameterArray aArray,
const PvString aFilename,
PvGenOpenMode  aMode 
)

Opens a file through the GenICam interface.

Attaches the PvGenFile object to a GenICam parameter array, validates the filename exists for this device and perform the open operation through GenApi.

Parameters
[in]aArrayThe eBUS SDK GenApi parameter array to use.
[in]aFilenameThe filename of the file to open on the device. Must match one of the pre-defined enumeration entry of the FileSelector feature. The filename is case sensitive.
[in]aModeMode used to access the file. Read or write.
Returns
Includes:
PvResult PvGenFile::Read ( uint8_t *  aBuffer,
int64_t  aLength,
int64_t &  aBytesRead 
)

Reads data from the opened device file.

Reads aLength bytes from the device file into aBuffer. If EOF (end-of-file) is reached, PvResult::Code::OK is returned but aBytesRead is 0 or less than aLength.

Parameters
[in]aBufferPointer to the buffer where to write the data read from the device file.
[in]aLengthNumber of bytes to read to the device file.
[out]aBytesReadNumber of bytes successfully read from the device file.
Returns
Includes:
PvResult PvGenFile::ReadTo ( const PvString aLocalFilename)

Reads a complete device file and writes it to a local file.

Parameters
[in]aLocalFilenameThe full path of the local file where data read from the device file is written to.
Returns
Includes:
PvResult PvGenFile::Write ( const uint8_t *  aBuffer,
int64_t  aLength,
int64_t &  aBytesWritten 
)

Writes data to the opened device file.

Writes aLength bytes from aBuffer to the device file. If EOF (end-of-file) is reached, PvResult::Code::OK is returned but aBytesWritten is 0 or less than aLength.

Parameters
[in]aBufferPointer to the data to write to the device file.
[in]aLengthNumber of bytes to write to the device file.
[out]aBytesWrittenNumber of bytes successfully written to the device file.
Returns
Includes:
PvResult PvGenFile::WriteFrom ( const PvString aLocalFilename)

Writes a complete local file to the opened device file.

If the file you are attempting to write to the device is not of a mod-4 length (in bytes) it will be padded with zero bytes in order to make sure the last write operation does not fail. This requirement does not come from GenICam but from the underlying GigE Vision control protocol.

Parameters
[in]aLocalFilenameThe full path of the local file to write to the device file.
Returns
Includes:

The documentation for this class was generated from the following files:

Copyright (c) 2002-2021 Pleora Technologies Inc.
www.pleora.com