#
whycq
2024-08-14 a5259c5238cf07b9a51b429a144eeac21864159e
app/src/main/java/com/example/agvcontroller/socket/NettyServerHandler.java
@@ -11,6 +11,7 @@
import android.util.Log;
import com.example.agvcontroller.Item;
import com.example.agvcontroller.protocol.AgvAction;
import org.greenrobot.eventbus.EventBus;
@@ -89,6 +90,19 @@
        }
    }
    public static void sendMessageToClient(String clientId, AgvAction<?> action) {
        Channel channel = channelMap.get(clientId);
        if (channel != null && channel.isActive()) {
            channel.writeAndFlush(action);
        } else {
            Log.d(TAG, "Client " + clientId + " is not connected");
        }
    }
    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        cause.printStackTrace();