Class: Extface::Driver::DaisyFx1200::RespFrame
- Inherits:
-
Object
- Object
- Extface::Driver::DaisyFx1200::RespFrame
- Includes:
- ActiveModel::Validations
- Defined in:
- app/models/extface/driver/daisy_fx1200.rb
Instance Attribute Summary collapse
-
#bcc ⇒ Object
readonly
Returns the value of attribute bcc.
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#frame ⇒ Object
readonly
Returns the value of attribute frame.
-
#len ⇒ Object
readonly
Returns the value of attribute len.
-
#seq ⇒ Object
readonly
Returns the value of attribute seq.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#ack? ⇒ Boolean
should wait, response is yet to come.
-
#initialize(buffer) ⇒ RespFrame
constructor
A new instance of RespFrame.
-
#nak? ⇒ Boolean
should retry command with same seq.
Constructor Details
#initialize(buffer) ⇒ RespFrame
Returns a new instance of RespFrame.
427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 427 def initialize(buffer) # test Extface::Driver::DaisyFx1200::RespFrame.new("\x16\x16\x01\x2c\x20\x2dP\x04SSSSSS\x05\BBBB\x03") # LEN SEQ CMD DATA STATUS BCC if match = buffer.match(/\x01(.{1})(.{1})(.{1})(.*)\x04(.{6})\x05(.{4})\x03/nm) @frame = match.to_a.first @len, @seq, @cmd, @data, @status, @bcc = match.captures else if buffer[/^\x16+$/] # only ACKs @ack = true elsif buffer.index("\x15") @nak = true end end end |
Instance Attribute Details
#bcc ⇒ Object (readonly)
Returns the value of attribute bcc.
421 422 423 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 421 def bcc @bcc end |
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
421 422 423 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 421 def cmd @cmd end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
421 422 423 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 421 def data @data end |
#frame ⇒ Object (readonly)
Returns the value of attribute frame.
421 422 423 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 421 def frame @frame end |
#len ⇒ Object (readonly)
Returns the value of attribute len.
421 422 423 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 421 def len @len end |
#seq ⇒ Object (readonly)
Returns the value of attribute seq.
421 422 423 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 421 def seq @seq end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
421 422 423 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 421 def status @status end |
Instance Method Details
#ack? ⇒ Boolean
should wait, response is yet to come
442 443 444 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 442 def ack? #should wait, response is yet to come !!@ack end |
#nak? ⇒ Boolean
should retry command with same seq
446 447 448 |
# File 'app/models/extface/driver/daisy_fx1200.rb', line 446 def nak? #should retry command with same seq !!@nak end |