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. Nine bytes (allowing for “WA0AAA-0”) To field. Nine bytes (allowing for “WB0BBB-0”) Type field. Two bytes (two hex digits) specifying encoding, compression. If the high-order bit is set, this is the last frame of a sequence (ie, wait for the other side). Sequence field. Two bytes (two hex digits) specifying sequence number. 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, sequence, done) ⇒ Frame

Returns a new instance of Frame.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hamnet.rb', line 43

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

  @frompad=@from
  while @frompad.length<9
    @frompad=@frompad+":"
  end

  @topad=@to
  while @topad.length<9
    @topad=@topad+":"
  end
end

Instance Attribute Details

#doneObject

Returns the value of attribute done.



41
42
43
# File 'lib/hamnet.rb', line 41

def done
  @done
end

#fromObject

Returns the value of attribute from.



41
42
43
# File 'lib/hamnet.rb', line 41

def from
  @from
end

#frompadObject

Returns the value of attribute frompad.



41
42
43
# File 'lib/hamnet.rb', line 41

def frompad
  @frompad
end

#sequenceObject

Returns the value of attribute sequence.



41
42
43
# File 'lib/hamnet.rb', line 41

def sequence
  @sequence
end

#toObject

Returns the value of attribute to.



41
42
43
# File 'lib/hamnet.rb', line 41

def to
  @to
end

#topadObject

Returns the value of attribute topad.



41
42
43
# File 'lib/hamnet.rb', line 41

def topad
  @topad
end

#typeObject

Returns the value of attribute type.



41
42
43
# File 'lib/hamnet.rb', line 41

def type
  @type
end

#validObject

Returns the value of attribute valid.



41
42
43
# File 'lib/hamnet.rb', line 41

def valid
  @valid
end

Instance Method Details

#to_sObject



65
66
67
# File 'lib/hamnet.rb', line 65

def to_s
  return @wiredata
end