Class: Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/hamnet.rb

Overview

This defines a basic frame of data for use with fldigi. The frame consists of:

Header field. Three bytes, consisting of “<<<” From field. Eight bytes (allowing for “WA0AAA-0”) To field. Eight bytes (allowing for “WB0BBB-0”) Type field. One byte (numeric) specifying encoding, compression. Data field. Arbitrary number of bytes of payload. CRC field. Last eight bytes, CRC32 checksum of From, To, Type, Data fields. Trailer field. Three bytes, consisting of “>>>”

Direct Known Subclasses

RxFrame, TxFrame

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to, type) ⇒ Frame

Returns a new instance of Frame.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/hamnet.rb', line 34

def initialize(from, to, type)
  @from=from.downcase
  @to=to.downcase
  @type=type
  @wiredata=nil
  @userdata=nil
  @crc=nil
  @valid=nil

  while @from.length<8
    @from=@from+":"
  end
  while @to.length<8
    @to=@to+":"
  end
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



32
33
34
# File 'lib/hamnet.rb', line 32

def from
  @from
end

#toObject

Returns the value of attribute to.



32
33
34
# File 'lib/hamnet.rb', line 32

def to
  @to
end

#typeObject

Returns the value of attribute type.



32
33
34
# File 'lib/hamnet.rb', line 32

def type
  @type
end

#validObject

Returns the value of attribute valid.



32
33
34
# File 'lib/hamnet.rb', line 32

def valid
  @valid
end

Instance Method Details

#to_sObject



51
52
53
# File 'lib/hamnet.rb', line 51

def to_s
  return @wiredata
end