public AFValues ConvertToAFValues(TimeSeriesDataList tsDataList, FitbitStream stream, FitbitUser fitbitUser)
        {

            AFValues values = new AFValues();
            foreach (var result in tsDataList.DataList)
            {
                AFValue val = null;
                if (stream.FitbitSource != TimeSeriesResourceType.TimeEnteredBed)
                {
                    val = new AFValue(Convert.ToSingle(result.Value), new AFTime(result.DateTime), stream.UnitsOfMeasure);
                }
                else
                {
                    val = new AFValue(result.Value, new AFTime(result.DateTime), stream.UnitsOfMeasure);
                }
                values.Add(val);

            }

            values.Attribute = fitbitUser.UserElement.Elements["Fitbit"].Attributes[stream.AttributeName];

            return values;
        }
        public FitbitStream CreateFitbitStream(TimeSeriesResourceType tsResourceType, string attributeName, UOM uom)
        {
            FitbitStream stream = new FitbitStream(tsResourceType, attributeName, uom);

            return stream;
        }
Пример #3
0
        private AFValues GetFitbitDataForStream(FitbitStream stream, FitbitUser fitbitUser, DateTime startTime, DateTime endTime)
        {

            TimeSeriesDataList internalDataList = fitbitUser.ApiClient.GetTimeSeries(stream.FitbitSource, startTime, endTime);

            PIFitnessLog.Write(TraceEventType.Verbose, 0, string.Format("Returned data. Stream: {0}, User: {1}", stream.FitbitSource, fitbitUser.UserElement.Name));

            AFValues vals = _fitbitConverter.ConvertToAFValues(internalDataList, stream, fitbitUser);

            return vals;

            //return null;
        }