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 parseTCPMsg(String msg) { ArrayList recordings = new ArrayList(); 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; } }