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,70 @@
package com.safemobile.libpad;
import java.io.Serializable;
import java.util.ArrayList;
import com.safemobile.lib.SM;
public class PadRecording implements Serializable {
private static final long serialVersionUID = 7819490854198306882L;
public int dbID = 0;
public int userID = 0;
public long radioID = 0;
public long initRadioID = 0;
public int callType = 0;
public boolean isOutgoing = false;
public long timeGMT = 0;
public int duration = 0;
public long bytes_length = 0;
public long bytes_received = 0;
public int result = 0;
public PadRecording() {
}
public PadRecording(int dbID, int userID, long radioID, boolean isOutgoing, long initRadioID, int callType, long timeGMT, int duration) {
this.dbID = dbID;
this.userID = userID;
this.radioID = radioID;
this.isOutgoing = isOutgoing;
this.initRadioID = initRadioID;
this.callType = callType;
this.timeGMT = timeGMT;
this.duration = duration;
}
public static ArrayList<PadRecording> parseTCPMsg(String msg) {
ArrayList<PadRecording> recordings = new ArrayList<PadRecording>();
try
{
msg = msg.replace("#", "");
// split payload to get contacts
// split contact by /
String[] contArr = msg.split("/");
PadRecording rec = new PadRecording();
rec.dbID = Integer.parseInt(contArr[0]);
rec.userID = Integer.parseInt(contArr[1]);
rec.radioID = Long.parseLong(contArr[2]);
rec.initRadioID = Long.parseLong(contArr[3]);
rec.callType = Integer.parseInt(contArr[4]);
rec.isOutgoing = (Integer.parseInt(contArr[5]) == 1 ? true: false);
rec.timeGMT = Long.parseLong(contArr[6]);
rec.duration = Integer.parseInt(contArr[7]);
recordings.add(rec);
}
catch(Exception ex)
{
SM.Exception("Exception parse Recording", ex.toString());
}
return recordings;
}
}

View File

@ -0,0 +1,70 @@
package com.safemobile.libpad;
import java.io.Serializable;
import java.util.ArrayList;
import com.safemobile.lib.SM;
public class PadTextMessage implements Serializable {
private static final long serialVersionUID = 1L;
public long dbID = 0;
public int userID = 0;
public long radioID = 0;
public String message = "";
public boolean isOutgoing = false;
public long timeGMT = 0;
public int status = 0;
public String seqID = "";
public Integer tmSeqID = 0;
public PadTextMessage() {
}
public PadTextMessage(long dbID, int usedID, long radioId, boolean isOutgoing, String msg, long timeGMT, int status, String seqID) {
this.dbID = dbID;
this.userID = usedID;
this.radioID = radioId;
this.isOutgoing = isOutgoing;
this.message = msg;
this.timeGMT = timeGMT;
this.status = status;
this.seqID = seqID;
}
public String toString() {
return dbID + "." + radioID + "[" + message + "]";
}
public static ArrayList<PadTextMessage> parseTCPMsg(String msg) {
ArrayList<PadTextMessage> messages = new ArrayList<PadTextMessage>();
try
{
msg = msg.replace("#", "");
// split payload to get contacts
// split contact by /
String[] contArr = msg.split("/");
PadTextMessage message = new PadTextMessage();
message.dbID = Integer.parseInt(contArr[0]);
message.userID = Integer.parseInt(contArr[1]);
message.radioID = Long.parseLong(contArr[2]);
message.message = contArr[3];
message.timeGMT = Long.parseLong(contArr[4]);
message.isOutgoing = (Integer.parseInt(contArr[5]) == 1 ? true: false);
message.status = Integer.parseInt(contArr[6]);
messages.add(message);
}
catch(Exception ex)
{
SM.Exception("Exception parse Message", ex.toString());
}
return messages;
}
}