Ejemplo n.º 1
0
 void OnHeartrateChange(MiBand d, UInt16 v)
 {
     if (InvokeRequired)
     {
         OnHeartrateChangeHandler c = new OnHeartrateChangeHandler(OnHeartrateChange);
         Invoke(c, new object[] { d, v });
     }
     else
     {
         heartrateLabel.Text = String.Format("{0} bpm", v);
     }
 }
Ejemplo n.º 2
0
        public void WriteDataInCSV(MiBand d, UInt16 v)
        {
            StreamWriter fp;

            if (File.Exists("heartrates.csv") == false)
            {
                fp = new StreamWriter("heartrates.csv");
                fp.WriteLine("datetime,heartrate");
            }
            else
            {
                fp = new StreamWriter("heartrates.csv", true);
            }
            fp.WriteLine(String.Format("{0},{1}", DateTime.Now.ToString(), v.ToString()));
            fp.Close();
        }
Ejemplo n.º 3
0
 void OnAuth(MiBand d, bool s)
 {
     if (InvokeRequired)
     {
         OnAuthHandler c = new OnAuthHandler(OnAuth);
         Invoke(c, new object[] { d, s });
     }
     else
     {
         if (s)
         {
             connectionStatusLabel.Text = "Connected | Auth";
             startButton.Enabled        = true;
         }
         else
         {
             MessageBox.Show("Auth failed !", "Device error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Ejemplo n.º 4
0
 private void ControlFrame_Load(object sender, EventArgs e)
 {
     device = new MiBand(DeviceControl.Instance.BluetoothManager);
 }
Ejemplo n.º 5
0
 public void WriteRealtimeHeartrateInFile(MiBand d, UInt16 v)
 {
     using (StreamWriter fp = new StreamWriter("heartrate.txt")) {
         fp.Write(v.ToString());
     }
 }