// Implemented for ISubviewParser //public ISensorProperty Read(IION ion, Manifold manifold, BinaryReader reader){ public ISensorProperty Read(IION ion, Sensor sensor, BinaryReader reader) { //var ret = new RateOfChangeSensorProperty(manifold, ion.preferences.device.trendInterval); var ret = new RateOfChangeSensorProperty(sensor, ion.preferences.device.trendInterval); ret.Resize(ion.preferences.device.trendInterval); ret.flags = (RateOfChangeSensorProperty.EFlags)reader.ReadInt32(); return(ret); }
private void LoadManifold() { var mp = Intent.GetParcelableExtra(EXTRA_MANIFOLD) as ManifoldParcelable; if (mp == null) { // TODO [email protected]: Localize Error("US Manifold was not passed to activity"); Finish(); return; } manifold = mp.Get(ion); if (manifold == null) { // TODO [email protected]: Localize Error("US Manifold did not load from parcelable"); Finish(); return; } // Primary sensor var ps = manifold.primarySensor; text1.Text = ps.type.GetSensorTypeName() + " " + ps.name; // Secondary sensor if (manifold.secondarySensor != null) { var ss = manifold.secondarySensor; text2.Text = ss.type.GetSensorTypeName() + " " + ss.name; } else { content2.Visibility = ViewStates.Gone; } // Title var values = Resources.GetStringArray(Resource.Array.preferences_device_trend_interval_values); var entries = Resources.GetStringArray(Resource.Array.preferences_device_trend_interval_entries); var interval = ion.preferences.device.trendInterval; var index = -1; for (int i = 0; i < values.Length; i++) { if (values[i].Equals((int)interval.TotalMilliseconds + "")) { index = i; } } if (index == -1) { Log.E(this, "Failed to find text for interval: " + interval); } else { title.Text = string.Format(GetString(Resource.String.trend_update_1arg), entries[index]); } roc = manifold.GetSensorPropertyOfType <RateOfChangeSensorProperty>(); if (roc == null) { Error("How did you get here if the manifold doesn't have a RateOfChangeSensorProperty"); Finish(); return; } rocManager = new RocWidgetManager(roc.manifold, plot, true); rocManager.Initialize(); }
public void makeEvents(lowHighSensor lhSensor, CGRect tableRect) { cellRoc = lhSensor.roc; cellSensor = lhSensor.currentSensor; cellRoc.onSensorPropertyChanged += OnSensorPropertyChanged; primaryColor = OxyColors.Blue; secondaryColor = OxyColors.Red; if (cellSensor.type == ESensorType.Temperature) { primaryColor = OxyColors.Red; secondaryColor = OxyColors.Blue; Console.WriteLine("Creating roc plotmodel for temperature sensor " + cellSensor.name); } else if (cellSensor.type == ESensorType.Vacuum) { primaryColor = OxyColors.Maroon; Console.WriteLine("Creating roc plotmodel for vacuum sensor " + cellSensor.name); } else { Console.WriteLine("Creating roc plotmodel for pressure sensor " + cellSensor.name); } Console.WriteLine("Cell height: " + this.Bounds.Height); cellHeader = new UILabel(new CGRect(0, 0, tableRect.Width, 36)); cellImage = new UIImageView(new CGRect(0, 36, 36, 36)); graphView = new UIView(new CGRect(0, 72, tableRect.Width, 72)); graphView.BackgroundColor = UIColor.Clear; ///SETUP THE TRENDING GRAPH if (plotView == null) { plotView = new PlotView(new CGRect(0, 0, graphView.Bounds.Width, graphView.Bounds.Height)) { Model = CreatePlotModel(), BackgroundColor = UIColor.Clear, }; plotView.Layer.BorderWidth = 1f; plotView.UserInteractionEnabled = false; graphView.AddSubview(plotView); } cellHeader.Text = "TREND"; cellHeader.TextColor = UIColor.White; cellHeader.BackgroundColor = UIColor.Black; cellHeader.Font = UIFont.FromName("Helvetica-Bold", 21f); cellHeader.TextAlignment = UITextAlignment.Center; cellHeader.AdjustsFontSizeToFitWidth = true; cellReading = lhSensor.rocReading; cellReading.Text = Util.Strings.Workbench.Viewer.ROC_STABLE; cellReading.TextAlignment = UITextAlignment.Right; cellReading.Font = UIFont.FromName("Helvetica-Bold", 18f); cellReading.AdjustsFontSizeToFitWidth = true; cellReading.Layer.BorderColor = UIColor.Black.CGColor; cellImage = lhSensor.rocImage; cellImage.Layer.BorderColor = UIColor.Black.CGColor; cellImage.Layer.BorderWidth = 1f; this.AddSubview(cellHeader); this.AddSubview(cellReading); this.AddSubview(cellImage); this.AddSubview(graphView); updateCellGraph(); }
public RateOfChangeRecord(Sensor sensor, ISensorProperty sensorProperty) : base(sensor, sensorProperty) { roc = sensor.GetSensorPropertyOfType <RateOfChangeSensorProperty>(); }