Compare commits
3 Commits
f6cb72368d
...
e22f6eb24b
Author | SHA1 | Date | |
---|---|---|---|
e22f6eb24b | |||
dc2cb825bb | |||
04fa7a5b2e |
@ -15,7 +15,7 @@ public class RadioMSG extends TCPmsg {
|
||||
|
||||
public int rOpcode;
|
||||
public String payload="";
|
||||
public ArrayList<RadioGW> RadioGWList=null;
|
||||
public ArrayList<RadioGW> RadioGWList = null;
|
||||
|
||||
//zone and channel;
|
||||
public Zone_and_channel zac= null;
|
||||
@ -36,6 +36,8 @@ public class RadioMSG extends TCPmsg {
|
||||
public ArrayList<Contact> contacts;
|
||||
|
||||
|
||||
|
||||
|
||||
public RadioMSG(TCPmsg tcp) {
|
||||
super(tcp);
|
||||
String date4parsing = super.data;
|
||||
@ -47,148 +49,34 @@ public class RadioMSG extends TCPmsg {
|
||||
|
||||
switch(rOpcode)
|
||||
{
|
||||
case 200:
|
||||
{
|
||||
RadioGWList = new ArrayList<RadioGW>();
|
||||
String[] tempArr = payload.split(";");
|
||||
|
||||
int count = 0;
|
||||
for(int i =0; i<tempArr.length;i++)
|
||||
{
|
||||
String[] oneRadio = tempArr[i].split("&");
|
||||
|
||||
if(oneRadio.length<5)
|
||||
continue;
|
||||
RadioGW rgw = new RadioGW();
|
||||
|
||||
rgw.ID = Integer.parseInt(oneRadio[0]);
|
||||
rgw.GW_ID = Integer.parseInt(oneRadio[1]);
|
||||
rgw.IMEI = oneRadio[2];
|
||||
rgw.IP = oneRadio[3];
|
||||
|
||||
String zonelistStr =oneRadio[4];
|
||||
String[] zoneArr = zonelistStr.split("@");
|
||||
for(int j =0; j<zoneArr.length;j++)
|
||||
{
|
||||
Zone zon = new Zone();
|
||||
String[] oneZoneArr = zoneArr[j].split(":");
|
||||
|
||||
//TODO check what this values are from SD
|
||||
zon.dbID = Integer.parseInt(oneZoneArr[0]);
|
||||
zon.id = Integer.parseInt(oneZoneArr[1]);
|
||||
zon.ZoneName = oneZoneArr[2];
|
||||
String channelListStr = oneZoneArr[3];
|
||||
|
||||
String[] channelArr = channelListStr.split(",");
|
||||
for(int k =0; k < channelArr.length; k++)
|
||||
{
|
||||
Channel chn = new Channel();
|
||||
String[] oneChnArr = channelArr[k].split("/");
|
||||
chn.dbID = Integer.parseInt(oneChnArr[0]);
|
||||
chn.id = Integer.parseInt(oneChnArr[1]);
|
||||
chn.chName = oneChnArr[2];
|
||||
|
||||
//add channel to zone
|
||||
zon.channelList.add(chn);
|
||||
}
|
||||
|
||||
//add zone to radio GW
|
||||
rgw.zoneList.add(zon);
|
||||
}
|
||||
|
||||
RadioGWList.add(rgw);
|
||||
count++;
|
||||
}
|
||||
count +=this.RadioGWList.size();
|
||||
SM.Debug("radio","RadioGWList size:" +this.RadioGWList.size() + " total:" +count);
|
||||
case 200 /* gw list */:
|
||||
RadioGWList = getRadioGWList();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case OperationCodes.CHANNEL_BRDCST:
|
||||
{
|
||||
try {
|
||||
zac = new Zone_and_channel();
|
||||
String[] tempArr = payload.split("&");
|
||||
|
||||
String[] gwID_and_rgwID = tempArr[0].split("/");
|
||||
zac.gwID = Integer.parseInt(gwID_and_rgwID[0]);
|
||||
zac.rgwID = Integer.parseInt(gwID_and_rgwID[1]);
|
||||
|
||||
String[] zoneNr_and_channelNr = tempArr[1].split("/");
|
||||
zac.zoneNr = Integer.parseInt(zoneNr_and_channelNr[0]);
|
||||
zac.channelNr = Integer.parseInt(zoneNr_and_channelNr[1]);
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 204 error:"+e.toString());
|
||||
}
|
||||
zac = parse_CHANNEL_BRDCST(payload);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case OperationCodes.RADIO_STATUS_REP:
|
||||
{
|
||||
try {
|
||||
rStatus = new RadioStatus();
|
||||
String[] tempArr = payload.split("&");
|
||||
|
||||
if(tempArr.length == 4 || tempArr.length == 5) {
|
||||
rStatus.status = 1;
|
||||
rStatus.incCall.callStatus = Integer.parseInt(tempArr[0]);
|
||||
rStatus.incCall.callType = Integer.parseInt(tempArr[1]);
|
||||
rStatus.incCall.Imei = Integer.parseInt(tempArr[2]);
|
||||
rStatus.incCall.callerID = Integer.parseInt(tempArr[2]);
|
||||
rStatus.incCall.groupId = Integer.parseInt(tempArr[3]);
|
||||
rStatus.incCall.callDestID = Integer.parseInt(tempArr[3]);
|
||||
|
||||
if(tempArr.length == 5)
|
||||
rStatus.incCall.userID = Integer.parseInt(tempArr[4]);
|
||||
}
|
||||
else {
|
||||
String[] gwID_and_rgwID = tempArr[0].split("/");
|
||||
rStatus.gwID = Integer.parseInt(gwID_and_rgwID[0]);
|
||||
rStatus.rgwID = Integer.parseInt(gwID_and_rgwID[1]);
|
||||
rStatus.status = Integer.parseInt(tempArr[1]);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 199 error:"+e.toString());
|
||||
}
|
||||
rStatus = parse_RADIO_STATUS_REP(payload);
|
||||
break;
|
||||
}
|
||||
|
||||
case 250:
|
||||
{
|
||||
try {
|
||||
suStatus = new SUstatus();
|
||||
String[] tempArr = payload.split("&");
|
||||
|
||||
suStatus.imei = Integer.parseInt(tempArr[0]);
|
||||
|
||||
suStatus.status = Integer.parseInt(tempArr[1]);
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 250 error:"+e.toString());
|
||||
}
|
||||
case OperationCodes.UNIT_STATUS_UPDATE :
|
||||
suStatus = parse_UNIT_STATUS_UPDATE(payload);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 125:
|
||||
case OperationCodes.CALL_STATUS_BRDCST:
|
||||
{
|
||||
try {
|
||||
incCall = new IncCall();
|
||||
incCall.opCode = rOpcode;
|
||||
String[] tempArr = payload.split("&");
|
||||
|
||||
String[] gwID_and_rgwID_imei = tempArr[0].split("/");
|
||||
incCall.gwID = Integer.parseInt(gwID_and_rgwID_imei[0]);
|
||||
incCall.rgwID = Integer.parseInt(gwID_and_rgwID_imei[1]);
|
||||
incCall.Imei = Long.parseLong(gwID_and_rgwID_imei[2]);
|
||||
|
||||
incCall.callStatus = Integer.parseInt(tempArr[1]);
|
||||
incCall.callType = Integer.parseInt(tempArr[2]);
|
||||
incCall.groupId = Integer.parseInt(tempArr[3]);
|
||||
incCall.userID = Integer.parseInt(tempArr[4]);
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 125, 126 error:"+e.toString());
|
||||
}
|
||||
incCall = parse_CALL_STATUS_BRDCST(payload);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 121:
|
||||
case 122:
|
||||
@ -265,21 +153,9 @@ public class RadioMSG extends TCPmsg {
|
||||
}
|
||||
|
||||
case OperationCodes.CALL_TYPE_REP:
|
||||
{
|
||||
|
||||
try {
|
||||
incCall = new IncCall();
|
||||
incCall.opCode = rOpcode;
|
||||
String[] tempArr = payload.split("/");
|
||||
incCall.callType = Integer.parseInt(tempArr[0]);
|
||||
incCall.callStatus = Integer.parseInt(tempArr[1]);
|
||||
|
||||
SM.Debug("GOT CHANGE CALL TYPE MSG", incCall.opCode + " # " + incCall.callType + " # " + incCall.callStatus);
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 115,116,117 error:"+e.toString());
|
||||
}
|
||||
incCall = parse_CALL_TYPE_REP(payload);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 172:
|
||||
{
|
||||
@ -302,20 +178,10 @@ public class RadioMSG extends TCPmsg {
|
||||
}
|
||||
|
||||
case OperationCodes.EMERGENCY_REP:
|
||||
{
|
||||
try {
|
||||
emerg = new Emerg();
|
||||
String[] tempArr = payload.split("/");
|
||||
|
||||
emerg.function = Integer.parseInt(tempArr[0]);
|
||||
emerg.status = Integer.parseInt(tempArr[1]);
|
||||
|
||||
// emerg.userID = Integer.parseInt(tempArr[2]);
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 230 error:"+e.toString());
|
||||
}
|
||||
emerg = parse_EMERGENCY_REP(payload);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
case OperationCodes.CONTACTS_REP:
|
||||
@ -341,4 +207,254 @@ public class RadioMSG extends TCPmsg {
|
||||
|
||||
}
|
||||
|
||||
private RadioGW parseRadioGW(String buffer)
|
||||
{
|
||||
RadioGW rgw = new RadioGW();
|
||||
String[] radioFields = buffer.split("&");
|
||||
|
||||
if( radioFields.length > 3 ) {
|
||||
|
||||
rgw.ID = Integer.parseInt(radioFields[0].trim());
|
||||
rgw.GW_ID = Integer.parseInt(radioFields[1].trim());
|
||||
rgw.IMEI = radioFields[2];
|
||||
rgw.IP = radioFields[3];
|
||||
}
|
||||
|
||||
return rgw;
|
||||
}
|
||||
|
||||
private Zone parseZone(String buffer)
|
||||
{
|
||||
Zone zone = new Zone();
|
||||
String[] zoneFields = buffer.split(":");
|
||||
|
||||
if( zoneFields.length > 2 ) {
|
||||
|
||||
zone.dbID = Integer.parseInt(zoneFields[0].trim());
|
||||
zone.id = Integer.parseInt(zoneFields[1].trim());
|
||||
zone.ZoneName = zoneFields[2];
|
||||
}
|
||||
|
||||
return zone;
|
||||
}
|
||||
|
||||
private Channel parseChannel(String buffer)
|
||||
{
|
||||
Channel channel = new Channel();
|
||||
String[] channelFields = buffer.split("/");
|
||||
|
||||
if( channelFields.length > 2 ) {
|
||||
|
||||
channel.dbID = Integer.parseInt(channelFields[0].trim());
|
||||
channel.id = Integer.parseInt(channelFields[1].trim());
|
||||
channel.chName = channelFields[2].trim();
|
||||
}
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
private String[] getChannelList(String zone)
|
||||
{
|
||||
String[] zoneArr = zone.split(":");
|
||||
if ( zoneArr.length > 3)
|
||||
return zoneArr[3].split(",");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private String[] getZoneList(String gw)
|
||||
{
|
||||
String[] zoneArr = gw.split("&");
|
||||
if ( zoneArr.length > 4)
|
||||
return zoneArr[4].split("@");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ArrayList<RadioGW> getRadioGWList()
|
||||
{
|
||||
ArrayList<RadioGW> radioGWList = new ArrayList<RadioGW>();
|
||||
String[] radioGWArr = payload.split(";");
|
||||
|
||||
for(int i=0; i < radioGWArr.length; i++)
|
||||
{
|
||||
RadioGW rgw = parseRadioGW(radioGWArr[i]);
|
||||
String[] zoneArr = getZoneList(radioGWArr[i]);
|
||||
if( zoneArr == null)
|
||||
continue;
|
||||
|
||||
for(int j=0; j < zoneArr.length; j++)
|
||||
{
|
||||
|
||||
Zone zone = parseZone(zoneArr[j]);
|
||||
String[] channelArr = getChannelList(zoneArr[j]);
|
||||
if( channelArr == null)
|
||||
continue;
|
||||
|
||||
for(int k =0; k < channelArr.length; k++)
|
||||
{
|
||||
Channel channel = parseChannel(channelArr[k]);
|
||||
|
||||
//add channel to zone
|
||||
zone.channelList.add(channel);
|
||||
}
|
||||
|
||||
//add zone to radio GW
|
||||
rgw.zoneList.add(zone);
|
||||
}
|
||||
|
||||
radioGWList.add(rgw);
|
||||
|
||||
}
|
||||
|
||||
return radioGWList;
|
||||
}
|
||||
|
||||
private Zone_and_channel parse_CHANNEL_BRDCST(String payload) {
|
||||
Zone_and_channel zacObj = new Zone_and_channel();
|
||||
|
||||
try {
|
||||
|
||||
String[] tempArr = payload.split("&");
|
||||
|
||||
String[] gwID_and_rgwID = tempArr[0].split("/");
|
||||
zacObj.gwID = Integer.parseInt(gwID_and_rgwID[0].trim());
|
||||
zacObj.rgwID = Integer.parseInt(gwID_and_rgwID[1].trim());
|
||||
|
||||
String[] zoneNr_and_channelNr = tempArr[1].split("/");
|
||||
zacObj.zoneNr = Integer.parseInt(zoneNr_and_channelNr[0].trim());
|
||||
zacObj.channelNr = Integer.parseInt(zoneNr_and_channelNr[1].trim());
|
||||
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 204 error:"+e.toString());
|
||||
|
||||
}
|
||||
|
||||
return zacObj;
|
||||
|
||||
}
|
||||
|
||||
private IncCall parse_CALL_STATUS_BRDCST(String payload)
|
||||
{
|
||||
IncCall incCallObj = new IncCall();
|
||||
|
||||
try {
|
||||
|
||||
incCallObj.opCode = rOpcode;
|
||||
String[] tempArr = payload.split("&");
|
||||
|
||||
String[] gwID_and_rgwID_imei = tempArr[0].split("/");
|
||||
incCallObj.gwID = Integer.parseInt(gwID_and_rgwID_imei[0]);
|
||||
incCallObj.rgwID = Integer.parseInt(gwID_and_rgwID_imei[1]);
|
||||
incCallObj.Imei = Long.parseLong(gwID_and_rgwID_imei[2]);
|
||||
|
||||
incCallObj.callStatus = Integer.parseInt(tempArr[1]);
|
||||
incCallObj.callType = Integer.parseInt(tempArr[2]);
|
||||
incCallObj.groupId = Integer.parseInt(tempArr[3]);
|
||||
if (tempArr.length > 4 )
|
||||
incCallObj.userID = Integer.parseInt(tempArr[4]);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 125, 126 error:"+e.toString());
|
||||
}
|
||||
|
||||
return incCallObj;
|
||||
}
|
||||
|
||||
private RadioStatus parse_RADIO_STATUS_REP(String payload)
|
||||
{
|
||||
RadioStatus radioStatus = new RadioStatus();
|
||||
|
||||
try
|
||||
{
|
||||
String[] tempArr = payload.split("&");
|
||||
|
||||
if(tempArr.length == 4 || tempArr.length == 5) {
|
||||
|
||||
radioStatus.status = 1;
|
||||
radioStatus.incCall.callStatus = Integer.parseInt(tempArr[0]);
|
||||
radioStatus.incCall.callType = Integer.parseInt(tempArr[1]);
|
||||
radioStatus.incCall.Imei = Integer.parseInt(tempArr[2]);
|
||||
radioStatus.incCall.callerID = Integer.parseInt(tempArr[2]);
|
||||
radioStatus.incCall.groupId = Integer.parseInt(tempArr[3]);
|
||||
radioStatus.incCall.callDestID = Integer.parseInt(tempArr[3]);
|
||||
|
||||
if(tempArr.length == 5)
|
||||
radioStatus.incCall.userID = Integer.parseInt(tempArr[4]);
|
||||
}
|
||||
else {
|
||||
String[] gwID_and_rgwID = tempArr[0].split("/");
|
||||
radioStatus.gwID = Integer.parseInt(gwID_and_rgwID[0]);
|
||||
radioStatus.rgwID = Integer.parseInt(gwID_and_rgwID[1]);
|
||||
radioStatus.status = Integer.parseInt(tempArr[1]);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
SM.Debug("Cmd 199 error:"+e.toString());
|
||||
}
|
||||
|
||||
return radioStatus;
|
||||
|
||||
}
|
||||
|
||||
private Emerg parse_EMERGENCY_REP(String payload)
|
||||
{
|
||||
Emerg emergObj = new Emerg();
|
||||
|
||||
try {
|
||||
|
||||
String[] tempArr = payload.split("/");
|
||||
|
||||
emergObj.function = Integer.parseInt(tempArr[0]);
|
||||
emergObj.status = Integer.parseInt(tempArr[1]);
|
||||
|
||||
// emerg.userID = Integer.parseInt(tempArr[2]);
|
||||
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 230 error:"+e.toString());
|
||||
}
|
||||
|
||||
return emergObj;
|
||||
}
|
||||
|
||||
private SUstatus parse_UNIT_STATUS_UPDATE(String payload)
|
||||
{
|
||||
SUstatus suStatusObj = new SUstatus();
|
||||
|
||||
try {
|
||||
|
||||
String[] tempArr = payload.split("&");
|
||||
|
||||
suStatusObj.imei = Integer.parseInt(tempArr[0]);
|
||||
suStatusObj.status = Integer.parseInt(tempArr[1]);
|
||||
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 250 error:"+e.toString());
|
||||
}
|
||||
|
||||
return suStatusObj;
|
||||
|
||||
}
|
||||
|
||||
private IncCall parse_CALL_TYPE_REP(String payload)
|
||||
{
|
||||
IncCall incCallObj = new IncCall();
|
||||
|
||||
try {
|
||||
|
||||
incCallObj.opCode = rOpcode;
|
||||
String[] tempArr = payload.split("/");
|
||||
incCallObj.callType = Integer.parseInt(tempArr[0]);
|
||||
incCallObj.callStatus = Integer.parseInt(tempArr[1]);
|
||||
|
||||
SM.Debug("GOT CHANGE CALL TYPE MSG", incCallObj.opCode + " # " + incCallObj.callType + " # " + incCallObj.callStatus);
|
||||
} catch (Exception e) {
|
||||
SM.Debug("Cmd 115,116,117 error:"+e.toString());
|
||||
}
|
||||
|
||||
return incCallObj;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -227,6 +227,7 @@ public class TCPmsgParser implements Runnable {
|
||||
if (TCPhandler.msgList == null)
|
||||
continue;
|
||||
if(!TCPhandler.msgList.isEmpty()) {
|
||||
|
||||
try {
|
||||
_msg = TCPhandler.msgList.poll();
|
||||
if(_msg == null)
|
||||
@ -235,27 +236,32 @@ public class TCPmsgParser implements Runnable {
|
||||
continue;
|
||||
//parse the rest of the message;
|
||||
|
||||
switch(_msg.opCode) {
|
||||
case 40:{
|
||||
|
||||
switch(_msg.opCode)
|
||||
{
|
||||
case 40: /* login */{
|
||||
_fireLoginEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 41:{
|
||||
case 41: /* vehicle */ {
|
||||
_fireVehEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 42:{
|
||||
|
||||
case 42: /* Text Message */{
|
||||
_fireSMSEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 43:{
|
||||
|
||||
case 43: /* Last text message */ {
|
||||
_fireLastSMSEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case OperationCodes.TM_ACK:
|
||||
case OperationCodes.TM_ACK_SD: {
|
||||
_fireSMSconfirm();
|
||||
@ -267,22 +273,23 @@ public class TCPmsgParser implements Runnable {
|
||||
break;
|
||||
}
|
||||
|
||||
case 45:{
|
||||
case 45: /* last position */ {
|
||||
_fireLastPos();
|
||||
break;
|
||||
}
|
||||
|
||||
case 131:{
|
||||
case 131: /* gps */ {
|
||||
_fireGPSEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 231:{
|
||||
case 231: /* pool */ {
|
||||
_firePOLLEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 50:{
|
||||
|
||||
case 50: /* radio */ {
|
||||
_fireRadioEvent();
|
||||
break;
|
||||
}
|
||||
@ -297,12 +304,14 @@ public class TCPmsgParser implements Runnable {
|
||||
break;
|
||||
}
|
||||
|
||||
case 47:{
|
||||
|
||||
case 47: /* alert list */ {
|
||||
_fireAlarmList();
|
||||
break;
|
||||
}
|
||||
|
||||
case 48:{
|
||||
|
||||
case 48: /* alert ack */ {
|
||||
_fireAlarmACK();
|
||||
break;
|
||||
}
|
||||
@ -359,8 +368,10 @@ public class TCPmsgParser implements Runnable {
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
catch(Exception ex) {
|
||||
try {
|
||||
if(TCPhandler.msgList.size() > 0)
|
||||
_msg = TCPhandler.msgList.remove(0);
|
||||
@ -370,6 +381,7 @@ public class TCPmsgParser implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SM.Debug("TCPmsgParser listen thread stoped.");
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ public class AudioHandle implements Runnable{
|
||||
private TcpAudioClient tcp;
|
||||
private int audioport = 50001;
|
||||
|
||||
|
||||
public int typeUDP;
|
||||
public AudioHandle(String IP, int _typeUDP)
|
||||
{
|
||||
@ -89,7 +90,7 @@ public class AudioHandle implements Runnable{
|
||||
t_micListner.start();
|
||||
|
||||
|
||||
if(typeUDP==1)
|
||||
if(typeUDP == 1)
|
||||
{
|
||||
udp.addUDPListener(new IUDPListener()
|
||||
{
|
||||
@ -99,7 +100,7 @@ public class AudioHandle implements Runnable{
|
||||
byte[] data = event.data();
|
||||
int len = event.len();
|
||||
SM.Debug("recv b:"+len+" data.length:"+data.length);
|
||||
if(data!=null)
|
||||
if(data != null)
|
||||
PlaySound(data, len);
|
||||
}
|
||||
|
||||
@ -141,20 +142,22 @@ public class AudioHandle implements Runnable{
|
||||
if (soundNeeded)
|
||||
{
|
||||
//SM.Debug("sending b:"+bRead);
|
||||
if(typeUDP==1)
|
||||
if(typeUDP == 1)
|
||||
{
|
||||
tempBuffer = new byte[512];//128];//invers3.bufferSize];
|
||||
bRead = recDev.read(tempBuffer, 0, 512);// 128);//invers3.bufferSize);
|
||||
int size = 512; // 2048
|
||||
|
||||
tempBuffer = new byte[size];
|
||||
bRead = recDev.read(tempBuffer, 0, size);
|
||||
|
||||
udp.Send(tempBuffer,bRead);
|
||||
SM.Debug("UDP sending b:"+bRead);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempBuffer = new byte[2048];//128];//invers3.bufferSize];
|
||||
bRead = recDev.read(tempBuffer, 0, 2048);// 128);//invers3.bufferSize);
|
||||
/*
|
||||
tempBuffer = new byte[16384];//128];//invers3.bufferSize];
|
||||
bRead = recDev.read(tempBuffer, 0,16384);// 128);//invers3.bufferSize);*/
|
||||
int size = 1024; //
|
||||
tempBuffer = new byte[size];
|
||||
bRead = recDev.read(tempBuffer, 0, size);
|
||||
|
||||
tcp.send(tempBuffer,bRead);
|
||||
SM.Debug("TCP sending b:"+bRead);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10,19 +10,13 @@ import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.NetworkRequest;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@ -120,17 +114,6 @@ public class SDMobileActivity extends Activity {
|
||||
super.onCreate(savedInstanceState);
|
||||
SM.Debug("##### onCREATE ##### with LANGUAGE " + AppParams.LANGUAGETMP);
|
||||
|
||||
ConnectivityManager connectivityManager =
|
||||
(ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
connectivityManager.registerDefaultNetworkCallback(networkCallback);
|
||||
} else {
|
||||
NetworkRequest request = new NetworkRequest.Builder()
|
||||
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build();
|
||||
connectivityManager.registerNetworkCallback(request, networkCallback);
|
||||
}
|
||||
|
||||
AppParams.theme = AppParams.Theme.SAFEDISPATCH;
|
||||
if (AppParams.theme == AppParams.Theme.SAFENET)
|
||||
this.setTheme(R.style.Theme_Safenet);
|
||||
@ -182,37 +165,16 @@ public class SDMobileActivity extends Activity {
|
||||
ImageView imageLoading = (ImageView) findViewById(R.id.imageLoading);
|
||||
imageLoading.setBackgroundResource(R.drawable.loading);
|
||||
|
||||
// language
|
||||
imageLanguage = (ImageView) findViewById(R.id.imageLanguage);
|
||||
|
||||
// change spinner icon and selected language according to tmpLanguage
|
||||
switch (AppParams.LANGUAGETMP) {
|
||||
case "en":
|
||||
imageLanguage.setImageResource(R.drawable.en);
|
||||
break;
|
||||
case "de":
|
||||
imageLanguage.setImageResource(R.drawable.de);
|
||||
break;
|
||||
case "tr":
|
||||
imageLanguage.setImageResource(R.drawable.tr);
|
||||
break;
|
||||
case "ro":
|
||||
imageLanguage.setImageResource(R.drawable.ro);
|
||||
break;
|
||||
case "es":
|
||||
imageLanguage.setImageResource(R.drawable.es);
|
||||
break;
|
||||
case "ru":
|
||||
imageLanguage.setImageResource(R.drawable.ru);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + AppParams.LANGUAGETMP);
|
||||
}
|
||||
|
||||
imageLanguage.setOnClickListener(LanguageListener);
|
||||
setLanguageIcon();
|
||||
|
||||
// username and password
|
||||
etUsername = (EditText) findViewById(R.id.etUsername);
|
||||
etPassword = (EditText) findViewById(R.id.etPassword);
|
||||
|
||||
// login button
|
||||
btLogin = (Button) findViewById(R.id.btLogin);
|
||||
btLogin.setOnClickListener(arg0 -> {
|
||||
|
||||
@ -304,6 +266,35 @@ public class SDMobileActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setLanguageIcon()
|
||||
{
|
||||
// change spinner icon and selected language according to tmpLanguage
|
||||
switch (AppParams.LANGUAGETMP) {
|
||||
case "en":
|
||||
imageLanguage.setImageResource(R.drawable.en);
|
||||
break;
|
||||
case "de":
|
||||
imageLanguage.setImageResource(R.drawable.de);
|
||||
break;
|
||||
case "tr":
|
||||
imageLanguage.setImageResource(R.drawable.tr);
|
||||
break;
|
||||
case "ro":
|
||||
imageLanguage.setImageResource(R.drawable.ro);
|
||||
break;
|
||||
case "es":
|
||||
imageLanguage.setImageResource(R.drawable.es);
|
||||
break;
|
||||
case "ru":
|
||||
imageLanguage.setImageResource(R.drawable.ru);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + AppParams.LANGUAGETMP);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (loadingDialog.isShowing())
|
||||
@ -541,22 +532,6 @@ public class SDMobileActivity extends Activity {
|
||||
SM.Debug("##### onRESUME #####");
|
||||
}
|
||||
|
||||
private final ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {
|
||||
@Override
|
||||
public void onAvailable(Network network) {
|
||||
// network available
|
||||
Log.v("NetworkAvailability", "available");
|
||||
if (tcp != null && !tcp.isConnectionUP)
|
||||
saveIPandRestartTCP(AppParams.IP, AppParams.PORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLost(Network network) {
|
||||
// network unavailable
|
||||
Log.v("NetworkAvailability", "unavailable");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private void startTabActivity(long userID) {
|
||||
// good login - load activity
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -155,13 +155,13 @@
|
||||
android:id="@+id/imageSettings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:contentDescription="holds the icon for language"
|
||||
android:src="@drawable/change_ip"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_alignTop="@+id/imageLanguage"
|
||||
android:layout_alignBottom="@+id/imageLanguage"
|
||||
android:layout_alignParentRight="true" />
|
||||
android:layout_alignParentRight="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="holds the icon for language"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/change_ip" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonLogin"
|
||||
|
Loading…
Reference in New Issue
Block a user