summaryrefslogtreecommitdiffstats
path: root/main.vala
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2012-05-30 11:45:23 +0200
committerLennart Weller <lhw@ring0.de>2012-06-06 09:59:39 +0200
commit11310c037ee90e879ae9c0d1d69a2200030cd085 (patch)
tree3da200c04879136c376a2186ff738644517062db /main.vala
parent7bc9589466cbb79e42f4deb92f6e91b9d021573c (diff)
downloadserial-barcode-scanner-11310c037ee90e879ae9c0d1d69a2200030cd085.tar.bz2
event based approach
Diffstat (limited to 'main.vala')
-rw-r--r--main.vala10
1 files changed, 6 insertions, 4 deletions
diff --git a/main.vala b/main.vala
index e584ab2..318653f 100644
--- a/main.vala
+++ b/main.vala
@@ -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) {