You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
444 B
Go
18 lines
444 B
Go
1 year ago
|
package nmodbus
|
||
|
|
||
|
import (
|
||
|
"git.noahlan.cn/noahlan/nnet"
|
||
|
"git.noahlan.cn/noahlan/nnet/conn"
|
||
|
"git.noahlan.cn/noahlan/nnet/event"
|
||
|
"git.noahlan.cn/noahlan/nnet/packet"
|
||
|
)
|
||
|
|
||
|
func withEvents() nnet.RunOption {
|
||
|
var statusChanger event.OnReceiveFn = func(nc *conn.Connection, p packet.IPacket) {
|
||
|
nc.SetStatus(conn.StatusWorking)
|
||
|
}
|
||
|
return func(ngin *nnet.Engine) {
|
||
|
ngin.EventManager().RegisterEventFront(event.EvtOnReceive, statusChanger)
|
||
|
}
|
||
|
}
|