protected void buildList() { Intent statusIntent; Server yastServer; Bundle b; statusIntent = Intent; b = statusIntent.Extras; yastServer = new Server(b); statusModule = yastServer.getStatusModule(); try { graphs = statusModule.getGraphs(); } catch(SAXException ex) { graphs = null; } try { logs = statusModule.getLogs(); } catch(Exception ex) { // Unable to get logs logs = null; Android.Util.Log.Error("SystemStatusActivity", ex.Message); } populateAdapter (); }
public void fetchMetricData() { Bundle b; Server yastServer; string resource_type; StatusModule statusModule; List<Metric> networkMetrics; b = Intent.Extras; resource_type = b.GetString("RESOURCE_TYPE"); yastServer = new Server(b); metric = null; // TODO: figure out how many data points we want to graph on this small screen if (resource_type == "Network") { try { statusModule = yastServer.getStatusModule(); networkMetrics = statusModule.getMetric(Metric.NETWORK); // FIXME: We are using "eth0" in the meantime, but we should be able to show the other interfaces // Also, each interface has different types, here we are hard-coding "if_packets" (aka, rx and tx) string id = null; foreach (Metric m in networkMetrics) { if (m.getTypeInstance () != null && m.getTypeInstance().CompareTo("eth0") == 0 && m.getType () != null && m.getType().CompareTo("if_packets") == 0) { id = m.getId (); break; } } timeStamp = (int) (new Date ().Time / 1000); timeStampStart = timeStamp - (60 * length); metric = statusModule.getMetricData(id, timeStampStart, timeStamp); if (metric != null) { // FIXME: GraphArrayList<E>orts one value only, List<Value> xmlValues = (List<Value>) metric.getValues (); // FIXME: We are using the first value, however the graph should show all the values available, for // example "if_packets" has "tx" and "rx" values. float [] fvalues = xmlValues[0].getValues ().ToArray(); values = new float [fvalues.Length]; for (int x=0; x<fvalues.Length; x++) { values[x] = fvalues[x]; } } } catch (Exception e) { Android.Util.Log.Error("DisplayResourceActivity", e.Message); } } Task returnRes = new Task (() => { buildGraph (); fetchMetricDataProgress.Dismiss (); }); RunOnUiThread (returnRes.Start); }