From 2fb610f86b0021d6f55b31996fb0158e258c3abd Mon Sep 17 00:00:00 2001 From: arnost00 Date: Sun, 31 Jul 2022 22:36:51 +0200 Subject: [PATCH] Extend SI punch decode - control code can be up to 511 --- libsiut/src/sipunch.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsiut/src/sipunch.cpp b/libsiut/src/sipunch.cpp index 8b0a94a53..ccd30cacb 100644 --- a/libsiut/src/sipunch.cpp +++ b/libsiut/src/sipunch.cpp @@ -24,12 +24,14 @@ SIPunch::SIPunch(const QByteArray &card_data, int ix) bit 3...1 - day of week, 000 = Sunday, 110 = Saturday bit 5...4 - week counter 0…3, relative bit 7...6 - control station code number high - (...1023) (reserved) + (...511) punching time PTH, PTL - 12h binary */ setTime((uint16_t)getUnsigned(card_data, ix + 2, 2)); - setCode((uint8_t)card_data[ix + 1]); uint8_t pdt = (uint8_t)card_data[ix]; + uint16_t code_complete = ((pdt & 0x60) >> 6) << 8; + code_complete += (uint8_t)card_data[ix + 1]; + setCode(code_complete); setPmFlag(pdt & 1); setDayOfWeek((pdt & 0x0e) >> 1); setWeekCnt((pdt & 0x30) >> 4);