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.
64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
#ifndef ASN1C_CONVERSION_HPP_9E5QN6UC
|
|
#define ASN1C_CONVERSION_HPP_9E5QN6UC
|
|
|
|
#include <vanetza/asn1/asn1c_wrapper.hpp>
|
|
#include <vanetza/common/byte_buffer_convertible.hpp>
|
|
#include <memory>
|
|
#include <type_traits>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace convertible
|
|
{
|
|
|
|
template<class T>
|
|
struct byte_buffer_impl : public byte_buffer
|
|
{
|
|
public:
|
|
using wrapper_type = T;
|
|
static_assert(
|
|
std::is_base_of<asn1::asn1c_wrapper_common<typename T::asn1c_type>, T>::value,
|
|
"Only asn1c_wrapper derivates are supported");
|
|
|
|
byte_buffer_impl(wrapper_type&& t) :
|
|
m_wrapper(new wrapper_type(std::move(t)))
|
|
{
|
|
}
|
|
|
|
byte_buffer_impl(std::shared_ptr<const wrapper_type> other) :
|
|
m_wrapper(other)
|
|
{
|
|
}
|
|
|
|
void convert(ByteBuffer& buffer) const override
|
|
{
|
|
buffer = m_wrapper->encode();
|
|
}
|
|
|
|
std::unique_ptr<byte_buffer> duplicate() const override
|
|
{
|
|
return std::unique_ptr<byte_buffer> {
|
|
new byte_buffer_impl { m_wrapper }
|
|
};
|
|
}
|
|
|
|
std::size_t size() const override
|
|
{
|
|
return m_wrapper->size();
|
|
}
|
|
|
|
std::shared_ptr<const wrapper_type> wrapper() const
|
|
{
|
|
return m_wrapper;
|
|
}
|
|
|
|
private:
|
|
std::shared_ptr<const wrapper_type> m_wrapper;
|
|
};
|
|
|
|
} // namespace convertible
|
|
} // namespace vanetza
|
|
|
|
#endif /* ASN1C_CONVERSION_HPP_9E5QN6UC */
|
|
|