radio for App Server Mobile + refactor #26
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -276,132 +276,133 @@ public class TCPmsgParser implements Runnable{
|
||||
|
||||
switch(_msg.opCode)
|
||||
{
|
||||
case 40:{
|
||||
_fireLoginEvent();
|
||||
break;
|
||||
}
|
||||
case 40: /* login */{
|
||||
_fireLoginEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 41:{
|
||||
_fireVehEvent();
|
||||
break;
|
||||
}
|
||||
case 41: /* vehicle */ {
|
||||
_fireVehEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 42:{
|
||||
_fireSMSEvent();
|
||||
break;
|
||||
}
|
||||
case 42: /* Text Message */{
|
||||
_fireSMSEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 43:{
|
||||
_fireLastSMSEvent();
|
||||
break;
|
||||
}
|
||||
case 43: /* Last text message */ {
|
||||
_fireLastSMSEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case OperationCodes.TM_ACK:{
|
||||
_fireSMSconfirm();
|
||||
break;
|
||||
}
|
||||
case OperationCodes.TM_ACK_SD:{
|
||||
_fireSMSconfirm();
|
||||
break;
|
||||
}
|
||||
case OperationCodes.TM_ACK:{
|
||||
_fireSMSconfirm();
|
||||
break;
|
||||
}
|
||||
|
||||
case OperationCodes.RECEIVED_TM:{
|
||||
_fireNewSMS();
|
||||
break;
|
||||
}
|
||||
case OperationCodes.TM_ACK_SD:{
|
||||
_fireSMSconfirm();
|
||||
break;
|
||||
}
|
||||
|
||||
case 45:{
|
||||
_fireLastPos();
|
||||
break;
|
||||
}
|
||||
case OperationCodes.RECEIVED_TM:{
|
||||
_fireNewSMS();
|
||||
break;
|
||||
}
|
||||
|
||||
case 131:{
|
||||
_fireGPSEvent();
|
||||
break;
|
||||
}
|
||||
case 45: /* last position */ {
|
||||
_fireLastPos();
|
||||
break;
|
||||
}
|
||||
|
||||
case 231:{
|
||||
_firePOLLEvent();
|
||||
break;
|
||||
}
|
||||
case 131: /* gps */ {
|
||||
_fireGPSEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 50:{
|
||||
_fireRadioEvent();
|
||||
break;
|
||||
}
|
||||
case 231: /* pool */ {
|
||||
_firePOLLEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 46:{
|
||||
_fireHistPos();
|
||||
break;
|
||||
}
|
||||
case 50: /* radio */ {
|
||||
_fireRadioEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case 86:{
|
||||
_fireHistCount();
|
||||
break;
|
||||
}
|
||||
case 46: {
|
||||
_fireHistPos();
|
||||
break;
|
||||
}
|
||||
|
||||
case 47:{
|
||||
_fireAlarmList();
|
||||
break;
|
||||
}
|
||||
case 86:{
|
||||
_fireHistCount();
|
||||
break;
|
||||
}
|
||||
|
||||
case 48:{
|
||||
_fireAlarmACK();
|
||||
break;
|
||||
}
|
||||
case 47: /* alert list */ {
|
||||
_fireAlarmList();
|
||||
break;
|
||||
}
|
||||
|
||||
case 49:{
|
||||
_fireRecordList();
|
||||
break;
|
||||
}
|
||||
case 48: /* alert ack */ {
|
||||
_fireAlarmACK();
|
||||
break;
|
||||
}
|
||||
|
||||
case 38:{
|
||||
_fireRecordPlay();
|
||||
break;
|
||||
}
|
||||
case 49:{
|
||||
_fireRecordList();
|
||||
break;
|
||||
}
|
||||
|
||||
case 135:
|
||||
case 136:
|
||||
case 137:
|
||||
case 138:
|
||||
case 140:{
|
||||
_fireAlarmLive();
|
||||
break;
|
||||
}
|
||||
case 38:{
|
||||
_fireRecordPlay();
|
||||
break;
|
||||
}
|
||||
|
||||
case OperationCodes.PONG: {
|
||||
//_firePONGReceivedEvent();
|
||||
break;
|
||||
}
|
||||
case 135:
|
||||
case 136:
|
||||
case 137:
|
||||
case 138:
|
||||
case 140:{
|
||||
_fireAlarmLive();
|
||||
break;
|
||||
}
|
||||
|
||||
case OperationCodes.CONNECTION_REP: {
|
||||
_fireConnectionReplyEvent();
|
||||
break;
|
||||
}
|
||||
case OperationCodes.PONG: {
|
||||
//_firePONGReceivedEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case OperationCodes.CONTACTS_REP: {
|
||||
sleep(15);
|
||||
_fireContactsReceivedEvent();
|
||||
break;
|
||||
}
|
||||
case OperationCodes.CONNECTION_REP: {
|
||||
_fireConnectionReplyEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case OperationCodes.TM_LIST_REP: {
|
||||
_fireTextMessagesReceivedEvent();
|
||||
break;
|
||||
}
|
||||
case OperationCodes.CONTACTS_REP: {
|
||||
sleep(15);
|
||||
_fireContactsReceivedEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case OperationCodes.RECORDINGS_LIST_REP: {
|
||||
_fireRecordingsReceivedEvent();
|
||||
break;
|
||||
}
|
||||
case OperationCodes.TM_LIST_REP: {
|
||||
_fireTextMessagesReceivedEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
case OperationCodes.RECORDING_REP: {
|
||||
_fireRecordingPlayReceivedEvent();
|
||||
break;
|
||||
}
|
||||
case OperationCodes.RECORDINGS_LIST_REP: {
|
||||
_fireRecordingsReceivedEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
case OperationCodes.RECORDING_REP: {
|
||||
_fireRecordingPlayReceivedEvent();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
@ -416,8 +417,6 @@ public class TCPmsgParser implements Runnable{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
catch (Exception e)
|
||||
|
@ -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
@ -165,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 -> {
|
||||
|
||||
@ -287,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())
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -151,17 +151,17 @@
|
||||
android:textColor="#000000"
|
||||
android:layout_marginBottom="5sp" />
|
||||
|
||||
<ImageView
|
||||
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" />
|
||||
<ImageView
|
||||
android:id="@+id/imageSettings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_alignTop="@+id/imageLanguage"
|
||||
android:layout_alignBottom="@+id/imageLanguage"
|
||||
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