Skip to content

Commit

Permalink
Complete implementation of the APRS UI improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
VanceVagell committed Nov 21, 2024
1 parent c735009 commit 58b20e1
Show file tree
Hide file tree
Showing 20 changed files with 992 additions and 206 deletions.
10 changes: 8 additions & 2 deletions android-src/KV4PHT/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ android {
applicationId "com.vagell.kv4pht"
minSdk 26
targetSdk 34
versionCode 15
versionName "1.1.1"
versionCode 16
versionName "1.2.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
{
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "7cfc71bec516a31279d986049855745c",
"entities": [
{
"tableName": "app_settings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `value` TEXT, PRIMARY KEY(`name`))",
"fields": [
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"name"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "channel_memories",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`memoryId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT, `frequency` TEXT, `offset` INTEGER NOT NULL, `tone` TEXT, `group` TEXT)",
"fields": [
{
"fieldPath": "memoryId",
"columnName": "memoryId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "frequency",
"columnName": "frequency",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "offset",
"columnName": "offset",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "tone",
"columnName": "tone",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "group",
"columnName": "group",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"memoryId"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "aprs_messages",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `type` INTEGER NOT NULL DEFAULT 0, `from_callsign` TEXT, `to_callsign` TEXT, `timestamp` INTEGER NOT NULL, `position_lat` REAL NOT NULL, `position_long` REAL NOT NULL, `comment` TEXT, `obj_name` TEXT, `ack` INTEGER NOT NULL, `message_num` INTEGER NOT NULL, `msg_body` TEXT, `temperature` REAL NOT NULL, `humidity` REAL NOT NULL, `pressure` REAL NOT NULL, `rain` REAL NOT NULL, `snow` REAL NOT NULL, `wind_force` INTEGER NOT NULL, `wind_dir` TEXT)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "fromCallsign",
"columnName": "from_callsign",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "toCallsign",
"columnName": "to_callsign",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "timestamp",
"columnName": "timestamp",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "positionLat",
"columnName": "position_lat",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "positionLong",
"columnName": "position_long",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "comment",
"columnName": "comment",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "objName",
"columnName": "obj_name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "wasAcknowledged",
"columnName": "ack",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "msgNum",
"columnName": "message_num",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "msgBody",
"columnName": "msg_body",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "temperature",
"columnName": "temperature",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "humidity",
"columnName": "humidity",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "pressure",
"columnName": "pressure",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "rain",
"columnName": "rain",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "snow",
"columnName": "snow",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "windForce",
"columnName": "wind_force",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "windDir",
"columnName": "wind_dir",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '7cfc71bec516a31279d986049855745c')"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
kv4p HT (see http://kv4p.com)
Copyright (C) 2024 Vance Vagell
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.vagell.kv4pht.data;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

@Entity(tableName = "aprs_messages")
public class APRSMessage {
public static final int UNKNOWN_TYPE = 0;
public static final int MESSAGE_TYPE = 1;
public static final int OBJECT_TYPE = 2;
public static final int POSITION_TYPE = 3;
public static final int WEATHER_TYPE = 4;

@PrimaryKey(autoGenerate = true)
public int id;

@ColumnInfo(name = "type", defaultValue = "" + UNKNOWN_TYPE)
public int type;

/*
* Fields relevant to all APRS message types.
*/
@ColumnInfo(name = "from_callsign")
public String fromCallsign;

@ColumnInfo(name = "to_callsign")
public String toCallsign;

@ColumnInfo(name = "timestamp")
public long timestamp; // Seconds since epoch in UTC

@ColumnInfo(name = "position_lat")
public double positionLat;

@ColumnInfo(name = "position_long")
public double positionLong;

@ColumnInfo(name = "comment")
public String comment;

/*
* Fields for APRS objects only.
*/
@ColumnInfo(name = "obj_name")
public String objName;

/*
* Fields for APRS messages (e.g. chat) only.
*/
@ColumnInfo(name = "ack")
public boolean wasAcknowledged;

@ColumnInfo(name = "message_num")
public int msgNum;

@ColumnInfo(name = "msg_body")
public String msgBody;

/*
* Fields for APRS weather only.
*/
@ColumnInfo(name = "temperature")
public double temperature;

@ColumnInfo(name = "humidity")
public double humidity;

@ColumnInfo(name = "pressure")
public double pressure;

@ColumnInfo(name = "rain")
public double rain;

@ColumnInfo(name = "snow")
public double snow;

@ColumnInfo(name = "wind_force")
public int windForce;

@ColumnInfo(name = "wind_dir")
public String windDir;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
kv4p HT (see http://kv4p.com)
Copyright (C) 2024 Vance Vagell
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.vagell.kv4pht.data;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao
public interface APRSMessageDao {
@Query("SELECT * FROM aprs_messages")
List<APRSMessage> getAll();

@Query("SELECT * FROM aprs_messages WHERE `from_callsign` = :fromCallsign AND `message_num` = :msgNum ORDER BY `id` DESC LIMIT 1")
APRSMessage getMsgToAck(String fromCallsign, int msgNum);

@Insert
void insertAll(APRSMessage... aprsMessages);

@Delete
void delete(APRSMessage aprsMessage);

@Update
void update(APRSMessage aprsMessage);
}
Loading

0 comments on commit 58b20e1

Please sign in to comment.