Unity

Importing Aidlab SDK to Unity is very simple. Unpack the Aidlab SDK, move to a Unity directory and place it in Assets. The SDK is now imported and you can start utilizing Aidlab's sensors.

Note: Aidlab SDK for Unity supports Android development only.

Prerequisites for Android development

  • Unity 5.4+
  • Java 8
  • Android SDK 25.0+
  • Device with Android 7.1+

Getting Started

  1. Download and extract the Aidlab SDK.
  2. Import the Aidlab SDK package for Unity into your Unity Project (Assets -> Import Package -> Custom Package...).
  3. Modify Example.cs to match your project requirements.
  4. Set minimum Android SDK version to 25.0+
  5. Build and run your project on your Android device to test your application.
  6. Make sure to turn on Bluetooth, and agree for the location permission.

To start your connection with Aidlab, you need to enable Bluetooth connectivity and location service:

enableBluetooth();
setLocationPermission();
aidlab = new Aidlab(this);

If an Aidlab is found, the onAidlabDetected function is called. The implementation of the function:

 void onAidlabDetected(AndroidJavaObject device, int rssi) {

        if (!this.aidlab.isAidlabDetected()) {

            this.aidlab.onDeviceDetectedEvent();

            Signal[] signals = {Signal.respiration};

            device.Call("connect", signals.Select(x => (int) x).ToArray(), false, this.aidlab);
        }
    }

The signals array allows you to subscribe to any signals you would like to acquire. List of the available signals.

After connecting, Aidlab starts sending signals that you've chosen in the form of events. In every event, the first parameter is an IAidlab object:

 public interface IAidlab {

    string firmwareRevision { get; }
    string hardwareRevision { get; }
    string serialNumber { get; }

    void disconnect();

}

results matching ""

    No results matching ""