CFx SDK Documentation  2022 SP0
Public Types | Public Member Functions | List of all members
CFxNANetworkReply Class Reference

#include <FxNANetworkReply.h>

Inheritance diagram for CFxNANetworkReply:
CFxUIObject

Public Types

enum  NetworkError {
  NoError = 0 , ConnectionRefusedError = 1 , RemoteHostClosedError , HostNotFoundError ,
  TimeoutError , OperationCanceledError , SslHandshakeFailedError , TemporaryNetworkFailureError ,
  NetworkSessionFailedError , BackgroundRequestNotAllowedError , TooManyRedirectsError , InsecureRedirectError ,
  UnknownNetworkError = 99 , ProxyConnectionRefusedError = 101 , ProxyConnectionClosedError , ProxyNotFoundError ,
  ProxyTimeoutError , ProxyAuthenticationRequiredError , UnknownProxyError = 199 , ContentAccessDenied = 201 ,
  ContentOperationNotPermittedError , ContentNotFoundError , AuthenticationRequiredError , ContentReSendError ,
  ContentConflictError , ContentGoneError , UnknownContentError = 299 , ProtocolUnknownError = 301 ,
  ProtocolInvalidOperationError , ProtocolFailure = 399 , InternalServerError = 401 , OperationNotImplementedError ,
  ServiceUnavailableError , UnknownServerError = 499
}
 
typedef CFxNAPair< CFxNAByteArray, CFxNAByteArrayRawHeaderPair
 

Public Member Functions

 CFxNANetworkReply ()=delete
 
 CFxNANetworkReply (FxNativeHandle nativeReply)
 
 CFxNANetworkReply (std::nullptr_t)=delete
 
 ~CFxNANetworkReply ()
 
void setRequest (const CFxNANetworkRequest &request)
 
const CFxNANetworkRequestrequest () const
 
bool isFinished () const
 
bool isRunning () const
 
NetworkError error () const
 
CFxNAString errorString () const
 
long long bytesAvailable () const
 
CFxNAByteArray readAll ()
 
long long pos () const
 
bool seek (long long pos)
 
CFxNAVariant attribute (CFxNANetworkRequest::Attribute code) const
 
CFxNAVariant header (CFxNANetworkRequest::KnownHeaders header) const
 
bool hasRawHeader (const CFxNAByteArray &headerName) const
 
CFxNAByteArray rawHeader (const CFxNAByteArray &headerName) const
 
CFxNAList< CFxNAByteArrayrawHeaderList () const
 
const CFxNAList< RawHeaderPair > & rawHeaderPairs () const
 
void abort ()
 
CFxUISignal< void(long long bytesReceived, long long bytesTotal)> & downloadProgress ()
 
CFxUISignal< void(long long bytesSent, long long bytesTotal)> & uploadProgress ()
 
CFxUISignal< void(void)> & encrypted ()
 
CFxUISignal< void(NetworkError)> & error ()
 
CFxUISignal< void(void)> & finished ()
 
- Public Member Functions inherited from CFxUIObject
 CFxUIObject ()
 
virtual ~CFxUIObject ()
 
FxNativeHandle getHandle () const
 
void setHandle (FxNativeHandle handle)
 
void setParent (CFxUIObject *parent)
 
CFxUIObjectparent ()
 
const CFxUIObjectparent () const
 
void setObjectName (const CFxUIString &objectName)
 
CFxUIString objectName () const
 
bool setProperty (const char *name, const CFxUIVariant &value)
 
CFxUIVariant property (const char *name)
 
CFxUIList< CFxUIObject * > children () const
 
template<typename T >
CFxUIList< T > findChildren (const CFxUIString &name=CFxUIString())
 
void blockSignals (bool block)
 
bool signalsBlocked () const
 

Additional Inherited Members

- Protected Member Functions inherited from CFxUIObject
CFxUIObjectsender ()
 
- Protected Attributes inherited from CFxUIObject
CFxUIObjectImpl * m_pImpl
 
CFxUIObjectData * m_pData
 

Detailed Description

Class CFxNANetworkReply class contains the data and headers for a request sent with CFxNANetworkAccessManager.

Definition at line 44 of file FxNANetworkReply.h.

Member Typedef Documentation

◆ RawHeaderPair

Definition at line 233 of file FxNANetworkReply.h.

Member Enumeration Documentation

◆ NetworkError

This enum type indicates all possible error conditions found during the processing of the request.

Enumerator
NoError 

no error condition.

ConnectionRefusedError 

the remote server refused the connection (the server is not accepting requests)

RemoteHostClosedError 

the remote server closed the connection prematurely, before the entire reply was received and processed

HostNotFoundError 

the remote host name was not found (invalid hostname)

TimeoutError 

the connection to the remote server timed out

OperationCanceledError 

the operation was canceled via calls to abort() or close() before it was finished.

SslHandshakeFailedError 

the SSL/TLS handshake failed and the encrypted channel could not be established. The sslErrors() signal should have been emitted.

TemporaryNetworkFailureError 

the connection was broken due to disconnection from the network, however the system has initiated roaming to another access point.

NetworkSessionFailedError 

the connection was broken due to disconnection from the network or failure to start the network.

BackgroundRequestNotAllowedError 

the background request is not currently allowed due to platform policy.

TooManyRedirectsError 

while following redirects, the maximum limit was reached.

InsecureRedirectError 

while following redirects, the network access API detected a redirect from a encrypted protocol (https) to an unencrypted one (http).

UnknownNetworkError 

an unknown network-related error was detected

ProxyConnectionRefusedError 

the connection to the proxy server was refused (the proxy server is not accepting requests)

ProxyConnectionClosedError 

the proxy server closed the connection prematurely, before the entire reply was received and processed

ProxyNotFoundError 

the proxy host name was not found (invalid proxy hostname)

ProxyTimeoutError 

the connection to the proxy timed out or the proxy did not reply in time to the request sent

ProxyAuthenticationRequiredError 

the proxy requires authentication in order to honour the request but did not accept any credentials offered (if any)

UnknownProxyError 

an unknown proxy-related error was detected

ContentAccessDenied 

the access to the remote content was denied (similar to HTTP error 403)

ContentOperationNotPermittedError 

the operation requested on the remote content is not permitted

ContentNotFoundError 

the remote content was not found at the server (similar to HTTP error 404)

AuthenticationRequiredError 

the remote server requires authentication to serve the content but the credentials provided were not accepted (if any)

ContentReSendError 

the request needed to be sent again, but this failed for example because the upload data could not be read a second time.

ContentConflictError 

the request could not be completed due to a conflict with the current state of the resource.

ContentGoneError 

the requested resource is no longer available at the server.

UnknownContentError 

an unknown error related to the remote content was detected

ProtocolUnknownError 

the Network Access API cannot honor the request because the protocol is not known

ProtocolInvalidOperationError 

the requested operation is invalid for this protocol

ProtocolFailure 

a breakdown in protocol was detected (parsing error, invalid or unexpected responses, etc.)

InternalServerError 

the server encountered an unexpected condition which prevented it from fulfilling the request.

OperationNotImplementedError 

the server does not support the functionality required to fulfill the request.

ServiceUnavailableError 

the server is unable to handle the request at this time.

UnknownServerError 

an unknown error related to the server response was detected

Definition at line 50 of file FxNANetworkReply.h.

Constructor & Destructor Documentation

◆ CFxNANetworkReply() [1/3]

CFxNANetworkReply::CFxNANetworkReply ( )
delete

Constructor

Not able to create object with default constructor.

◆ CFxNANetworkReply() [2/3]

CFxNANetworkReply::CFxNANetworkReply ( FxNativeHandle  nativeReply)
explicit

Constructor

◆ CFxNANetworkReply() [3/3]

CFxNANetworkReply::CFxNANetworkReply ( std::nullptr_t  )
delete

Constructor

◆ ~CFxNANetworkReply()

CFxNANetworkReply::~CFxNANetworkReply ( )

Destructor

Member Function Documentation

◆ abort()

void CFxNANetworkReply::abort ( )

Aborts the operation immediately and close down any network connections still open.

Uploads still in progress are also aborted.

◆ attribute()

CFxNAVariant CFxNANetworkReply::attribute ( CFxNANetworkRequest::Attribute  code) const

Returns the attribute associated with the code code.

Parameters
codeInput attribute define by Attribute enum
Returns
NAVariant This returns an CFxNAVariant attribute.

◆ bytesAvailable()

long long CFxNANetworkReply::bytesAvailable ( ) const

Returns the number of bytes that are available for reading.

This function is commonly used with sequential devices to determine the number of bytes to allocate in a buffer before reading.

Returns
long

◆ downloadProgress()

CFxUISignal<void( long long bytesReceived, long long bytesTotal )>& CFxNANetworkReply::downloadProgress ( )

Signal is emitted to indicate the progress of the download part of this network request, if there's any.

If there's no download associated with this request, this signal will be emitted once with 0 as the value of both bytesReceived and bytesTotal.

◆ encrypted()

CFxUISignal<void( void )>& CFxNANetworkReply::encrypted ( )

Signal is emitted when an SSL/TLS session has successfully completed the initial handshake.

At this point, no user data has been transmitted

◆ error() [1/2]

CFxUISignal<void( NetworkError )>& CFxNANetworkReply::error ( )

This signal is emitted when the reply detects an error in processing.

The finished() signal will probably follow, indicating that the connection is over.

◆ error() [2/2]

NetworkError CFxNANetworkReply::error ( ) const

Returns the error that was found during the processing of this request. If no error was found, returns NoError.

Returns
NetworkError

◆ errorString()

CFxNAString CFxNANetworkReply::errorString ( ) const

Returns a human-readable description of the last device error that occurred.

Returns
NAString

◆ finished()

CFxUISignal<void( void )>& CFxNANetworkReply::finished ( )

This signal is emitted when the reply has finished processing. After this signal is emitted, there will be no more updates to the reply's data or metadata.

Unless close() or abort() have been called, the reply will be still be opened for reading, so the data can be retrieved by calls to read() or readAll().

◆ hasRawHeader()

bool CFxNANetworkReply::hasRawHeader ( const CFxNAByteArray headerName) const

Returns true if the raw header of name headerName was sent by the remote server

Parameters
headerNameInput
Returns
bool

◆ header()

CFxNAVariant CFxNANetworkReply::header ( CFxNANetworkRequest::KnownHeaders  header) const

Returns the value of the known header header, if that header was sent by the remote server

Parameters
headerInput attribute define by KnownHeaders enum
Returns
NAVariant If the header was not sent, returns an invalid CFxNAVariant.

◆ isFinished()

bool CFxNANetworkReply::isFinished ( ) const

Returns true when the reply has finished or was aborted.

Returns
bool

◆ isRunning()

bool CFxNANetworkReply::isRunning ( ) const

Returns true when the request is still processing and the reply has not finished or was aborted yet.

Returns
bool

◆ pos()

long long CFxNANetworkReply::pos ( ) const

For random-access devices, this function returns the position that data is written to or read from.

Returns
long

◆ rawHeader()

CFxNAByteArray CFxNANetworkReply::rawHeader ( const CFxNAByteArray headerName) const

Returns the raw contents of the header headerName as sent by the remote server.

Parameters
headerNameInput
Returns
byteArray

◆ rawHeaderList()

CFxNAList< CFxNAByteArray > CFxNANetworkReply::rawHeaderList ( ) const

Returns a list of headers fields that were sent by the remote server, in the order that they were sent.

Duplicate headers are merged together and take place of the latter duplicate.

Returns
list This returns the list of CFxNAByteArray type.

◆ rawHeaderPairs()

const CFxNAList< RawHeaderPair >& CFxNANetworkReply::rawHeaderPairs ( ) const

◆ readAll()

CFxNAByteArray CFxNANetworkReply::readAll ( )

Reads all remaining data from the device, and returns it as a byte array.

Returns
NAByteArray

◆ request()

const CFxNANetworkRequest& CFxNANetworkReply::request ( ) const

Returns the request that was posted for this reply. In special, note that the URL for the request may be different than that of the reply.

Returns
CFxNANetworkRequest

◆ seek()

bool CFxNANetworkReply::seek ( long long  pos)

For random-access devices, this function sets the current position to pos, returning true on success, or false if an error occurred.

Parameters
posInput
Returns
bool

◆ setRequest()

void CFxNANetworkReply::setRequest ( const CFxNANetworkRequest request)

Sets the associated request for this object to be request. This value will be returned by request().

Parameters
requestInput

◆ uploadProgress()

CFxUISignal<void( long long bytesSent, long long bytesTotal )>& CFxNANetworkReply::uploadProgress ( )

Signal is emitted to indicate the progress of the upload part of this network request, if there's any. If there's no upload associated with this request, this signal will not be emitted.

The bytesSent parameter indicates the number of bytes uploaded, while bytesTotal indicates the total number of bytes to be uploaded.

If the number of bytes to be uploaded could not be determined, bytesTotal will be -1.


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