📄 constructtlv.java
字号:
package demo.smpp34demo;
import java.util.ArrayList;
import com.huawei.smproxy.comm.smpp34.*;
/**
* A iuniform external interface for constructing the option arguments.
* @version 1.0
*/
public class ConstructTLV
{
public ConstructTLV ()
{
}
ArrayList tlvs = new ArrayList();
//Constructs various option arguments.
public void adduser_message_reference()
{
//Constructs a option argument.
TLVUnit user_message_reference = new TLVUnit(TLVConstant.USER_MESSAGE_REFERENCE,(short)2,(short)33);
//Add the option argument to the list of option arguments.
tlvs.add(user_message_reference);
}
public void addsource_port()
{
TLVUnit source_port = new TLVUnit(TLVConstant.SOURCE_PORT,
(short)2, (short)1021);
tlvs.add(source_port);
}
public void addsource_addr_subunit()
{
TLVUnit source_addr_subunit = new TLVUnit(TLVConstant.SOURCE_ADDR_SUBUNIT,
(short)1, (byte)2);
tlvs.add(source_addr_subunit);
}
public void adddestination_port()
{
TLVUnit destination_port = new TLVUnit(TLVConstant.DESTINATION_PORT, (short)2,
(short)674);
tlvs.add(destination_port);
}
public void adddest_addr_subunit()
{
TLVUnit dest_addr_subunit = new TLVUnit(TLVConstant.DEST_ADDR_SUBUNIT,
(short)2, (byte)3);
tlvs.add(dest_addr_subunit);
}
public void addsar_msg_ref_num()
{
TLVUnit sar_msg_ref_num = new TLVUnit(TLVConstant.SAR_MSG_REF_NUM, (short)2,
(short)111);
tlvs.add(sar_msg_ref_num);
}
public void addsar_total_segments()
{
TLVUnit sar_total_segments = new TLVUnit(TLVConstant.SAR_TOTAL_SEGMENTS,
(short)1, (byte)2);
tlvs.add(sar_total_segments);
}
public void addsar_segment_seqnum()
{
TLVUnit sar_segment_seqnum = new TLVUnit(TLVConstant.SAR_SEGMENT_SEQNUM,
(short)2, (byte)2);
tlvs.add(sar_segment_seqnum);
}
public void addmore_messages_to_send()
{
TLVUnit more_messages_to_send = new TLVUnit(TLVConstant.MORE_MESSAGES_TO_SEND, (short)2, (byte)1);
tlvs.add(more_messages_to_send);
}
public void addpayload_type()
{
TLVUnit payload_type = new TLVUnit(TLVConstant.PAYLOAD_TYPE,
(short)1, (byte)1);
tlvs.add(payload_type);
}
public void addmessage_payload(){
TLVUnit message_payload = new TLVUnit(TLVConstant.MESSAGE_PAYLOAD, (short)2,
(byte)1);
tlvs.add(message_payload);
}
public void addprivacy_indicator()
{
TLVUnit privacy_indicator = new TLVUnit(TLVConstant.PRIVACY_INDICATOR,
(short)2, (byte)1);
tlvs.add(privacy_indicator);
}
public void addcallback_num()
{
TLVUnit callback_num = new TLVUnit(TLVConstant.CALLBACK_NUM,
(short)2, (byte)11);
tlvs.add(callback_num);
}
public void addcallback_num_pres_ind()
{
TLVUnit callback_num_pres_ind = new TLVUnit(TLVConstant.CALLBACK_NUM_PRES_IND, (short)1, (byte)10);
tlvs.add(callback_num_pres_ind);
}
public void addcallback_num_atag()
{
TLVUnit callback_num_atag = new TLVUnit(TLVConstant.CALLBACK_NUM_ATAG,
(short)8, "00000001", false);
tlvs.add(callback_num_atag);
}
//Obtians the list of option arguments.The list will be a argument of SMPP messages.
public ArrayList getTLVList ()
{
return tlvs;
}
// Clear the list of the option arguments.
public void clear ()
{
tlvs.clear();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -