Class: Ax25::AprsKiss

Inherits:
Object
  • Object
show all
Includes:
Encoder
Defined in:
lib/ax25/encoder/aprs_kiss.rb

Instance Method Summary collapse

Instance Method Details

#close(*args, **kwargs) ⇒ Object



28
29
30
# File 'lib/ax25/encoder/aprs_kiss.rb', line 28

def close(*args, **kwargs)
    @data_stream.close(*args, **kwargs)
end

#connect(*args, **kwargs) ⇒ Object



23
24
25
# File 'lib/ax25/encoder/aprs_kiss.rb', line 23

def connect(*args, **kwargs)
    @data_stream.connect(*args, **kwargs)
end

#read(*args, **kwargs) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ax25/encoder/aprs_kiss.rb', line 33

def read(*args, **kwargs)
  frame_map = @data_stream.read
  return nil if frame_map.nil?

  source = Ax25::ImmutableEntity.from_raw(frame_map[:source])
  destination = Ax25::ImmutableEntity.from_raw(frame_map[:destination])

  path = Ax25::ImmutablePath.from_raw(frame_map[:path])

  return Ax25::ImmutableFrame.new(source, destination, path, frame_map[:payload])
end

#write(frame, *args, **kwargs) ⇒ Object

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ax25/encoder/aprs_kiss.rb', line 46

def write(frame, *args, **kwargs)
  raise ArgumentError.new("frame argument can not be nil") if frame.nil?

  frame_map = {
    :source => frame.source.to_s,
    :destination => frame.destination.to_s,
    :path => frame.path.to_string_array,
    :payload => frame.payload
  }

  @data_stream.write(frame_map)
end