added Dormakaba lock server integration

This commit is contained in:
2026-06-02 10:10:17 +01:00
parent b982698ccd
commit ffd814e076
8 changed files with 326 additions and 25 deletions
+13 -5
View File
@@ -25,10 +25,11 @@ const (
Omnitec = "omnitec"
Salto = "salto"
TLJ = "tlj"
Dormakaba = "kaba"
)
var (
Cert string
Cert string
LockServerURL string
)
@@ -38,6 +39,11 @@ type (
LockSequence() error
}
KabaLockServer struct {
encoderAddr string
command []byte
}
AssaLockServer struct {
encoderAddr string
command string
@@ -69,22 +75,24 @@ func NewLockServer(lockType, encoderAddr string, fatalError func(error)) LockSer
return &SaltoLockServer{encoderAddr: encoderAddr}
case TLJ:
return &TLJLockServer{encoderAddr: encoderAddr}
case Dormakaba:
return &KabaLockServer{encoderAddr: encoderAddr}
default:
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
}
}
func InitializeServerConnection(LockserverUrl string) (net.Conn, error) {
func InitializeServerConnection(LockserverURL string) (net.Conn, error) {
const funcName = "InitializeServerConnection"
// Parse the URL to extract host and port
parsedUrl, err := url.Parse(LockserverUrl)
parsedURL, err := url.Parse(LockserverURL)
if err != nil {
return nil, fmt.Errorf("[%s] failed to parse LockserverUrl: %v", funcName, err)
return nil, fmt.Errorf("[%s] failed to parse LockserverURL: %v", funcName, err)
}
// Remove any leading/trailing slashes just in case
address := strings.Trim(parsedUrl.Host, "/")
address := strings.Trim(parsedURL.Host, "/")
// Establish a TCP connection to the Visionline server
conn, err := net.Dial("tcp", address)