Vanetza
 
Loading...
Searching...
No Matches
gbc_gac_header.hpp
1#ifndef GBC_GAC_HEADER_HPP_FS5DH20M
2#define GBC_GAC_HEADER_HPP_FS5DH20M
3
4#include <vanetza/geonet/areas.hpp>
5#include <vanetza/geonet/position_vector.hpp>
6#include <vanetza/geonet/sequence_number.hpp>
7#include <vanetza/geonet/serialization.hpp>
8#include <vanetza/geonet/units.hpp>
9#include <cstddef>
10
11namespace vanetza
12{
13namespace geonet
14{
15namespace detail
16{
17
18/**
19 * GeoBroadcast GUC and GeoAnycast GAC have identical header layout.
20 * We use this class as common base class to reduce duplicate code.
21 */
23{
24 static constexpr std::size_t length_bytes = 20 + LongPositionVector::length_bytes;
25
26 SequenceNumber sequence_number;
27 uint16_t reserved1 = 0;
28 LongPositionVector source_position;
29 geo_angle_i32t geo_area_pos_latitude;
30 geo_angle_i32t geo_area_pos_longitude;
31 distance_u16t distance_a;
32 distance_u16t distance_b;
33 angle_u16t angle;
34 uint16_t reserved2 = 0;
35
36 void destination(const Area&);
37 GeodeticPosition position() const;
38 void position(const GeodeticPosition&);
39
40protected:
41 Area destination(const decltype(Area::shape)&) const;
42};
43
44void serialize(const GbcGacHeader&, OutputArchive&);
45void deserialize(GbcGacHeader&, InputArchive&);
46
47} // namespace detail
48} // namespace geonet
49} // namespace vanetza
50
51#endif /* GBC_GAC_HEADER_HPP_FS5DH20M */
52