Viam C++ SDK current
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
viam::sdk::DataConsumer Class Reference

A DataConsumer provides an interfaces for a connection to the Viam app which can be used to query historical data for a module resource. More...

#include "module/data_consumer.hpp"

Classes

struct  query_options
 

Public Member Functions

 DataConsumer (DataClient &dc)
 Construct a DataConsumer from the DataClient which will be used to access the Viam app.
 
std::vector< DataClient::BSONBytes > query_tabular_data (const std::string &resource, query_options opts)
 Query historical module data for.
 

Detailed Description

A DataConsumer provides an interfaces for a connection to the Viam app which can be used to query historical data for a module resource.

Remarks
This class deals exclusively with BSON as vectors of bytes; it is up to users to perform BSON encoding/decoding with a library of their choice.

Constructor & Destructor Documentation

◆ DataConsumer()

viam::sdk::DataConsumer::DataConsumer ( DataClient & dc)

Construct a DataConsumer from the DataClient which will be used to access the Viam app.

Remarks
DataConsumer does not own
Parameters
dcand must not outlive it.

Member Function Documentation

◆ query_tabular_data()

std::vector< DataClient::BSONBytes > viam::sdk::DataConsumer::query_tabular_data ( const std::string & resource,
query_options opts )

Query historical module data for.

Parameters
resource.
Remarks
The default query is constructed from environment variables and the arguments passed as follows: The default query is as follows: { "$match": { "part_id": {part_id}, "component_name": {resource}, "time_received": { "$gte": {time_point} } } }

where

  • part_id is the value of the environment variable
  • resource is
    Parameters
    resource
  • time_point is the current time minus the time_back field from
    Parameters
    opts
    If any additional stages are specified in
    Parameters
    optsthey will be added after the default query above.

The documentation for this class was generated from the following file: