// ///////////////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////////////// // 开始远程控制 public Packet requestControl(Packet packet) { // TODO: 暂不响应服务器端的控制请求的细节要求,比如压缩方式、带宽、颜色位数等 int compressMethod = packet.nextByte() & 0xff; int bandWidth = packet.nextByte() & 0xff; int colorBits = packet.nextByte() & 0xff; // TODO: 获取屏幕当前分辨率 // Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); short screenWidth = (short)Screen.PrimaryScreen.Bounds.Width; short screenHeight = (short)Screen.PrimaryScreen.Bounds.Height; Packet resp = Packet.create(Command.CONTROL_RESPONSE, 15) .addByte((byte)0x01) // 压缩方式 .addByte((byte)0x00) // 带宽 .addByte((byte)0x03) // 颜色位数 .addShort((short)screenWidth) // 屏幕宽度 .addShort((short)screenHeight) // 屏幕高度 .addLong(DateTime.Now.Ticks / 1000000); // 当前系统时间戳 // TODO: 在这里启动工作线程 (compressWorker = new CompressWorker(this.client)).start(); (captureWorker = new CaptureWorker(compressWorker)).start(); (hidExecutor = new HIDCommandExecutor()).start(); return(resp); }
public CaptureWorker(CompressWorker compressWorker) { this.compressWorker = compressWorker; }