Skip to content

Commit

Permalink
Merge pull request #787 from arnost00/si_readout_extend_code_number
Browse files Browse the repository at this point in the history
Extend SI punch decode - control code can be up to 511
  • Loading branch information
fvacek authored Aug 1, 2022
2 parents f489f4e + 2fb610f commit 654bc23
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 654bc23

Please sign in to comment.