1
0
mirror of https://github.com/4yn/slidershim.git synced 2024-12-18 07:05:52 +01:00
slidershim/src-wwserial/include/wwserial.h

25 lines
622 B
C
Raw Normal View History

2022-02-21 13:58:38 +01:00
#pragma once
#include "rust/cxx.h"
#include <memory>
#include <string>
struct CxxSerial
{
2022-02-22 14:55:39 +01:00
CxxSerial(rust::String port, uint32_t baud, uint32_t read_timeout, uint32_t write_timeout, bool hardware);
2022-02-21 13:58:38 +01:00
uint32_t write(const rust::Vec<uint8_t> &data) const;
2022-02-22 14:55:39 +01:00
uint32_t read(rust::Vec<uint8_t> &data) const;
2022-02-21 13:58:38 +01:00
void flush() const;
bool check() const;
private:
struct impl;
std::shared_ptr<impl> impl;
};
// port: String, baud: u32, timeout: u32, hardware: bool
2022-02-22 14:55:39 +01:00
std::unique_ptr<CxxSerial> new_cxx_serial(rust::String port, uint32_t baud, uint32_t read_timeout, uint32_t write_timeout, bool hardware);