diff --git a/lib/apex/aprs_kiss.rb b/lib/apex/aprs_kiss.rb index a062efa1d0c645300ea2bb7d32f0f3727cff96ad..572126dd935fc94ef55b26737e7ccfee540366ae 100644 --- a/lib/apex/aprs_kiss.rb +++ b/lib/apex/aprs_kiss.rb @@ -22,8 +22,8 @@ module Apex # Less than 2 callsigns? if 1.0 < i and i < 11.0 if raw_frame[raw_slice + 1] & 0x03 == 0x03 and [0xf0, 0xcf].include? raw_frame[raw_slice + 2] - text_as_array = raw_frame[raw_slice + 3..-1].map { |b| b.chr } - frame[:text] = text_as_array.join + payload_as_array = raw_frame[raw_slice + 3..-1].map { |b| b.chr } + frame[:payload] = payload_as_array.join frame[:destination] = identity_as_string(extract_callsign(raw_frame)) frame[:source] = identity_as_string(extract_callsign(raw_frame[7..-1])) frame[:path] = extract_path(i.to_i, raw_frame) @@ -100,7 +100,7 @@ module Apex enc_frame += encode_callsign(parse_identity_string(path)) end - return enc_frame[0...-1] + [enc_frame[-1] | 0x01] + [Kiss::SLOT_TIME] + [0xf0] + frame[:text].chars.map { |c| c.ord } + return enc_frame[0...-1] + [enc_frame[-1] | 0x01] + [Kiss::SLOT_TIME] + [0xf0] + frame[:payload].chars.map { |c| c.ord } end private @@ -170,4 +170,4 @@ module Apex end end end -end \ No newline at end of file +end diff --git a/lib/apex/igate_tcp.rb b/lib/apex/igate_tcp.rb index 2466ef052c96e3f501f512d67354d2d75d6f66c8..6b5aa2a62830a5d64ee24c2c2744fb2d0c70e020 100644 --- a/lib/apex/igate_tcp.rb +++ b/lib/apex/igate_tcp.rb @@ -35,7 +35,7 @@ module Apex formatted_frame = [formatted_frame, IGateTcp::format_path(frame[:path])].join(',') end formatted_frame += ':' - formatted_frame += frame[:text] + formatted_frame += frame[:payload] return formatted_frame end @@ -59,7 +59,7 @@ module Apex path = path.split(',') decoded_frame[:destination] = path.shift decoded_frame[:path] = path - decoded_frame[:text] = frame_so_far + decoded_frame[:payload] = frame_so_far decoded_frame end diff --git a/test/tc_aprs_kiss.rb b/test/tc_aprs_kiss.rb index f6aa7a4874ab7bac469c71839fe0de7c543c433a..c5058c51c24be32e09dcea4cb9e9664c197d225b 100644 --- a/test/tc_aprs_kiss.rb +++ b/test/tc_aprs_kiss.rb @@ -7,7 +7,7 @@ module Apex :source => 'W2GMD-1', :destination => 'OMG', :path => ['WIDE1-1', 'WIDE2-2'], - :text => 'test_encode_frame' + :payload => 'test_encode_frame' } ENCODED_FRAME_KISS = [192, 0, 158, 154, 142, 64, 64, 64, 96, 174, 100, 142, 154, 136, 64, 98, 174, 146, 136, 138, 98, 64, 98, 174, 146, 136, 138, 100, 64, 101, 3, 240, 116, 101, 115, 116, 95, 101, 110, 99, 111, 100, @@ -17,7 +17,7 @@ module Apex :source => 'KG6WTF', :destination => 'S7TSUV', :path => ['MTOSO-2', 'WIDE2*' 'qAR', 'KF6FIR-10'], - :text => '`17El#X-/kg6wtf@gosselinfamily.com' + :payload => '`17El#X-/kg6wtf@gosselinfamily.com' } ENCODED_FRAME_KISS_INVALID = [192, 0, 166, 110, 168, 166, 170, 172, 96, 150, 142, 108, 174, 168, 140, 96, 154, 168, 158, 166, 158, 64, 100, 174, 146, 136, 138, 100, 226, 130, 164, 224, 150, 140, 108, 140, 146, 164, @@ -81,4 +81,4 @@ module Apex assert_equal 0, all_raw_frames.length end end -end \ No newline at end of file +end