|
|
@ -6,7 +6,6 @@ import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"git.noahlan.cn/noahlan/nnet/packet"
|
|
|
|
"git.noahlan.cn/noahlan/nnet/packet"
|
|
|
|
"git.noahlan.cn/noahlan/ntool-biz/nmodbus/util"
|
|
|
|
"git.noahlan.cn/noahlan/ntool-biz/nmodbus/util"
|
|
|
|
"git.noahlan.cn/noahlan/ntool/nlog"
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type RTUPacker struct {
|
|
|
|
type RTUPacker struct {
|
|
|
@ -44,7 +43,7 @@ func (d *RTUPacker) Pack(header interface{}, data []byte) ([]byte, error) {
|
|
|
|
func (d *RTUPacker) Unpack(data []byte) ([]packet.IPacket, error) {
|
|
|
|
func (d *RTUPacker) Unpack(data []byte) ([]packet.IPacket, error) {
|
|
|
|
d.buf.Write(data)
|
|
|
|
d.buf.Write(data)
|
|
|
|
|
|
|
|
|
|
|
|
nlog.Debugf("接收RTU数据: %x", data)
|
|
|
|
//nlog.Debugf("接收RTU数据: %x", data)
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
packets []packet.IPacket
|
|
|
|
packets []packet.IPacket
|
|
|
|