Пример #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);
     }
 }
Пример #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();
        }
Пример #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);
         }
     }
 }
Пример #4
0
 private void ControlFrame_Load(object sender, EventArgs e)
 {
     device = new MiBand(DeviceControl.Instance.BluetoothManager);
 }
Пример #5
0
 public void WriteRealtimeHeartrateInFile(MiBand d, UInt16 v)
 {
     using (StreamWriter fp = new StreamWriter("heartrate.txt")) {
         fp.Write(v.ToString());
     }
 }