We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9221f93 commit 3d303f5Copy full SHA for 3d303f5
src/listener.cpp
@@ -0,0 +1,36 @@
1
+// #include <nlohmann/json.hpp>
2
+#include <iostream>
3
+#include <string>
4
+#include <lcm/lcm-cpp.hpp>
5
+#include "msg/encode_msg.hpp"
6
+
7
+// using json = nlohmann::json;
8
9
10
+class Handler
11
+{
12
+ public:
13
+ ~Handler() {}
14
15
+ void handleMessage(const lcm::ReceiveBuffer* rbuf,
16
+ const std::string& chan,
17
+ const msg::encode_msg* msg)
18
+ {
19
+ std::cout << msg->payload << std::endl
20
+ << msg->timestamp << std::endl;
21
+ }
22
+};
23
24
+int main(int argc, char** argv)
25
26
+ lcm::LCM lcm;
27
+ if(!lcm.good())
28
+ return 1;
29
30
+ Handler handlerObject;
31
+ lcm.subscribe("ENCODE", &Handler::handleMessage, &handlerObject);
32
33
+ while(0 == lcm.handle());
34
35
+ return 0;
36
+}
0 commit comments