Method: OpenC3::PreidentifiedProtocol#initialize

Defined in:
lib/openc3/interfaces/protocols/preidentified_protocol.rb

#initialize(sync_pattern = nil, max_length = nil, _unused = nil, allow_empty_data = nil) ⇒ PreidentifiedProtocol

Returns a new instance of PreidentifiedProtocol.

Parameters:

  • max_length (Integer) (defaults to: nil)

    The maximum allowed value of the length field

  • _unused (Integer) (defaults to: nil)

    Legacy version number - unused

  • allow_empty_data (true/false/nil) (defaults to: nil)

    See Protocol#initialize

  • sync_pattern (String) (defaults to: nil)

    String representing a hex number ("0x1234") that will be searched for in the raw data. Bytes encountered before this pattern is found are discarded.



35
36
37
38
39
# File 'lib/openc3/interfaces/protocols/preidentified_protocol.rb', line 35

def initialize(sync_pattern = nil, max_length = nil, _unused = nil, allow_empty_data = nil)
  super(0, sync_pattern, false, allow_empty_data)
  @max_length = ConfigParser.handle_nil(max_length)
  @max_length = Integer(@max_length) if @max_length
end