diff options
author | Lennart Weller <lhw@ring0.de> | 2012-06-05 22:30:07 +0200 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2012-06-06 09:59:39 +0200 |
commit | f41f825484569a147c941dad70b599f209d465aa (patch) | |
tree | 5d9eef7b6a290ea9f9825dabadcc1eab5c9ef6f7 | |
parent | b15581705656ec9e18d51da51eb6c66e87110b4b (diff) | |
download | serial-barcode-scanner-f41f825484569a147c941dad70b599f209d465aa.tar.bz2 |
remove old code
-rw-r--r-- | device.vala | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/device.vala b/device.vala index 098e25c..1ee3def 100644 --- a/device.vala +++ b/device.vala @@ -159,57 +159,11 @@ public class Device { return true; } -#if 0 - private ssize_t read(void *buf, size_t count) { - return Posix.read(fd, buf, count); - } -#endif - private ssize_t write(void *buf, size_t count) { ssize_t size = Posix.write(fd, buf, count); return size; } -#if 0 - public string receive() { - char[] detected = {}; - char buf[64]; - - while(true) { - int size = (int) this.read(buf, 64); - - if(size <= 0) - error("serial device lost.\n"); - - for(int i = 0; i < size; i++) { - if(buf[i] != '\r' && buf[i] != '\n') { - detected += (char) buf[i]; - } else { - if(detected.length > 0) { - detected += '\0'; - - if(((string) detected).has_prefix("USER ")) { - if(!check_code39_checksum((string) detected)) - return "SCANNER RETURNED INCORRECT DATA"; - else /* remove checksum */ - detected[detected.length-2] = '\0'; - } - - if(((string) detected).has_prefix("AMOUNT ")) { - if(!check_code39_checksum((string) detected)) - return "SCANNER RETURNED INCORRECT DATA"; - else /* remove checksum */ - detected[detected.length-2] = '\0'; - } - - return ((string) detected); - } - } - } - } - } -#endif - private bool check_code39_checksum(string data) { int result = 0; |