Files
Ashin Walpola d107534eb2 Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
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.
2026-09-24 10:56:05 +02:00

85 lines
2.4 KiB
C++

#ifndef POSITION_VECTOR_HPP_WJAGEOCS
#define POSITION_VECTOR_HPP_WJAGEOCS
#include <vanetza/common/bit_number.hpp>
#include <vanetza/geodesy/position.hpp>
#include <vanetza/geonet/address.hpp>
#include <vanetza/geonet/serialization.hpp>
#include <vanetza/geonet/timestamp.hpp>
#include <vanetza/geonet/units.hpp>
#include <boost/units/quantity.hpp>
#include <boost/units/systems/si/velocity.hpp>
#include <cstdint>
namespace vanetza
{
namespace geonet
{
using geodesy::GeodeticPosition;
class LongPositionVector
{
public:
static constexpr std::size_t length_bytes = 24;
typedef boost::units::quantity<boost::units::make_scaled_unit<
boost::units::si::velocity,
boost::units::scale<10, boost::units::static_rational<-2>>
>::type, BitNumber<uint_fast16_t, 15>> speed_u15t; // 1/100 m/s
Address gn_addr;
Timestamp timestamp; // ms since 2004-01-01 00:00:00.000
geo_angle_i32t latitude;
geo_angle_i32t longitude;
bool position_accuracy_indicator;
speed_u15t speed;
heading_u16t heading;
LongPositionVector();
GeodeticPosition position() const;
};
bool operator==(const LongPositionVector& lhs, const LongPositionVector& rhs);
bool operator!=(const LongPositionVector& lhs, const LongPositionVector& rhs);
/**
* Check if position vector is empty (default)
* \return true if all data fields are zero
*/
bool is_empty(const LongPositionVector&);
/**
* Check if position vector contains valid data,
* i.e. not empty and latitude, longitude, and heading values within range
* \return true if all data fields are valid
*/
bool is_valid(const LongPositionVector&);
void serialize(const LongPositionVector&, OutputArchive&);
void deserialize(LongPositionVector&, InputArchive&);
class ShortPositionVector
{
public:
static constexpr std::size_t length_bytes = 20;
ShortPositionVector() = default;
ShortPositionVector(const ShortPositionVector&) = default;
ShortPositionVector& operator=(const ShortPositionVector&) = default;
explicit ShortPositionVector(const LongPositionVector&);
Address gn_addr;
Timestamp timestamp;
geo_angle_i32t latitude;
geo_angle_i32t longitude;
};
bool operator==(const ShortPositionVector& lhs, const ShortPositionVector& rhs);
bool operator!=(const ShortPositionVector& lhs, const ShortPositionVector& rhs);
} // namespace geonet
} // namespace vanetza
#endif /* POSITION_VECTOR_HPP_WJAGEOCS */