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

📄 cmppdelivermessage.java

📁 使用华为cmpp2.0网关
💻 JAVA
字号:
package com.hoten.cmpp.message;

/**
 * <p>Title: 服务器下发信息</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company: </p>
 * @author unascribed
 * @version 1.0
 */

public class CMPPDeliverMessage  extends CMPPHead{

    public CMPPDeliverMessage() {
        this.nCommandID=5;
    }
    public DeliverMsg getDeliverMsg(){
        DeliverMsg msg = new DeliverMsg();
        msg.nIsDelivery=this.nIsDelivery;
        msg.nMsgFormat=this.nMsgFormat;
        msg.nMsgLength=this.nMsgLength;
        msg.nReportMsgId=this.nReportMsgId;
        msg.nSMSCSequence=this.nSMSCSequence;
        msg.sDestId=this.sDestId;
        msg.sDestTerminalId=this.sDestTerminalId;
        msg.sDoneTime=this.sDoneTime;
        msg.sMsgContent=this.sMsgContent;
        msg.sServiceId=this.sServiceId;
        msg.sSrcTerminalId=this.sSrcTerminalId;
        msg.sStat=this.sStat;
        msg.sSubmitTime=this.sSubmitTime;
        return msg;
    }
    public void setMsgID(byte[] id){

    }
    public void setReportMsgId(byte[] id){
      nReportMsgId=DecodeCMPPMsgID(id);
    }
    private String FormatInt(int i, int j)
    {
        String s;
        for(s = String.valueOf(i); s.length() < j; s = "0" + s);
        return s;
    }

    private String DecodeCMPPMsgID(byte abyte0[])
    {
        StringBuffer stringbuffer = new StringBuffer();
        byte byte0 = 0;
        int l1 = 0;
        byte0 = abyte0[0];
        int j = (byte)(byte0 >>> 4) & 0xf;
        byte0 = abyte0[0];
        byte0 <<= 4;
        int k = (byte)(byte0 >>> 3);
        k &= 0x1f;
        byte0 = abyte0[1];
        byte0 >>>= 7;
        byte0 &= 1;
        k += byte0;
        k &= 0x1f;
        byte0 = abyte0[1];
        byte0 <<= 1;
        int l = (byte)(byte0 >>> 3);
        l &= 0x1f;
        byte0 = abyte0[1];
        byte0 <<= 6;
        int i1 = (byte)(byte0 >>> 2);
        i1 &= 0x3f;
        byte0 = abyte0[2];
        byte0 >>>= 4;
        i1 += byte0;
        i1 &= 0x3f;
        byte0 = abyte0[2];
        byte0 <<= 4;
        int j1 = (byte)(byte0 >>> 2);
        j1 &= 0x3f;
        byte0 = abyte0[3];
        byte0 >>>= 6;
        j1 += byte0;
        j1 &= 0x3f;
        byte0 = abyte0[3];
        byte0 <<= 2;
        byte0 >>>= 2;
        byte0 &= 0x3f;
        l1 = abyte0[4] & 0xff;
        int i = byte0 * 0x10000 + l1 * 256;
        l1 = abyte0[5] & 0xff;
        i += l1;
        i &= 0x3fffff;
        byte0 = abyte0[6];
        l1 = byte0;
        l1 &= 0xff;
        int k1 = l1 * 256;
        byte0 = abyte0[7];
        l1 = byte0;
        l1 &= 0xff;
        k1 += l1;
        k1 &= 0xffff;
        stringbuffer.setLength(0);
        if(j < 10)
            stringbuffer.append("0");
        stringbuffer.append(j);
        if(k < 10)
            stringbuffer.append("0");
        stringbuffer.append(k);
        if(l < 10)
            stringbuffer.append("0");
        stringbuffer.append(l);
        if(i1 < 10)
            stringbuffer.append("0");
        stringbuffer.append(i1);
        if(j1 < 10)
            stringbuffer.append("0");
        stringbuffer.append(j1);
        stringbuffer.append(FormatInt(i, 5));
        stringbuffer.append(FormatInt(k1, 5));
        return stringbuffer.toString();
    }

    public String nMsgId;                 //消息标识
    public long msgID;
    public String sDestId;             //目的号码 SP服务代码
    public String sServiceId;          //业务类型
    public int nTPpid;
    public int nTPudhi;
    public int nMsgFormat;             //信息格式
    public String sSrcTerminalId;      //源终端MSISDN号码
    public int nIsDelivery;            //是否为状态报告 0:非状态报告 1:状态报告
    public int nMsgLength;             //消息长度
    public String sMsgContent;         //消息内容
    public String sReserved;           //保留
    /////////////////////////////////////////////////////////////////////////////////////////
    public String nReportMsgId;           //信息标识 (状态报告是有用)
    public String sStat;               //发送短信的应答结果 (状态报告是有用)
    public String sSubmitTime;         //消息提交时间 YYMMDDHHMM(状态报告是有用)
    public String sDoneTime;           //YYMMDDHHMM(状态报告是有用)
    public String sDestTerminalId;     //目的终端MSISDN号码(状态报告是有用)
    public int nSMSCSequence;          //取自SMSC发送状态报告的消息体中的消息标识(状态报告是有用)
}

⌨️ 快捷键说明

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