PalmSens SDK for Android – Xamarin
With this PalmSens Software Development Kit you develop Android applications in Visual Studio .NET using Xamarin. The SDK can be used with all PalmSens instruments and potentiostat modules.
Scroll down to the download sectionWhat is Xamarin?
.NET is a developer platform made up of tools, programming languages, and libraries for building many different types of applications.
Xamarin extends the .NET developer platform with tools and libraries specifically for building apps for Android, iOS, tvOS, watchOS, macOS, and Windows. Xamarin is a free cross-platform, open source app platform for building Android and iOS apps with .NET and C#.
Available libraries and projects
The PalmSens SDK consists of the following libraries and projects
Libraries explained
There are two sets of libraries: Instrument control and Plot
The open-source PalmSens.Core.Simplified and PalmSens.Core.Simplified.Android projects are basically a wrapper for the PalmSens.Core.dll and PalmSens.PSAndroid.Core.dll. The wrappers give you quick and easy access to all the basic functions of the PalmSens instruments and modules and automatically handles most potential threading issues for you. We strongly recommend including these wrapper projects as references to your own projects. The wrapper simplify;
- connecting;
- manual control of the cell;
- running measurements;
- and accessing and processing measured data
The PalmSens.Core and PalmSens.PSAndroid.Core libraries contain the namespaces with all the necessary files for using PalmSens/EmStat devices in your software. These namespaces are:
Library | Description |
---|---|
PalmSens | all necessary classes and functions for performing measurements and doing analysis with PalmSens or EmStat. |
PalmSens.Comm | for Serial, USB or TCP communication with PalmSens or EmStat |
PalmSens.DataFiles | for saving and loading method and data files |
PalmSens.Devices | for handling communications and device capabilities |
PalmSens.Techniques | contains all measurement techniques for PalmSens and EmStat |
PalmSens.Units | contains a collection of units used by these libraries |
The SDKPlot and SDKPlot.Android projects (.csproj) are a wrapper for the open source plot control. These wrappers allow you to easily plot your measurements (in real-time). These projects require the library OxyPlot.dll and OxyPlot.Xamarin.Android.dll.
These libraries again are based on the open-source OxyPlot library, https://oxyplot.github.io.
Xamarin example: how to connect and run a measurement
The code example shows an example using asynchronous programming to prevent the PalmSens SDK libraries from blocking the user interface. The Basic Example Async shows how to make a connection and run a measurement, with a minimum amount of code. All examples are included in the SDK.
/// Discovers the connected PalmSens & EmStat devices and adds them to the spinner control. private async Task DiscoverConnectedDevices() { _btnRefresh.Click -= _btnRefresh_Click; _btnRefresh.Text = "Refreshing..."; _btnRefresh.Enabled = false; _adapterConnectedDevices.Clear(); DisplayMessage($"Searching for available devices."); try { //Discover connected devices _connectedDevices = await _psCommSimpleAndroid.GetConnectedDevices(10000); } catch (Exception ex) { DisplayMessage(ex.Message); } foreach (Device d in _connectedDevices) //Add connected devices to spinner control _adapterConnectedDevices.Add(d.ToString()); int nDevices = _connectedDevices.Length; DisplayMessage($"Found {nDevices} device(s)."); _btnConnect.Enabled = nDevices > 0; _btnRefresh.Text = "Refresh"; _btnRefresh.Enabled = true; _btnRefresh.Click += _btnRefresh_Click; }