Files
StarPilot/selfdrive/boardd/pigeon.h
T
Dean Lee e333e4f189 Cleanup selfdrive/ includes (#20822)
* cleanup include path

* continue

* format includes

* fix testraw.cc

* remove include path from SConstruct

* regroup

* rebase master

* almost done

* apply review

* rename FileReader.xx to filereader.xx

* rename Unlogger.x->unlogger.x

* rename FrameReader.xx -> framereader.xx

* apply reviews

* ui.h

* continue

* fix framebuffer.cc build error:mv util.h up

* full path to msm_media_info

* fix qcom2 camerad

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 7222d0f20dc8edfe0d2f3417d1ce7c84fbd32805
2021-05-08 22:15:17 -07:00

48 lines
986 B
C++

#pragma once
#include <termios.h>
#include <atomic>
#include <string>
#include "selfdrive/boardd/panda.h"
class Pigeon {
public:
static Pigeon* connect(Panda * p);
static Pigeon* connect(const char * tty);
virtual ~Pigeon(){};
void init();
bool wait_for_ack();
bool send_with_ack(std::string cmd);
virtual void set_baud(int baud) = 0;
virtual void send(const std::string &s) = 0;
virtual std::string receive() = 0;
virtual void set_power(bool power) = 0;
};
class PandaPigeon : public Pigeon {
Panda * panda = NULL;
public:
~PandaPigeon();
void connect(Panda * p);
void set_baud(int baud);
void send(const std::string &s);
std::string receive();
void set_power(bool power);
};
class TTYPigeon : public Pigeon {
int pigeon_tty_fd = -1;
struct termios pigeon_tty;
public:
~TTYPigeon();
void connect(const char* tty);
void set_baud(int baud);
void send(const std::string &s);
std::string receive();
void set_power(bool power);
};