//RETRIEVE DESIRED COURSE or GPS POSITION
StrDHead = Dcourse.getText();
StrDLat = DLat.getText();
StrDLong = DLong.getText();
StrDHeadLoc = "x," + " " + StrDHead + "," + StrDLat + "," + StrDLong;
//UPDATE ROBOT STATUS WINDOW
if(StrDHeadLoc.length()<5)
RobotStatus.setText(NA);
else
if(StrDHeadLoc.length()<8)
RobotStatus.setText(HO);
else
RobotStatus.setText(NAV);
//SEND DHeadLoc DATA
try {
DHeadLocsock = new Socket("131.120.101.81", 2003);
DHeadLocIn = new BufferedReader(new InputStreamReader(DHeadLocsock.getInputStream()));
DHeadLocOut = DHeadLocsock.getOutputStream();
} catch (Exception ex) {
System.err.println("Could not connect to " + "131.120.101.81" + ". Quitting.");
System.exit(0);
}
try {
DHeadLocOut.write((StrDHeadLoc + "\n").getBytes());
} catch (Exception ex) {}
}
}
);
StopNav.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent ev) {
//SEND STOP SIGNAL
//SETUP INITIAL COMMS ON STOP PORT
try {
StopNavsock = new Socket("131.120.101.81", 2004);
StopNavIn = new BufferedReader(new InputStreamReader(StopNavsock.getInputStream()));
StopNavOut = StopNavsock.getOutputStream();
} catch (Exception ex) {
System.err.println("Could not connect to " + "131.120.101.81" + ". Quitting.");
System.exit(0);
}
}
Kommentare zu diesen Handbüchern