Examples of PduParser


Examples of org.ajwcc.pduUtils.gsm3040.PduParser

  {
    boolean ok = false;
    List<String> pdus = msg.getPdus(getSmscNumber(), this.outMpRefNo);
    for (String pdu : pdus)
    {
      Pdu newPdu = new PduParser().parsePdu(pdu);
      Logger.getInstance().logDebug(newPdu.toString(), null, getGatewayId());
      int j = pdu.length() / 2;
      if (getSmscNumber() == null)
      {
        // Do nothing on purpose!
View Full Code Here

Examples of org.ajwcc.pduUtils.gsm3040.PduParser

          if (line == null) break;
          line = line.trim();
          if (line.length() > 0) break;
        }
        // use the parser to determine the message type
        PduParser parser = new PduParser();
        while (true)
        {
          if (line == null) break;
          line = line.trim();
          if (line.length() <= 0 || line.equalsIgnoreCase("OK")) break;
          if (line.length() <= 0 || line.equalsIgnoreCase("ERROR")) break;
          i = line.indexOf(':');
          j = line.indexOf(',');
          memIndex = 0;
          try
          {
            memIndex = Integer.parseInt(line.substring(i + 1, j).trim());
          }
          catch (NumberFormatException e)
          {
            // TODO: What to do here?
            Logger.getInstance().logWarn("Incorrect Memory Index number parsed!", e, getGatewayId());
          }
          // Start modifications by Wim Stevens
          // A line contains something like +CMGL: 1,1,,25
          // first parameter is the memory index
          // last parameter is the length of the PDU, not counting the addressing part
          // the parser must always have an addressing part -> we will add it if required
          i = line.lastIndexOf(',');
          j = line.length();
          int pduSize = 0;
          try
          {
            pduSize = Integer.parseInt(line.substring(i + 1, j).trim());
          }
          catch (NumberFormatException e)
          {
            // TODO: What to do here?
            Logger.getInstance().logWarn("Incorrect pdu size parsed!", e, getGatewayId());
          }
          pduString = reader.readLine().trim();
          if ((pduSize > 0) && ((pduSize * 2) == pduString.length()))
          {
            pduString = "00" + pduString;
          }
          try
          {
            Logger.getInstance().logDebug("READ PDU: " + pduString, null, getGatewayId());
            // this will throw an exception for PDUs
            // it can't classify
            Pdu pdu = parser.parsePdu(pduString);
            // NOTE: maybe a message validity vs the current
            //       date should be put here.
            //       if the message is invalid, the message should
            //       be ignored and but logged
            if (pdu instanceof SmsDeliveryPdu)
View Full Code Here

Examples of org.ajwcc.pduUtils.gsm3040.PduParser

    if ((pdu.hasTpUdhi()) && (getEncoding() == MessageEncodings.ENC7BIT)) { throw new RuntimeException("getPduUserData() not supported for 7-bit messages with UDH"); }
    // sum up the ud parts
    StringBuffer ud = new StringBuffer();
    for (String pduString : pdus)
    {
      Pdu newPdu = new PduParser().parsePdu(pduString);
      ud.append(PduUtils.bytesToPdu(newPdu.getUserDataAsBytes()));
    }
    return ud.toString();
  }
View Full Code Here

Examples of org.ajwcc.pduUtils.gsm3040.PduParser

    // NOTE: - the mpRefNo is arbitrarily set to 1
    // - if the user wishes to extract the UDH per part, he would need to get all pduStrings
    // using getPdus(String smscNumber, int mpRefNo), use a
    // PduParser on each pduString in the returned list, then access the UDH via the Pdu object
    List<String> pdus = pduGenerator.generatePduList(pdu, 1);
    Pdu newPdu = new PduParser().parsePdu(pdus.get(0));
    byte[] udh = newPdu.getUDHData();
    if (udh != null) return PduUtils.bytesToPdu(udh);
    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.