Files
bj_power/bj_power_mes/internal/plc/tcp.go
T

35 lines
1023 B
Go
Raw Normal View History

2026-08-28 15:06:01 +08:00
package plc
import (
"context"
"bj_power_mes/internal/config"
)
// tcpClient 占位:对接西门子 S7 的实现签名。
// 本项目以 mock 为主,真实 S7 对接预留(寄存器写工序码、读完成信号位)。
type tcpClient struct {
c config.PlcConf
}
func newTcpClient(c config.PlcConf) *tcpClient {
return &tcpClient{c: c}
}
func (t *tcpClient) SendProcessCode(_ context.Context, combination string) ([]int, error) {
return parseCombination(combination), nil
}
func (t *tcpClient) QueryDone(_ context.Context) (bool, error) {
return true, nil
}
func (t *tcpClient) AckDone(_ context.Context, ok bool) {
_ = ok
}
// QueryDockPallet 读接驳台托盘传感器。真实对接:按 DOCK 编码映射 PLC 寄存器(如 DB101.DBX0.0=DOCK01 托盘到位)。
// 信号定义未确认前返回 false(默认无托盘),待现场 PLC 点位表给到后在此处补读寄存器逻辑。
func (t *tcpClient) QueryDockPallet(_ context.Context, _ string) (bool, error) {
return false, nil
2026-08-28 15:06:01 +08:00
}