Voici le code que j'utilise, toute les 100 ms le programme (est censé) accede au recepteur GPS. Mais rien ne d'affiche... sniff!
public void onStart() {
port = new SerialPort(SerialPort.BLUETOOTH, 9600);
add(testPortButton = new Button("Test port" ),CENTER,0); // outside
add( gps = new GPS(port, 100));
// TODO: Insert application initialization code here
}
public void onEvent(Event event) {
boolean ok;
switch (event.type) {
case ControlEvent.PRESSED:
if (event.target == testPortButton) {
showMsg("Etat port Bluetooth",port.isOpen()?"OUVERT":"FERME" );
}
break;
}
if (event.target == gps) {
String msg = String.valueOf(gps.getLatitude())+" "+String.valueOf(gps.getLongitude());
showMsg("Latitude/Longitude", msg);
}
}