[Resolved] Geting no calibresult data in last pointend
Posted: 06 Feb 2014, 17:20
I'm trying to perform a calibration using the Java client. Everything goes right until I call the pointend request for the last calibration point.
The server then responds with
Is there anything I am doing wrong?
This is my code
In Calibration.java
In CalibrationHandler.java
In CalibrationThread.java
The server then responds with
- Code: Select all
IN: {"category":"calibration","request":"pointend","statuscode":200}
Is there anything I am doing wrong?
This is my code
In Calibration.java
- Code: Select all
public class Calibration
{
public static void main (String[] args){
GazeManager.getInstance().activate(ApiVersion.VERSION_1_0, ClientMode.PUSH);
CalibrationHandler handler = new CalibrationHandler();
GazeManager.getInstance().calibrationStart(9, handler);
}
}
In CalibrationHandler.java
- Code: Select all
public class CalibrationHandler implements ICalibrationProcessHandler
{
public static ArrayList<CalibrationPosition> calibrationPositions = new ArrayList<CalibrationPosition>();
int position = 0;
static{
calibrationPositions.add( new CalibrationPosition(10, 10)); //CalibrationPosition is just a bean with x and y
calibrationPositions.add( new CalibrationPosition(1355, 10));
calibrationPositions.add( new CalibrationPosition(1355, 760));
calibrationPositions.add( new CalibrationPosition(10, 760));
calibrationPositions.add( new CalibrationPosition(10, 10));
calibrationPositions.add( new CalibrationPosition(1355, 10));
calibrationPositions.add( new CalibrationPosition(1355, 760));
calibrationPositions.add( new CalibrationPosition(10, 760));
calibrationPositions.add( new CalibrationPosition(10, 10));
}
@Override
public void onCalibrationProcessing() {
System.out.println("--------------Processing");
}
@Override
public void onCalibrationProgress(double arg0) {
if( arg0 < 1d){
takeNextPosition();
}
}
@Override
public void onCalibrationResult(CalibrationResult arg0) {
System.out.println("--------------result ");
}
private void takeNextPosition(){
CalibrationThread calibrationThread = new CalibrationThread();
calibrationThread.setX( calibrationPositions.get(position).getX());
calibrationThread.setY( calibrationPositions.get(position).getY());
calibrationThread.start();
position ++;
}
@Override
public void onCalibrationStarted() {
position = 0;
System.out.println("--------------started");
takeNextPosition();
}
}
In CalibrationThread.java
- Code: Select all
public class CalibrationThread extends Thread{
private int x;
private int y;
public void run() {
try{Thread.sleep(250);}catch (Exception e){};
GazeManager.getInstance().calibrationPointStart(x,y);
try{Thread.sleep(500);}catch (Exception e){};
GazeManager.getInstance().calibrationPointEnd();
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
}