-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix from_json implementation for std::unique_ptr<LogicalLinkControlPa…
…cket>. fix std variant from_json. add example for downloaded csv back to packets. add print function for std::unique_ptr<LogicalLinkControlPacket>.
- Loading branch information
1 parent
e83f72d
commit e7bd52f
Showing
15 changed files
with
302 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "lib/ViterbiDecoderCpp"] | ||
path = lib/ViterbiDecoderCpp | ||
url = https://github.com/FiendChain/ViterbiDecoderCpp.git | ||
[submodule "lib/rapidcsv"] | ||
path = lib/rapidcsv | ||
url = https://github.com/d99kris/rapidcsv.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (C) 2024 Transit Live Mapping Solutions | ||
* All rights reserved. | ||
* | ||
* Authors: | ||
* Marenz Schmidl | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "borzoi/borzoi_packets.hpp" | ||
#include "nlohmann/std_unique_ptr_logical_link_control_packet.hpp" | ||
#include <nlohmann/json.hpp> | ||
|
||
namespace nlohmann { | ||
template <> struct adl_serializer<BorzoiReceiveTetraPacket> { | ||
static void from_json(const json& j, BorzoiReceiveTetraPacket& brtp) { | ||
brtp.time = j["time"]; | ||
brtp.station = j["station"]; | ||
adl_serializer<std::unique_ptr<LogicalLinkControlPacket>>::from_json(j, brtp.packet); | ||
} | ||
}; | ||
} // namespace nlohmann |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (C) 2024 Transit Live Mapping Solutions | ||
* All rights reserved. | ||
* | ||
* Authors: | ||
* Marenz Schmidl | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "borzoi/borzoi_packets.hpp" | ||
#include "nlohmann/slots.hpp" | ||
#include <nlohmann/json.hpp> | ||
|
||
namespace nlohmann { | ||
template <> struct adl_serializer<BorzoiReceiveTetraSlots> { | ||
static void from_json(const json& j, BorzoiReceiveTetraSlots& brtp) { | ||
brtp.time = j["time"]; | ||
brtp.station = j["station"]; | ||
adl_serializer<Slots>::from_json(j, brtp.slots); | ||
} | ||
}; | ||
} // namespace nlohmann |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
include/utils/ostream_std_unique_ptr_logical_link_control.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (C) 2024 Transit Live Mapping Solutions | ||
* All rights reserved. | ||
* | ||
* Authors: | ||
* Marenz Schmidl | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "l3/mobile_link_entity_packet.hpp" | ||
#include "l3/mobile_management_packet.hpp" | ||
#include "l3/short_data_service_packet.hpp" | ||
|
||
inline auto operator<<(std::ostream& stream, const std::unique_ptr<LogicalLinkControlPacket>& packet) -> std::ostream& { | ||
/// process the parsed packet | ||
auto* cplane_signalling = dynamic_cast<UpperMacCPlaneSignallingPacket*>(packet.get()); | ||
auto* llc = dynamic_cast<LogicalLinkControlPacket*>(cplane_signalling); | ||
|
||
stream << *cplane_signalling; | ||
stream << *llc; | ||
if (auto* mle = dynamic_cast<MobileLinkEntityPacket*>(llc)) { | ||
stream << *mle; | ||
if (auto* cmce = dynamic_cast<CircuitModeControlEntityPacket*>(llc)) { | ||
stream << *cmce; | ||
if (auto* sds = dynamic_cast<ShortDataServicePacket*>(llc)) { | ||
stream << *sds; | ||
} | ||
} | ||
if (auto* mm = dynamic_cast<MobileManagementPacket*>(llc)) { | ||
stream << *mm; | ||
} | ||
} | ||
|
||
return stream; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.csv |
Oops, something went wrong.