Class: Extface::Driver::DaisyFx1200::RespFrame

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
app/models/extface/driver/daisy_fx1200.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buffer) ⇒ RespFrame

Returns a new instance of RespFrame.



284
285
286
287
288
289
290
291
292
293
# File 'app/models/extface/driver/daisy_fx1200.rb', line 284

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
    #TODO look for NAK
  end
end

Instance Attribute Details

#bcc ⇒ Object (readonly)

Returns the value of attribute bcc.



278
279
280
# File 'app/models/extface/driver/daisy_fx1200.rb', line 278

def bcc
  @bcc
end

#cmd ⇒ Object (readonly)

Returns the value of attribute cmd.



278
279
280
# File 'app/models/extface/driver/daisy_fx1200.rb', line 278

def cmd
  @cmd
end

#data ⇒ Object (readonly)

Returns the value of attribute data.



278
279
280
# File 'app/models/extface/driver/daisy_fx1200.rb', line 278

def data
  @data
end

#frame ⇒ Object (readonly)

Returns the value of attribute frame.



278
279
280
# File 'app/models/extface/driver/daisy_fx1200.rb', line 278

def frame
  @frame
end

#len ⇒ Object (readonly)

Returns the value of attribute len.



278
279
280
# File 'app/models/extface/driver/daisy_fx1200.rb', line 278

def len
  @len
end

#seq ⇒ Object (readonly)

Returns the value of attribute seq.



278
279
280
# File 'app/models/extface/driver/daisy_fx1200.rb', line 278

def seq
  @seq
end

#status ⇒ Object (readonly)

Returns the value of attribute status.



278
279
280
# File 'app/models/extface/driver/daisy_fx1200.rb', line 278

def status
  @status
end