Class: OpenC3::FixedProtocol
- Inherits:
-
BurstProtocol
- Object
- Protocol
- BurstProtocol
- OpenC3::FixedProtocol
- Defined in:
- lib/openc3/interfaces/protocols/fixed_protocol.rb
Overview
Delineates packets by identifying them and then reading out their entire fixed length. Packets lengths can vary but they must all be fixed.
Instance Attribute Summary
Attributes inherited from Protocol
#allow_empty_data, #extra, #interface
Instance Method Summary collapse
-
#initialize(min_id_size, discard_leading_bytes = 0, sync_pattern = nil, telemetry = true, fill_fields = false, unknown_raise = false, allow_empty_data = nil) ⇒ FixedProtocol
constructor
A new instance of FixedProtocol.
-
#read_packet(packet) ⇒ Object
Set the received_time, target_name and packet_name which we recorded when we identified this packet.
Methods inherited from BurstProtocol
#handle_sync_pattern, #log_discard, #read_data, #reset, #write_data, #write_packet
Methods inherited from Protocol
#connect_reset, #disconnect_reset, #post_write_interface, #protocol_cmd, #read_data, #reset, #write_data, #write_packet
Constructor Details
#initialize(min_id_size, discard_leading_bytes = 0, sync_pattern = nil, telemetry = true, fill_fields = false, unknown_raise = false, allow_empty_data = nil) ⇒ FixedProtocol
Returns a new instance of FixedProtocol.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/openc3/interfaces/protocols/fixed_protocol.rb', line 40 def initialize( min_id_size, discard_leading_bytes = 0, sync_pattern = nil, telemetry = true, fill_fields = false, unknown_raise = false, allow_empty_data = nil ) super(discard_leading_bytes, sync_pattern, fill_fields, allow_empty_data) @min_id_size = Integer(min_id_size) @telemetry = telemetry @unknown_raise = ConfigParser.handle_true_false(unknown_raise) @received_time = nil @target_name = nil @packet_name = nil end |
Instance Method Details
#read_packet(packet) ⇒ Object
Set the received_time, target_name and packet_name which we recorded when we identified this packet. The server will also do this but since we know the information here, we perform this optimization.
61 62 63 64 65 66 |
# File 'lib/openc3/interfaces/protocols/fixed_protocol.rb', line 61 def read_packet(packet) packet.received_time = @received_time packet.target_name = @target_name packet.packet_name = @packet_name return packet end |