Class: Ucp::Pdu::Ucp01Result
- Inherits:
-
UCP01
- Object
- UCPMessage
- UCP01
- Ucp::Pdu::Ucp01Result
- Defined in:
- lib/ucp/pdu/ucp01_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(sm = "") ⇒ Object
-
#initialize(fields = nil) ⇒ Ucp01Result
constructor
A new instance of Ucp01Result.
- #nack(ec, sm = "") ⇒ Object
Methods inherited from UCP01
#initialize_message, #set_fields
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) ⇒ Ucp01Result
Returns a new instance of Ucp01Result.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ucp/pdu/ucp01_result.rb', line 22 def initialize(fields=nil) super() @operation_type="R" if fields.nil? return end @trn=fields[0] if fields[4].eql?("A") # 06/00043/R/01/A/01234567890:090196103258/4E ack(fields[5]) elsif fields[4].eql?("N") # 12/00022/R/01/N/02//03 nack(fields[5],fields[6]) else raise "invalid result in UCP01" end # TODO: verificar len e checksum end |
Instance Method Details
#ack(sm = "") ⇒ Object
45 46 47 48 49 |
# File 'lib/ucp/pdu/ucp01_result.rb', line 45 def ack(sm="") @fields=[:ack,:sm] @h[:ack]="A" @h[:sm]=sm end |
#nack(ec, sm = "") ⇒ Object
51 52 53 54 55 56 |
# File 'lib/ucp/pdu/ucp01_result.rb', line 51 def nack(ec,sm="") @fields=[:nack,:ec,:sm] @h[:nack]="N" @h[:ec]=ec @h[:sm]=sm end |