/** * Updates dst's internal data by parsing src according to the interpretation of the current mode. * * @param data * @param decLoc * @param dst */ public void update(String src, GPSDatum dst) { int i = 0; switch (this) { case AUTO_CALC_MODE: dst.updateAutoCalcMode(src); break; case CALC_MODE: dst.updateCalcMode(src); break; case SAT11: i++; case SAT10: i++; case SAT09: i++; case SAT08: i++; case SAT07: i++; case SAT06: i++; case SAT05: i++; case SAT04: i++; case SAT03: i++; case SAT02: i++; case SAT01: i++; case SAT00: dst.addSVToTrackedList(src, i); break; case PDOP: dst.updatePDOP(src); break; case HDOP: dst.updateHDOP(src); break; case VDOP: dst.updateVDOP(src); break; } }
/** @see ecologylab.oodss.messages.RequestMessage#performService(ecologylab.collections.Scope) */ @Override public ResponseMessage performService(Scope objectRegistry) { GPSDatum gpsDatum = (GPSDatum) objectRegistry.get(EarthGPSSimulatorServer.GPS_DATUM); if (gpsDatum == null) gpsDatum = new GPSDatum(); long lastTimePoint = (Long) objectRegistry.get(EarthGPSSimulatorServer.LAST_TIME_POINT); if (lastTimePoint != 0) gpsDatum.setGrndSpd(gpsDatum.distanceTo(lat, lon) / ((timePoint - lastTimePoint) / 1000.0)); objectRegistry.put(EarthGPSSimulatorServer.LAST_TIME_POINT, timePoint); gpsDatum.setLat(lat); gpsDatum.setLon(lon); CompassDatum compassDatum = (CompassDatum) objectRegistry.get(EarthGPSSimulatorServer.COMPASS_DATUM); if (compassDatum == null) compassDatum = new CompassDatum(); compassDatum.setHeading(heading); Kml currentLookPointKML = new Kml(); Placemark currentLookPoint = new Placemark("location", "Current simulated GPS location.", null); currentLookPoint.setPoint(new Point(gpsDatum)); try { debug(SimplTypesScope.serialize(currentLookPoint, StringFormat.XML)); } catch (SIMPLTranslationException e) { e.printStackTrace(); } currentLookPointKML.setPlacemark(currentLookPoint); KmlResponse resp = new KmlResponse(currentLookPointKML); debug("Ground speed: " + gpsDatum.getSpeed()); return resp; }