Revision 425
compatibility updates with colonet server
ColonetServerInterface.java | ||
---|---|---|
314 | 314 |
* @see Colonet#parseXBeeIDs(String) |
315 | 315 |
*/ |
316 | 316 |
public void sendXBeeIDRequest () { |
317 |
System.out.println("Sending XBee ID request"); |
|
318 | 317 |
sendRequest(ColonetServerInterface.REQUEST_XBEE_IDS, ""); |
319 | 318 |
} |
320 | 319 |
|
... | ... | |
331 | 330 |
* @see Colonet#parseBattery(String) |
332 | 331 |
*/ |
333 | 332 |
public void sendBatteryRequest (int robotNum) { |
334 |
sendData(ColonetServerInterface.BATTERY, "" + robotNum); |
|
333 |
//create packet |
|
334 |
String packet = ""; |
|
335 |
packet += ColonetServerInterface.SEND_TO_ROBOT; |
|
336 |
packet += " " + robotNum; |
|
337 |
packet += " " + ColonetServerInterface.COLONET_REQUEST; |
|
338 |
packet += " " + ColonetServerInterface.BATTERY; //add the command code here |
|
339 |
packet += "\n"; |
|
340 |
sendString(packet); |
|
335 | 341 |
} |
336 | 342 |
|
337 | 343 |
/* |
... | ... | |
485 | 491 |
ColonetServerInterface.REQUEST_XBEE_IDS)) |
486 | 492 |
colonet.parseXBeeIDs(line); |
487 | 493 |
// Battery |
488 |
else if (line.charAt(0) == Integer.parseInt(ColonetServerInterface.RESPONSE_TO_CLIENT_REQUEST) |
|
489 |
&& line.charAt(2) == Integer.parseInt(ColonetServerInterface.BATTERY)) |
|
490 |
colonet.parseBattery(line); |
|
491 |
/* |
|
492 | 494 |
else if (line.startsWith(ColonetServerInterface.RESPONSE_TO_CLIENT_REQUEST + " " + |
493 | 495 |
ColonetServerInterface.BATTERY)) |
494 | 496 |
colonet.parseBattery(line); |
495 |
*/ |
|
496 | 497 |
// Unknown type |
497 | 498 |
else |
498 | 499 |
System.out.println("Got data:" + line); |
Also available in: Unified diff