Initial working fully go release

This commit is contained in:
Martino Ferrari
2026-04-30 23:01:01 +02:00
parent 6e51ffc5e1
commit 90669c5fd6
22 changed files with 2950 additions and 196 deletions
+11 -7
View File
@@ -338,9 +338,11 @@ func (s *Server) handleConn(conn net.Conn) {
ioid := hdr.Parameter2
var pvName string
for _, info := range channels {
var cid uint32
for c, info := range channels {
if info.sid == sid {
pvName = info.pvName
cid = c
break
}
}
@@ -368,7 +370,8 @@ func (s *Server) handleConn(conn net.Conn) {
Command: proto.CmdReadNotify,
DataType: hdr.DataType,
DataCount: hdr.DataCount,
Parameter1: ioid,
Parameter1: cid, // echo client channel ID (matches real EPICS IOC)
Parameter2: ioid, // echo ioid so client can match the reply
}, replyPayload)
conn.Write(reply)
@@ -430,7 +433,8 @@ func (s *Server) buildEventMsg(sub *serverSub, pv *serverPV) []byte {
Command: proto.CmdEventAdd,
DataType: sub.dbrType,
DataCount: sub.count,
Parameter1: sub.subID,
Parameter1: 1, // ECA_NORMAL
Parameter2: sub.subID,
}, payload)
}
@@ -461,12 +465,12 @@ func (s *Server) encodeTimeValue(dbrType uint16, _ uint32, val any) []byte {
binary.BigEndian.PutUint32(body, uint32(int32(toF64(val))))
case proto.DBRTimeShort, proto.DBRTimeEnum:
body = make([]byte, 4) // 2 value + 2 pad
binary.BigEndian.PutUint16(body, uint16(int16(toF64(val))))
body = make([]byte, 4) // 2-byte RISC pad + 2-byte value
binary.BigEndian.PutUint16(body[2:], uint16(int16(toF64(val))))
case proto.DBRTimeChar:
body = make([]byte, 4) // 1 value + 3 pad
body[0] = byte(uint8(toF64(val)))
body = make([]byte, 4) // RISC_pad0[0:2] + RISC_pad1[2] + value[3]
body[3] = byte(uint8(toF64(val)))
case proto.DBRTimeString:
body = make([]byte, 40)