Class: Majoron::AntHill::SMPP::SMPPReplaceSM
- Defined in:
- lib/pdu/smpp_replace_sm.rb
Instance Attribute Summary collapse
-
#message_id ⇒ Object
Mandatory fields.
-
#message_payload ⇒ Object
Optional fields.
-
#message_payload_len ⇒ Object
Optional fields length.
-
#registered_delivery ⇒ Object
Returns the value of attribute registered_delivery.
-
#schedule_delivery_time ⇒ Object
Returns the value of attribute schedule_delivery_time.
-
#short_message ⇒ Object
Returns the value of attribute short_message.
-
#sm_default_msg_id ⇒ Object
Returns the value of attribute sm_default_msg_id.
-
#sm_length ⇒ Object
Returns the value of attribute sm_length.
-
#source_addr ⇒ Object
Returns the value of attribute source_addr.
-
#source_addr_npi ⇒ Object
Returns the value of attribute source_addr_npi.
-
#source_addr_ton ⇒ Object
Returns the value of attribute source_addr_ton.
-
#validity_period ⇒ Object
Returns the value of attribute validity_period.
Attributes inherited from SMPPPDU
Instance Method Summary collapse
-
#decode_packet(decoder) ⇒ Object
Interface to decode SMPP packet.
-
#encode_packet(encoder) ⇒ Object
Interface to encode SMPP packet.
-
#initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil) ⇒ SMPPReplaceSM
constructor
A new instance of SMPPReplaceSM.
-
#output_packet(outputter) ⇒ Object
Interface to output SMPP packet.
-
#validate_packet(validator) ⇒ Object
Interface to validate SMPP packet.
Methods inherited from SMPPPDU
#command_id, #command_length, #command_status, #command_status=, #sequence_number, #sequence_number=
Constructor Details
#initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil) ⇒ SMPPReplaceSM
Returns a new instance of SMPPReplaceSM.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/pdu/smpp_replace_sm.rb', line 23 def initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil) super(CommandId::CM_REPLACE_SM, command_status, sequence_number) # Mandatory fields @message_id = "" @source_addr_ton = TON::UNKNOWN @source_addr_npi = NPI::UNKNOWN @source_addr = "" @schedule_delivery_time = "" @validity_period = "" @registered_delivery = 0 @sm_default_msg_id = 0 @sm_length = 0 @short_message = "" # Optional fields @message_payload = nil # Optional fields length @message_payload_len = SMPPTLVLen::ZERO_LEN end |
Instance Attribute Details
#message_id ⇒ Object
Mandatory fields
152 153 154 |
# File 'lib/pdu/smpp_replace_sm.rb', line 152 def @message_id end |
#message_payload ⇒ Object
Optional fields
164 165 166 |
# File 'lib/pdu/smpp_replace_sm.rb', line 164 def @message_payload end |
#message_payload_len ⇒ Object
Optional fields length
167 168 169 |
# File 'lib/pdu/smpp_replace_sm.rb', line 167 def @message_payload_len end |
#registered_delivery ⇒ Object
Returns the value of attribute registered_delivery.
158 159 160 |
# File 'lib/pdu/smpp_replace_sm.rb', line 158 def registered_delivery @registered_delivery end |
#schedule_delivery_time ⇒ Object
Returns the value of attribute schedule_delivery_time.
156 157 158 |
# File 'lib/pdu/smpp_replace_sm.rb', line 156 def schedule_delivery_time @schedule_delivery_time end |
#short_message ⇒ Object
Returns the value of attribute short_message.
161 162 163 |
# File 'lib/pdu/smpp_replace_sm.rb', line 161 def @short_message end |
#sm_default_msg_id ⇒ Object
Returns the value of attribute sm_default_msg_id.
159 160 161 |
# File 'lib/pdu/smpp_replace_sm.rb', line 159 def sm_default_msg_id @sm_default_msg_id end |
#sm_length ⇒ Object
Returns the value of attribute sm_length.
160 161 162 |
# File 'lib/pdu/smpp_replace_sm.rb', line 160 def sm_length @sm_length end |
#source_addr ⇒ Object
Returns the value of attribute source_addr.
155 156 157 |
# File 'lib/pdu/smpp_replace_sm.rb', line 155 def source_addr @source_addr end |
#source_addr_npi ⇒ Object
Returns the value of attribute source_addr_npi.
154 155 156 |
# File 'lib/pdu/smpp_replace_sm.rb', line 154 def source_addr_npi @source_addr_npi end |
#source_addr_ton ⇒ Object
Returns the value of attribute source_addr_ton.
153 154 155 |
# File 'lib/pdu/smpp_replace_sm.rb', line 153 def source_addr_ton @source_addr_ton end |
#validity_period ⇒ Object
Returns the value of attribute validity_period.
157 158 159 |
# File 'lib/pdu/smpp_replace_sm.rb', line 157 def validity_period @validity_period end |
Instance Method Details
#decode_packet(decoder) ⇒ Object
Interface to decode SMPP packet
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/pdu/smpp_replace_sm.rb', line 67 def decode_packet(decoder) # Decode header and mandatory fields @header = decoder.decode_header() @message_id = decoder.(command_length()) @source_addr_ton = decoder.decode_source_addr_ton(command_length()) @source_addr_npi = decoder.decode_source_addr_npi(command_length()) @source_addr = decoder.decode_source_addr21(command_length()) @schedule_delivery_time = decoder.decode_schedule_delivery_time(command_length()) @validity_period = decoder.decode_validity_period(command_length()) @registered_delivery = decoder.decode_registered_delivery(command_length()) @sm_default_msg_id = decoder.decode_sm_default_msg_id(command_length()) @sm_length = decoder.decode_sm_length(command_length()) @short_message = decoder.(@sm_length, command_length()) # Decode optional fields while decoder.has_tlvs() case decoder.get_tlv_code() when OptTags::TAG_MESSAGE_PAYLOAD @message_payload, @message_payload_len = decoder.(command_length()) else # Report about error raise Errors::UNKNOWN_TAG_MSG + decoder.get_tlv_error() end end end |
#encode_packet(encoder) ⇒ Object
Interface to encode SMPP packet
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/pdu/smpp_replace_sm.rb', line 47 def encode_packet(encoder) # Encode header and mandatory fields encoder.encode_header(@header) encoder.(@message_id) encoder.encode_source_addr_ton(@source_addr_ton) encoder.encode_source_addr_npi(@source_addr_npi) encoder.encode_source_addr21(@source_addr) encoder.encode_schedule_delivery_time(@schedule_delivery_time) encoder.encode_validity_period(@validity_period) encoder.encode_registered_delivery(@registered_delivery) encoder.encode_sm_default_msg_id(@sm_default_msg_id) encoder.encode_sm_length(@sm_length) encoder.(@short_message) # Encode optional fields encoder.(@message_payload, @message_payload_len) if !@message_payload.nil? end |
#output_packet(outputter) ⇒ Object
Interface to output SMPP packet
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/pdu/smpp_replace_sm.rb', line 120 def output_packet(outputter) # Output header and mandatory fields outputter.output_header(@header) outputter.(@message_id) outputter.output_source_addr_ton(@source_addr_ton) outputter.output_source_addr_npi(@source_addr_npi) outputter.output_source_addr21(@source_addr) outputter.output_schedule_delivery_time(@schedule_delivery_time) outputter.output_validity_period(@validity_period) outputter.output_registered_delivery(@registered_delivery) outputter.output_sm_default_msg_id(@sm_default_msg_id) outputter.output_sm_length(@sm_length) outputter.(@short_message) # Output optional fields outputter.(@message_payload, @message_payload_len) if !@message_payload.nil? end |
#validate_packet(validator) ⇒ Object
Interface to validate SMPP packet
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/pdu/smpp_replace_sm.rb', line 95 def validate_packet(validator) # Validate header and mandatory fields validator.validate_header(@header) validator.(@message_id) validator.validate_source_addr_ton(@source_addr_ton) validator.validate_source_addr_npi(@source_addr_npi) validator.validate_source_addr21(@source_addr) validator.validate_schedule_delivery_time(@schedule_delivery_time) validator.validate_validity_period(@validity_period) validator.validate_registered_delivery(@registered_delivery) validator.validate_sm_default_msg_id(@sm_default_msg_id) validator.validate_sm_length(@sm_length) validator.(@short_message) # Validate optional fields validator.(@message_payload, @message_payload_len) if !@message_payload.nil? # Validate complex rules validator.(@short_message, @message_payload) if !@message_payload.nil? end |