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

📄 smppencoder.java

📁 Java实现的点对点短消息发送协议(smpp)开发包源码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            }
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void recipient(Object obj)
        throws encoderException
    {
        String s = null;
        try
        {
            if(obj == null)
                throw new encoderException("missing.recipient.");
            if(obj instanceof Address)
            {
                s = "Address.";
                int8((byte)1);
                Address((Address)obj);
                return;
            }
            if(obj instanceof DLName)
            {
                s = "DLName.";
                int8((byte)2);
                DLName((DLName)obj);
                return;
            } else
            {
                s = null;
                throw new encoderException("unknown.instance.recipient.");
            }
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void queryDetailsResponse(Message message)
        throws encoderException
    {
        String s = null;
        try
        {
            if(message == null)
                throw new encoderException("missing.queryDetailsResponse.");
            s = "service.";
            if(message.service != null)
                asciiz(message.service, 6);
            else
                int8(0);
            s = "from.";
            Address(message.from);
            s = "recipients_len.";
            int8(message.recipients_len);
            s = "recipients.";
            for(int i = 0; i < lenfix(message.recipients_len); i++)
                recipient(message.recipients[i]);

            s = "pid.";
            int8(message.pid);
            s = "priority.";
            int8(!message.priority ? 0 : 1);
            s = "schedule.";
            UTC(message.schedule);
            s = "expiry.";
            UTC(message.expiry);
            s = "registered.";
            int8(!message.registered ? 0 : 1);
            s = "dcs.";
            int8(message.dcs);
            s = "text_len.";
            int8(message.text_len);
            s = "text.";
            for(int j = 0; j < lenfix(message.text_len); j++)
                int8(message.text[j]);

            s = "id.";
            if(message.id != null)
                asciiz(message.id, 9);
            else
                int8(0);
            s = "timeStamp.";
            UTC(message.timeStamp);
            s = "status.";
            int8(message.status);
            s = "gsmError.";
            int8(message.gsmError);
            return;
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void getCustomerResponse(Customer customer)
        throws encoderException
    {
        String s = null;
        try
        {
            if(customer == null)
                throw new encoderException("missing.getCustomerResponse.");
            s = "id.";
            if(customer.id != null)
                asciiz(customer.id, 21);
            else
                int8(0);
            s = "name.";
            if(customer.name != null)
                asciiz(customer.name, 21);
            else
                int8(0);
            s = "streetAddress.";
            if(customer.streetAddress != null)
                asciiz(customer.streetAddress, 31);
            else
                int8(0);
            s = "smsAddress.";
            Address(customer.smsAddress);
            s = "serviceLevel.";
            int32(customer.serviceLevel);
            s = "smsAllowed.";
            int8(!customer.smsAllowed ? 0 : 1);
            s = "ocos.";
            int32(customer.ocos);
            s = "tcos.";
            int32(customer.tcos);
            s = "password.";
            if(customer.password != null)
            {
                asciiz(customer.password, 9);
                return;
            } else
            {
                int8(0);
                return;
            }
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void deleteDL(smDL smdl)
        throws encoderException
    {
        String s = null;
        try
        {
            if(smdl == null)
                throw new encoderException("missing.deleteDL.");
            s = "source.";
            Address(smdl.source);
            s = "name.";
            if(smdl.name != null)
            {
                asciiz(smdl.name, 21);
                return;
            } else
            {
                int8(0);
                return;
            }
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void listDL(Address address)
        throws encoderException
    {
        String s = null;
        try
        {
            if(address == null)
                throw new encoderException("missing.listDL.");
            s = "ton.";
            int8(address.ton);
            s = "npi.";
            int8(address.npi);
            s = "msisdn.";
            if(address.msisdn != null)
            {
                asciiz(address.msisdn, 21);
                return;
            } else
            {
                int8(0);
                return;
            }
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void DLName(DLName dlname)
        throws encoderException
    {
        String s = null;
        try
        {
            if(dlname == null)
                throw new encoderException("missing.DLName.");
            s = "name.";
            if(dlname.name != null)
            {
                asciiz(dlname.name, 21);
                return;
            } else
            {
                int8(0);
                return;
            }
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void addCustomer(Customer customer)
        throws encoderException
    {
        String s = null;
        try
        {
            if(customer == null)
                throw new encoderException("missing.addCustomer.");
            s = "id.";
            if(customer.id != null)
                asciiz(customer.id, 21);
            else
                int8(0);
            s = "name.";
            if(customer.name != null)
                asciiz(customer.name, 21);
            else
                int8(0);
            s = "streetAddress.";
            if(customer.streetAddress != null)
                asciiz(customer.streetAddress, 31);
            else
                int8(0);
            s = "smsAddress.";
            Address(customer.smsAddress);
            s = "serviceLevel.";
            int32(customer.serviceLevel);
            s = "smsAllowed.";
            int8(!customer.smsAllowed ? 0 : 1);
            s = "ocos.";
            int32(customer.ocos);
            s = "tcos.";
            int32(customer.tcos);
            s = "password.";
            if(customer.password != null)
            {
                asciiz(customer.password, 9);
                return;
            } else
            {
                int8(0);
                return;
            }
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void submitMulti(Message message)
        throws encoderException
    {
        String s = null;
        try
        {
            if(message == null)
                throw new encoderException("missing.submitMulti.");
            s = "service.";
            if(message.service != null)
                asciiz(message.service, 6);
            else
                int8(0);
            s = "from.";
            Address(message.from);
            s = "recipients_len.";
            int8(message.recipients_len);
            s = "recipients.";
            for(int i = 0; i < lenfix(message.recipients_len); i++)
                recipient(message.recipients[i]);

            s = "esm.";
            int8(message.esm);
            s = "pid.";
            int8(message.pid);
            s = "priority.";
            int8(!message.priority ? 0 : 1);
            s = "schedule.";
            UTC(message.schedule);
            s = "expiry.";
            UTC(message.expiry);
            s = "registered.";
            int8(!message.registered ? 0 : 1);
            s = "replacement.";
            int8(!message.replacement ? 0 : 1);
            s = "dcs.";
            int8(message.dcs);
            s = "predefined.";
            int8(message.predefined);
            s = "text_len.";
            int8(message.text_len);
            s = "text.";
            for(int j = 0; j < lenfix(message.text_len); j++)
                int8(message.text[j]);

            return;
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void getCustomer(Customer customer)
        throws encoderException
    {
        String s = null;
        try
        {
            if(customer == null)
                throw new encoderException("missing.getCustomer.");
            s = "id.";
            if(customer.id != null)
            {
                asciiz(customer.id, 21);
                return;
            } else
            {
                int8(0);
                return;
            }
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void modDL(modDL moddl)
        throws encoderException
    {
        String s = null;
        try
        {
            if(moddl == null)
            {
                throw new encoderException("missing.modDL.");
            } else
            {
                s = "dl.";
                smDL(moddl.dl);
                s = "modify.";
                DLmodification(moddl.modify);
                return;
            }
        }
        catch(encoderException encoderexception)
        {
            if(s != null)
                throw new encoderException(encoderexception + s);
            else
                throw encoderexception;
        }
    }

    public void viewDLresponse(viewDLresponse viewdlresponse)
        throws encoderException
    {
        String s = null;
        try
        {
            if(viewdlresponse == null)
                throw new encoderException("missing.viewDLresponse.");
            s = "members_len.";
            int8(viewdlresponse.members_len);
            s = "members.";
            for(int i = 0; i < lenfix(viewdlresponse.members_len); i++)
                Member(viewdlresponse.members[i]);

⌨️ 快捷键说明

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