Class: Toybox::ActivityRecording::Session

Inherits:
Lang::Object show all

Overview

Session objects control the FIT recording state machine.

Examples:

Format for setting up a Session object

using Toybox.ActivityRecording;
var session = ActivityRecording.createSession({     // set up recording session
    :name=>"Generic",                               // set session name
    :sport=>ActivityRecording.SPORT_GENERIC,        // set sport type
    :subSport=>ActivityRecording.SUB_SPORT_GENERIC  // set sub sport type
});

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Instance Method Details

addLapToybox::Lang::Boolean

Add a lap to the current recording.

Returns:

Since:

  • 1.0.0


5348
5349
# File 'Monkeybrains.rb', line 5348

def addLap()
end

createField(name, fieldId, type, options) ⇒ Toybox::FitContributor::Field

Create a new Field.

Field objects allow developers to store information in FIT developer fields. This information can be displayed in Garmin Connect as a per-second graph, as lap information, or as workout summary information.

Parameters:

Options Hash (options):

  • :count (Toybox::Lang::Number)

    The number of elements to add to the Field if it is an Array

    • This is also the maximum combined size of strings plus null terminators if the type is DATA_TYPE_STRING (Default 1)

    • Apps are limited to 256 total bytes per message

    • Data fields are limited to 32 bytes per message

    • Messages larger than the limit will result in a “New Field out of memory for FIT data” error.

  • :mesgType (Toybox::Lang::Number)

    The message type that this Field should be added to

  • :units (Toybox::Lang::String)

    The display units as a String

    • This should use the current device language

    • The maximum length may vary between products

    • At least 16 bytes are available

  • :nativeNum (Toybox::Lang::Number)

    If this Field can be treated equivalently to a Field that is included in the FIT SDK use this to indicate the Field Number that is specified by the FIT Profile.

Returns:

See Also:

Since:

  • 1.3.0


5413
5414
# File 'Monkeybrains.rb', line 5413

def createField(name, fieldId, type, options)
end

discardToybox::Lang::Boolean

Complete the Session by discarding the recorded data.

Returns:

Since:

  • 1.0.0


5369
5370
# File 'Monkeybrains.rb', line 5369

def discard()
end

isRecordingToybox::Lang::Boolean

Check if recording is active for this Session.

Returns:

Since:

  • 1.0.0


5355
5356
# File 'Monkeybrains.rb', line 5355

def isRecording()
end

saveToybox::Lang::Boolean

Complete the session by storing the FIT file on the file system.

Returns:

Since:

  • 1.0.0


5362
5363
# File 'Monkeybrains.rb', line 5362

def save()
end

setTimerEventListener(listener) ⇒ Object

Note:

The keys in the Dictionary passed to the listener callback depend on the the value of the eventType parameter.

  • TIMER_EVENT_LAP: the following are provided if available:

    • :elapsedDistance Float (meters)

    • :averageSpeed Float (meters/second)

    • :maxSpeed Float (meters/second)

    • :startTime Moment (Moment)

    • :elapsedTime Number (milliseconds)

    • :timerTime Number (milliseconds)

Set the listener for Session timer events

The listener method is called whenever a new timer event occurs.

Parameters:

  • listener (Toybox::Lang::Method)

    A reference to a callback which must accept two arguments.

    • eventType: A TIMER_EVENT_* enum that describes the event that occurred.

    • eventData: A Dictionary containing data relevant to the timer event or null.

Since:

  • 1.0.0


5436
5437
# File 'Monkeybrains.rb', line 5436

def setTimerEventListener(listener)
end

startToybox::Lang::Boolean

Begin recording a FIT file on the system.

Returns:

Since:

  • 1.0.0


5334
5335
# File 'Monkeybrains.rb', line 5334

def start()
end

stopToybox::Lang::Boolean

Stop recording a FIT file on the system.

Returns:

Since:

  • 1.0.0


5341
5342
# File 'Monkeybrains.rb', line 5341

def stop()
end