From 66cd3cebfdcebefe6918d90745d69302fbf5ffe4 Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Sat, 19 Feb 2011 01:44:27 +0100 Subject: [PATCH] implement APDRxx to-call --- src/AprsPacket.scala | 4 ++-- src/AprsService.scala | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/AprsPacket.scala b/src/AprsPacket.scala index ea1fa17..c541280 100644 --- a/src/AprsPacket.scala +++ b/src/AprsPacket.scala @@ -52,9 +52,9 @@ object AprsPacket { "" } - def formatLoc(callssid : String, symbol : String, + def formatLoc(callssid : String, toCall : String, symbol : String, status : String, location : Location) : String = { - callssid + ">APAND1,TCPIP*:" + new PositionPacket( + callssid + ">" + toCall + ",TCPIP*:" + new PositionPacket( new Position(location.getLatitude, location.getLongitude, 0, symbol(0), symbol(1)), formatCourseSpeed(location) + formatAltitude(location) + diff --git a/src/AprsService.scala b/src/AprsService.scala index 4e3e5e4..ea8176b 100644 --- a/src/AprsService.scala +++ b/src/AprsService.scala @@ -183,6 +183,11 @@ class AprsService extends Service with LocationListener { postLocation(location) } + def appVersion() : String = { + val pi = getPackageManager().getPackageInfo(getPackageName(), 0) + "APDR%s".format(pi.versionName filter (_.isDigit) take 2) + } + def postLocation(location : Location) { lastLoc = location @@ -195,7 +200,7 @@ class AprsService extends Service with LocationListener { if (symbol.length != 2) symbol = getString(R.string.default_symbol) val status = prefs.getString("status", getString(R.string.default_status)) - val packet = AprsPacket.formatLoc(callssid, symbol, status, location) + val packet = AprsPacket.formatLoc(callssid, appVersion(), symbol, status, location) Log.d(TAG, "packet: " + packet) val result = try {