I've asked about this in the begining of the year!
I made some modifications in the library to be able to set diferents DCS.
It will be great if this feature be included in the next release.
I am sending the patch.
Maybe it can help you.

Thanks folks



Index: src/java/org/ajwcc/pduUtils/gsm3040/Pdu.java
===================================================================
--- src/java/org/ajwcc/pduUtils/gsm3040/Pdu.java (revision 1643)
+++ src/java/org/ajwcc/pduUtils/gsm3040/Pdu.java (working copy)
@@ -459,10 +459,13 @@
  {
   this.dataBytes = dataBytes;
   this.decodedText = null;
-  // clear the encoding bits for this field 8-bit/data
+
+//TODO: Jeff's hint  - it was overwriting the class config! Now it is ok!
+        /*
   this.dataCodingScheme &= PduUtils.DCS_ENCODING_MASK;
   this.dataCodingScheme |= PduUtils.DCS_ENCODING_8BIT;
   this.dataCodingScheme |= PduUtils.DCS_CODING_GROUP_DATA;
+    */
  }

  public byte[] getDataBytes()
@@ -473,7 +476,7 @@
  public boolean isBinary()
  {
   // use the DCS coding group or 8bit encoding
-  return ((this.dataCodingScheme & PduUtils.DCS_CODING_GROUP_DATA) == 
PduUtils.DCS_CODING_GROUP_DATA || (this.dataCodingScheme & 
PduUtils.DCS_ENCODING_8BIT) == PduUtils.DCS_ENCODING_8BIT);
+  return ((this.dataCodingScheme & PduUtils.DCS_CODING_GROUP_DATA) == 
PduUtils.DCS_CODING_GROUP_DATA || (this.dataCodingScheme & 
PduUtils.DCS_ENCODING_8BIT) == PduUtils.DCS_ENCODING_8BIT );
  }

  public void setDecodedText(String decodedText)
Index: src/java/org/ajwcc/pduUtils/gsm3040/PduUtils.java
===================================================================
--- src/java/org/ajwcc/pduUtils/gsm3040/PduUtils.java (revision 1643)
+++ src/java/org/ajwcc/pduUtils/gsm3040/PduUtils.java (working copy)
@@ -457,8 +457,16 @@

  public static final int DCS_MESSAGE_CLASS_MASK = 0xEC;

- public static final int DCS_MESSAGE_CLASS_FLASH = 0x10;
+ public static final int DCS_MESSAGE_CLASS_NONE = 0x00;

+    public static final int DCS_MESSAGE_CLASS_FLASH = 0x10;
+
+    public static final int DCS_MESSAGE_CLASS_ME = 0x11;
+
+    public static final int DCS_MESSAGE_CLASS_SIM = 0x12;
+
+    public static final int DCS_MESSAGE_CLASS_TE = 0x13;
+
  public static int extractDcsEncoding(int dataCodingScheme)
  {
   return dataCodingScheme & ~PduUtils.DCS_ENCODING_MASK;
@@ -470,6 +478,12 @@
   return dataCodingScheme & ~DCS_MESSAGE_CLASS_MASK;
  }

+    public static int extractDcsClass(int dataCodingScheme)
+ {
+
+  return dataCodingScheme & ~DCS_MESSAGE_CLASS_MASK;
+ }
+
  public static int extractDcsCodingGroup(int dataCodingScheme)
  {
   return dataCodingScheme & ~DCS_CODING_GROUP_MASK;
@@ -620,12 +634,24 @@
     break;
   }
   // are flash messages are only applicable to general coding group?
+        // Inclued all class type
   if ((pdu.getDataCodingScheme() & ~PduUtils.DCS_CODING_GROUP_GENERAL) == 
0)
   {
-   if (PduUtils.extractDcsFlash(pdu.getDataCodingScheme()) == 
PduUtils.DCS_MESSAGE_CLASS_FLASH)
-   {
-    sb.append(", (Flash Message)");
-   }
+   switch (PduUtils.extractDcsClass(pdu.getDataCodingScheme()))
+            {
+                case PduUtils.DCS_MESSAGE_CLASS_FLASH:
+                  sb.append(", (Flash Message)");
+                  break;
+                case PduUtils.DCS_MESSAGE_CLASS_ME:
+                  sb.append(", (Class1 ME Message)");
+                  break;
+                case PduUtils.DCS_MESSAGE_CLASS_SIM:
+                  sb.append(", (Class2 SIM Message)");
+                  break;
+                case PduUtils.DCS_MESSAGE_CLASS_TE:
+                  sb.append(", (Class3 TE Message)");
+                  break;
+            }
   }
   return sb.toString();
  }
Index: src/java/org/smslib/Message.java
===================================================================
--- src/java/org/smslib/Message.java (revision 1643)
+++ src/java/org/smslib/Message.java (working copy)
@@ -58,7 +58,30 @@
   ENCCUSTOM
  }

- /**
+ public enum MessageClasses
+ {
+  /**
+   * Default option to set no message class meaning.
+   */
+  MSGCLASS_NONE,
+        /**
+   * Class 0 - Immediate display (alert).
+   */
+  MSGCLASS_FLASH,
+  /**
+   * Class 1 - ME specific
+   */
+  MSGCLASS_ME,
+  /**
+   * Classs 2 - SIM specific
+   */
+  MSGCLASS_SIM,
+  /**
+   * Class 3 - TE specific
+   */
+  MSGCLASS_TE
+ }
+    /**
   * Enumeration representing the different types of messages.
   */
  public enum MessageTypes
@@ -97,6 +120,8 @@

  private MessageEncodings encoding;

+    private MessageClasses msgClass;
+
  protected int dstPort;

  protected int srcPort;
@@ -112,6 +137,7 @@
   setDate(myDate);
   this.text = myText;
   this.encoding = MessageEncodings.ENC7BIT;
+        this.msgClass = MessageClasses.MSGCLASS_NONE;
   this.srcPort = -1;
   this.dstPort = -1;
   this.messageCharCount = 0;
@@ -154,6 +180,22 @@
   return this.encoding;
  }

+
+    /**
+  * Returns the message Class.
+  *
+  * @return The message class.
+  * @see #setDCSMessageClass
+  * @see MessageClasses
+  */
+
+    public MessageClasses getDCSMessageClass()
+ {
+  return this.msgClass;
+ }
+
+
+
  /**
   * Returns the ID of the gateway which the message was received from (for
   * inbound messages) or the message was dispatched from (outbound 
messages).
@@ -339,6 +381,21 @@
   this.encoding = myEncoding;
  }

+
+ /**
+  * Sets the message Class to the specified one.
+  *
+  * @param myMsgClass
+  *            The message Class.
+  * @see #getDCSMessageClass()
+  * @see MessageClasses
+  */
+ public void setDCSMessageClass(MessageClasses myMsgClass)
+ {
+  this.msgClass = myMsgClass;
+ }
+
+
  public abstract String getPduUserData();

  public abstract String getPduUserDataHeader();
Index: src/java/org/smslib/OutboundMessage.java
===================================================================
--- src/java/org/smslib/OutboundMessage.java (revision 1643)
+++ src/java/org/smslib/OutboundMessage.java (working copy)
@@ -98,10 +98,8 @@

  private boolean statusReport;

- private boolean flashSms;
+    private String from;

- private String from;
-
  private MessageStatuses messageStatus;

  private FailureCauses failureCause;
@@ -124,12 +122,12 @@
   this.recipient = "";
   this.validityPeriod = -1;
   this.statusReport = false;
-  this.flashSms = false;
   this.from = "";
   this.dispatchDate = null;
   setDate(new Date());
   setEncoding(MessageEncodings.ENC7BIT);
-  this.messageStatus = MessageStatuses.UNSENT;
+        setDCSMessageClass(MessageClasses.MSGCLASS_NONE);
+        this.messageStatus = MessageStatuses.UNSENT;
   this.failureCause = FailureCauses.NO_ERROR;
   this.retryCount = 0;
   this.priority = 0;
@@ -150,11 +148,11 @@
   this.recipient = myRecipient;
   this.validityPeriod = -1;
   this.statusReport = false;
-  this.flashSms = false;
   this.from = "";
   this.dispatchDate = null;
   setDate(new Date());
   setEncoding(MessageEncodings.ENC7BIT);
+        setDCSMessageClass(MessageClasses.MSGCLASS_NONE);
   this.messageStatus = MessageStatuses.UNSENT;
   this.failureCause = FailureCauses.NO_ERROR;
   this.retryCount = 0;
@@ -211,7 +209,8 @@
   */
  public boolean getFlashSms()
  {
-  return this.flashSms;
+  if (getDCSMessageClass() == MessageClasses.MSGCLASS_FLASH) return true;
+        return false;
  }

  /**
@@ -228,7 +227,7 @@
   */
  public void setFlashSms(boolean myFlashSms)
  {
-  this.flashSms = myFlashSms;
+        setDCSMessageClass(MessageClasses.MSGCLASS_FLASH);
  }

  /**
@@ -532,12 +531,25 @@
     // just use this
     dcs = PduUtils.DCS_ENCODING_7BIT;
    }
-   if (this.flashSms)
-   {
-    // add flash indicator
-    dcs = dcs | PduUtils.DCS_MESSAGE_CLASS_FLASH;
-   }
-   pdu.setDataCodingScheme(dcs);
+
+            if (getDCSMessageClass() == MessageClasses.MSGCLASS_FLASH)
+            {
+                dcs = dcs | PduUtils.DCS_MESSAGE_CLASS_FLASH;
+            }
+            else if (getDCSMessageClass() == MessageClasses.MSGCLASS_ME)
+            {
+                dcs = dcs | PduUtils.DCS_MESSAGE_CLASS_ME;
+            }
+            else if (getDCSMessageClass() == MessageClasses.MSGCLASS_SIM)
+            {
+                dcs = dcs | PduUtils.DCS_MESSAGE_CLASS_SIM;
+            }
+            else if (getDCSMessageClass() == MessageClasses.MSGCLASS_TE)
+            {
+                dcs = dcs | PduUtils.DCS_MESSAGE_CLASS_TE;
+            }
+
+            pdu.setDataCodingScheme(dcs);
   }
   // validity period
   pdu.setValidityPeriod(this.validityPeriod);
Index: src/java/org/smslib/smsserver/interfaces/Database.java
===================================================================
--- src/java/org/smslib/smsserver/interfaces/Database.java (revision 1643)
+++ src/java/org/smslib/smsserver/interfaces/Database.java (working copy)
@@ -35,6 +35,7 @@
 import org.smslib.OutboundMessage;
 import org.smslib.StatusReportMessage;
 import org.smslib.Message.MessageEncodings;
+import org.smslib.Message.MessageClasses;
 import org.smslib.Message.MessageTypes;
 import org.smslib.OutboundMessage.MessageStatuses;
 import org.smslib.smsserver.SMSServer;
@@ -246,7 +247,21 @@
        msg = new OutboundMessage(rs.getString("recipient").trim(), 
rs.getString("text").trim());
        msg.setEncoding(MessageEncodings.ENCUCS2);
        break;
-      default:
+      case 'C':
+       {
+        String text = rs.getString("text").trim();
+        byte bytes[] = new byte[text.length() / 2];
+        for (int i = 0; i < text.length(); i +=2 )
+        {
+         int value = (Integer.parseInt("" + text.charAt(i)) * 16) + 
(Integer.parseInt("" + text.charAt(i + 1)));
+         bytes[i / 2] = (byte) value;
+        }
+        msg = new OutboundBinaryMessage(rs.getString("recipient").trim(), 
bytes);
+        msg.setEncoding(MessageEncodings.ENC8BIT);
+        msg.setDCSMessageClass(MessageClasses.MSGCLASS_ME);
+       }
+       break;
+                        default:
        msg = new OutboundMessage(rs.getString("recipient").trim(), 
rs.getString("text").trim());
        msg.setEncoding(MessageEncodings.ENC7BIT);
        break;



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SMSLib User Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/SMSLib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to