public void Add(Heartrate heartrate)
        {
            var query   = "INSERT INTO Heartrates(DateTime, HeartrateValue) VALUES(?,?)";
            var command = _database.Instance.CreateCommand(query, heartrate.DateTime, heartrate.HeartrateValue);

            command.ExecuteNonQuery();
        }
Example #2
0
        private HeartrateData getHeartrateDataExt(string param2)
        {
            string param = Consts.GET_HEART_DATA + getParams();

            try
            {
                String        sleepInfo = webClient.Post(param, param2, CONTENT_TYPE);
                HeartrateData data      = JsonConvert.DeserializeObject <HeartrateData>(sleepInfo);
                if (data == null || data.heartrate == null)
                {
                    data = new HeartrateData();
                    Heartrate heartrate = new Heartrate();
                    data.heartrate = heartrate;
                }
                return(data);
            }
            catch (Exception ex)
            {
                if (currentTryRunNum == TRY_AGAIN_MUN)
                {
                    FailRequestManager.mInstance.saveInFailList(mUserModel.UserID, Convert.ToDateTime(mSyncDay), param, (ex == null ? "" : ex.Message));
                    return(null);
                }
                else
                {
                    currentTryRunNum++;
                    return(getHeartrateDataExt(param2));
                }
            }
        }
Example #3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Time != null)
         {
             hashCode = hashCode * 59 + Time.GetHashCode();
         }
         if (Distance != null)
         {
             hashCode = hashCode * 59 + Distance.GetHashCode();
         }
         if (Latlng != null)
         {
             hashCode = hashCode * 59 + Latlng.GetHashCode();
         }
         if (Altitude != null)
         {
             hashCode = hashCode * 59 + Altitude.GetHashCode();
         }
         if (VelocitySmooth != null)
         {
             hashCode = hashCode * 59 + VelocitySmooth.GetHashCode();
         }
         if (Heartrate != null)
         {
             hashCode = hashCode * 59 + Heartrate.GetHashCode();
         }
         if (Cadence != null)
         {
             hashCode = hashCode * 59 + Cadence.GetHashCode();
         }
         if (Watts != null)
         {
             hashCode = hashCode * 59 + Watts.GetHashCode();
         }
         if (Temp != null)
         {
             hashCode = hashCode * 59 + Temp.GetHashCode();
         }
         if (Moving != null)
         {
             hashCode = hashCode * 59 + Moving.GetHashCode();
         }
         if (GradeSmooth != null)
         {
             hashCode = hashCode * 59 + GradeSmooth.GetHashCode();
         }
         return(hashCode);
     }
 }
        private void AddHeartrate(DateTime datetime, ActivitySample sample)
        {
            var heartRate = new Heartrate(datetime, sample.HeartRate != 255 ? sample.HeartRate : 0);

            _heartrateRepository.Add(heartRate);
        }
Example #5
0
        /// <summary>
        /// Returns true if StreamSet instances are equal
        /// </summary>
        /// <param name="other">Instance of StreamSet to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(StreamSet other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Time == other.Time ||
                     Time != null &&
                     Time.Equals(other.Time)
                     ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     Latlng == other.Latlng ||
                     Latlng != null &&
                     Latlng.Equals(other.Latlng)
                 ) &&
                 (
                     Altitude == other.Altitude ||
                     Altitude != null &&
                     Altitude.Equals(other.Altitude)
                 ) &&
                 (
                     VelocitySmooth == other.VelocitySmooth ||
                     VelocitySmooth != null &&
                     VelocitySmooth.Equals(other.VelocitySmooth)
                 ) &&
                 (
                     Heartrate == other.Heartrate ||
                     Heartrate != null &&
                     Heartrate.Equals(other.Heartrate)
                 ) &&
                 (
                     Cadence == other.Cadence ||
                     Cadence != null &&
                     Cadence.Equals(other.Cadence)
                 ) &&
                 (
                     Watts == other.Watts ||
                     Watts != null &&
                     Watts.Equals(other.Watts)
                 ) &&
                 (
                     Temp == other.Temp ||
                     Temp != null &&
                     Temp.Equals(other.Temp)
                 ) &&
                 (
                     Moving == other.Moving ||
                     Moving != null &&
                     Moving.Equals(other.Moving)
                 ) &&
                 (
                     GradeSmooth == other.GradeSmooth ||
                     GradeSmooth != null &&
                     GradeSmooth.Equals(other.GradeSmooth)
                 ));
        }
Example #6
0
 public override string ToString()
 {
     return(Time.ToString(@"hh\:mm\:ss") + sep + Altitude.ToString("N1") + sep + Velocity.ToString("N2") + sep + Cadence.ToString("N0") + sep + Grade.ToString("N2")
            + sep + Heartrate.ToString("N0") + sep + Temperature.ToString("N1") + sep + Distance.ToString("N3") + sep + Moving);
 }