Merge pull request #478 from afischerdev/update-version

Extend android service interface and http API
This commit is contained in:
zod 2022-11-14 21:47:58 +01:00 committed by GitHub
commit 0566f8154c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 7 deletions

View file

@ -202,6 +202,12 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
rc.keyValues = new HashMap<String, String>();
}
rc.keyValues.put(e.getKey().substring(8), e.getValue());
} else if (e.getKey().equals("straight")) {
String[] sa = e.getValue().split(",");
for (int i = 0; i < sa.length; i++) {
int v = Integer.valueOf(sa[i]);
if (wplist.size() > v) wplist.get(v).direct = true;
}
}
}
cr = new RoutingEngine(null, null, serviceContext.segmentDir, wplist, rc);
@ -242,15 +248,18 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
e.printStackTrace();
} finally {
cr = null;
if (br != null) try {
if (br != null)
try {
br.close();
} catch (Exception e) {
}
if (bw != null) try {
if (bw != null)
try {
bw.close();
} catch (Exception e) {
}
if (clientSocket != null) try {
if (clientSocket != null)
try {
clientSocket.close();
} catch (Exception e) {
}

View file

@ -95,6 +95,13 @@ public class ServerHandler extends RequestHandler {
if (lonLat.length < 2)
throw new IllegalArgumentException("we need two lat/lon points at least!");
wplist.add(readPosition(lonLat[0], lonLat[1], "via" + i));
if (lonLat.length > 2) {
if (lonLat[2].equals("d")) {
wplist.get(wplist.size()-1).direct = true;
} else {
wplist.get(wplist.size()-1).name = lonLat[2];
}
}
}
wplist.get(0).name = "from";