aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/SiwiProtocolDecoder.java1
-rw-r--r--src/org/traccar/smpp/SmppClient.java9
-rw-r--r--test/org/traccar/protocol/SiwiProtocolDecoderTest.java3
3 files changed, 12 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/SiwiProtocolDecoder.java b/src/org/traccar/protocol/SiwiProtocolDecoder.java
index 9c9e71e2e..78f32d01e 100644
--- a/src/org/traccar/protocol/SiwiProtocolDecoder.java
+++ b/src/org/traccar/protocol/SiwiProtocolDecoder.java
@@ -88,6 +88,7 @@ public class SiwiProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(parser.nextDouble());
position.setLongitude(parser.nextDouble());
position.setAltitude(parser.nextDouble());
+ position.setCourse(parser.nextInt());
DateBuilder dateBuilder = new DateBuilder(TimeZone.getTimeZone("IST"))
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt())
diff --git a/src/org/traccar/smpp/SmppClient.java b/src/org/traccar/smpp/SmppClient.java
index 317d6debf..122bbaea1 100644
--- a/src/org/traccar/smpp/SmppClient.java
+++ b/src/org/traccar/smpp/SmppClient.java
@@ -59,6 +59,7 @@ public class SmppClient {
private Integer reconnectionDelay;
private String sourceAddress;
+ private String commandSourceAddress;
private int submitTimeout;
private String notificationsCharsetName;
private byte notificationsDataCoding;
@@ -67,6 +68,8 @@ public class SmppClient {
private byte sourceTon;
private byte sourceNpi;
+ private byte commandSourceTon;
+ private byte commandSourceNpi;
private byte destTon;
private byte destNpi;
@@ -84,6 +87,7 @@ public class SmppClient {
sessionConfig.getLoggingOptions().setLogPdu(Context.getConfig().getBoolean("sms.smpp.logPdu"));
sourceAddress = Context.getConfig().getString("sms.smpp.sourceAddress", "");
+ commandSourceAddress = Context.getConfig().getString("sms.smpp.commandSourceAddress", sourceAddress);
submitTimeout = Context.getConfig().getInteger("sms.smpp.submitTimeout", 10000);
notificationsCharsetName = Context.getConfig().getString("sms.smpp.notificationsCharset",
@@ -97,7 +101,9 @@ public class SmppClient {
sourceTon = (byte) Context.getConfig().getInteger("sms.smpp.sourceTon", SmppConstants.TON_ALPHANUMERIC);
+ commandSourceTon = (byte) Context.getConfig().getInteger("sms.smpp.commandSourceTon", sourceTon);
sourceNpi = (byte) Context.getConfig().getInteger("sms.smpp.sourceNpi", SmppConstants.NPI_UNKNOWN);
+ commandSourceNpi = (byte) Context.getConfig().getInteger("sms.smpp.commandSourceNpi", sourceNpi);
destTon = (byte) Context.getConfig().getInteger("sms.smpp.destTon", SmppConstants.TON_INTERNATIONAL);
destNpi = (byte) Context.getConfig().getInteger("sms.smpp.destNpi", SmppConstants.NPI_E164);
@@ -204,7 +210,8 @@ public class SmppClient {
textBytes = CharsetUtil.encode(message, command ? commandsCharsetName : notificationsCharsetName);
submit.setDataCoding(command ? commandsDataCoding : notificationsDataCoding);
submit.setShortMessage(textBytes);
- submit.setSourceAddress(new Address(sourceTon, sourceNpi, sourceAddress));
+ submit.setSourceAddress(command ? new Address(commandSourceTon, commandSourceNpi, commandSourceAddress)
+ : new Address(sourceTon, sourceNpi, sourceAddress));
submit.setDestAddress(new Address(destTon, destNpi, destAddress));
SubmitSmResp submitResponce = getSession().submit(submit, submitTimeout);
if (submitResponce.getCommandStatus() == SmppConstants.STATUS_OK) {
diff --git a/test/org/traccar/protocol/SiwiProtocolDecoderTest.java b/test/org/traccar/protocol/SiwiProtocolDecoderTest.java
index c5c93b7d0..19d1552b2 100644
--- a/test/org/traccar/protocol/SiwiProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/SiwiProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class SiwiProtocolDecoderTest extends ProtocolTest {
SiwiProtocolDecoder decoder = new SiwiProtocolDecoder(new SiwiProtocol());
verifyPosition(decoder, text(
+ "$SIWI,9803932,23992,E,0,,0,1,1,0,5055,0,5,A,22.289887,70.807192,152,168,102922,090317,28,1,12,5,4098,1,0,13,0,0,0,1.0,3.1CHKS_4.82,0!"));
+
+ verifyPosition(decoder, text(
"$SIWI,2845,1320,Q,10,airtelgprs.com,1,1,0,0,876578,43,9,A,19.0123456,72.65347,45,0,055929,071107,22,5,1,0,3700,1210,0,2500,1230,321,0,1.1,4.0,1!"));
verifyPosition(decoder, text(