mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-09-15 03:53:43 +08:00
ea800c8f74
version: dragonpilot v0.9.2 beta for EON/C2 date: 2023-03-27T06:11:06 dp-dev(priv2) master commit: 0a08aa2b73a505e11e4c98ac6c5989464b7d339f
36 lines
963 B
C++
36 lines
963 B
C++
#pragma once
|
|
|
|
#include <set>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <unistd.h>
|
|
|
|
#include "cereal/messaging/messaging.h"
|
|
#include "cereal/visionipc/visionipc.h"
|
|
#include "cereal/visionipc/visionbuf.h"
|
|
|
|
class VisionIpcClient {
|
|
private:
|
|
std::string name;
|
|
Context * msg_ctx;
|
|
SubSocket * sock;
|
|
Poller * poller;
|
|
|
|
cl_device_id device_id = nullptr;
|
|
cl_context ctx = nullptr;
|
|
|
|
void init_msgq(bool conflate);
|
|
|
|
public:
|
|
bool connected = false;
|
|
VisionStreamType type;
|
|
int num_buffers = 0;
|
|
VisionBuf buffers[VISIONIPC_MAX_FDS];
|
|
VisionIpcClient(std::string name, VisionStreamType type, bool conflate, cl_device_id device_id=nullptr, cl_context ctx=nullptr);
|
|
~VisionIpcClient();
|
|
VisionBuf * recv(VisionIpcBufExtra * extra=nullptr, const int timeout_ms=100);
|
|
bool connect(bool blocking=true);
|
|
bool is_connected() { return connected; }
|
|
static std::set<VisionStreamType> getAvailableStreams(const std::string &name, bool blocking = true);
|
|
};
|