1st version that works

This commit is contained in:
2022-03-14 11:53:00 +02:00
parent ee2884b2ff
commit 3806d2c80d
617 changed files with 17293 additions and 4470 deletions

View File

@ -0,0 +1,26 @@
package com.safemobile.lib.radio;
public class Channel {
public int dbID;
public int id;
public String chName;
public Channel()
{
}
public Channel(int dbId, int id, String chName) {
this.dbID = dbId;
this.id = id;
this.chName = chName;
}
public String toString()
{
return "dbID: " + dbID + " | id: " + id + " | chName: " + chName ;
}
}

View File

@ -0,0 +1,14 @@
package com.safemobile.lib.radio;
public class Emerg {
public int function = 0;
public int status = 0;
public Emerg(){
}
public String toString()
{
return "function: " + function + " | status: " + status ;
}
}

View File

@ -0,0 +1,58 @@
package com.safemobile.lib.radio;
import com.safemobile.lib.AppParams;
import com.safemobile.lib.Mic;
public class IncCall {
public int gwID;
public int rgwID;
public long Imei;
public int callStatus;
public int callType;
public int groupId;
public int userID;
public int opCode;
public Mic mic = null;
public long callerID = 0;
public long callDestID = 0;
public IncCall(){
}
public String toString()
{
return " Imei: " + Imei + " | opCode: " + opCode
+ " | callStatus: " + callStatus+ " | callType: " + callType
+ " | groupId: " + groupId + " | userID: " + userID;
}
public static String getCallTypeAsString(int type) {
switch (type) {
case AppParams.MotoAllCall: return "All Call";
case AppParams.MotoGroup: return "Group Call";
case AppParams.MotoPrivate: return "Private Call";
default: return "";
}
}
public static String getCallStatusAsString(int status) {
switch (status) {
case AppParams.InProgress: return "In Progress";
case AppParams.Initiated: return "Initiated";
case AppParams.Decoded: return "Decoded";
case AppParams.Hangtime: return "Hangtime";
case AppParams.Ended: return "Ended";
default: return "unknown";
}
}
public static String getCallInitiatorAsString(final long myID, int userID) {
if(userID == myID)
return "my Android";
else if (userID == 0)
return "Portable";
else
return "other Android";
}
}

View File

@ -0,0 +1,44 @@
package com.safemobile.lib.radio;
import java.util.ArrayList;
public class RadioGW {
public int ID;
public int GW_ID;
public String IP;
public String IMEI;
public ArrayList<Zone> zoneList;
public int lastZoneNr = 0;
public int lastChannelNr = 0;
public boolean isOnline = false;
public RadioGW(){zoneList = new ArrayList<Zone>();}
public String toString()
{
return "ID: " + ID + " | GW_ID: " + GW_ID + " | IP: " + IP
+ " | IMEI: " + IMEI ;
}
public String getChannelName() {
for(Zone zone: zoneList) {
if(zone.id == lastZoneNr) {
for(Channel ch: zone.channelList) {
if(ch.id == lastChannelNr)
return ch.chName;
}
}
}
return "";
}
public String getZoneName() {
for(Zone zone: zoneList) {
if(zone.id == lastZoneNr)
return zone.ZoneName;
}
return "";
}
}

View File

@ -0,0 +1,17 @@
package com.safemobile.lib.radio;
public class RadioStatus {
public int gwID = 0;
public int rgwID = 0;
public int status = 0;
public IncCall incCall = new IncCall();
public RadioStatus(){
}
public String toString()
{
return "gwID: " + gwID + " | rgwID: " + rgwID + " | status: " + status;
}
}

View File

@ -0,0 +1,14 @@
package com.safemobile.lib.radio;
public class SUstatus {
public int imei;
public int status;
public SUstatus(){
}
public String toString()
{
return "imei: " + imei + " | status: " + status ;
}
}

View File

@ -0,0 +1,51 @@
package com.safemobile.lib.radio;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class Zone {
public int dbID;
public int id;
public String ZoneName="";
public ArrayList<Channel> channelList = new ArrayList<Channel>();
public Zone()
{
channelList = new ArrayList<Channel>();
}
public String toString()
{
return "zoneDbID: " + id +" |zoneID: " + dbID + " | ZoneName: " + ZoneName ;
}
/**
* sort the list of channels based on their names
*/
public void sortChannelListByName() {
//Sorting
Collections.sort(channelList, new Comparator<Channel>() {
@Override
public int compare(Channel channel1, Channel channel2)
{
return channel1.chName.compareTo(channel2.chName);
}
});
}
/**
* sort the list of channels based on their ids
*/
public void sortChannelListByChannelID() {
//Sorting
Collections.sort(channelList, new Comparator<Channel>() {
@Override
public int compare(Channel channel1, Channel channel2)
{
return (channel1.id < channel2.id ? 1 : 0);
}
});
}
}

View File

@ -0,0 +1,46 @@
package com.safemobile.lib.radio;
public class ZoneChannel {
private Zone zone;
private Channel channel;
private boolean isSection = false;
public ZoneChannel(Zone zone) {
setZone(zone);
setSection(true);
}
public ZoneChannel(Zone zone, Channel channel) {
setZone(zone);
setChannel(channel);
if(channel != null)
setSection(false);
else
setSection(true);
}
public Zone getZone() {
return zone;
}
public void setZone(Zone zone) {
this.zone = zone;
}
public Channel getChannel() {
return channel;
}
public void setChannel(Channel channel) {
this.channel = channel;
}
public boolean isSection() {
return isSection;
}
public void setSection(boolean isSection) {
this.isSection = isSection;
}
}

View File

@ -0,0 +1,18 @@
package com.safemobile.lib.radio;
public class Zone_and_channel {
public int gwID = 0;
public int rgwID = 0;
public int zoneNr = 0;
public int channelNr = 0;
public Zone_and_channel(){
}
public String toString()
{
return "gwID: " + gwID + " | rgwID: " + rgwID + " | zoneNr: " + zoneNr
+ " | mechannelNrss: " + channelNr ;
}
}