Evaluating Triggers

shared_ptr<TriggerResult> SmartCapture::Client::evaluate(const string & trigger_id)

This method allows the evaluation of a specific trigger based on the current state. The returned TriggerResult pointer has the output.

Returns
shared_ptr<TriggerResult>: TriggerResult struct with output

Parameters
string trigger_id: trigger id to evaluate

Return Codes

  • 301: InvalidTriggerID
  • 302: IncompleteTriggerState
  • 303: InvalidTriggerState

unordered_map<string, shared_ptr<TriggerResult>> SmartCapture::Client::evaluate_all()

This method evaluates all triggers registered for the device in the client. Return type is a map where the key is the trigger_id and the value is a pointer to the TriggerResult.

Returns
unordered_map<string, shared_ptr<TriggerResult>>: all the trigger results

Return Codes

  • 302: IncompleteTriggerState
  • 303: InvalidTriggerState

void SmartCapture::Client::register_trigger_callback(const string & trigger_id, std::function<void(TriggerResult&, string&)>)

Fields
string trigger_id: string trigger id to register the callback too
std::function func: callback function to call when trigger fires, as an example this can upload to Nucleus.

📘

Note

All valid callback functions need to take the evaluation result as TriggerResult, and the trigger_id as string, as inputs.


Did this page help you?