Getting Started

Add SDK References to the project

Right-click on the References map in your project and click Add Reference:

Reference external libraries (*.dll files) by selecting them via the ‘Browse’ button and reference project files (*.csproj) by adding them to your solution and referencing the project. (Important! When using the PalmSens SDK without the simplified wrapper, the CoreDependencies must be initiated before you run a measurement, to do this invoke the PalmSens.PSAndroid.Utils.CoreDependencies.Init(Context) method with the app’s current Android.Content.Context in its OnCreate event).

The PalmSens.Core.dll and PalmSens.PSAndroid.Core.dll libraries should always be referenced. If you wish to use the simplified wrapper to control your devices the PalmSens.Core.Simplified.csproj and PalmSens.Core.Simplified.Android.csproj should be referenced.
To use the plot control the SDKPlot.csprojSDKPlot.Android.csprojOxyPlot.dll, and OxyPlot.Xamarin.Android.csproj should be referenced.

Add PSCommSimpleWinforms component to your user interface (simplified wrapper only)

First import the PalmSens.Core.Simplified.csproj and PalmSens.Core.Simplified.Android.csproj into your solution. Then reference these projects in your project and build it. Next, go to the designer of your Main.axml and look for the psCommSimpleAndroid control in your toolbox. Drag and drop this component on your Page. Alternatively, you can add the following lines of code to the AXML code of the Main Page:

<PalmSens.Core.Simplified.Android.PSCommSimpleAndroid
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:id="@+id/pSCommSimpleAndroid1" />

 

Defining the App features and permissions

In order to communicate with a PalmSens/EmStat device and to load and save data the app requires permission, the app’s permissions are defined in the AndroidManifest.xml file in your project. To add the permissions to the AndroidManifest.xml file, open it and add the following features and permissions.

To prevent the device from going to sleep during a measurement add the following permission:

<uses-permission android:name="android.permission.WAKE_LOCK" />

 

 

To use an EmStat or PalmSens Device via BlueTooth add the following feature and permissions:

 <DeviceCapability Name="serialcommunication">
    <Device Id="any">
       <Function Type="name:serialPort" />
    </Device>
 </DeviceCapability>

To use an EmStat or PalmSens Device via USB add the following feature and permission:

 <DeviceCapability Name="usb">
    <Device Id="vidpid:0403 D182">
       <Function Type="classId:02 * *" />
       <Function Type="name:cdcControl" />
    </Device>
 </DeviceCapability>

To save and load data to and from your external storage add the following permissions:

 <DeviceCapability Name="usb">
    <Device Id="vidpid:0403 D182">
       <Function Type="classId:02 * *" />
       <Function Type="name:cdcControl" />
    </Device>
 </DeviceCapability>

Example:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="PSSDKBasicExample.PSSDKBasicExample" android:versionCode="1" android:versionName="1.0">
  <uses-sdk android:minSdkVersion="16" />
  <!--Staying awake during measurement-->
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <!--BlueTooth-->
  <uses-feature android:name="android.hardware.bluetooth" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.BLUETOOTH" />
  <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
  <!--USB-->
  <uses-feature android:name="android.hardware.usb.host" />
  <uses-permission android:name="android.permission.USB_PERMISSION" />
  <!--Storage-->
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <application android:label="PSSDKBasicExample"></application>
</manifest>