added preliminary aprs formatter

remotes/nogy/update_90
Georg Lukas 2010-01-06 03:45:27 +01:00
rodzic da6519fa9b
commit 97deab67cf
2 zmienionych plików z 31 dodań i 0 usunięć

Wyświetl plik

@ -227,6 +227,7 @@
<echo>Converting compiled files and external libraries into ${out-folder}/${dex-file}...</echo>
<apply executable="${dx}" failonerror="true" parallel="true">
<arg value="--dex" />
<arg value="--no-locals" />
<arg value="--output=${intermediate-dex-location}" />
<fileset dir="${out-folder}" includes="*.min.jar"/>
</apply>

Wyświetl plik

@ -0,0 +1,30 @@
package de.duenndns.aprsdroid
import _root_.android.location.Location
object AprsPacket {
def splitCoord(c : Double) : (Int, Double, Int) = {
var deg = c.asInstanceOf[Int]
val min = (c - deg)*60
var letter = 0
if (deg < 0) {
deg = -deg
letter = 1
}
(deg, min, letter)
}
def formatLat(c : Double) : String = {
val (deg, min, letter) = splitCoord(c)
"%02d%05.2f%c".format(deg, min, "NS"(letter))
}
def formatLon(c : Double) : String = {
val (deg, min, letter) = splitCoord(c)
"%03d%05.2f%c".format(deg, min, "EW"(letter))
}
def formatLoc(callsign : String, location : Location) : String = {
callsign + ">APRS:!" + formatLat(location.getLatitude) + "/" +
formatLon(location.getLongitude)
}
}