diff options
author | Lennart Weller <lhw@ring0.de> | 2012-05-30 11:45:23 +0200 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2012-06-06 09:59:39 +0200 |
commit | 11310c037ee90e879ae9c0d1d69a2200030cd085 (patch) | |
tree | 3da200c04879136c376a2186ff738644517062db /main.vala | |
parent | 7bc9589466cbb79e42f4deb92f6e91b9d021573c (diff) | |
download | serial-barcode-scanner-11310c037ee90e879ae9c0d1d69a2200030cd085.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) { |