Changes between Version 5 and Version 6 of GEC22Agenda/LabWiki/ModuleE/Execute


Ignore:
Timestamp:
03/10/15 17:50:32 (9 years ago)
Author:
eswer18@gmail.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GEC22Agenda/LabWiki/ModuleE/Execute

    v5 v6  
    6666defProperty('sinkaddr11', '192.168.1.6', "Ping destination address")
    6767peak_list = []
     68
    6869count =0
    6970
     
    187188  end
    188189end
    189 defEvent(:MY_EVENT, every: 0.5) do
     190defEvent(:MY_EVENT, every: 10) do
    190191# Query for some measurements...
    191192  # returns an array where each element is a hash representing a row from the DB
     
    195196
    196197  triggered = false
    197   if !data.nil? && !(last_row = data.pop).nil? # Make sure we have some data
    198     next if peak_list.include?(last_row[:srcaddr]) # Do nothing if we have seen this sample before
    199     if !peak_list.include?(last_row[:srcaddr])
    200       peak_list << last_row[:srcaddr] # record that sample, so we dont trigger on it again
    201       #count+=1
    202     end
    203     if  peak_list.size >= 1
    204      
    205       triggered = true
    206     end
    207   end
     198   if !data.nil?
     199    data.each do |test|
     200      next if peak_list.include?(test[:srcaddr]) # Do nothing if we have seen this sample before
     201        if !peak_list.include?(test[:srcaddr])
     202        peak_list << test[:srcaddr] # record that sample, so we dont trigger on it again
     203        end
     204        if  peak_list.size >= 4
     205        triggered = true
     206        end
     207        end
     208   end
    208209  triggered
    209210end
     
    224225
    225226
    226 
    227227}}}
    228228=== 3.1.3 Start your application from !LabWiki ===