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