Class: TxFrame
Overview
This defines a frame to be transmitted using fldigi. You need to supply the originating call sign (from), the destination call sign (to), the type of frame (see constants above), and the actual data to be transmitted.
Instance Attribute Summary collapse
-
#done ⇒ Object
Returns the value of attribute done.
-
#from ⇒ Object
Returns the value of attribute from.
-
#sequence ⇒ Object
Returns the value of attribute sequence.
-
#to ⇒ Object
Returns the value of attribute to.
-
#type ⇒ Object
Returns the value of attribute type.
-
#userdata ⇒ Object
Returns the value of attribute userdata.
-
#wiredata ⇒ Object
Returns the value of attribute wiredata.
Attributes inherited from Frame
Instance Method Summary collapse
-
#initialize(from, to, type, sequence, userdata, done) ⇒ TxFrame
constructor
A new instance of TxFrame.
Methods inherited from Frame
Constructor Details
#initialize(from, to, type, sequence, userdata, done) ⇒ TxFrame
Returns a new instance of TxFrame.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/hamnet.rb', line 77 def initialize(from, to, type, sequence, userdata, done) # Create the object. super(from, to, type, sequence, done) @userdata=userdata sendtype=type if @done or @type==HAMNET_FRAME_ACK or @type==HAMNET_FRAME_PING or @type==HAMNET_FRAME_PING_REPLY sendtype=(sendtype|128) end # Do the needful with the payload. case @type when HAMNET_FRAME_PING =@frompad+@topad+sprintf("%02x",sendtype).downcase+sprintf("%02x",@sequence).downcase when HAMNET_FRAME_PING_REPLY =@frompad+@topad+sprintf("%02x",sendtype).downcase+sprintf("%02x",@sequence).downcase+@userdata when HAMNET_FRAME_ACK =@frompad+@topad+sprintf("%02x",sendtype).downcase+sprintf("%02x",@sequence).downcase when HAMNET_FRAME_SIMPLE =@frompad+@topad+sprintf("%02x",sendtype).downcase+sprintf("%02x",@sequence).downcase+@userdata when HAMNET_FRAME_BASE64 =@frompad+@topad+sprintf("%02x",sendtype).downcase+sprintf("%02x",@sequence).downcase+Base64::strict_encode64(@userdata) when HAMNET_FRAME_COMPRESSED_BASE64 =@frompad+@topad+sprintf("%02x",sendtype).downcase+sprintf("%02x",@sequence).downcase+Base64::strict_encode64(Zlib::Deflate.deflate(@userdata,Zlib::BEST_COMPRESSION)) else return false end # Calculate the CRC. @crc=sprintf("%08x",Zlib::crc32()).downcase # Set the rest of the fields, and done. @wiredata="----------<<<#{}#{@crc}>>>" @valid=true end |
Instance Attribute Details
#done ⇒ Object
Returns the value of attribute done.
75 76 77 |
# File 'lib/hamnet.rb', line 75 def done @done end |
#from ⇒ Object
Returns the value of attribute from.
75 76 77 |
# File 'lib/hamnet.rb', line 75 def from @from end |
#sequence ⇒ Object
Returns the value of attribute sequence.
75 76 77 |
# File 'lib/hamnet.rb', line 75 def sequence @sequence end |
#to ⇒ Object
Returns the value of attribute to.
75 76 77 |
# File 'lib/hamnet.rb', line 75 def to @to end |
#type ⇒ Object
Returns the value of attribute type.
75 76 77 |
# File 'lib/hamnet.rb', line 75 def type @type end |
#userdata ⇒ Object
Returns the value of attribute userdata.
75 76 77 |
# File 'lib/hamnet.rb', line 75 def userdata @userdata end |
#wiredata ⇒ Object
Returns the value of attribute wiredata.
75 76 77 |
# File 'lib/hamnet.rb', line 75 def wiredata @wiredata end |