fix: rebuild MES as compilable go-zero+ent backend (renamed bj_power_mes), restore 3 workstation projects from pristine original, align naming; all Go projects go build clean
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2025 Beijing Hardman Automation Equipment Co., LTD. All rights reserved.
|
||||
*
|
||||
* Project: adapter
|
||||
* File: address.go
|
||||
* Last: 2025-05-09 16:46:26
|
||||
* Author: wangcheng@bj-hardman.com
|
||||
*/
|
||||
|
||||
package preload
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"bjhardman.cn/bjhardman/goplc/s7"
|
||||
)
|
||||
|
||||
type MAddress struct {
|
||||
LineId int
|
||||
Name string
|
||||
Desc string
|
||||
ReplyOffset int
|
||||
Addr s7.Address
|
||||
}
|
||||
|
||||
func (m MAddress) Copy() MAddress {
|
||||
return MAddress{
|
||||
LineId: m.LineId,
|
||||
Name: m.Name,
|
||||
Desc: m.Desc,
|
||||
ReplyOffset: m.ReplyOffset,
|
||||
Addr: m.Addr,
|
||||
}
|
||||
}
|
||||
|
||||
func (m MAddress) String() string {
|
||||
return fmt.Sprintf("%s(%s)", m.Addr, m.Name)
|
||||
}
|
||||
|
||||
func (m MAddress) Address() string {
|
||||
return m.Addr.String()
|
||||
}
|
||||
func (m MAddress) GetReplyAddress() string {
|
||||
return m.Addr.Add(0, m.ReplyOffset).String()
|
||||
}
|
||||
func (m MAddress) GetReplyMAddress() MAddress {
|
||||
return MAddress{
|
||||
LineId: m.LineId,
|
||||
Name: m.Name,
|
||||
Desc: m.Desc,
|
||||
ReplyOffset: 0,
|
||||
Addr: m.Addr.Add(0, m.ReplyOffset),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user