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-05-30 11:45:23 +0200
commitd0662a530aca84dd41b68c0f2bfe07dd6a27e78d (patch)
treeeeadac0aca9e81a95b3314aaeb50b8823deb3bd2 /main.vala
parent79727379cd4f561bd9c7dbe423805bf86223c276 (diff)
downloadserial-barcode-scanner-d0662a530aca84dd41b68c0f2bfe07dd6a27e78d.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 bbe91d7..b570b23 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) {