Class: Peak::Plugins::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/peak/plugins/status.rb

Instance Method Summary collapse

Instance Method Details

#handle_packet(frame, recv_port) ⇒ Object



65
66
# File 'lib/peak/plugins/status.rb', line 65

def handle_packet(frame, recv_port)
end

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/peak/plugins/status.rb', line 31

def run
    @running = true
        
    # Don't do anything in the first 90 seconds
    last_trigger = Status::now
    while @running and Status::now - last_trigger < 90
        sleep(1)
    end
        
    # run every 600 second
    last_trigger = Status::now
    while @running
        if Status::now - last_trigger >= 600
            last_trigger = Status::now
            @port_configs.each do |port, port_config|
                frame = {:source => port.identifier,
                         :destination => 'APRS',
                         :path => port_config[:status_path],
                         :text => port_config[:status_text]
                }
                port.write(frame)
            end
        else
            sleep(1)
        end
    end
end

#stopObject



60
61
62
# File 'lib/peak/plugins/status.rb', line 60

def stop
    @running = false
end