serial library in c++ for godot
Diffstat (limited to 'src/gdserial.h')
| -rw-r--r-- | src/gdserial.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gdserial.h b/src/gdserial.h new file mode 100644 index 0000000..dd8c9e1 --- /dev/null +++ b/src/gdserial.h @@ -0,0 +1,31 @@ +#ifndef GDSERIAL_H +#define GDSERIAL_H + +#include <Godot.hpp> + +namespace godot { + +class GDSerial : public Reference { + GODOT_CLASS(GDSerial, Reference) + +private: + int serial_port; + +public: + static void _register_methods(); + + GDSerial(); + ~GDSerial(); + + void _init(); // our initializer called by Godot + + bool start(String port, int baud_rate); + void end(); + void send(String text); + int get_available(); + String read_string(); +}; + +} // namespace godot + +#endif |