Class EventsManager

Nested Relationships

Nested Types

Class Documentation

class EventsManager

Public Functions

explicit EventsManager(std::string apiKey = "", bool uploadCachedOnStart = false)
inline explicit EventsManager(bool uploadCachedOnStart)
~EventsManager()
std::optional<std::string> sendEvent(const std::string &name, const std::vector<std::string> &tags = {}, const std::unordered_map<std::string, std::string> &extras = {}, const std::vector<std::string> &associateFiles = {})

Send an event to the events service

Parameters:
  • name – Name of the event

  • tags – List of tags to send

  • extras – Extra data to send

  • associateFiles – List of associate files with ids

Returns:

LocalID of the sent Event

std::optional<std::string> sendSnap(const std::string &name, const std::shared_ptr<FileGroup> fileGroup, const std::vector<std::string> &tags = {}, const std::unordered_map<std::string, std::string> &extras = {}, const std::function<void(SendSnapCallbackResult)> successCallback = nullptr, const std::function<void(SendSnapCallbackResult)> failureCallback = nullptr)

Send a snap to the events service. Snaps should be used for sending images and other files.

Parameters:
  • name – Name of the snap

  • fileGroupFileGroup containing FileData objects to send

  • tags – List of tags to send

  • extras – Extra data to send

  • successCallback – Callback to be called when the snap is successfully uploaded to the hub

  • failureCallback – Callback to be called if the snap upload is unsuccessful

Returns:

LocalID of the sent Snap

std::optional<std::string> sendSnap(const std::string &name, const std::optional<std::string> &fileTag, const std::shared_ptr<ImgFrame> imgFrame, const std::optional<std::shared_ptr<ImgDetections>> &imgDetections = std::nullopt, const std::vector<std::string> &tags = {}, const std::unordered_map<std::string, std::string> &extras = {}, const std::function<void(SendSnapCallbackResult)> successCallback = nullptr, const std::function<void(SendSnapCallbackResult)> failureCallback = nullptr)

Send a snap to the events service, with an ImgFrame and ImgDetections pair as files

Parameters:
  • name – Name of the snap

  • fileTag – File tag used to create FileData

  • imgFrameImgFrame to send

  • imgDetectionsImgDetections to sent

  • tags – List of tags to send

  • extras – Extra data to send

  • successCallback – Callback to be called when the snap is successfully uploaded to the hub

  • failureCallback – Callback to be called if the snap upload is unsuccessful

Returns:

LocalID of the sent Snap

bool waitForPendingUploads(uint64_t timeoutMs = 0)

Wait for pending snaps/events to be processed by the background upload thread

Parameters:

timeoutMs – Timeout in milliseconds. 0 means wait until uploads are finished, connection is dropped, or manager is stopped

Returns:

true if the pending data was uploaded before timeout, false if not - either because of timeout, dropped connection, or shutdown

void setLogResponse(bool logResponse)

Set whether to log the responses from the server. By default, logResponse is set to false

Parameters:

logResponse – bool

Returns:

void

void setVerifySsl(bool verifySsl)

Set whether to verify the SSL certificate. By default, verifySsl is set to false

Parameters:

verifySsl – bool

Returns:

void

void setCacheDir(const std::string &cacheDir)

Set the cache directory for storing cached data. By default, the cache directory is set to /internal/private

Parameters:

cacheDir – Cache directory

Returns:

void

void setCacheIfCannotSend(bool cacheIfCannotSend)

Set whether to cache data if it cannot be sent. By default, cacheIfCannotSend is set to false

Parameters:

cacheIfCannotSend – bool

Returns:

void