-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.cpp
More file actions
69 lines (55 loc) · 2.24 KB
/
main.cpp
File metadata and controls
69 lines (55 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "mach/main.hpp"
#include <iostream>
#include <spdlog/spdlog.h>
#include <yaml-cpp/yaml.h>
#include "mach/labjack.hpp"
#include "mach/config_parser.hpp"
#include "mach/device/device_manager.hpp"
#include "mach/sequences/action_factory.hpp"
#include "mach/sequences/open_action.hpp"
#include "mach/device/device.hpp"
#include "mach/sequences/sleep_action.hpp"
#include "mach/sequences/close_action.hpp"
#include "mach/sequences/sequence_parser.hpp"
#include "mach/sequences/check_action.hpp"
#include "mach/grpc_client.hpp"
#include "mach/gui.hpp"
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#define LABJACK_CONFIG std::string("config/labjacks/")
#define REMOTE_CONFIG std::string("config/remote.yml")
#define SEQUENCES_CONFIG std::string("config/sequences/")
ABSL_FLAG(bool, demo, false, "Demo mode");
static bool demo = false;
int main(int argc, char* argv[]) {
spdlog::info("MACH: Hello World!");
absl::ParseCommandLine(argc, argv);
demo = absl::GetFlag(FLAGS_demo);
spdlog::info("MACH: Demo mode: {}", demo);
// Read configuration 🤓
mach::parseAllLabjacks(LABJACK_CONFIG);
mach::parseRemoteConfig(REMOTE_CONFIG);
// Print all devices for debug.
mach::DeviceManager& deviceManager = mach::DeviceManager::getInstance();
// deviceManager.printDevices();
// Register sequence actions.
mach::ActionFactory& actionFactory = mach::ActionFactory::getInstance();
actionFactory.registerAction("OPEN", []() { return std::make_unique<mach::OpenAction>(); });
actionFactory.registerAction("CLOSE", []() { return std::make_unique<mach::CloseAction>(); });
actionFactory.registerAction("SLEEP", []() { return std::make_unique<mach::SleepAction>(); });
actionFactory.registerAction("CHECK", []() { return std::make_unique<mach::CheckAction>(); });
// Parse all sequences.
mach::parseAllSequences(SEQUENCES_CONFIG);
// Start streaming all LabJacks.
// deviceManager.connectAllLabjacks();
deviceManager.startAllLabjackStreams();
// Start gRPC client.
mach::grpcStartClient(argc, argv);
// Start GUI.
// mach::gui::startGUI(argc, argv);
spdlog::info("MACH: Reached end of main."); //🧏♂️🤫
while (true) {}
}
bool mach::isDemo() {
return demo;
}