removed minutes from the start and expiry time in Salto lock command

This commit is contained in:
yurii 2025-10-06 15:36:02 +01:00
parent da5cafe031
commit 04c664294d
3 changed files with 11 additions and 8 deletions

View File

@ -31,8 +31,8 @@ func calculateLRC(data []byte) byte {
func (lock *SaltoLockServer) BuildCommand(req DoorCardRequest, checkIn, checkOut time.Time) error {
// helper: hh[mm]DDMMYY
fmtStamp := func(t time.Time) string {
return fmt.Sprintf("%02d%02d%02d%02d%02d",
t.Hour(), t.Minute(), t.Day(), int(t.Month()), t.Year()%100)
return fmt.Sprintf("%02d%02d%02d%02d",
t.Hour(), t.Day(), int(t.Month()), t.Year()%100)
}
start := fmtStamp(checkIn)
expiry := fmtStamp(checkOut)
@ -152,7 +152,7 @@ func (lock *SaltoLockServer) LockSequence() error {
}
defer conn.Close()
reader := bufio.NewReader(conn)
reader := bufio.NewReader(conn)
// 1. Send ENQ
log.Infof("Sending ENQ")
@ -210,11 +210,11 @@ func (lock *SaltoLockServer) LockSequence() error {
case b1 == 'C' && b2 == 'C':
log.Infof("LockSequence: command response is CC (follow-up)")
case b1 == 'T' && b2 == 'D':
log.Warnf("LockSequence: command response is TD (room does not exist)")
return fmt.Errorf("lock response indicates room does not exist")
log.Warnf("LockSequence: command response is TD (room does not exist): %q", string(resp))
return fmt.Errorf("lock response indicates room does not exist: %q", string(resp))
default:
log.Warnf("LockSequence: unexpected command response %q", string(resp))
return fmt.Errorf("error encoding keycard, unexpected response")
return fmt.Errorf("error encoding keycard, unexpected response: %q", string(resp))
}
} else {
log.Warnf("LockSequence: response too short: %q", string(resp))

View File

@ -29,7 +29,7 @@ import (
)
const (
buildVersion = "1.0.19"
buildVersion = "1.0.20"
serviceName = "hardlink"
customLayout = "2006-01-02 15:04:05 -0700"
transactionUrl = "http://127.0.0.1:18181/start-transaction/"

View File

@ -2,6 +2,9 @@
builtVersion is a const in main.go
#### 1.0.20 - 06 October 2025
removed minutes from the start and expiry time in Salto lock command
#### 1.0.19 - 10 September 2025
allowed to continue if the connection to the lock server fails at startup