Class: Ucp::Pdu::Ucp51Result
- Inherits:
-
UCP5x
- Object
- UCPMessage
- UCP5x
- Ucp::Pdu::Ucp51Result
- Defined in:
- lib/ucp/pdu/ucp51_result.rb
Direct Known Subclasses
Ucp52Result, Ucp53Result, Ucp54Result, Ucp55Result, Ucp56Result, Ucp57Result, Ucp58Result
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) ⇒ Ucp51Result
constructor
A new instance of Ucp51Result.
- #nack(ec, sm = "") ⇒ Object
Methods inherited from UCP5x
#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) ⇒ Ucp51Result
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ucp/pdu/ucp51_result.rb', line 23 def initialize(fields=nil) super() @operation="51" @operation_type="R" if fields.nil? return end @trn=fields[0] if fields[4].eql?("A") # 00/00039/R/51/A//012234:090996101010/68 ack(fields[5],fields[6]) elsif fields[4].eql?("N") # 00/00022/R/51/N/31//07 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
47 48 49 50 51 52 |
# File 'lib/ucp/pdu/ucp51_result.rb', line 47 def ack(mvp="",sm="") @fields=[:ack,:mvp,:sm] @h[:ack]="A" @h[:mvp]=mvp @h[:sm]=sm end |
#nack(ec, sm = "") ⇒ Object
54 55 56 57 58 59 |
# File 'lib/ucp/pdu/ucp51_result.rb', line 54 def nack(ec,sm="") @fields=[:nack,:ec,:sm] @h[:nack]="N" @h[:ec]=ec @h[:sm]=sm end |