private static void QueryDevice() { // Other system tests Console.WriteLine("Connecting..."); zeitgeber.Connect(); Console.Write("Connected to "); Console.WriteLine(zeitgeber.DeviceDescription); Console.WriteLine("Ping()"); zeitgeber.Ping(); //zeitgeber.SetLed(2, 1); Console.WriteLine("GetBatteryInfo()"); var battery = zeitgeber.GetBatteryInfo(); Console.WriteLine(String.Format("\tlevel: {0}%", battery.Level)); Console.WriteLine(String.Format("\tvoltage: {0}mV", battery.Voltage)); Console.WriteLine(String.Format("\tpower status: {0}", battery.PowerStatus)); Console.WriteLine(); Console.WriteLine("GetCpuInfo()"); var cpu = zeitgeber.GetCpuInfo(); Console.WriteLine(String.Format("\tsystick: {0}", cpu.systick)); Console.WriteLine(); Console.WriteLine("QueryDisplay()"); var display = zeitgeber.QueryDisplay(); Console.WriteLine(String.Format( "\tsize: {0}x{1}x{2}bpp ({3} bytes)", display.Width, display.Height, display.BitsPerPixel, display.Width * display.Height * (display.BitsPerPixel / 8) )); Console.WriteLine(); zeitgeber.SetDateTime(DateTime.Now); Console.WriteLine("GetDateTime()"); var dt = zeitgeber.GetDateTime(); Console.WriteLine(dt.ToString()); Console.WriteLine("Actual:"); Console.WriteLine(DateTime.Now.ToString()); Console.WriteLine(); }
/// <summary> /// Called by the update timer when the device is connected /// </summary> private void UpdateDiagnostics() { listViewInfo.BeginUpdate(); try { var cpuInfo = zeitgeber.GetCpuInfo(); var cpuGroup = listViewInfo.Groups["listViewGroupCPU"]; cpuGroup.Items[0].SubItems[1].Text = cpuInfo.systick.ToString(); var batteryInfo = zeitgeber.GetBatteryInfo(); var batteryGroup = listViewInfo.Groups["listViewGroupBattery"]; batteryGroup.Items[0].SubItems[1].Text = batteryInfo.Level.ToString() + "%"; batteryGroup.Items[1].SubItems[1].Text = batteryInfo.Voltage.ToString() + "mV"; batteryGroup.Items[2].SubItems[1].Text = ((Zeitlib.PowerStatus)batteryInfo.PowerStatus).ToString(); DateTime?dt = zeitgeber.GetDateTime(); if (dt.HasValue) { var rtcGroup = listViewInfo.Groups["listViewGroupRTC"]; rtcGroup.Items[0].SubItems[1].Text = dt.Value.ToLongTimeString(); rtcGroup.Items[1].SubItems[1].Text = dt.Value.ToShortDateString(); } string msg; do { msg = zeitgeber.GetNextDebugMessage(); if (msg != null) { msg = msg.Replace("\n", Environment.NewLine); txtConsole.AppendText(msg); } } while (msg != null); } finally { listViewInfo.EndUpdate(); } // itm.SetValue("Test"); }