Class EventsManager
Defined in File EventsManager.hpp
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
Send a snap to the events service. Snaps should be used for sending images and other files.
- Parameters:
name – Name of the snap
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
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
imgFrame – ImgFrame to send
imgDetections – ImgDetections 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
-
explicit EventsManager(std::string apiKey = "", bool uploadCachedOnStart = false)