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) } }