📄 smpptransmitter.java
字号:
SMPPResponse resp = sendRequest(s); Debug.d(this, "submitMulti", "submit_multi sent", 3); return ((SubmitMultiResp)resp); } /** Cancel an already submitted message. * @param st The service type the original message was submitted under * @param msgId The Id of the original message * @param d The Destination address of the original message * @return The cancel message response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs. */ public CancelSMResp cancelMessage(String st, String msgId, SmeAddress d) throws IOException, ie.omk.smpp.SMPPException { return (this.cancelMessage(st, msgId, null, d)); } /** Cancel an already submitted message. * @param st The service type the original message was submitted under * @param msgId The Id of the original message * @param dst The Destination address of the original message (may be null) * @param src The source address of the original message (may be null) * @return The cancel message response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs. */ public CancelSMResp cancelMessage(String st, String msgId, SmeAddress src, SmeAddress dst) throws IOException, ie.omk.smpp.SMPPException { CancelSM s = new CancelSM(); s.setServiceType(st); s.setMessageId(msgId); if(dst != null) s.setDestination(dst); if(src != null) s.setSource(src); SMPPResponse resp = sendRequest(s); Debug.d(this, "cancelMessage", "cancel_sm sent", 3); return ((CancelSMResp)resp); } /** Replace an existing message with a new one. * @param msgId The Id of the original message. * @param msg The text of the new message (may be null) * @param flags The flags of the new message. Only the registered delivery * and the default message Id flags are relevant. * @return The replace message response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs * @deprecated This method will disappear from this class within the next 2 * releases. */ public ReplaceSMResp replaceMessage(String msgId, String msg, MsgFlags flags) throws java.io.IOException, ie.omk.smpp.SMPPException { return (this.replaceMessage(msgId, msg, flags, null, null, null)); } /** Replace an existing message with a new one. * @param msgId The Id of the original message. * @param msg The text of the new message (may be null) * @param flags The flags of the new message. Only the registered delivery * @param src The Source address of the original message (may be null) * and the default message Id flags are relevant. * @return The replace message response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs * @deprecated This method will disappear from this class within the next 2 * releases. */ public ReplaceSMResp replaceMessage(String msgId, String msg, MsgFlags flags, SmeAddress src) throws java.io.IOException, ie.omk.smpp.SMPPException { return (this.replaceMessage(msgId, msg, flags, src, null, null)); } /** Replace an existing message with a new one. * @param msgId The Id of the original message. * @param msg The text of the new message (may be null) * @param flags The flags of the new message. Only the registered delivery * @param src The Source address of the original message (may be null) * and the default message Id flags are relevant. * @param del The absolute delivery time of the message (may be null) * @param valid The validity period of the message, after which it will * expire (may be null) * @return true if the replacement is successful, false otherwise * @exception java.io.IOException If a network error occurs * @deprecated This method will disappear from this class within the next 2 * releases. */ public ReplaceSMResp replaceMessage(String msgId, String msg, MsgFlags flags, SmeAddress src, SMPPDate del, SMPPDate valid) throws java.io.IOException, ie.omk.smpp.SMPPException { ReplaceSM s = new ReplaceSM(); s.setMessageId(msgId); s.setPriority(flags.priority); s.setRegistered(flags.registered); s.setEsmClass(flags.esm_class); s.setProtocolID(flags.protocol); s.setDataCoding(flags.data_coding); s.setDefaultMsg(flags.default_msg); if(src != null) s.setSource(src); if(msg != null) s.setMessageText(msg); if(del != null) s.setDeliveryTime(del); if(valid != null) s.setExpiryTime(valid); SMPPResponse resp = sendRequest(s); Debug.d(this, "replaceMessage", "replace_sm sent", 3); return ((ReplaceSMResp)resp); } /** Get the value of a configurable parameter from the SMSC. * @param name The name of the parameter to get * @return The param retrieve response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs. */ public ParamRetrieveResp paramRetrieve(String name) throws java.io.IOException, ie.omk.smpp.SMPPException { ParamRetrieve s = new ParamRetrieve(); s.setParamName(name); SMPPResponse resp = sendRequest(s); Debug.d(this, "paramRetrieve", "param_retrieve sent", 3); return ((ParamRetrieveResp)resp); } // ---------------- All the query operations below here ---------------- /** Query the status of a message. * @param msgId The Id of the submitted message * @return The query message response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs. * @see MessageDetails */ public QuerySMResp queryMessage(String msgId) throws java.io.IOException, ie.omk.smpp.SMPPException { return (this.queryMessage(msgId, null)); } /** Query the status of a message. * @param msgId The Id of the submitted message * @param src The source address of the original message (may be null) * @return The query message response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs. * @see MessageDetails */ public QuerySMResp queryMessage(String msgId, SmeAddress src) throws java.io.IOException, ie.omk.smpp.SMPPException { QuerySM s = new QuerySM(); s.setMessageId(msgId); if(src != null) s.setSource(src); SMPPResponse resp = sendRequest(s); Debug.d(this, "queryMessage", "query_sm sent", 3); return ((QuerySMResp)resp); } /** Query the last number of messages for an Sme. * @param src The address of the Sme to query for. * @param num The number of messages to query (0 < num <= 100). * @return The query last messages response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs. */ public QueryLastMsgsResp queryLastMsgs(SmeAddress src, int num) throws java.io.IOException, ie.omk.smpp.SMPPException { if(src == null) throw new NullPointerException("Source address cannot be null."); if(num < 1) num = 1; if(num > 100) num = 100; QueryLastMsgs s = new QueryLastMsgs(); s.setSource(src); s.setMsgCount(num); SMPPResponse resp = sendRequest(s); Debug.d(this, "queryLastMsgs", "query_last_msgs sent", 3); return ((QueryLastMsgsResp)resp); } /** Query the details of a submitted message. * @param msgId The Id of the message to query. * @param len The number of bytes of the message text to get. * @return The query details response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs. */ public QueryMsgDetailsResp queryMsgDetails(String msgId, int len) throws java.io.IOException, ie.omk.smpp.SMPPException { return (this.queryMsgDetails(msgId, null, len)); } /** Query the details of a submitted message. * @param msgId The Id of the message to query. * @param src The source address of the message (may be null) * @param len The number of bytes of the message text to get. * @return The query details response, or null if asynchronous * communication is used. * @exception java.io.IOException If a network error occurs. */ public QueryMsgDetailsResp queryMsgDetails(String msgId, SmeAddress src, int len) throws java.io.IOException, ie.omk.smpp.SMPPException { // Make sure the length requested is sane! if(len < 0) len = 0; if(len > 161) len = 161; QueryMsgDetails s = new QueryMsgDetails(); s.setMessageId(msgId); if(src != null) s.setSource(src); s.setSmLength(len); SMPPResponse resp = sendRequest(s); Debug.d(this, "queryMsgDetails", "query_msg_details sent", 3); return ((QueryMsgDetailsResp)resp); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -