| |
| #include <chrono> // NOLINT |
| #include <iostream> |
| #include <string> |
| #include <thread> // NOLINT |
| |
| #include "absl/flags/flag.h" |
| #include "absl/flags/parse.h" |
| #include "tlbmc/hal/shared_mem/client.h" |
| |
| ABSL_FLAG(bool, unit_test, false, "Use shared memory for unit test."); |
| |
| int main(int argc, char** argv) { |
| absl::ParseCommandLine(argc, argv); |
| if (absl::GetFlag(FLAGS_unit_test)) { |
| milotic_tlbmc::SharedMemoryClient::SetUpInstanceForUnitTest(); |
| } |
| |
| std::cout << "SharedMemoryClient: " << '\n'; |
| float value = 0.0f; |
| while (true) { |
| milotic_tlbmc::SharedMemoryClient::GetInstance() |
| .UpdateSensorValue("sensor001", value).IgnoreError(); |
| std::cout << "Set Sensor value: " << value << "\n"; |
| value += 1.0f; |
| std::this_thread::sleep_for(std::chrono::microseconds(1)); |
| } |
| |
| return 0; |
| } |