Class: ActivityRecognitionTrigger
- Inherits:
-
SensorsTrigger
- Object
- MacroObject
- Trigger
- SensorsTrigger
- ActivityRecognitionTrigger
- Defined in:
- lib/ruby-macrodroid.rb
Overview
Category: Sensors
Instance Attribute Summary
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ ActivityRecognitionTrigger
constructor
A new instance of ActivityRecognitionTrigger.
- #to_s ⇒ Object
- #to_summary ⇒ Object
Methods inherited from Trigger
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ ActivityRecognitionTrigger
Returns a new instance of ActivityRecognitionTrigger.
2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 |
# File 'lib/ruby-macrodroid.rb', line 2079 def initialize(h={}) = { confidence_level: 50, selected_index: 1 } super(.merge h) @activity = ['In Vehicle', 'On Bicycle', 'Running', 'Walking', 'Still'] end |
Instance Method Details
#to_s ⇒ Object
2092 2093 2094 2095 |
# File 'lib/ruby-macrodroid.rb', line 2092 def to_s() activity = @activity[@h[:selected_index]] 'Activity - ' + activity end |
#to_summary ⇒ Object
2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 |
# File 'lib/ruby-macrodroid.rb', line 2097 def to_summary activity = @activity[@h[:selected_index]] s = if activity.length > 10 then activity[0..7] + '..' else activity end 'Activity - ' + s end |