obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#include "byte_buffer_convertible.hpp"
|
|
#include <algorithm>
|
|
#include <iterator>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace convertible
|
|
{
|
|
|
|
std::unique_ptr<byte_buffer> byte_buffer::duplicate() const
|
|
{
|
|
ByteBuffer duplicate;
|
|
this->convert(duplicate);
|
|
std::unique_ptr<byte_buffer> result {
|
|
new byte_buffer_impl<ByteBuffer>(std::move(duplicate))
|
|
};
|
|
return result;
|
|
}
|
|
|
|
byte_buffer_impl<std::string>::byte_buffer_impl(const std::string& str) : m_buffer(str) {}
|
|
byte_buffer_impl<std::string>::byte_buffer_impl(std::string&& str) : m_buffer(std::move(str)) {}
|
|
|
|
void byte_buffer_impl<std::string>::convert(ByteBuffer& buffer) const
|
|
{
|
|
buffer.clear();
|
|
std::copy(m_buffer.begin(), m_buffer.end(), std::back_inserter(buffer));
|
|
}
|
|
|
|
std::size_t byte_buffer_impl<std::string>::size() const
|
|
{
|
|
return m_buffer.size();
|
|
}
|
|
|
|
std::unique_ptr<byte_buffer> byte_buffer_impl<std::nullptr_t>::duplicate() const
|
|
{
|
|
return std::unique_ptr<byte_buffer> { new byte_buffer_impl<std::nullptr_t>() };
|
|
}
|
|
|
|
} // namespace convertible
|
|
|
|
ByteBufferConvertible::ByteBufferConvertible(const ByteBufferConvertible& other) :
|
|
m_wrapper(other.m_wrapper->duplicate())
|
|
{
|
|
}
|
|
|
|
ByteBufferConvertible& ByteBufferConvertible::operator=(const ByteBufferConvertible& other)
|
|
{
|
|
m_wrapper = other.m_wrapper->duplicate();
|
|
return *this;
|
|
}
|
|
|
|
} // namespace vanetza
|
|
|