diff options
author | Lennart Weller <lhw@ring0.de> | 2012-05-30 11:45:23 +0200 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2012-05-30 11:45:23 +0200 |
commit | d0662a530aca84dd41b68c0f2bfe07dd6a27e78d (patch) | |
tree | eeadac0aca9e81a95b3314aaeb50b8823deb3bd2 /main.vala | |
parent | 79727379cd4f561bd9c7dbe423805bf86223c276 (diff) | |
download | serial-barcode-scanner-d0662a530aca84dd41b68c0f2bfe07dd6a27e78d.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) { |