-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcomm_pst.h
More file actions
47 lines (34 loc) · 952 Bytes
/
Copy pathcomm_pst.h
File metadata and controls
47 lines (34 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// (C) 2026 by Folkert van Heusden
// Released under MIT license
#include "gen.h"
#if !defined(BUILD_FOR_PICO2W)
#include <atomic>
#include <thread>
#include "comm.h"
#include "my_lock.h"
class comm_pst: public comm
{
private:
const std::string dev_name;
std::atomic_bool stop_flag { false };
std::thread *th { nullptr };
my_lock msg_buffer_lock;
char msg_buffer[32];
int mb_offset { 0 };
void put_ts(const timespec & tp);
public:
comm_pst(const std::string & dev_name);
virtual ~comm_pst();
bool begin() override;
#if IS_POSIX
JsonDocument serialize() const override;
static comm_pst *deserialize(const JsonVariantConst j);
#endif
std::string get_identifier() const;
bool is_connected() override;
bool has_data() override;
uint8_t get_byte() override;
void operator()();
void send_data(const uint8_t *const in, const size_t n) override;
};
#endif