#
whycq
2025-02-06 17bb52d9337328323f5f8d2a806cf4f445673b4a
app/src/main/java/com/example/agvcontroller/socket/NettyServerHandler.java
@@ -2,6 +2,8 @@
import static com.example.agvcontroller.utils.DateUtils.formatDate;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
@@ -13,6 +15,7 @@
import android.os.Message;
import android.util.Log;
import com.example.agvcontroller.AGVApplication;
import com.example.agvcontroller.AGVCar;
import com.example.agvcontroller.MainActivity;
import com.example.agvcontroller.action.AGV_11_UP;
@@ -26,11 +29,13 @@
import com.example.agvcontroller.protocol.AgvAction;
import com.example.agvcontroller.protocol.AgvPackage;
import com.example.agvcontroller.protocol.ProtocolType;
import com.example.agvcontroller.utils.DateUtils;
import org.greenrobot.eventbus.EventBus;
import java.net.InetSocketAddress;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -162,7 +167,12 @@
                if (null != ackType) {
                    AgvPackage ackPac = AckMsgBuilder.ofSuccess(pac, ackType);
                    AGV_F0_DOWN agv_f0_down = (AGV_F0_DOWN) ackPac.getBody().getMessageBody();
                    Log.d("updown", "上行: " + ip + "[登录包]>>>" + pac.getSourceHexStr());
                    String log = formatDate(new Date(), "yyyy-MM-dd HH:mm:ss") + " 上行: " + ip + "[登录包]>>>" + pac.getSourceHexStr();
                    Log.d("updown", log);
                    AGVApplication.addLog(log);
//                    EventBus.getDefault().post(log);
                    ctx.writeAndFlush(ackPac);
                }
                final int battery = agv_f0_up.getBattery();