Skip to content

Commit

Permalink
* Update to cluon-complete v0.0.58
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berger <[email protected]>
  • Loading branch information
chrberger committed Apr 1, 2018
1 parent 58253ee commit 824a415
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN apk update && \
g++
ADD . /opt/sources
WORKDIR /opt/sources
RUN ln -sf cluon-complete-v0.0.56.hpp cluon-complete.cpp && \
RUN ln -sf cluon-complete-v0.0.58.hpp cluon-complete.cpp && \
g++ -std=c++14 -Wall -D HAVE_CLUON_LIVEFEED -pthread -s -static -static-libgcc -static-libstdc++ -o /tmp/cluon-livefeed cluon-complete.cpp

RUN [ "cross-build-end" ]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN apk update && \
g++
ADD . /opt/sources
WORKDIR /opt/sources
RUN ln -sf cluon-complete-v0.0.56.hpp cluon-complete.cpp && \
RUN ln -sf cluon-complete-v0.0.58.hpp cluon-complete.cpp && \
g++ -std=c++14 -Wall -D HAVE_CLUON_LIVEFEED -pthread -s -static -static-libgcc -static-libstdc++ -o /tmp/cluon-livefeed cluon-complete.cpp


Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.armhf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN apk update && \
g++
ADD . /opt/sources
WORKDIR /opt/sources
RUN ln -sf cluon-complete-v0.0.56.hpp cluon-complete.cpp && \
RUN ln -sf cluon-complete-v0.0.58.hpp cluon-complete.cpp && \
g++ -std=c++14 -Wall -D HAVE_CLUON_LIVEFEED -pthread -s -static -static-libgcc -static-libstdc++ -o /tmp/cluon-livefeed cluon-complete.cpp

RUN [ "cross-build-end" ]
Expand Down
45 changes: 40 additions & 5 deletions cluon-complete-v0.0.56.hpp → cluon-complete-v0.0.58.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is an auto-generated header-only single-file distribution of libcluon.
// Date: Sat, 31 Mar 2018 22:46:13 +0200
// Version: 0.0.56
// Date: Sun, 01 Apr 2018 15:22:27 +0200
// Version: 0.0.58
//
//
// Implementation of N4562 std::experimental::any (merged into C++17) for C++11 compilers.
Expand Down Expand Up @@ -13177,9 +13177,12 @@ int main(int argc, char **argv) {
*/

//#include "cluon/cluon.hpp"
//#include "cluon/MetaMessage.hpp"
//#include "cluon/MessageParser.hpp"
//#include "cluon/OD4Session.hpp"

#include <chrono>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
Expand All @@ -13195,6 +13198,10 @@ enum Color {
DEFAULT = 39,
};

void clearScreen();
void writeText(Color c, uint8_t y, uint8_t x, const std::string &text);
std::string formatTimeStamp(const cluon::data::TimeStamp &ts);

void clearScreen() {
std::cout << "\033[2J" << std::endl;
}
Expand All @@ -13218,10 +13225,31 @@ int main(int argc, char **argv) {
auto commandlineArguments = cluon::getCommandlineArguments(argc, argv);
if (0 == commandlineArguments.count("cid")) {
std::cerr << PROGRAM
<< " displays any Envelopes received from an OpenDaVINCI v4 session to stdout." << std::endl;
std::cerr << "Usage: " << PROGRAM << " --cid=<OpenDaVINCI session>" << std::endl;
<< " displays any Envelopes received from an OpenDaVINCI v4 session to stdout with optional data type resolving using a .odvd message specification." << std::endl;
std::cerr << "Usage: " << PROGRAM << " [--odvd=<ODVD message specification file>] --cid=<OpenDaVINCI session>" << std::endl;
std::cerr << "Examples: " << PROGRAM << " --cid=111" << std::endl;
std::cerr << " " << PROGRAM << " --odvd=MyMessages.odvd --cid=111" << std::endl;
} else {
std::map<int32_t, cluon::MetaMessage> scopeOfMetaMessages{};

// Try parsing a supplied .odvd file to resolve numerical data types to human readable message names.
{
std::string odvdFile{commandlineArguments["odvd"]};
if (!odvdFile.empty()) {
std::fstream fin{odvdFile, std::ios::in};
if (fin.good()) {
const std::string s{static_cast<std::stringstream const&>(std::stringstream() << fin.rdbuf()).str()}; // NOLINT

cluon::MessageParser mp;
auto parsingResult = mp.parse(s);
if (cluon::MessageParser::MessageParserErrorCodes::NO_ERROR == parsingResult.second) {
for (const auto &mm : parsingResult.first) { scopeOfMetaMessages[mm.messageIdentifier()] = mm; }
std::clog << "Parsed " << parsingResult.first.size() << " message(s)." << std::endl;
}
}
}
}

std::mutex mapOfLastEnvelopesMutex;
std::map<int32_t, std::map<uint32_t, cluon::data::Envelope> > mapOfLastEnvelopes;

Expand All @@ -13245,7 +13273,14 @@ int main(int argc, char **argv) {
auto env = ee.second;
std::stringstream sstr;

sstr << "Envelope: " << std::setfill(' ') << std::setw(5) << env.dataType() << std::setw(0) << "/" << env.senderStamp() << "; " << "sent: " << formatTimeStamp(env.sent()) << "; sample: " << formatTimeStamp(env.sampleTimeStamp()) << std::endl;
sstr << "Envelope: " << std::setfill(' ') << std::setw(5) << env.dataType() << std::setw(0) << "/" << env.senderStamp() << "; " << "sent: " << formatTimeStamp(env.sent()) << "; sample: " << formatTimeStamp(env.sampleTimeStamp());
if (scopeOfMetaMessages.count(env.dataType()) > 0) {
sstr << "; " << scopeOfMetaMessages[env.dataType()].messageName();
}
else {
sstr << "; unknown data type";
}
sstr << std::endl;

const auto AGE{LAST_TIME_POINT - (env.received().seconds() * 1000 * 1000 + env.received().microseconds())};

Expand Down

0 comments on commit 824a415

Please sign in to comment.