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).
91 lines
2.0 KiB
C++
91 lines
2.0 KiB
C++
#pragma once
|
|
#include <kj/async-io.h>
|
|
#include <vanetza/dcc/channel_load.hpp>
|
|
#include <vanetza/net/chunk_packet.hpp>
|
|
#include <vanetza/net/cohesive_packet.hpp>
|
|
#include <vanetza/net/mac_address.hpp>
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <string>
|
|
|
|
namespace vanetza
|
|
{
|
|
|
|
namespace access { class DataRequest; }
|
|
|
|
namespace rpc
|
|
{
|
|
|
|
class Logger;
|
|
|
|
class LinkLayerClient
|
|
{
|
|
public:
|
|
enum class ErrorCode
|
|
{
|
|
Ok,
|
|
InvalidArgument,
|
|
Unsupported,
|
|
InternalError,
|
|
};
|
|
|
|
enum class Technology
|
|
{
|
|
Unspecified,
|
|
ITS_G5,
|
|
LTE_V2X,
|
|
};
|
|
|
|
struct Indication
|
|
{
|
|
Indication(vanetza::ByteBuffer);
|
|
|
|
vanetza::MacAddress source;
|
|
vanetza::MacAddress destination;
|
|
vanetza::CohesivePacket packet;
|
|
Technology technology = Technology::Unspecified;
|
|
};
|
|
|
|
struct Identity
|
|
{
|
|
std::uint64_t id = 0;
|
|
std::uint32_t version = 0;
|
|
std::string info;
|
|
};
|
|
|
|
using IndicationCallback = std::function<void(Indication)>;
|
|
using ChannelLoadReportCallback = std::function<void(dcc::ChannelLoad)>;
|
|
|
|
LinkLayerClient(kj::Timer&, kj::AsyncIoStream&, Logger* = nullptr);
|
|
~LinkLayerClient();
|
|
|
|
kj::Promise<Identity> identify();
|
|
void request(const access::DataRequest&, std::unique_ptr<ChunkPacket>);
|
|
void indicate(IndicationCallback callback);
|
|
void report_channel_load(ChannelLoadReportCallback callback);
|
|
kj::Promise<ErrorCode> set_source_address(const MacAddress&);
|
|
|
|
void configure(Technology);
|
|
void add_task(kj::Promise<void>&&);
|
|
|
|
private:
|
|
class Context;
|
|
|
|
void do_indicate(Indication);
|
|
void do_report(dcc::ChannelLoad);
|
|
|
|
std::unique_ptr<Context> context_;
|
|
std::mutex callback_mutex_;
|
|
IndicationCallback indication_callback_;
|
|
ChannelLoadReportCallback cbr_callback_;
|
|
Technology technology_ = Technology::Unspecified;
|
|
};
|
|
|
|
const char* stringify(LinkLayerClient::ErrorCode);
|
|
const char* stringify(LinkLayerClient::Technology);
|
|
|
|
} // namespace rpc
|
|
} // namespace vanetza
|