com.garmin.fit
Class MonitoringReader

java.lang.Object
  extended by com.garmin.fit.MonitoringReader
All Implemented Interfaces:
DeviceSettingsMesgListener, MonitoringInfoMesgListener, MonitoringMesgListener

public class MonitoringReader
extends java.lang.Object
implements MonitoringInfoMesgListener, MonitoringMesgListener, DeviceSettingsMesgListener


Field Summary
static java.lang.String ACTIVE_CAL_STRING
           
static java.lang.String ACTIVE_TIME_STRING
           
static java.lang.String ASCENT_STRING
           
static java.lang.String CALORIE_STRING
           
static java.lang.String CYCLES_STRING
           
static int DAILY_INTERVAL
           
static java.lang.String DESCENT_STRING
           
static java.lang.String DISTANCE_STRING
           
static java.lang.String HR_STRING
           
static java.lang.String INTENSITY_STRING
           
static java.lang.String MOD_ACTIVITY_MIN_STRING
           
static java.lang.String TEMPERATURE_STRING
           
static java.lang.String VIG_ACTIVITY_MIN_STRING
           
 
Constructor Summary
MonitoringReader(int interval)
           
 
Method Summary
 void addListener(MonitoringMesgListener mesgListener)
          Adds a listener for decoded monitoring data.
 void broadcast()
          Broadcast all pending monitoring data.
 void excludeAllFields()
           
 java.util.HashMap<java.lang.String,java.lang.Boolean> getFieldStates()
           
 void includeAllFields()
           
 void onMesg(DeviceSettingsMesg mesg)
          Sets the local and UTC time stamp offsets based on information from the passed in DeviceSettingsMesg
 void onMesg(MonitoringInfoMesg mesg)
          Updates the stored information message and local time offset from information contained in the passed in MonitoringInfoMesg.
 void onMesg(MonitoringMesg mesg)
          Extracts data from the passed in MonitoringMesg into a new message, then updates the list of messages in the interval and the last message variable.
 void outputDailyTotals()
          Enables output of data from start of day instead of start of file.
 void setFieldIncluded(java.lang.String field, boolean state)
           
 void setSystemToLocalTimestampOffset(long offset)
          Set offset in seconds from system time to local time.
 void setSystemToUtcTimestampOffset(long offset)
          Set offset in seconds from system time to UTC time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DAILY_INTERVAL

public static final int DAILY_INTERVAL
See Also:
Constant Field Values

CYCLES_STRING

public static final java.lang.String CYCLES_STRING
See Also:
Constant Field Values

DISTANCE_STRING

public static final java.lang.String DISTANCE_STRING
See Also:
Constant Field Values

ACTIVE_CAL_STRING

public static final java.lang.String ACTIVE_CAL_STRING
See Also:
Constant Field Values

CALORIE_STRING

public static final java.lang.String CALORIE_STRING
See Also:
Constant Field Values

ACTIVE_TIME_STRING

public static final java.lang.String ACTIVE_TIME_STRING
See Also:
Constant Field Values

INTENSITY_STRING

public static final java.lang.String INTENSITY_STRING
See Also:
Constant Field Values

HR_STRING

public static final java.lang.String HR_STRING
See Also:
Constant Field Values

TEMPERATURE_STRING

public static final java.lang.String TEMPERATURE_STRING
See Also:
Constant Field Values

ASCENT_STRING

public static final java.lang.String ASCENT_STRING
See Also:
Constant Field Values

DESCENT_STRING

public static final java.lang.String DESCENT_STRING
See Also:
Constant Field Values

MOD_ACTIVITY_MIN_STRING

public static final java.lang.String MOD_ACTIVITY_MIN_STRING
See Also:
Constant Field Values

VIG_ACTIVITY_MIN_STRING

public static final java.lang.String VIG_ACTIVITY_MIN_STRING
See Also:
Constant Field Values
Constructor Detail

MonitoringReader

public MonitoringReader(int interval)
Parameters:
interval - Duration of time to be contained in the broadcast monitoring messages.
Method Detail

setFieldIncluded

public void setFieldIncluded(java.lang.String field,
                             boolean state)

getFieldStates

public java.util.HashMap<java.lang.String,java.lang.Boolean> getFieldStates()

excludeAllFields

public void excludeAllFields()

includeAllFields

public void includeAllFields()

outputDailyTotals

public void outputDailyTotals()
Enables output of data from start of day instead of start of file. Cumulative fields such as steps are accumulated from the start of the day so daily totals can be computed from a file that does not include data for earlier in the day. Instantaneous fields such as intensity and heart rate are not output in this mode because data for the whole day is required.


setSystemToUtcTimestampOffset

public void setSystemToUtcTimestampOffset(long offset)
Set offset in seconds from system time to UTC time. Used to convert system timestamps to UTC.

Parameters:
offset - UTC offset in seconds

setSystemToLocalTimestampOffset

public void setSystemToLocalTimestampOffset(long offset)
Set offset in seconds from system time to local time. Used to convert system timestamps to local time.

Parameters:
offset - local time offset in seconds

addListener

public void addListener(MonitoringMesgListener mesgListener)
Adds a listener for decoded monitoring data. Listener will receive monitoring data at interval specified in constructor. Data in the monitoring message is the total for the interval (not cumulative).

Parameters:
mesgListener - Listener for output monitoring data messages

broadcast

public void broadcast()
Broadcast all pending monitoring data. Call after reading file to flush partial intervals. If pending monitoring data does not align to interval boundary then timestamp will correspond to end of data and duration indicates partial interval.


onMesg

public void onMesg(MonitoringInfoMesg mesg)
Updates the stored information message and local time offset from information contained in the passed in MonitoringInfoMesg.

Specified by:
onMesg in interface MonitoringInfoMesgListener
Parameters:
mesg - The message containing cycle conversion factors

onMesg

public void onMesg(MonitoringMesg mesg)
Extracts data from the passed in MonitoringMesg into a new message, then updates the list of messages in the interval and the last message variable.

Specified by:
onMesg in interface MonitoringMesgListener
Parameters:
mesg - The message containing needed information

onMesg

public void onMesg(DeviceSettingsMesg mesg)
Sets the local and UTC time stamp offsets based on information from the passed in DeviceSettingsMesg

Specified by:
onMesg in interface DeviceSettingsMesgListener
Parameters:
mesg - The message containing needed information