kopia lustrzana https://github.com/ge0rg/aprsdroid
store originating call of objects in table
rodzic
97f82ec4cd
commit
43ddb3989c
|
|
@ -82,15 +82,15 @@ object AprsPacket {
|
|||
double2microdeg(comp.map(_-33).reduceLeft(_*91+_)/190463.0 - 180)
|
||||
}
|
||||
|
||||
def parseReport(report : String) : (String, Int, Int, String, String) = {
|
||||
def parseReport(report : String) : (String, Int, Int, String, String, String) = {
|
||||
report match {
|
||||
case PositionRegex(call, _, lat, sym1, lon, sym2, comment) =>
|
||||
(call, coord2microdeg(lat), coord2microdeg(lon), sym1+sym2, comment)
|
||||
(call, coord2microdeg(lat), coord2microdeg(lon), sym1+sym2, comment, null)
|
||||
case PositionCompRegex(call, _, sym1comp, latcomp, loncomp, sym2, _, comment) =>
|
||||
val sym1 = if ('a' <= sym1comp(0) && sym1comp(0) <= 'j') (sym1comp(0) - 'a' + '0').toChar else sym1comp
|
||||
(call, compressed2lat(latcomp), compressed2lon(loncomp), sym1+sym2, comment)
|
||||
(call, compressed2lat(latcomp), compressed2lon(loncomp), sym1+sym2, comment, null)
|
||||
case ObjectRegex(call, objcall, lat, sym1, lon, sym2, comment) =>
|
||||
(objcall.trim(), coord2microdeg(lat), coord2microdeg(lon), sym1+sym2, comment)
|
||||
(objcall.trim(), coord2microdeg(lat), coord2microdeg(lon), sym1+sym2, comment, call)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ class StationOverlay(icons : Drawable, context : Context, db : StorageDatabase)
|
|||
|
||||
def addStation(post : String) {
|
||||
try {
|
||||
val (call, lat, lon, sym, comment) = AprsPacket.parseReport(post)
|
||||
val (call, lat, lon, sym, comment, origin) = AprsPacket.parseReport(post)
|
||||
Log.d(TAG, "got %s(%d, %d)%s -> %s".format(call, lat, lon, sym, comment))
|
||||
addStation(new Station(new GeoPoint(lat, lon), call, comment, sym))
|
||||
} catch {
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class StorageDatabase(context : Context) extends
|
|||
|
||||
def addPosition(ts : Long, message : String) {
|
||||
try {
|
||||
val (call, lat, lon, sym, comment) = AprsPacket.parseReport(message)
|
||||
val (call, lat, lon, sym, comment, origin) = AprsPacket.parseReport(message)
|
||||
val cv = new ContentValues()
|
||||
cv.put(Position.TS, ts.asInstanceOf[java.lang.Long])
|
||||
cv.put(Position.CALL, call.toUpperCase)
|
||||
|
|
@ -134,6 +134,8 @@ class StorageDatabase(context : Context) extends
|
|||
cv.put(Position.LON, lon.asInstanceOf[java.lang.Integer])
|
||||
cv.put(Position.SYMBOL, sym)
|
||||
cv.put(Position.COMMENT, comment)
|
||||
if (origin != null)
|
||||
cv.put(Position.ORIGIN, origin)
|
||||
Log.d(TAG, "got %s(%d, %d)%s -> %s".format(call, lat, lon, sym, comment))
|
||||
getWritableDatabase().insertOrThrow(Position.TABLE, Position.CALL, cv)
|
||||
} catch {
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue