using Android.App; using Android.Widget; using Android.OS; using PalmSens.Core.Simplified.Android; using SDKPlot.Android; using PalmSens.Techniques; using PalmSens.Devices; using PalmSens.Core.Simplified.Data; using PalmSens; using System.Threading.Tasks; using System; using PalmSens.Comm; using Android.Content.PM; using Android; using Android.Support.V4.App; using Android.Runtime; using Android.Support.Design.Widget; using Android.Views; using System.Collections.Generic; namespace PSSDKPlotExample { [Activity(Label = "OCPPlot", MainLauncher = true, Icon = "@mipmap/emspico")] public class MainActivity : Activity { /// /// The psCommSimpleAndroid control that allows you to control your PalmSens/EmStat device /// private PSCommSimpleAndroid _psCommSimpleAndroid; /// /// The main view /// private View _view; /// /// List of permission ids used in the OnRequestPermissionResult /// private enum PermissionGroupIDs { BlueTooth = 0, ExternalStorage = 1 } /// /// The refresh devices button /// private Button _btnRefresh; /// /// The (dis)connect button /// private Button _btnConnect; /// /// The start/abort measurement button /// private Button _btnMeasure; /// /// The potential textview /// //private TextView _txtPotential; /// /// The current textview /// //private TextView _txtCurrent; /// /// The status textview /// private TextView _txtStatus; /// /// The connected devices spinner /// private Spinner _spinnerConnectedDevices; /// /// The connected devices list adapter /// private ArrayAdapter _adapterConnectedDevices; /// /// The SDKPlot android plot object /// private Plot _plot; /// /// The instance of method class containing the Cyclic Voltammetry parameters /// private Method _method; /// /// The connected PalmSens & EmStat devices /// private Device[] _connectedDevices = new Device[0]; /// /// The active SimpleMeasurement /// private SimpleMeasurement _activeMeasurement = null; /// /// The active SimpleCurve /// private SimpleCurve _activeCurve = null; /// /// The active SimpleCurve /// private List _activeCurves = null; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); _view = FindViewById(Resource.Id.mainLayout); //Get reference to psCommSimpleAndroid control _psCommSimpleAndroid = FindViewById(Resource.Id.pSCommSimpleAndroid); _psCommSimpleAndroid.ReceiveStatus += _psCommSimpleAndroid_ReceiveStatus; _psCommSimpleAndroid.StateChanged += _psCommSimpleAndroid_StateChanged; _psCommSimpleAndroid.MeasurementStarted += _psCommSimpleAndroid_MeasurementStarted; _psCommSimpleAndroid.MeasurementEnded += _psCommSimpleAndroid_MeasurementEnded; _psCommSimpleAndroid.SimpleCurveStartReceivingData += _psCommSimpleAndroid_SimpleCurveStartReceivingData; _psCommSimpleAndroid.Disconnected += _psCommSimpleAndroid_Disconnected; //Get reference to spinner control _spinnerConnectedDevices = FindViewById(Resource.Id.spinnerConnectedDevices); _adapterConnectedDevices = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem); _spinnerConnectedDevices.Adapter = _adapterConnectedDevices; //Get references to button controls _btnRefresh = FindViewById