SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
edge_metrics_provider_impl.hpp
1//
2// Created by greg on 7/17/25.
3// Copyright (c) 2025 Presage Technologies
4//
5// SPDX-License-Identifier: LGPL-3.0-or-later
6
7#pragma once
8// === standard library includes (if any) ===
9// === third-party includes (if any) ===
10// === local includes (if any) ===
11#include "edge_metrics_provider.hpp"
12
13namespace presage::smartspectra::grpc_bindings {
14
15template<container::settings::IntegrationMode TIntegrationMode>
16EdgeMetricsProvider<TIntegrationMode>::EdgeMetricsProvider(std::shared_ptr<BackgroundContainer> container) {
17 SwapContainer(container);
18}
19
20template<container::settings::IntegrationMode TIntegrationMode>
21void EdgeMetricsProvider<TIntegrationMode>::SwapContainer(std::shared_ptr<BackgroundContainer> new_container) {
22 this->container.reset();
23 this->container = std::move(new_container);
24 if (this->container == nullptr) {
25 this->Finish(grpc::Status(
26 grpc::StatusCode::FAILED_PRECONDITION,
27 "Physiology Preprocessing is not running, unable to get metrics."
28 ));
29 }
30 auto status = this->container->SetOnEdgeMetricsOutput(
31 [this](const presage::physiology::Metrics& metrics_output, int64_t timestamp) {
32 this->EnqueueWrite(metrics_output);
33 return absl::OkStatus();
34 }
35 );
36 if (!status.ok()) {
37 this->Finish(rpc::abslStatusToGrpc(status));
38 }
39}
40
41} // namespace presage::smartspectra::grpc_bindings