Skip to content

Latest commit

 

History

History
231 lines (128 loc) · 4.71 KB

async_client.md

File metadata and controls

231 lines (128 loc) · 4.71 KB

AsyncClientClass

Description

The async client class.

class AsyncClientClass

Constructors

  1. 🔹 AsyncClientClass()

Default constructor.

AsyncClientClass()
  1. 🔹 AsyncClientClass(Client &client, network_config_data &net)

AsyncClientClass(Client &client, network_config_data &net)

Params:

  • client - The SSL client that working with the network interface.

  • net - The network config data can be obtained from the networking classes via the static function called getNetwork.

  1. 🔹 AsyncClientClass(AsyncTCPConfig &tcpClientConfig, network_config_data &net)

AsyncClientClass(AsyncTCPConfig &tcpClientConfig, network_config_data &net)

Params:

  • tcpClientConfig - The AsyncTCPConfig object. See src/core/AsyncTCPConfig.h

  • net - The network config data can be obtained from the networking classes via the static function called getNetwork.

Functions

  1. 🔹 void setAsyncResult(AsyncResult &result)

Set the external async result to use with the sync task.

If no async result was set (unset) for sync task, the internal async result will be used and shared usage for all sync tasks.

void setAsyncResult(AsyncResult &result)

Params:

  • result - The AsyncResult to set.
  1. 🔹 void unsetAsyncResult()

Unset the external async result use with the sync task.

The internal async result will be used for sync task.

void unsetAsyncResult()
  1. 🔹 bool networkStatus()

Get the network connection status.

bool networkStatus()

Returns:

  • bool - Returns true if network is connected.
  1. 🔹 unsigned long networkLastSeen()

Get the network disconnection time.

unsigned long networkLastSeen()

Returns:

  • unsigned long - The millisec of network successfully connection since device boot.
  1. 🔹 firebase_network_data_type getNetworkType()

Return the current network type.

firebase_network_data_type getNetworkType()

Returns:

  • firebase_network_data_type - The firebase_network_data_type enums are firebase_network_data_default_network, firebase_network_data_generic_network, firebase_network_data_ethernet_network and firebase_network_data_gsm_network.
  1. 🔹 void stopAsync(bool all = false)

Stop and remove the async/sync task from the queue.

void stopAsync(bool all = false)

Params:

  • all - The option to stop and remove all tasks. If false, only running task will be stop and removed from queue.
  1. 🔹 void stopAsync(const String &uid)

Stop and remove the specific async/sync task from the queue.

void stopAsync(const String &uid)

Params:

  • uid - The task identifier of the task to stop and remove from the queue.
  1. 🔹 size_t taskCount() const

Get the number of async/sync tasks that stored in the queue.

size_t taskCount() const

Returns:

  • size_t - The total tasks in the queue.
  1. 🔹 FirebaseError lastError() const

Get the last error information from async client.

FirebaseError lastError() const

Returns:

  • FirebaseError - The FirebaseError object that contains the last error information.
  1. 🔹 String etag() const

Get the response ETag.

String etag() const

Returns:

  • String - The response ETag header.
  1. 🔹 void setETag(const String &etag)

Set the ETag header to the task.

ETag of async client which obtained from etag() function will be empty after it assign to the task.

void setETag(const String &etag) 

Params:

  • etag - The ETag to set to the task.
  1. 🔹 void setSyncSendTimeout(uint32_t timeoutSec)

Set the sync task's send timeout in seconds.

void setSyncSendTimeout(uint32_t timeoutSec)

Params:

  • timeoutSec - The TCP write timeout in seconds.
  1. 🔹 void setSyncReadTimeout(uint32_t timeoutSec)

Set the sync task's read timeout in seconds.

void setSyncReadTimeout(uint32_t timeoutSec) 

Params:

  • timeoutSec - The TCP read timeout in seconds.
  1. 🔹 void setNetwork(Client &client, network_config_data &net)

Set the network interface.

The SSL client set here should work for the type of network set.

void setNetwork(Client &client, network_config_data &net)

Params:

  • client - The SSL client that working with this type of network interface.

  • net - The network config data can be obtained from the networking classes via the static function called getNetwork.