}
try {
- printWriter = new PrintWriter(new BufferedWriter(new FileWriter(logPath)), true);
+ printWriter = new PrintWriter(
+ new BufferedWriter(new FileWriter(logPath)), true);
} catch (IOException e) {
e.printStackTrace();
}
Thread dataThread = new Thread(null, new DataChannelThread(),
AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD);
// start message send
- HostResult result = handleControlMessage(GlobalInformation.getCurrentDeviceInfo(), ret);
+ HostResult result = handleControlMessage(
+ GlobalInformation.getCurrentDeviceInfo(), ret);
DA_LOG.performance("TEST", "Start Trace", "Make and Send start message");
// FIX
if (result.isSuccess()) {
if (!isCorrectAck(MSG_START_ACK, result)) {
HostResult failResult = HostResult.ERR_MSG_START_FAIL;
- failResult.setMessage(ErrorCode.getError(getReturnId(result.getRet())).toString());
+ failResult.setMessage(ErrorCode.getError(getReturnId(result.getRet()))
+ .toString());
DACommunicator.setRunning(false);
dataThread = null;
return failResult;
}
@Override
- public HostResult sendConfigurationMessage(DeviceInfo devInfo, int type, String message) {
+ public HostResult sendConfigurationMessage(DeviceInfo devInfo, int type,
+ String message) {
// send config message
byte[] config = ByteUtil.toBytes(AnalyzerConstants.MSG_CONFIG);
RunTimeConfiguration rt = new RunTimeConfiguration();
- rt.setFeatures(ConfigureManager.getInstance().getConfiguration(devInfo), ConfigureManager
- .getInstance().getPreConfiguration(devInfo));
+ rt.setFeatures(ConfigureManager.getInstance().getConfiguration(devInfo),
+ ConfigureManager.getInstance().getPreConfiguration(devInfo));
rt.setSystemTracePeriod(ConfigureManager.getInstance().getSystemPeriod());
rt.setSamplingPeriod(ConfigureManager.getInstance().getSamplingPeriod());
byte[] rtByte = rt.toByteStream();
byte[] stop = ByteUtil.toBytes(AnalyzerConstants.MSG_STOP_SWAP);
int length = 0;
byte[] stopMsg = ByteUtil.getByte(stop, length);
- HostResult result = handleControlMessage(GlobalInformation.getCurrentDeviceInfo(),
- stopMsg);
+ HostResult result = handleControlMessage(
+ GlobalInformation.getCurrentDeviceInfo(), stopMsg);
if (result.isSuccess()) {
if (isCorrectAck(MSG_STOP_ACK, result)) {
HostResult result = HostResult.SUCCESS;
Socket controlSock = null;
try {
- controlSock = new Socket(CommonConstants.LOCAL_HOST, CommunicatorUtils.LOCAL_PORT);
+ controlSock = new Socket(CommonConstants.LOCAL_HOST,
+ CommunicatorUtils.LOCAL_PORT);
controlSock.setSoTimeout(AnalyzerConstants.CONTROL_SOCKET_TIMEOUT);
controlSock.setReuseAddress(true);
controlSock.setTcpNoDelay(true);
HostResult result = HostResult.SUCCESS;
Socket dataSock = null;
try {
- dataSock = new Socket(CommonConstants.LOCAL_HOST, CommunicatorUtils.LOCAL_PORT);
+ dataSock = new Socket(CommonConstants.LOCAL_HOST,
+ CommunicatorUtils.LOCAL_PORT);
dataSock.setSoTimeout(AnalyzerConstants.DATA_SOCKET_TIMEOUT);
dataSock.setReuseAddress(true);
dataSock.setTcpNoDelay(true);
int index = 0;
int msgId = ByteUtil.toInt(data, index);
index += INT_SIZE;
- // int length = ByteUtils.toInt(data, index);
+ int paylen = ByteUtil.toInt(data, index);
index += INT_SIZE;
int retId = ByteUtil.toInt(data, index);
index += INT_SIZE;
if (ackType == msgId) {
- if (retId == ErrorCode.SUCCESS.getErrorNumber()) {
+ if (paylen != INT_SIZE || retId == ErrorCode.SUCCESS.getErrorNumber()) {
return true;
}
}
size = size - exSize;
libInst = ByteUtil.getByte(libInst, binaryPath, size);
for (int i = 0; i < size; i++) {
- libInst = ByteUtil.getByte(libInst, functionInstList.get(i).toByteStream());
+ libInst = ByteUtil.getByte(libInst, functionInstList.get(i)
+ .toByteStream());
}
}
count = count - failedCount;
msg = ByteUtil.getByte(msg, length, libInst);
// ByteUtils.printByteArrayForStart(msg);
- HostResult result = handleControlMessage(GlobalInformation.getCurrentDeviceInfo(), msg);
+ HostResult result = handleControlMessage(
+ GlobalInformation.getCurrentDeviceInfo(), msg);
int ackMsg = AnalyzerConstants.MSG_SWAP_INST_ADD_ACK;
if (messageId == AnalyzerConstants.MSG_SWAP_INST_REMOVE) {
int length = sendBin.length;
byte[] msg = ByteUtil.getByte(AnalyzerConstants.MSG_BINARY_INFO, length, sendBin);
- HostResult result = handleControlMessage(GlobalInformation.getCurrentDeviceInfo(), msg);
+ HostResult result = handleControlMessage(
+ GlobalInformation.getCurrentDeviceInfo(), msg);
if (!result.isSuccess() || !isCorrectAck(MSG_BINARY_INFO_ACK, result)) {
return HostResult.ERR_BIN_INFO_GET_FAIL;
for (int i = 0; i < count; i++) {
String targetPath = targetPaths.get(i);
- BinaryInfo binInfo = curDevice.getDeviceStatusInfo().getBinaryInfo(targetPath);
+ BinaryInfo binInfo = curDevice.getDeviceStatusInfo()
+ .getBinaryInfo(targetPath);
int binaryType = ByteUtil.toInt(payload, index);
index += INT_SIZE;
if (CommonUtil.isLinux()) {
// check local binary path validation
// host has no binary file - pull binary file from target
- if (splitLocalBinaryPath.length < 3 || !(new File(localBinaryPath)).exists()) {
+ if (splitLocalBinaryPath.length < 3
+ || !(new File(localBinaryPath)).exists()) {
localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH + File.separator
+ getFileName(targetPath);
result = pullTheFile(targetPath, localBinaryPath);
DA_LOG.debug("host md5sum get failed : " + errorStr);
result = HostResult.ERR_BIN_INFO_GET_FAIL;
} else {
- String[] splitResult = line.trim().split(CommonConstants.SPACE);
+ String[] splitResult = line.trim().split(
+ CommonConstants.SPACE);
localHashCode = new String(splitResult[0]);
}
} catch (IOException e) {
if (localHashCode == null
|| 0 != localHashCode.compareTo(binInfo.getMd5sumValue())) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH + File.separator
- + getFileName(targetPath);
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ + File.separator + getFileName(targetPath);
result = pullTheFile(targetPath, localBinaryPath);
if (result.isSuccess()) {
binInfo.setTempBinaryPath(localBinaryPath);