+
+ public AltosMag() {
+ x = AltosLib.MISSING;
+ y = AltosLib.MISSING;
+ z = AltosLib.MISSING;
+ }
+
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosMag mag = new AltosMag(link);
+
+ if (mag != null)
+ state.set_mag(mag);
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ public AltosMag(AltosLink link) throws InterruptedException, TimeoutException {
+ this();
+ link.printf("M\n");
+ for (;;) {
+ String line = link.get_reply_no_dialog(5000);
+ if (line == null) {
+ throw new TimeoutException();
+ }
+ if (parse_string(line))
+ break;
+ }
+ }