⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmppdeliver.java

📁 短信系统SMS:支持普通短信、长短信和wap push短信的发送。
💻 JAVA
字号:
package com.ekun.sms.cmpp2;

public class CmppDeliver
{

  public CmppDeliver(byte bodys[], int bodylens)
  {
    this.bodylens = bodylens;
    bodybytes = new byte[bodylens];

    //MsgId = -1;
    DestnationId = "";
    ServiceId = "";
    TPpid = -1;
    TPudhi = -1;
    MsgFmt = -1;
    SrcTerminalId = "";
    RegisteredDelivery = -1;
    MsgLength = 0;
    MsgContent = new byte[160];
    Reverse = "";

    Stat = "";
    SubmitTime = "";
    DoneTime = "";
    DestTerminalId = "";
    SMSCSequence = -1;

    int i = 0;
    for (i = 0; i < bodylens; i++)
    {
      bodybytes[i] = bodys[i];
    }
  }

  public byte[] getMsgId()
  {

    byte tempbytes[] = new byte[8];

    CmppCommon.BytesCopy(bodybytes, tempbytes, 0, 7, 0);

    MsgId = tempbytes;

    return MsgId;
  }

  public byte[] getReceiptMsgId()
  {
    byte tmp = bodybytes[63];
    int isRegisteredDelivery = (int) tmp;

    byte tempbytes[] = new byte[8];

    if (isRegisteredDelivery == 1)
    {
      CmppCommon.BytesCopy(bodybytes, tempbytes, 65, 72, 0);
    }

    MsgId = tempbytes;

    return MsgId;
  }

  public String getDestnationId()
  {
    byte tempbytes[] = new byte[21];
    CmppCommon.BytesCopy(bodybytes, tempbytes, 8, 28, 0);
    DestnationId = new String(tempbytes);
    return DestnationId;
  }

  public String getServiceId()
  {
    byte tempbytes[] = new byte[10];
    CmppCommon.BytesCopy(bodybytes, tempbytes, 29, 38, 0);
    ServiceId = new String(tempbytes);
    return ServiceId;
  }

  public int getTPpid()
  {
    byte tmp = bodybytes[39];
    //System.out.println("bodybytes[39]:"+bodybytes[39]);
    TPpid = tmp;
    return TPpid;
  }

  public int getTPudhi()
  {
    byte tmp = bodybytes[40];
    TPudhi = (int) tmp;
    return TPudhi;
  }

  public int getMsgFmt()
  {
    byte tmp = bodybytes[41];
    MsgFmt = (int) tmp;
    return MsgFmt;
  }

  public String getSrcTerminalId()
  {
    byte tempbytes[] = new byte[21];
    CmppCommon.BytesCopy(bodybytes, tempbytes, 42, 62, 0);
    SrcTerminalId = new String(tempbytes);
    return SrcTerminalId;
  }

  public int getRegisteredDelivery()
  {
    byte tmp = bodybytes[63];
    RegisteredDelivery = (int) tmp;
    return RegisteredDelivery;
  }

  public int getMsgLength()
  {
    byte tmp = bodybytes[64];
    MsgLength = (int) tmp;
    if (MsgLength < 0)
    {
      MsgLength += 256;
    }
    return MsgLength;
  }

  public byte[] getMsgContent()
  {
    // byte tmp = bodybytes[64];
    int lengths = getMsgLength();

    //System.out.println("lengths:"+lengths);
    MsgContent = new byte[lengths];

    CmppCommon.BytesCopy(bodybytes, MsgContent, 65, 64 + lengths, 0);

    return MsgContent;
  }

  public String getReverse()
  {
    int lengths;
    int RegisteredDelivery = getRegisteredDelivery();
    if (RegisteredDelivery == 1)
    {
      lengths = 60;
    }
    else
    {
      lengths = getMsgLength();
    }

    byte tempbytes[] = new byte[8];

    CmppCommon.BytesCopy(bodybytes, tempbytes, 65 + lengths, 65 + lengths + 7,
                         0);
    Reverse = new String(tempbytes);

    return Reverse;
  }

  public String getReceiptStat()
  {
    byte tmp = bodybytes[63];
    int isRegisteredDelivery = (int) tmp;

    if (isRegisteredDelivery == 1)
    {
      byte tempbytes[] = new byte[7];

      CmppCommon.BytesCopy(bodybytes, tempbytes, 73, 79, 0);
      Stat = new String(tempbytes);
    }
    return Stat;
  }

  public String getReceiptSubmitTime()
  {
    byte tmp = bodybytes[63];
    int isRegisteredDelivery = (int) tmp;

    if (isRegisteredDelivery == 1)
    {
      byte tempbytes[] = new byte[10];

      CmppCommon.BytesCopy(bodybytes, tempbytes, 80, 89, 0);
      SubmitTime = new String(tempbytes);
    }
    return SubmitTime;
  }

  public String getReceiptDoneTime()
  {
    byte tmp = bodybytes[63];
    int isRegisteredDelivery = (int) tmp;

    if (isRegisteredDelivery == 1)
    {
      byte tempbytes[] = new byte[10];

      CmppCommon.BytesCopy(bodybytes, tempbytes, 90, 99, 0);
      DoneTime = new String(tempbytes);
    }

    return DoneTime;
  }

  public String getReceiptDestTerminalId()
  {
    byte tmp = bodybytes[63];
    int isRegisteredDelivery = (int) tmp;

    if (isRegisteredDelivery == 1)
    {
      byte tempbytes[] = new byte[21];

      CmppCommon.BytesCopy(bodybytes, tempbytes, 100, 120, 0);
      DestTerminalId = new String(tempbytes);
    }

    return DestTerminalId;
  }

  public int getReceiptSMSCSequence()
  {
    byte tmp = bodybytes[63];
    int isRegisteredDelivery = (int) tmp;

    if (isRegisteredDelivery == 1)
    {
      byte tempbytes[] = new byte[4];

      CmppCommon.BytesCopy(bodybytes, tempbytes, 121, 124, 0);
      SMSCSequence = CmppCommon.Bytes4ToInt(tempbytes);
    }
    return SMSCSequence;
  }

  byte bodybytes[]; //包体

  byte MsgId[];
  String DestnationId;
  String ServiceId;
  int TPpid;
  int TPudhi;
  int MsgFmt;
  String SrcTerminalId;
  int RegisteredDelivery;
  int MsgLength;
  byte[] MsgContent;
  String Reverse;

  String Stat;
  String SubmitTime;
  String DoneTime;
  String DestTerminalId;
  int SMSCSequence;

  int bodylens;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -