Class: Ucp::Pdu::Ucp30Result
- Inherits:
-
UCP30
- Object
- UCPMessage
- UCP30
- Ucp::Pdu::Ucp30Result
- Defined in:
- lib/ucp/pdu/ucp30_result.rb
Overview
Ruby library implementation of EMI/UCP protocol v4.6 for SMS Copyright © 2011, Sergio Freire <[email protected]>
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Constant Summary
Constants inherited from UCPMessage
Ucp::Pdu::UCPMessage::DELIMITER, Ucp::Pdu::UCPMessage::ETX, Ucp::Pdu::UCPMessage::STX
Instance Attribute Summary
Attributes inherited from UCPMessage
#dcs, #message_ref, #operation, #operation_type, #part_nr, #total_parts, #trn
Instance Method Summary collapse
- #ack(mvp = "", sm = "") ⇒ Object
-
#initialize(fields = nil) ⇒ Ucp30Result
constructor
A new instance of Ucp30Result.
- #nack(ec, sm = "") ⇒ Object
Methods inherited from UCPMessage
#checksum, #get_field, #is_ack?, #is_nack?, #is_operation?, #is_result?, #length, #set_field, #set_fields, #to_s
Constructor Details
#initialize(fields = nil) ⇒ Ucp30Result
Returns a new instance of Ucp30Result.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ucp/pdu/ucp30_result.rb', line 22 def initialize(fields=nil) super() @operation="30" @operation_type="R" if fields.nil? return end @trn=fields[0] if fields[4].eql?("A") # 10/00039/R/30/A//067345:070295121212/6F ack(fields[5],fields[6]) elsif fields[4].eql?("N") # 11/00022/R/30/N/24//08 nack(fields[5],fields[6]) else raise "invalid result in UCP51" end # TODO: verificar len e checksum end |
Instance Method Details
#ack(mvp = "", sm = "") ⇒ Object
46 47 48 49 50 51 |
# File 'lib/ucp/pdu/ucp30_result.rb', line 46 def ack(mvp="",sm="") @fields=[:ack,:sm] @h[:ack]="A" @h[:mvp]=mvp @h[:sm]=sm end |
#nack(ec, sm = "") ⇒ Object
53 54 55 56 57 58 |
# File 'lib/ucp/pdu/ucp30_result.rb', line 53 def nack(ec,sm="") @fields=[:nack,:ec,:sm] @h[:nack]="N" @h[:ec]=ec @h[:sm]=sm end |