kopia lustrzana https://github.com/ge0rg/aprsdroid
parse QRG in reports
rodzic
fe7a52e95e
commit
8dca9cd891
|
@ -4,6 +4,7 @@ import _root_.android.location.Location
|
||||||
import _root_.net.ab0oo.aprs._
|
import _root_.net.ab0oo.aprs._
|
||||||
|
|
||||||
object AprsPacket {
|
object AprsPacket {
|
||||||
|
val QRG_RE = ".*?(\\d{2,3}[.,]\\d{3,4}).*?".r
|
||||||
|
|
||||||
def passcode(callssid : String) : Int = {
|
def passcode(callssid : String) : Int = {
|
||||||
// remove ssid, uppercase, add \0 for odd-length calls
|
// remove ssid, uppercase, add \0 for odd-length calls
|
||||||
|
@ -72,6 +73,13 @@ object AprsPacket {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def parseQrg(comment : String) : String = {
|
||||||
|
comment match {
|
||||||
|
case QRG_RE(qrg) => qrg
|
||||||
|
case _ => null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def parseHostPort(hostport : String, defaultport : Int) : (String, Int) = {
|
def parseHostPort(hostport : String, defaultport : Int) : (String, Int) = {
|
||||||
val splits = hostport.split(":")
|
val splits = hostport.split(":")
|
||||||
if (splits.length == 2)
|
if (splits.length == 2)
|
||||||
|
|
|
@ -148,6 +148,7 @@ class StorageDatabase(context : Context) extends
|
||||||
val lon = (pos.getLongitude()*1000000).asInstanceOf[Int]
|
val lon = (pos.getLongitude()*1000000).asInstanceOf[Int]
|
||||||
val sym = "%s%s".format(pos.getSymbolTable(), pos.getSymbolCode())
|
val sym = "%s%s".format(pos.getSymbolTable(), pos.getSymbolCode())
|
||||||
val comment = fap.getAprsInformation().getComment()
|
val comment = fap.getAprsInformation().getComment()
|
||||||
|
val qrg = AprsPacket.parseQrg(comment)
|
||||||
cv.put(Position.TS, ts.asInstanceOf[java.lang.Long])
|
cv.put(Position.TS, ts.asInstanceOf[java.lang.Long])
|
||||||
if (objectname != null) {
|
if (objectname != null) {
|
||||||
cv.put(Position.CALL, objectname)
|
cv.put(Position.CALL, objectname)
|
||||||
|
@ -158,6 +159,7 @@ class StorageDatabase(context : Context) extends
|
||||||
cv.put(Position.LON, lon.asInstanceOf[java.lang.Integer])
|
cv.put(Position.LON, lon.asInstanceOf[java.lang.Integer])
|
||||||
cv.put(Position.SYMBOL, sym)
|
cv.put(Position.SYMBOL, sym)
|
||||||
cv.put(Position.COMMENT, comment)
|
cv.put(Position.COMMENT, comment)
|
||||||
|
cv.put(Position.QRG, qrg)
|
||||||
Log.d(TAG, "got %s(%d, %d)%s -> %s".format(call, lat, lon, sym, comment))
|
Log.d(TAG, "got %s(%d, %d)%s -> %s".format(call, lat, lon, sym, comment))
|
||||||
getWritableDatabase().insertOrThrow(Position.TABLE, Position.CALL, cv)
|
getWritableDatabase().insertOrThrow(Position.TABLE, Position.CALL, cv)
|
||||||
} catch {
|
} catch {
|
||||||
|
|
Ładowanie…
Reference in New Issue