improve print order
This commit is contained in:
parent
cd543b92bd
commit
0758e2e50d
19
mitm.rb
19
mitm.rb
|
@ -16,18 +16,23 @@ while true
|
|||
activities[0].each do |activity|
|
||||
data = activity.readpartial(16+1+5)
|
||||
line = data.unpack("C*").collect { |b| sprintf("%02X ",b) }.join
|
||||
begin
|
||||
telegram = Telegram.parse(data)
|
||||
rescue Exception => e
|
||||
puts e.to_s
|
||||
end
|
||||
if activity==pc_serial then
|
||||
puts "pc->ps: "+line
|
||||
puts "pc->ps: "+telegram.to_s if telegram
|
||||
begin
|
||||
telegram = Telegram.parse(data)
|
||||
puts "pc->ps: "+telegram.to_s if telegram
|
||||
rescue Exception => e
|
||||
puts e.to_s
|
||||
end
|
||||
ps_serial.write(data)
|
||||
elsif activity==ps_serial then
|
||||
puts "ps->pc: "+line
|
||||
puts "ps->pc: "+telegram.to_s if telegram
|
||||
begin
|
||||
telegram = Telegram.parse(data)
|
||||
puts "ps->pc: "+telegram.to_s if telegram
|
||||
rescue Exception => e
|
||||
puts e.to_s
|
||||
end
|
||||
pc_serial.write(data)
|
||||
else
|
||||
raise "unknown source"
|
||||
|
|
Loading…
Reference in New Issue