📄 smppdecoder.java
字号:
package projectsmpp;public class SmppDecoder extends Decoder { public SmppDecoder(byte abyte0[]) { super(abyte0); }//----------------------------------------------------------------------- //对收到的smppHeader进行解码//--------------------------------------------------------------------- public SmppHeader smppHeader(SmppHeader smppheader) throws decoderException { if(smppheader == null) smppheader = new SmppHeader(); String s = null; try { s = "command_length."; smppheader.command_length = super.int32(); s = "command_id."; smppheader.command_id = super.int32(); s = "command_status."; smppheader.command_status = super.int32(); s = "sequence_no."; smppheader.sequence_no = super.int32(); } catch(decoderException decoderexception) { if(s != null) throw new decoderException(decoderexception + s); else throw decoderexception; } return smppheader; } public SmppHeader smppHeader() throws decoderException { return smppHeader(null); }//--------------------------------------------------------------------- //对返回的bind响应进行解码//-------------------------------------------------------------------- public Bind bindResponse(Bind binding) throws decoderException { if(binding == null) binding = new Bind(); String s = null; try { s = "system_id."; binding.system_id = asciiz(16); } catch(decoderException decoderexception) { if(s != null) throw new decoderException(decoderexception + s); else throw decoderexception; } return binding; } public Bind bindResponse() throws decoderException { return bindResponse(null); }//---------------------------------------------------------------------- //对收到的deliver-sm消息进行解码//--------------------------------------------------------------------public DeliverSm deliverSm(DeliverSm submit) throws decoderException { if(submit==null) submit=new DeliverSm(); String s=null; try { s = "service_type."; submit.service_type=asciiz(6); s = "source_address_ton."; submit.source_address_ton=int8(); s = "source_address_npi."; submit.source_address_npi=int8(); s = "source_address."; submit.source_address=asciiz(21); s = "dest_address_ton."; submit.dest_address_ton=int8(); s = "dest_address_npi."; submit.dest_address_npi=int8(); s= "destination_address."; submit.destination_address=asciiz(21); s="esm_class."; submit.esm_class=int8(); s="protocol_id."; submit.protocol_id=int8(); s="priority_flag."; submit.priority_flag=int8(); s="schedule_delivery_time."; submit.schedule_delivery_time=UTC(); s="validaty_period."; submit.validaty_period=UTC(); s="registered_delivery_flag."; submit.registered_delivery_flag=int8(); s="replace_if_present_flag."; submit.replace_if_present_flag=int8(); s="data_coding."; submit.data_coding=int8(); s="sm_default_msg_id."; submit.sm_default_msg_id=int8(); s="sm_length."; submit.sm_length=super.lenfix(int8()); s="short_message_text."; submit.short_message_text = new byte[lenfix(submit.sm_length)]; for(int j = 0; j < lenfix(submit.sm_length); j++) submit.short_message_text[j] = super.int8(); } catch(decoderException decoderexception) { if(s != null) throw new decoderException(decoderexception + s); else throw decoderexception; } return submit; } public DeliverSm deliverSm()throws decoderException { return deliverSm(null); } //------------------------------------------------------------------ //对提交消息的响应进行解码 //------------------------------------------------------------------- public SubmitResp submitResp(SubmitResp submitResp) throws decoderException { if(submitResp==null) submitResp=new SubmitResp(); String s=null; try{ s="message_id."; submitResp.message_id=asciiz(9); } catch(decoderException decoderexception) { if(s != null) throw new decoderException(decoderexception + s); else throw decoderexception; } return submitResp; } public SubmitResp submitResp() throws decoderException { return submitResp(null); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -