diff options
author | Lennart Weller <lhw@ring0.de> | 2012-05-30 11:45:23 +0200 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2012-06-05 17:07:34 +0200 |
commit | a2a528f3a0e6bc3591d4db0e08a251df1e85dd17 (patch) | |
tree | 4e320464fb7ecf43367313bdf1dea0fb02ba1d02 /main.vala | |
parent | 4849db1dd49c8f4d33c5d622e36634e117f75aeb (diff) | |
download | serial-barcode-scanner-a2a528f3a0e6bc3591d4db0e08a251df1e85dd17.tar.bz2 |
event based approach
Diffstat (limited to 'main.vala')
-rw-r--r-- | main.vala | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -10,11 +10,13 @@ public static int main(string[] args) { dev = new Device(args[1], 9600, 8, 1); db = new Database("shop.db"); - while(true) { - string message = dev.receive(); - if(interpret((string) message)) + dev.received_barcode.connect((data) => { + if(interpret(data)) dev.blink(10); - } + }); + + new MainLoop(null, false).run(); + return 0; } public static bool interpret(string data) { |