예제 #1
0
        public EventBaseSequenceItem(JObject json)
        {
            dynamic rawSequence = (dynamic)json;

            SequenceId = rawSequence.SequenceId;
            StartTime = rawSequence.StartTime; // TODO: DateTime needs to be adjusted per export settings
            CaloriesBurned = rawSequence.CaloriesBurned;
            Duration = rawSequence.Duration;
            Order = rawSequence.Order;

            HeartRate = new HeartRateSummary((int)rawSequence.AverageHeartRate, (int)rawSequence.LowestHeartRate, (int)rawSequence.PeakHeartRate);
        }
예제 #2
0
        public EventBaseSequenceItem(JObject json)
        {
            dynamic rawSequence = (dynamic)json;

            SequenceId     = rawSequence.SequenceId;
            StartTime      = rawSequence.StartTime; // TODO: DateTime needs to be adjusted per export settings
            CaloriesBurned = rawSequence.CaloriesBurned;
            Duration       = rawSequence.Duration;
            Order          = rawSequence.Order;

            HeartRate = new HeartRateSummary((int)rawSequence.AverageHeartRate, (int)rawSequence.LowestHeartRate, (int)rawSequence.PeakHeartRate);
        }
예제 #3
0
        public BandEventInfoItem(JObject jsonEvent)
        {
            dynamic rawEvent = (dynamic)jsonEvent;

            TimeOfDay         = TimeZone.CurrentTimeZone.ToLocalTime(rawEvent.TimeOfDay.Value);
            DayClassification = rawEvent.DayClassification;
            ActivityLevel     = rawEvent.ActivityLevel;
            StepsTaken        = rawEvent.StepsTaken;
            CaloriesBurned    = rawEvent.CaloriesBurned;
            UvExposure        = rawEvent.UvExposure;
            Location          = rawEvent.Location; // always seem to be null? If this ever shows up, will have to parse it properly

            HeartRate = new HeartRateSummary((int)rawEvent.AverageHeartRate, (int)rawEvent.LowestHeartRate, (int)rawEvent.PeakHeartRate);

            TotalDistance     = rawEvent.TotalDistance;
            ItCal             = rawEvent.ItCal;
        }
예제 #4
0
        }                              // unclear what this means

        public BandEventBase(JObject json)
        {
            dynamic eventSummary = (dynamic)json;

            EventID        = eventSummary.EventId;
            Duration       = eventSummary.Duration;
            ParentEventId  = eventSummary.ParentEventId;
            Name           = eventSummary.Name;
            DeliveryID     = eventSummary.DeliveryID;
            EventType      = eventSummary.EventType;
            StartTime      = eventSummary.StartTime;
            CaloriesBurned = eventSummary.CaloriesBurned;
            DayId          = eventSummary.DayId;
            Feeling        = eventSummary.Feeling;
            HeartRate      = new HeartRateSummary((int)eventSummary.AverageHeartRate, (int)eventSummary.LowestHeartRate, (int)eventSummary.PeakHeartRate);
            Flags          = eventSummary.Flags;
        }
예제 #5
0
        public BandEventInfoItem(JObject jsonEvent)
        {
            dynamic rawEvent = (dynamic)jsonEvent;

            TimeOfDay         = TimeZone.CurrentTimeZone.ToLocalTime(rawEvent.TimeOfDay.Value);
            DayClassification = rawEvent.DayClassification;
            ActivityLevel     = rawEvent.ActivityLevel;
            StepsTaken        = rawEvent.StepsTaken;
            CaloriesBurned    = rawEvent.CaloriesBurned;
            UvExposure        = rawEvent.UvExposure;
            Location          = rawEvent.Location; // always seem to be null? If this ever shows up, will have to parse it properly

            HeartRate = new HeartRateSummary((int)rawEvent.AverageHeartRate, (int)rawEvent.LowestHeartRate, (int)rawEvent.PeakHeartRate);

            TotalDistance = rawEvent.TotalDistance;
            ItCal         = rawEvent.ItCal;
        }
예제 #6
0
        /// <summary>
        /// Called to indicate that this is the constructor for a UserActivity that will be part of a segment, not a top level
        /// which we then treat a little different (in other words, call Create() to toplevel)
        /// </summary>
        /// <param name="json"></param>
        /// <param name="toplevel"></param>
        private UserDailyActivity(JObject json) : base()
        {
            dynamic eventSummary = (dynamic)json;

            StartTime = eventSummary.TimeOfDay;
            DayClassification = eventSummary.DayClassification;
            ActivityLevel = eventSummary.ActivityLevel;
            StepsTaken = eventSummary.StepsTaken;
            HeartRate = new HeartRateSummary((int)eventSummary.AverageHeartRate, (int)eventSummary.LowestHeartRate, (int)eventSummary.PeakHeartRate);
            CaloriesBurned = eventSummary.CaloriesBurned;
            UvExposure = eventSummary.UvExposure;
            TotalDistance = eventSummary.TotalDistance;
            DayId = StartTime; // TODO: we could 0 this out to be 0:00 UTC based like other activities?
            ItCal = eventSummary.ItCal;

            // Location is always null, so ignore for now

            EventType = BandEventType.UserDailyActivity;
        }
예제 #7
0
        /// <summary>
        /// Called to indicate that this is the constructor for a UserActivity that will be part of a segment, not a top level
        /// which we then treat a little different (in other words, call Create() to toplevel)
        /// </summary>
        /// <param name="json"></param>
        /// <param name="toplevel"></param>
        private UserDailyActivity(JObject json) : base()
        {
            dynamic eventSummary = (dynamic)json;

            StartTime         = eventSummary.TimeOfDay;
            DayClassification = eventSummary.DayClassification;
            ActivityLevel     = eventSummary.ActivityLevel;
            StepsTaken        = eventSummary.StepsTaken;
            HeartRate         = new HeartRateSummary((int)eventSummary.AverageHeartRate, (int)eventSummary.LowestHeartRate, (int)eventSummary.PeakHeartRate);
            CaloriesBurned    = eventSummary.CaloriesBurned;
            UvExposure        = eventSummary.UvExposure;
            TotalDistance     = eventSummary.TotalDistance;
            DayId             = StartTime; // TODO: we could 0 this out to be 0:00 UTC based like other activities?
            ItCal             = eventSummary.ItCal;

            // Location is always null, so ignore for now

            EventType = BandEventType.UserDailyActivity;
        }
예제 #8
0
        public BandEventBase(JObject json)
        {
            dynamic eventSummary = (dynamic)json;

            EventID        = eventSummary.EventId;
            Duration       = eventSummary.Duration;
            ParentEventId  = eventSummary.ParentEventId;
            Name           = eventSummary.Name;
            DeliveryID     = eventSummary.DeliveryID;
            EventType      = eventSummary.EventType;
            StartTime      = eventSummary.StartTime;
            CaloriesBurned = eventSummary.CaloriesBurned;
            DayId          = eventSummary.DayId;
            Feeling        = eventSummary.Feeling;
            HeartRate      = new HeartRateSummary((int)eventSummary.AverageHeartRate, (int)eventSummary.LowestHeartRate, (int)eventSummary.PeakHeartRate);
            Flags          = eventSummary.Flags;

            InfoSegments = new List<BandEventInfoItem>();
            Sequences = new List<EventBaseSequenceItem>();
        }