29 lines
646 B
Go
29 lines
646 B
Go
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
|
|
} |