Commit c2a4fa31 authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

Fixed disappearing messages

parent 6bf438a9
......@@ -24,6 +24,8 @@ namespace Serial {
[DBus (name = "info.skorepa.DSerial1.port")]
private interface Methods : GLib.Object {
[DBus (name = "Write")]
public abstract void write_sync(uint8[] msg) throws IOError;
public abstract async void write(uint8[] msg) throws IOError;
public abstract void open() throws IOError;
public abstract void close() throws IOError;
......@@ -304,8 +306,11 @@ public class SerialClient : GLib.Object {
/*=====================================
* Message sender
*=====================================*/
public void write(uint8[] msg) {
methods.write.begin(msg,()=>{});
public void write(uint8[] msg, bool asynchronous = false) {
if(asynchronous) methods.write.begin(msg,()=>{});
else try {
methods.write_sync(msg);
} catch (Error e) {}
}
/*=====================================
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment