Files
cariflex/tools/EVerest-main/modules/HardwareDrivers/NfcReaders/NxpNfcFrontendTokenProvider/namedPipeDataSource/namedPipeDataSource.hpp
Eric F d398a6ced2 Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1)
- OpenOCPP extracted (firmware OCPP 1.6J/2.0.1)
- ShapeShifter library installed (pip install -e)
- ShapeShifter specification extracted
- EVerest extracted

TODO updated with progress
2026-06-08 00:38:27 -04:00

44 lines
1.4 KiB
C++

// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest
#ifndef NAMED_PIPE_TOKEN_PROVIDER_IMPL_HPP
#define NAMED_PIPE_TOKEN_PROVIDER_IMPL_HPP
#include <atomic>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <thread>
#include <utility>
#include <vector>
class NamedPipeDataSource {
public:
NamedPipeDataSource();
explicit NamedPipeDataSource(const std::string& filename);
NamedPipeDataSource(const NamedPipeDataSource&) = delete;
NamedPipeDataSource(const NamedPipeDataSource&&) = delete;
NamedPipeDataSource operator=(const NamedPipeDataSource&) = delete;
NamedPipeDataSource operator=(const NamedPipeDataSource&&) = delete;
~NamedPipeDataSource();
void setDetectionCallback(const std::function<void(const std::pair<std::string, std::vector<std::uint8_t>>&)>&);
void setErrorLogCallback(const std::function<void(const std::string&)>&);
void run();
private:
void getLinesForever();
std::optional<std::pair<std::string, std::vector<std::uint8_t>>> parseInput(const std::string& input);
std::string m_filename;
std::function<void(const std::pair<std::string, std::vector<std::uint8_t>>&)> m_callback;
std::function<void(const std::string&)> m_err_callback;
std::unique_ptr<std::thread> m_line_reader;
std::atomic<bool> stopped{false};
};
#endif // NAMED_PIPE_TOKEN_PROVIDER_IMPL_HPP