Class: ActivityRecognitionTrigger
- Inherits:
-
SensorsTrigger
- Object
- MacroObject
- Trigger
- SensorsTrigger
- ActivityRecognitionTrigger
- Defined in:
- lib/ruby-macrodroid/triggers.rb
Overview
Category: Sensors
Instance Attribute Summary
Attributes inherited from Trigger
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ ActivityRecognitionTrigger
constructor
A new instance of ActivityRecognitionTrigger.
- #to_s(colour: false) ⇒ Object
- #to_summary(colour: false) ⇒ Object
Methods inherited from Trigger
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ ActivityRecognitionTrigger
Returns a new instance of ActivityRecognitionTrigger.
1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1270 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(colour: false) ⇒ Object
1283 1284 1285 1286 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1283 def to_s(colour: false) activity = @activity[@h[:selected_index]] 'Activity - ' + activity end |
#to_summary(colour: false) ⇒ Object
1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1288 def to_summary(colour: false) activity = @activity[@h[:selected_index]] s = if activity.length > 10 then activity[0..7] + '..' else activity end 'Activity - ' + s end |