Files
StarPilot/selfdrive/boardd/pigeon.h
T
Willem Melching 07f89b2838 Improve robustness of ublox init procedure (#20685)
* improve ublox init robustness

* cleanup

* only log if running at 1hz

* not needed
old-commit-hash: a163daf5e024867d7301f4e20bea20fba4bb59ae
2021-04-15 14:11:53 +02:00

46 lines
950 B
C++

#pragma once
#include <string>
#include <termios.h>
#include "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);
};