Sends or receives files from a GigE Vision video interface using the TFTP protocol. More...
Public Member Functions | |
PvTftpClient () | |
Constructor. | |
~PvTftpClient () | |
Destructor. | |
PvResult | Init (const PvString &aDeviceIPAddress, const PvString &aDeviceFilename) |
Initializes the client for file transfer. More... | |
PvResult | SendFile (const PvString &aHostFilename="") |
Sends a local file to the device using TFTP. More... | |
PvResult | SendData (const uint8_t *aBuffer, uint32_t aBufferLength) |
Sends data to a device file using TFTP. More... | |
PvResult | GetFile (const PvString &aHostFilename="") |
Reads a file from the device using TFTP. More... | |
PvResult | GetData (uint8_t *aBuffer, uint32_t aBufferLength, uint32_t *aBytesRead) |
Gets data from a device file using TFTP. More... | |
PvResult | Abort () |
Aborts the current transfer. More... | |
PvResult | GetWarning (PvString &aWarning) |
Pops the oldest transfer warning and returns it in aStatus. More... | |
PvResult | GetTransferResult () const |
Returns the last error message. More... | |
PvResult | GetProgress (int64_t &aCompleted, int64_t &aTotal) |
Returns the transfer progress. More... | |
Sends or receives files from a GigE Vision video interface using the TFTP protocol.
Init must first be called in order to specify the device IP address and file.
SendFile/SendData are used to send a host file or memory buffer to the device file. ReceiveFile/ReceiveData are used to transfer a device file to a host file or memory buffer.
SendFile and ReceiveFile are blocking calls. Another thread can poll GetWarning, GetTransferResult and GetProgress to provide the user with status updates.
Calling Abort from another thread aborts the current transfer.
PvResult PvTftpClient::Abort | ( | ) |
Aborts the current transfer.
As the send and receive methods are blocking, this one needs to be called from a different thread.
PvResult PvTftpClient::GetData | ( | uint8_t * | aBuffer, |
uint32_t | aBufferLength, | ||
uint32_t * | aBytesRead | ||
) |
Gets data from a device file using TFTP.
[in] | aBuffer | pointer to the buffer where the data is written. |
[in] | aBufferLength | the size of the buffer in bytes. |
[in] | aBytesRead | output, the number of bytes read from the device file into aBuffer in bytes. |
Reads a file from the device using TFTP.
[in] | aHostFilename | if provided, the file read from the device is written to that location. If not provided, the file is written to aDeviceFilename (from Init) in the current working directory. |
PvResult PvTftpClient::GetProgress | ( | int64_t & | aCompleted, |
int64_t & | aTotal | ||
) |
Returns the transfer progress.
[out] | aCompleted | how many bytes have been transferred. |
[out] | aTotal | size of the transfer in bytes. |
PvResult PvTftpClient::GetTransferResult | ( | ) | const |
Returns the last error message.
Pops the oldest transfer warning and returns it in aStatus.
[in] | aWarning | the last warning. |
Initializes the client for file transfer.
[in] | aDeviceIPAddress | the IP address of the device to transfer to/from. |
[in] | aDeviceFilename | the name device-side filename written to or read from the device. |
PvResult PvTftpClient::SendData | ( | const uint8_t * | aBuffer, |
uint32_t | aBufferLength | ||
) |
Sends data to a device file using TFTP.
[in] | aBuffer | pointer to the buffer containing the data to send. |
[in] | aBufferLength | the size of the buffer, in bytes. |
Sends a local file to the device using TFTP.
[in] | aHostFilename | if provided, the name of the local file to write to the device. If not provided, the aDeviceFilename (from Init) from the current working directory is sent to the device. |
Copyright (c) 2002-2021 Pleora Technologies Inc.
www.pleora.com