Class: ActivityRecognitionTrigger

Inherits:
SensorsTrigger show all
Defined in:
lib/ruby-macrodroid.rb

Overview

Category: Sensors

Instance Attribute Summary

Attributes inherited from Trigger

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Trigger

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ ActivityRecognitionTrigger

Returns a new instance of ActivityRecognitionTrigger.



2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
# File 'lib/ruby-macrodroid.rb', line 2233

def initialize(h={})

  options = {
    confidence_level: 50,
    selected_index: 1
  }

  super(options.merge h)
  
  @activity = ['In Vehicle', 'On Bicycle', 'Running', 'Walking', 'Still']    

end

Instance Method Details

#to_sObject



2246
2247
2248
2249
# File 'lib/ruby-macrodroid.rb', line 2246

def to_s()
  activity = @activity[@h[:selected_index]]
  'Activity - ' + activity
end

#to_summaryObject



2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
# File 'lib/ruby-macrodroid.rb', line 2251

def to_summary
  
  activity = @activity[@h[:selected_index]]
  s = if activity.length > 10 then
    activity[0..7] + '..'
  else
    activity
  end
  
  'Activity - ' + s
  
end