obu-firmware builds against the vanetza-idf C-ITS library, which until now came from the colleague's microbu-esp32c5 tree beside the repository and was not tracked here, so a clone of this repository could not build the firmware it ships. The library alone is now part of obu-firmware, as obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from there by default; -DVANETZA_IDF_DIR still points the build elsewhere. The rest of the colleague's tree (their own VAM firmware, PKI tooling, station-link Python tools, the V2X2MAP bridge) stays out of this repository and gitignored; nothing is pushed to their repository. NOTES.md, docs/06, TODO.md and the pcap verifier's usage line point at the new location.
55 lines
2.1 KiB
C++
55 lines
2.1 KiB
C++
#include <vanetza/asn1/asn1c_wrapper.hpp>
|
|
#include <vanetza/asn1/its/r2/EventHistory.h>
|
|
#include <vanetza/asn1/its/r2/EventZone.h>
|
|
#include <vanetza/asn1/its/r2/HeadingConfidence.h>
|
|
#include <vanetza/asn1/its/r2/SituationContainer.h>
|
|
#include <vanetza/asn1/its/r2/TimestampIts.h>
|
|
#include <vanetza/asn1/vam.hpp>
|
|
#include <gtest/gtest.h>
|
|
|
|
using namespace vanetza;
|
|
|
|
TEST(ItsAsn1, max_timestamp_roundtrip)
|
|
{
|
|
const std::int64_t max_timestamp = 4398046511103;
|
|
asn1::asn1c_wrapper<Vanetza_ITS2_TimestampIts_t> tx { asn_DEF_Vanetza_ITS2_TimestampIts };
|
|
asn_imax2INTEGER(&*tx, max_timestamp);
|
|
auto buffer = tx.encode();
|
|
EXPECT_EQ(6, buffer.size());
|
|
asn1::asn1c_wrapper<Vanetza_ITS2_TimestampIts_t> rx { asn_DEF_Vanetza_ITS2_TimestampIts };
|
|
EXPECT_TRUE(rx.decode(buffer));
|
|
std::int64_t rx_timestamp = 0;
|
|
asn_INTEGER2imax(&*tx, &rx_timestamp);
|
|
EXPECT_EQ(rx_timestamp, max_timestamp);
|
|
}
|
|
|
|
TEST(ItsAsn1R2, validate_vam)
|
|
{
|
|
asn1::r2::Vam vam;
|
|
|
|
vam->header.messageId = Vanetza_ITS2_MessageId_vam;
|
|
vam->header.protocolVersion = 2;
|
|
vam->header.stationId = 123;
|
|
|
|
vam->vam.generationDeltaTime = 0;
|
|
vam->vam.vamParameters.basicContainer.referencePosition.latitude = Vanetza_ITS2_Latitude_unavailable;
|
|
vam->vam.vamParameters.basicContainer.referencePosition.longitude = Vanetza_ITS2_Longitude_unavailable;
|
|
vam->vam.vamParameters.basicContainer.stationType = 5;
|
|
|
|
vam->vam.vamParameters.vruHighFrequencyContainer.heading.value = 0;
|
|
vam->vam.vamParameters.vruHighFrequencyContainer.heading.confidence = Vanetza_ITS2_HeadingConfidence_unavailable;
|
|
|
|
vam->vam.vamParameters.vruHighFrequencyContainer.speed.speedValue = 0;
|
|
vam->vam.vamParameters.vruHighFrequencyContainer.speed.speedConfidence = Vanetza_ITS2_SpeedConfidence_unavailable;
|
|
|
|
EXPECT_TRUE(vam.validate());
|
|
}
|
|
|
|
TEST(ItsAsn1R2, event_zone)
|
|
{
|
|
// just needs to compile (SituationContainer's eventZone is patched)
|
|
Vanetza_ITS2_SituationContainer_t container {};
|
|
container.eventZone = vanetza::asn1::allocate<Vanetza_ITS2_EventZone_t>();
|
|
vanetza::asn1::free(asn_DEF_Vanetza_ITS2_EventZone, container.eventZone);
|
|
}
|