Class: Ucp::Pdu::Ucp31Result
- Inherits:
-
UCP31
- Object
- UCPMessage
- UCP31
- Ucp::Pdu::Ucp31Result
- Defined in:
- lib/ucp/pdu/ucp31_result.rb
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) ⇒ Ucp31Result
constructor
A new instance of Ucp31Result.
- #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) ⇒ Ucp31Result
Returns a new instance of Ucp31Result.
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/ucp31_result.rb', line 23 def initialize(fields=nil) super() @operation_type="R" if fields.nil? return end @trn=fields[0] if fields[4].eql?("A") # 04/00024/R/31/A/0003/5D ack(fields[5]) elsif fields[4].eql?("N") # 00/00022/R/31/N/06//07 nack(fields[5],fields[6]) else raise "invalid result in UCP31" end # TODO: verificar len e checksum end |
Instance Method Details
#ack(sm = "") ⇒ Object
46 47 48 49 50 |
# File 'lib/ucp/pdu/ucp31_result.rb', line 46 def ack(sm="") @fields=[:ack,:sm] @h[:ack]="A" @h[:sm]=sm end |
#nack(ec, sm = "") ⇒ Object
52 53 54 55 56 57 |
# File 'lib/ucp/pdu/ucp31_result.rb', line 52 def nack(ec,sm="") @fields=[:nack,:ec,:sm] @h[:nack]="N" @h[:ec]=ec @h[:sm]=sm end |