Skip to content

Commit

Permalink
Extend SI punch decode - control code can be up to 511
Browse files Browse the repository at this point in the history
  • Loading branch information
arnost00 committed Jul 31, 2022
1 parent 3936ebf commit 2fb610f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libsiut/src/sipunch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2fb610f

Please sign in to comment.