feat: add src/main.cpp
This commit is contained in:
17
src/main.cpp
Normal file
17
src/main.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "fusion.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
const std::int64_t now = 100000;
|
||||
Reading primary{"A", 24.0, now - 100};
|
||||
Reading secondary{"B", 25.5, now - 200};
|
||||
for (int scenario = 0; scenario < 4; ++scenario) {
|
||||
if (scenario == 1) secondary.timestamp_ms = now - 9000;
|
||||
if (scenario == 2) { secondary.timestamp_ms = now; secondary.celsius = 37.0; }
|
||||
if (scenario == 3) { primary.celsius = 150.0; secondary.celsius = 150.0; }
|
||||
auto result = fuse(assess_channel(primary, now), assess_channel(secondary, now));
|
||||
std::cout << state_name(result.state) << " source=" << result.source;
|
||||
if (result.celsius) std::cout << " value=" << *result.celsius;
|
||||
std::cout << '\n';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user