// log.debug("width "+width);
// log.debug("height "+height);
// log.debug("lengthPayload "+lengthPayload);
// log.debug("publicSID "+request.getPublicSID());
IoBuffer buffer = IoBuffer.allocate(frameSize, false);
//mode is weather 1(sharing) or 2(recording) or 3(sharing + recording)
buffer.put(this.convertIntToByteArray(clientFrameBean.getMode()));// 4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getSequenceNumber()));//4 Byte
buffer.put(this.convertIntToByteArray(lengthSecurityToken));//4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getXValue()));//4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getYValue()));//4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getWidth()));//4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getHeight()));//4 Byte
buffer.put(this.convertIntToByteArray(lengthPayload));//4 Byte
buffer.put(securityTokenAsByte);//32 Byte usually
buffer.put(clientFrameBean.getImageBytes());
log.debug("FRAME SIZE "+ClientCaptureScreen.frameCalculated+"||"+frameSize+"||"+buffer.array().length);
// IoBuffer buffer = IoBuffer.allocate(12, false);
//
// buffer.putInt(request.getWidth());
//
// buffer.putInt(request.getHeight());
//
// buffer.putInt(request.getNumberOfCharacters());
//
// buffer.flip();
//byte counter
ClientCaptureScreen.frameCalculated += frameSize;
if (ClientStartScreen.instance!=null) {
ClientStartScreen.instance.updateScreen();
}
buffer.flip();
out.write(buffer);
} else if (message instanceof ClientStatusBean) {
ClientStatusBean clientStatusBean = (ClientStatusBean) message;
byte[] securityTokenAsByte = clientStatusBean.getPublicSID().getBytes();
Integer lengthSecurityToken = securityTokenAsByte.length;
Integer frameSize = 4 * 10 + lengthSecurityToken;
IoBuffer buffer = IoBuffer.allocate(frameSize, false);
//mode is weather 0(start) or 4(stop)
buffer.put(this.convertIntToByteArray(clientStatusBean.getMode()));// 4 Byte
buffer.put(this.convertIntToByteArray(ClientConnectionBean.getFrameNumber()));//4 Byte
buffer.put(this.convertIntToByteArray(lengthSecurityToken));//4 Byte
buffer.put(this.convertIntToByteArray(clientStatusBean.getXValue()));//4 Byte
buffer.put(this.convertIntToByteArray(clientStatusBean.getYValue()));//4 Byte
buffer.put(this.convertIntToByteArray(clientStatusBean.getWidth()));//4 Byte
buffer.put(this.convertIntToByteArray(clientStatusBean.getHeight()));//4 Byte
buffer.put(this.convertIntToByteArray(0));//4 Byte => this data is not needed
buffer.put(securityTokenAsByte);//32 Byte usually
buffer.put(this.convertIntToByteArray(clientStatusBean.getTileWidth()));//4 Byte
buffer.put(this.convertIntToByteArray(clientStatusBean.getTileHeight()));//4 Byte
//byte counter
ClientCaptureScreen.frameCalculated += frameSize;
if (ClientStartScreen.instance!=null) {
ClientStartScreen.instance.updateScreen();
}
buffer.flip();
out.write(buffer);
} else if (message instanceof ClientViewerRegisterBean) {
ClientViewerRegisterBean clientViewerRegisterBean = (ClientViewerRegisterBean) message;
byte[] securityTokenAsByte = clientViewerRegisterBean.getPublicSID().getBytes();
Integer lengthSecurityToken = securityTokenAsByte.length;
Integer frameSize = 4 * 8 + lengthSecurityToken;
IoBuffer buffer = IoBuffer.allocate(frameSize, false);
//mode is 5
buffer.put(this.convertIntToByteArray(clientViewerRegisterBean.getMode()));// 4 Byte
buffer.put(this.convertIntToByteArray(ClientConnectionBean.getFrameNumber()));//4 Byte
buffer.put(this.convertIntToByteArray(lengthSecurityToken));//4 Byte
buffer.put(this.convertIntToByteArray(0));//4 Byte => Empty
buffer.put(this.convertIntToByteArray(0));//4 Byte => Empty
buffer.put(this.convertIntToByteArray(0));//4 Byte => Empty
buffer.put(this.convertIntToByteArray(0));//4 Byte => Empty
buffer.put(this.convertIntToByteArray(0));//4 Byte => this data is not needed
buffer.put(securityTokenAsByte);//32 Byte usually
//byte counter
ClientCaptureScreen.frameCalculated += frameSize;
if (ClientStartScreen.instance!=null) {
ClientStartScreen.instance.updateScreen();
}
buffer.flip();
out.write(buffer);
} else if (message instanceof ClientCursorStatus) {
ClientCursorStatus clientCursorStatus = (ClientCursorStatus) message;
byte[] securityTokenAsByte = clientCursorStatus.getPublicSID().getBytes();
Integer lengthSecurityToken = securityTokenAsByte.length;
Integer frameSize = 4 * 8 + lengthSecurityToken;
IoBuffer buffer = IoBuffer.allocate(frameSize, false);
//mode is 6
buffer.put(this.convertIntToByteArray(clientCursorStatus.getMode()));// 4 Byte
buffer.put(this.convertIntToByteArray(ClientConnectionBean.getFrameNumber()));//4 Byte
buffer.put(this.convertIntToByteArray(lengthSecurityToken));//4 Byte
buffer.put(this.convertIntToByteArray(clientCursorStatus.getX()));//4 Byte => X-Position
buffer.put(this.convertIntToByteArray(clientCursorStatus.getY()));//4 Byte => Y-Position
buffer.put(this.convertIntToByteArray(0));//4 Byte => Empty
buffer.put(this.convertIntToByteArray(0));//4 Byte => Empty
buffer.put(this.convertIntToByteArray(0));//4 Byte => this data is not needed
buffer.put(securityTokenAsByte);//32 Byte usually
//byte counter
ClientCaptureScreen.frameCalculated += frameSize;
if (ClientStartScreen.instance!=null) {
ClientStartScreen.instance.updateScreen();
}
buffer.flip();
out.write(buffer);
}