Compare commits

..
9 Commits
8 changed files with 361 additions and 117 deletions
+4
View File
@@ -251,6 +251,8 @@ func CardToEncoderPosition(port *serial.Port) (string, error) {
return "", fmt.Errorf("error sending ENQ to prompt device: %v", err) return "", fmt.Errorf("error sending ENQ to prompt device: %v", err)
} }
time.Sleep(delay)
//Check card position status //Check card position status
status, err := CheckDispenserStatus(port) status, err := CheckDispenserStatus(port)
if err != nil { if err != nil {
@@ -281,6 +283,8 @@ func CardOutOfMouth(port *serial.Port) (string, error) {
return "", fmt.Errorf("error sending ENQ to prompt device: %v", err) return "", fmt.Errorf("error sending ENQ to prompt device: %v", err)
} }
time.Sleep(delay)
//Check card position status //Check card position status
status, err := CheckDispenserStatus(port) status, err := CheckDispenserStatus(port)
if err != nil { if err != nil {
+10 -3
View File
@@ -10,17 +10,24 @@ import (
) )
// Build key encoding request command for the Assa Abloy lock server. // Build key encoding request command for the Assa Abloy lock server.
func (lock *AssaLockServer) BuildCommand(lockId string, checkIn, checkOut time.Time) error { func (lock *AssaLockServer) BuildCommand(doorReq DoorCardRequest, checkIn, checkOut time.Time) error {
ci := checkIn.Format("200601021504") ci := checkIn.Format("200601021504")
co := checkOut.Format("200601021504") co := checkOut.Format("200601021504")
lock.command = fmt.Sprintf("CCA;EA%s;GR%s;CO%s;CI%s;AM1;\r\n", lock.encoderAddr, lockId, co, ci) lock.command = fmt.Sprintf("CCA;EA%s;GR%s;CO%s;CI%s;AM1;\r\n", lock.encoderAddr, doorReq.RoomField, co, ci)
return nil return nil
} }
// Checks heart beat of the Assa Abloy lock server and perform key encoding // Checks heart beat of the Assa Abloy lock server and perform key encoding
func (lock *AssaLockServer) LockSequence(conn net.Conn) error { func (lock *AssaLockServer) LockSequence() error {
const funcName = "AssaLockServer.LockSequence" const funcName = "AssaLockServer.LockSequence"
conn, err := InitializeServerConnection(lock.encoderAddr)
if err != nil {
return err
}
defer conn.Close()
resp, err := sendHeartbeatToServer(conn) resp, err := sendHeartbeatToServer(conn)
if err != nil { if err != nil {
return fmt.Errorf("[%s] heartbeat failed: %v", funcName, err) return fmt.Errorf("[%s] heartbeat failed: %v", funcName, err)
+29 -13
View File
@@ -12,42 +12,63 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
// DoorCardRequest is the JSON payload for /issue-door-card.
type DoorCardRequest struct {
RoomField string `json:"roomField"`
CheckinTime string `json:"checkinTime"`
CheckoutTime string `json:"checkoutTime"`
FollowStr string `json:"followStr"`
}
const ( const (
AssaAbloy = "assaabloy" AssaAbloy = "assaabloy"
Omnitec = "omnitec" Omnitec = "omnitec"
Salto = "salto" Salto = "salto"
TLJ = "tlj"
)
var (
Cert string
LockServerURL string
) )
type ( type (
LockServer interface { LockServer interface {
BuildCommand(lockId string, checkIn, checkOut time.Time) error BuildCommand(doorReq DoorCardRequest, checkIn, checkOut time.Time) error
LockSequence(conn net.Conn) error LockSequence() error
} }
AssaLockServer struct { AssaLockServer struct {
encoderAddr string encoderAddr string
command string command string
} }
OmniLockServer struct { OmniLockServer struct {
encoderAddr string // Encoder unit address encoderAddr string // Encoder unit address
command []byte // Command to be sent to the lock server command []byte // Command to be sent to the lock server
} }
SaltoLockServer struct { SaltoLockServer struct {
encoderAddr string encoderAddr string
command []byte command []byte
}
TLJLockServer struct {
encoderAddr string
command string
} }
) )
func NewLockServer(lockType, encoderAddr string, fatalError func(error)) LockServer { func NewLockServer(lockType, encoderAddr string, fatalError func(error)) LockServer {
switch lockType { switch strings.ToLower(lockType) {
case AssaAbloy: case AssaAbloy:
return &AssaLockServer{encoderAddr: encoderAddr} return &AssaLockServer{encoderAddr: encoderAddr}
case Omnitec: case Omnitec:
return &OmniLockServer{encoderAddr: encoderAddr} return &OmniLockServer{encoderAddr: encoderAddr}
case Salto: case Salto:
return &SaltoLockServer{encoderAddr: encoderAddr} return &SaltoLockServer{encoderAddr: encoderAddr}
case TLJ:
return &TLJLockServer{encoderAddr: encoderAddr}
default: default:
fatalError(fmt.Errorf("unsupported LockType: %s; must be 'assaabloy' or 'omnitec'", lockType)) fatalError(fmt.Errorf("unsupported LockType: %s; must be 'assaabloy' or 'omnitec'", lockType))
return nil // This line will never be reached, but is needed to satisfy the compiler return nil // This line will never be reached, but is needed to satisfy the compiler
@@ -92,8 +113,3 @@ func sendAndReceive(conn net.Conn, command []byte) (string, error) {
response := buf[:n] response := buf[:n]
return string(response), nil return string(response), nil
} }
+10 -3
View File
@@ -13,7 +13,7 @@ import (
) )
// Build key encoding request command for the Omnitec lock server. // Build key encoding request command for the Omnitec lock server.
func (lock *OmniLockServer) BuildCommand(lockId string, checkIn, checkOut time.Time) error { func (lock *OmniLockServer) BuildCommand(doorReq DoorCardRequest, checkIn, checkOut time.Time) error {
const funcName = "OmniLockServer.BuildCommand" const funcName = "OmniLockServer.BuildCommand"
hostname, err := os.Hostname() hostname, err := os.Hostname()
if err != nil { if err != nil {
@@ -21,7 +21,7 @@ func (lock *OmniLockServer) BuildCommand(lockId string, checkIn, checkOut time.T
} }
// Format lockId as 4-digit zero-padded string // Format lockId as 4-digit zero-padded string
idInt, err := strconv.Atoi(lockId) idInt, err := strconv.Atoi(doorReq.RoomField)
if err != nil { if err != nil {
return fmt.Errorf("[%s] failed to convert lockId to integer: %v", funcName, err) return fmt.Errorf("[%s] failed to convert lockId to integer: %v", funcName, err)
} }
@@ -53,8 +53,15 @@ func (lock *OmniLockServer) BuildCommand(lockId string, checkIn, checkOut time.T
} }
// Starts link to the Omnitec lock server and perform key encoding // Starts link to the Omnitec lock server and perform key encoding
func (lock *OmniLockServer) LockSequence(conn net.Conn) error { func (lock *OmniLockServer) LockSequence() error {
const funcName = "OmniLockServer.LockSequence" const funcName = "OmniLockServer.LockSequence"
conn, err := net.Dial("tcp", lock.encoderAddr)
if err != nil {
return err
}
defer conn.Close()
// Start the link with the lock server // Start the link with the lock server
regs, err := lock.linkStart(conn) regs, err := lock.linkStart(conn)
if err != nil { if err != nil {
+186 -63
View File
@@ -1,103 +1,226 @@
package lockserver package lockserver
import ( import (
"bufio"
"fmt" "fmt"
"net" "net"
"time" "time"
// "strings"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
const ( const (
STX = 0x02 // Start of Text STX = 0x02 // Start of Text
ETX = 0x03 // End of Text ETX = 0x03 // End of Text
ENQ = 0x05 // Enquiry from host ENQ = 0x05 // Enquiry from host
ACK = 0x06 // Positive response ACK = 0x06 // Positive response
NAK = 0x15 // Negative response NAK = 0x15 // Negative response
separator = 0xB3 // '│' character in ASCII (179 decimal)
) )
// calculateLRC computes the Longitudinal Redundancy Check over data
func calculateLRC(data []byte) byte { func calculateLRC(data []byte) byte {
lrc := byte(0x00) var lrc byte
for _, b := range data { for _, b := range data {
lrc ^= b lrc ^= b
} }
return lrc return lrc
} }
// simple join that avoids importing strings just for this. // BuildCommand assembles the SALTO frame with fields #0–#10, STX/ETX and LRC
func stringJoin(parts []string, sep string) string { func (lock *SaltoLockServer) BuildCommand(req DoorCardRequest, checkIn, checkOut time.Time) error {
if len(parts) == 0 { // helper: hh[mm]DDMMYY
return ""
}
out := parts[0]
for _, p := range parts[1:] {
out += sep + p
}
return out
}
// BuildCommand builds a Salto card‑issuance command in the form:
// STX|CN|<encoder addres>|E|<room>| | | | | |<start>|<expiry>|ETX|<LRC>
// where <start> and <expiry> are hhmmDDMMYY, and LRC is the XOR of all bytes
func (lock *SaltoLockServer) BuildCommand(lockId string, checkIn, checkOut time.Time) error {
// format helper: hhmmDDMMYY
fmtStamp := func(t time.Time) string { fmtStamp := func(t time.Time) string {
return fmt.Sprintf("%02d%02d%02d%02d%02d", return fmt.Sprintf("%02d%02d%02d%02d%02d",
t.Hour(), t.Minute(), t.Day(), int(t.Month()), t.Year()%100) t.Hour(), t.Minute(), t.Day(), int(t.Month()), t.Year()%100)
} }
start := fmtStamp(checkIn) start := fmtStamp(checkIn)
expiry := fmtStamp(checkOut) expiry := fmtStamp(checkOut)
// the 12 fields between STX and ETX // command type
cmd := "CN"
if req.FollowStr == "1" {
cmd = "CC"
}
// fields 0–10
fields := []string{ fields := []string{
"CN", lock.encoderAddr, "E", lockId, "", "", "", "", "", "", start, expiry, cmd,
lock.encoderAddr,
"E",
req.RoomField,
"", // optional field 4
"", // 5
"", // 6
"", // 7
"", // 8
start,
expiry,
} }
body := "|" + stringJoin(fields, "|") + "|" // leading/trailing pipes, so the ETX ends the last field // build payload between STX and ETX
body := []byte{STX}
for _, f := range fields {
body = append(body, separator)
body = append(body, []byte(f)...)
}
body = append(body, separator)
body = append(body, ETX)
// wrap with STX/ETX // append LRC (XOR of everything after STX through ETX)
msg := append([]byte{STX}, []byte(body)...) lrc := calculateLRC(body[1:])
msg = append(msg, ETX) body = append(body, lrc)
// compute LRC over everything *after* STX up to and including ETX lock.command = body
lrc := calculateLRC(msg[1:]) // skip STX
msg = append(msg, lrc)
lock.command = msg
return nil return nil
} }
// Checks heart beat of the Assa Abloy lock server and perform key encoding // readFrame consumes a full frame starting with firstByte (expected STX).
func (lock *SaltoLockServer) LockSequence(conn net.Conn) error { // It reads up to ETX and then attempts to read a trailing LRC (or CR). timeout controls read deadlines.
const funcName = "SaltoLockServer.LockSequence" func (lock *SaltoLockServer) readFrame(conn net.Conn, reader *bufio.Reader, firstByte byte, timeout time.Duration) ([]byte, error) {
frame := []byte{firstByte}
// Step 1: ENQ to check availability for {
respStr, err := sendAndReceive(conn, []byte{ENQ}) conn.SetReadDeadline(time.Now().Add(timeout))
if err != nil { b, e := reader.ReadByte()
return fmt.Errorf("[%s] failed sending ENQ: %w", funcName, err) if e != nil {
return frame, fmt.Errorf("error reading frame body: %w", e)
}
frame = append(frame, b)
if b == ETX {
break
}
} }
resp := []byte(respStr) // read trailing LRC (or CR) if present (non-blocking w/ timeout)
conn.SetReadDeadline(time.Now().Add(timeout))
if len(resp) != 1 || resp[0] != ACK { if lrc, e := reader.ReadByte(); e == nil {
return fmt.Errorf("[%s] expected ACK (0x06) after ENQ, got: %q (hex: % X)", funcName, respStr, resp) frame = append(frame, lrc)
} else {
// Not fatal: some devices might omit LRC/CR — just log
log.Warnf("readFrame: no trailing LRC/CR: %v", e)
} }
return frame, nil
// Step 2: Send actual command
respStr, err = sendAndReceive(conn, lock.command)
if err != nil {
return fmt.Errorf("[%s] failed sending command: %w", funcName, err)
}
resp = []byte(respStr)
if len(resp) == 1 && resp[0] == NAK {
return fmt.Errorf("[%s] command rejected by lock server (NAK)", funcName)
}
log.Infof("Encoding response: %q", respStr)
return nil
} }
// waitForAck waits for ACK or NAK. If STX frames are encountered they are drained
// using readFrame. drainedCount (if non-nil) accumulates the number of drained frames.
func (lock *SaltoLockServer) waitForAck(conn net.Conn, reader *bufio.Reader, timeout time.Duration, drainedCount *int) error {
deadline := time.Now().Add(timeout)
for {
conn.SetReadDeadline(time.Now().Add(time.Until(deadline)))
b, e := reader.ReadByte()
if e != nil {
return fmt.Errorf("error waiting for ACK/NAK: %w", e)
}
switch b {
case ACK:
return nil
case NAK:
return fmt.Errorf("received NAK")
case STX:
// stale or queued full response: consume it and continue waiting
frame, fe := lock.readFrame(conn, reader, b, timeout)
if fe != nil {
// if we can't consume frame, consider it an error
return fmt.Errorf("failed to consume queued STX frame: %w", fe)
}
if drainedCount != nil {
*drainedCount++
log.Infof("Drained queued frame #%d (while waiting for ACK): %q", *drainedCount, string(frame))
} else {
log.Infof("Drained queued frame (while waiting for ACK): %q", string(frame))
}
// loop to keep waiting for ACK
default:
// Unexpected byte while waiting for ACK. Log and continue reading.
log.Warnf("waitForAck: unexpected byte 0x%X while waiting for ACK; ignoring", b)
// keep looping until timeout or ACK/NAK
}
}
}
// LockSequence performs the full ENQ/ACK handshake and command exchange
func (lock *SaltoLockServer) LockSequence() error {
const timeout = 10 * time.Second
var (
resp []byte
drained = 0 // count of stale frames consumed across waits
)
conn, err := InitializeServerConnection(lock.encoderAddr)
if err != nil {
return err
}
defer conn.Close()
reader := bufio.NewReader(conn)
// 1. Send ENQ
log.Infof("Sending ENQ")
if _, e := conn.Write([]byte{ENQ}); e != nil {
return fmt.Errorf("failed to send ENQ: %w", e)
}
// 2. Expect ACK (but drain any queued STX frames first)
if e := lock.waitForAck(conn, reader, timeout, &drained); e != nil {
return fmt.Errorf("error awaiting ACK to ENQ: %w", e)
}
// 3. Send command frame
log.Infof("Sending encoding command: %q", string(lock.command))
if _, e := conn.Write(lock.command); e != nil {
return fmt.Errorf("failed to send command frame: %w", e)
}
// 4. Expect ACK to command (again drain any queued frames that might precede it)
if e := lock.waitForAck(conn, reader, timeout, &drained); e != nil {
return fmt.Errorf("error awaiting ACK to command: %w", e)
}
// 5. Now read the *next* STX frame which should be the response to our command.
for {
conn.SetReadDeadline(time.Now().Add(20 * time.Second))
b, e := reader.ReadByte()
if e != nil {
return fmt.Errorf("error reading response start: %w", e)
}
if b != STX {
// If anything else arrives, it might be another control byte or noise;
// log and keep consuming until we find STX.
log.Warnf("expected STX to start response but got 0x%X; ignoring", b)
continue
}
// consume full response frame
frame, fe := lock.readFrame(conn, reader, b, timeout)
if fe != nil {
return fmt.Errorf("error reading response frame: %w", fe)
}
resp = append(resp, frame...)
break
}
// parse the command code within response frame
if len(resp) >= 4 {
// The command bytes are usually at indices 2 and 3 if separator is at index 1
sepIndex := 1
b1 := resp[sepIndex+1]
b2 := resp[sepIndex+2]
switch {
case b1 == 'C' && b2 == 'N':
log.Infof("LockSequence: command response is CN (normal)")
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")
default:
log.Warnf("LockSequence: unexpected command response %q", string(resp))
return fmt.Errorf("error encoding keycard, unexpected response")
}
} else {
log.Warnf("LockSequence: response too short: %q", string(resp))
return fmt.Errorf("response too short")
}
log.Infof("LockSequence: received response: %q", string(resp))
return nil
}
+70
View File
@@ -0,0 +1,70 @@
package lockserver
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"time"
log "github.com/sirupsen/logrus"
)
// GuestCardResponse represents the JSON response from the GuestCard API call.
type GuestCardResponse struct {
Code string `json:"code"`
CardID string `json:"CardID"`
CommandID int `json:"CommandID"` // optional
Msg string `json:"Msg"` // error message if Code != "0"
}
func (lock *TLJLockServer) BuildCommand(doorReq DoorCardRequest, checkIn, checkOut time.Time) error {
params := url.Values{}
params.Set("cer", Cert)
params.Set("room", doorReq.RoomField)
params.Set("BeginTime", checkIn.Format("2006-01-02 15:04:05"))
params.Set("EndTime", checkOut.Format("2006-01-02 15:04:05"))
switch doorReq.FollowStr {
case "0":
params.Set("CheckInMode", "new")
case "1":
params.Set("CheckInMode", "follow")
}
lock.command = fmt.Sprintf("%s/GuestCard?%s", LockServerURL, params.Encode())
return nil
}
func (lock *TLJLockServer) LockSequence() error {
log.Infof("Sending command: %q", lock.command)
client := &http.Client{Timeout: 10 * time.Second}
resp, err := client.Get(lock.command)
if err != nil {
return fmt.Errorf("HTTP request failed: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("unexpected HTTP status: %s", resp.Status)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read response: %v", err)
}
// Parse response JSON
var result GuestCardResponse
err = json.Unmarshal(body, &result)
if err != nil {
return fmt.Errorf("invalid JSON response: %v", err)
}
if result.Code != "0" {
log.Printf("API error %s: %s", result.Code, result.Msg)
return fmt.Errorf("API error %s: %s", result.Code, result.Msg)
}
log.Printf("Guest card created successfully: CardID=%s, CommandID=%d", result.CardID, result.CommandID)
return nil
}
+23 -32
View File
@@ -6,7 +6,6 @@ import (
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"io" "io"
"net"
"net/http" "net/http"
"os" "os"
"os/exec" "os/exec"
@@ -30,7 +29,7 @@ import (
) )
const ( const (
buildVersion = "1.0.4" buildVersion = "1.0.13"
serviceName = "hardlink" serviceName = "hardlink"
customLayout = "2006-01-02 15:04:05 -0700" customLayout = "2006-01-02 15:04:05 -0700"
transactionUrl = "http://127.0.0.1:18181/start-transaction/" transactionUrl = "http://127.0.0.1:18181/start-transaction/"
@@ -42,32 +41,23 @@ type configRec struct {
LockserverUrl string `yaml:"lockservUrl"` LockserverUrl string `yaml:"lockservUrl"`
LockType string `yaml:"lockType"` LockType string `yaml:"lockType"`
EncoderAddress string `yaml:"encoderAddr"` EncoderAddress string `yaml:"encoderAddr"`
Cert string `yaml:"cert"`
DispenserPort string `yaml:"dispensPort"` DispenserPort string `yaml:"dispensPort"`
DispenserAdrr string `yaml:"dispensAddr"` DispenserAdrr string `yaml:"dispensAddr"`
PrinterName string `yaml:"printerName"` PrinterName string `yaml:"printerName"`
LogDir string `yaml:"logdir"` LogDir string `yaml:"logdir"`
isPayment bool `yaml:"isPayment"` IsPayment bool `yaml:"isPayment"`
}
// DoorCardRequest is the JSON payload for /issue-door-card.
type DoorCardRequest struct {
RoomField string `json:"roomField"`
CheckinTime string `json:"checkinTime"`
CheckoutTime string `json:"checkoutTime"`
FollowStr string `json:"followStr"`
} }
// App holds shared resources. // App holds shared resources.
type App struct { type App struct {
dispPort *serial.Port dispPort *serial.Port
lockConn net.Conn
lockserver lockserver.LockServer lockserver lockserver.LockServer
} }
func newApp(dispPort *serial.Port, lockConn net.Conn, config configRec) *App { func newApp(dispPort *serial.Port, config configRec) *App {
return &App{ return &App{
dispPort: dispPort, dispPort: dispPort,
lockConn: lockConn,
lockserver: lockserver.NewLockServer(config.LockType, config.EncoderAddress, fatalError), lockserver: lockserver.NewLockServer(config.LockType, config.EncoderAddress, fatalError),
} }
} }
@@ -75,9 +65,10 @@ func newApp(dispPort *serial.Port, lockConn net.Conn, config configRec) *App {
func main() { func main() {
// Load config // Load config
config := readConfig() config := readConfig()
printer.Layout = readTicketLayout() printer.Layout = readTicketLayout()
printer.PrinterName = config.PrinterName printer.PrinterName = config.PrinterName
lockserver.Cert = config.Cert
lockserver.LockServerURL = config.LockserverUrl
// Setup logging and get file handle // Setup logging and get file handle
logFile, err := setupLogging(config.LogDir) logFile, err := setupLogging(config.LogDir)
@@ -107,21 +98,20 @@ func main() {
} }
log.Infof("Dispenser initialized on port %s, %s", config.DispenserPort, status) log.Infof("Dispenser initialized on port %s, %s", config.DispenserPort, status)
// Initialize lock-server connection once // Test lock-server connection
lockConn, err := lockserver.InitializeServerConnection(config.LockserverUrl) switch strings.ToLower(config.LockType) {
if err != nil { case lockserver.TLJ:
fatalError(err)
default:
lockConn, err := lockserver.InitializeServerConnection(config.LockserverUrl)
if err != nil {
fatalError(err)
}
log.Infof("Connectting to lock server at %s", config.LockserverUrl)
lockConn.Close()
} }
defer lockConn.Close()
log.Infof("Connected to lock server at %s", config.LockserverUrl)
// db, err := payment.InitMSSQL(config.dbport, config.dbname, config.dbuser, config.dbpassword) if config.IsPayment {
// if err != nil {
// fatalError(fmt.Errorf("DB init failed: %v", err))
// }
// defer db.Close()
if config.isPayment {
startClient := func() (*exec.Cmd, error) { startClient := func() (*exec.Cmd, error) {
cmd := exec.Command("./ChipDNAClient/ChipDnaClient.exe") cmd := exec.Command("./ChipDNAClient/ChipDnaClient.exe")
err := cmd.Start() err := cmd.Start()
@@ -179,7 +169,8 @@ func main() {
} }
// Create App and wire routes // Create App and wire routes
app := newApp(dispHandle, lockConn, config) // dispHandle := &serial.Port{} // Placeholder, replace with actual dispenser handle
app := newApp(dispHandle, config)
mux := http.NewServeMux() mux := http.NewServeMux()
setUpRoutes(app, mux) setUpRoutes(app, mux)
@@ -323,7 +314,7 @@ func (app *App) startTransaction(w http.ResponseWriter, r *http.Request) {
func (app *App) issueDoorCard(w http.ResponseWriter, r *http.Request) { func (app *App) issueDoorCard(w http.ResponseWriter, r *http.Request) {
const op = logging.Op("issueDoorCard") const op = logging.Op("issueDoorCard")
var ( var (
doorReq DoorCardRequest doorReq lockserver.DoorCardRequest
theResponse cmstypes.StatusRec theResponse cmstypes.StatusRec
) )
@@ -384,10 +375,10 @@ func (app *App) issueDoorCard(w http.ResponseWriter, r *http.Request) {
} }
// build lock server command // build lock server command
app.lockserver.BuildCommand(doorReq.RoomField, checkIn, checkOut) app.lockserver.BuildCommand(doorReq, checkIn, checkOut)
// lock server sequence // lock server sequence
err = app.lockserver.LockSequence(app.lockConn) err = app.lockserver.LockSequence()
if err != nil { if err != nil {
logging.Error(serviceName, err.Error(), "Key encoding", string(op), "", "", 0) logging.Error(serviceName, err.Error(), "Key encoding", string(op), "", "", 0)
writeError(w, http.StatusBadGateway, err.Error()) writeError(w, http.StatusBadGateway, err.Error())
+29 -3
View File
@@ -2,9 +2,35 @@
builtVersion is a const in main.go builtVersion is a const in main.go
#### 1.0.1 - 22 July 2024 #### 1.0.13 - 21 August 2025
added salto lock server and implemented workflow for Salto TCP/IP connection to the lock server is now established before encoding the keycard and closedafter the encoding is done.
#### 1.0.12 - 11 August 2024
added delay before checking dispenser status
#### 1.0.11 - 11 August 2024
updated Salto key encoding workflow
#### 1.0.10 - 08 August 2024
updated logging for TLJ locks
#### 1.0.9 - 08 August 2024
added TLJ lock server and implemented workflow for TLJ locks
#### 1.0.8 - 01 August 2024
improved error handling and logging in Salto
#### 1.0.7 - 25 July 2024
added check if the room exists
#### 1.0.6 - 25 July 2024
updated workflow for Salto locks
#### 1.0.5 - 24 July 2024
added encoding keycard copy for Salto locks
#### 1.0.4 - 22 July 2024
added salto lock server and implemented workflow for Salto
#### 1.0.0 - 30 June 2024 #### 1.0.0 - 30 June 2024
added creditcall payment method added creditcall payment method