diff options
author | Sebastian Reichel <sre@ring0.de> | 2012-04-29 18:42:32 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2012-04-29 18:42:32 +0200 |
commit | 9c4e832a367a416c6ca8f0f0b0947f08400bd74f (patch) | |
tree | ed69ee353585760e698c0fdc517337a071334b41 /main.vala | |
parent | 2ec60322a8cc54760af87e572c340c9bed07b5e7 (diff) | |
download | serial-barcode-scanner-9c4e832a367a416c6ca8f0f0b0947f08400bd74f.tar.bz2 |
differ between user and product barcodes
Diffstat (limited to 'main.vala')
-rw-r--r-- | main.vala | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -18,13 +18,19 @@ public static int main(string[] args) { } else { if(detected.length > 0) { detected += '\0'; - interpret(detected); + interpret((string) detected); } detected = {}; } } } -public static void interpret(char[] data) { - stdout.printf("%s\n", (string) data); +public static void interpret(string data) { + if(data.has_prefix("USER ")) { + string str_id = data.substring(5); + int id = int.parse(str_id); + stdout.printf("login: %d\n", id); + } else { + stdout.printf(" product: %s\n", data); + } } |