Skip to content

Commit

Permalink
modified: src/v2i-hub/MapPlugin/src/MapPlugin.cpp
Browse files Browse the repository at this point in the history
	modified:   src/v2i-hub/MapPlugin/src/MapPlugin.h
  • Loading branch information
jwillmartin committed Apr 29, 2024
1 parent d298723 commit cfc8b43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/v2i-hub/MapPlugin/src/MapPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ int MapPlugin::Main() {
return (EXIT_SUCCESS);
}

string MapPlugin::removeMessageFrame(string &fileContent) {
// Check for and remove MessageFrame
if (fileContent.size() >= 4 && fileContent.substr(0, 4) == "0012") {
size_t pos = fileContent.find("38");
PLOG(logDEBUG) << "Beginning of MapData found at: " << pos;
fileContent.erase(0, pos);
PLOG(logDEBUG) << "Payload without MessageFrame: " << fileContent;
}
return fileContent;
}

bool MapPlugin::LoadMapFiles()
{
if (_mapFiles.empty())
Expand Down Expand Up @@ -255,13 +266,7 @@ bool MapPlugin::LoadMapFiles()
// Remove any newline characters
fileContent.erase(remove(fileContent.begin(), fileContent.end(), '\n'), fileContent.end());

// Check for and remove MessageFrame
if (fileContent.size() >= 4 && fileContent.substr(0, 4) == "0012") {
size_t pos = fileContent.find("38");
PLOG(logDEBUG) << "Beginning of MapData found at: " << pos;
fileContent.erase(0, pos);
PLOG(logDEBUG) << "Payload without MessageFrame: " << fileContent;
}
fileContent = removeMessageFrame(fileContent);

std::istringstream streamableContent(fileContent);
streamableContent >> bytes;
Expand Down
2 changes: 2 additions & 0 deletions src/v2i-hub/MapPlugin/src/MapPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class MapPlugin: public PluginClientClockAware {

bool LoadMapFiles();
void DebugPrintMapFiles();
string removeMessageFrame(string &fileContent);

};

} // namespace MapPlugin
Expand Down

0 comments on commit cfc8b43

Please sign in to comment.