Class EventsManager

Nested Relationships

Nested Types

Class Documentation

class EventsManager

Public Functions

explicit EventsManager(std::string url = "https://events-ingest.cloud.luxonis.com", bool uploadCachedOnStart = false, float publishInterval = 10.0)
~EventsManager()
bool sendEvent(const std::string &name, const std::shared_ptr<ImgFrame> &imgFrame = nullptr, std::vector<std::shared_ptr<EventData>> data = {}, const std::vector<std::string> &tags = {}, const std::unordered_map<std::string, std::string> &extraData = {}, const std::string &deviceSerialNo = "")

Send an event to the events service

Parameters:
  • name – Name of the event

  • imgFrame – Image frame to send

  • data – List of EventData objects to send

  • tags – List of tags to send

  • extraData – Extra data to send

  • deviceSerialNoDevice serial number

Returns:

bool

bool sendSnap(const std::string &name, const std::shared_ptr<ImgFrame> &imgFrame = nullptr, std::vector<std::shared_ptr<EventData>> data = {}, const std::vector<std::string> &tags = {}, const std::unordered_map<std::string, std::string> &extraData = {}, const std::string &deviceSerialNo = "")

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

Parameters:
  • name – Name of the snap

  • imgFrame – Image frame to send

  • data – List of EventData objects to send

  • tags – List of tags to send

  • extraData – Extra data to send

  • deviceSerialNoDevice serial number

Returns:

bool

void setDeviceSerialNumber(const std::string &deviceSerialNumber)
void setUrl(const std::string &url)

Set the URL of the events service. By default, the URL is set to https://events-ingest.cloud.luxonis.com

Parameters:

url – URL of the events service

Returns:

void

void setSourceAppId(const std::string &sourceAppId)

Set the source app ID. By default, the source app ID is taken from the environment variable AGENT_APP_ID

Parameters:

sourceAppId – Source app ID

Returns:

void

void setSourceAppIdentifier(const std::string &sourceAppIdentifier)

Set the source app identifier. By default, the source app identifier is taken from the environment variable AGENT_APP_IDENTIFIER

Parameters:

sourceAppIdentifier – Source app identifier

Returns:

void

void setToken(const std::string &token)

Set the token for the events service. By default, the token is taken from the environment variable DEPTHAI_HUB_API_KEY

Parameters:

token – Token for the events service

Returns:

void

void setQueueSize(uint64_t queuSize)

Set the queue size for the amount of events that can be added and sent. By default, the queue size is set to 10

Parameters:

queueSize – Queue size

Returns:

void

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

bool checkConnection()

Check if the device is connected to Hub. Performs a simple GET request to the URL/health endpoint

Returns:

bool

void uploadCachedData()

Upload cached data to the events service

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