Skip to content

Commit

Permalink
Merge pull request #6 from Mentalab-hub/develop
Browse files Browse the repository at this point in the history
Pull request for Version 0.2 Release
  • Loading branch information
salman2135 committed Nov 30, 2021
2 parents 3b603e9 + 36c1f7a commit 4f627b3
Show file tree
Hide file tree
Showing 115 changed files with 1,544 additions and 45,592 deletions.
2 changes: 0 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions README.md
Expand Up @@ -9,6 +9,9 @@ Explore Android API is Mentalab's open-source biosignal acquisition API for use

* Real-time streaming of ExG, orientation and environmental data
* Connect, pair and search Explore device via Bluetooth
* Record data in csv format
* Push data to Lab Streaming Layer(LSL)
* Change device settings

Requirements
==================
Expand All @@ -29,25 +32,24 @@ maven { url ‘https://jitpack.io’ }

![alt text](https://github.com/Mentalab-hub/explore-android/blob/master/screenshots/maven.png?raw=true)

* In your app’s build.gradle add the dependency
* Add the following dependency in your app level build.gradle file
```
implementation 'com.github.Mentalab-hub:explore-android:V_0.1'
implementation 'com.github.Mentalab-hub:explore-android:V_0.2'
```

![alt text](https://github.com/Mentalab-hub/explore-android/blob/master/screenshots/app.png?raw=true)

* Add the following line in your android manifest:
* Add the following permisions in your android manifest:
```
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.INTERNET" />
```
* Sync gradle and Mentlab API is ready to use!

A demo Android application is availble here:
The following example shows how to set up the your project for explore-android. Please always follow the instructions in this page to integrate latest features in your app.


[![SC2 Video](https://img.youtube.com/vi/nP57MqztEUI/0.jpg)](https://youtu.be/nP57MqztEUI)

A demo Android application which used explore-java library is available [here](https://github.com/Mentalab-hub/explore-demo-app)
A demo Android application which used explore-java library is available [here](https://github.com/Mentalab-hub/explore-demo-app).
Please check troubleshooting section of this document in case of issues.

Usage Example
Expand All @@ -63,13 +65,21 @@ MentalabCommands.connect("Explore_XXXX");
InputStream inputStream = MentalabCommands.getRawData();
/* Get data map with decoded data points */
Map<String, Queue<Float>> map = MentalabCodec.decode(inputStream);

/* Push data to LSL */
MentalabCommands.pushToLsl();

/* Set specific channels */
Map<String, Boolean> configMap = Map.of(DeviceConfigSwitches.Channels[7], false,
MentalabConstants.DeviceConfigSwitches.Channels[6], false);
MentalabCommands.setEnabled(configMap);
```


Documentation
=============

For the full documentation of the API, please visit our [Javadoc page](https://javadoc.jitpack.io/com/github/Mentalab-hub/explore-android/V_0.1/javadoc/)
For the full documentation of the API, please visit our [Javadoc page](https://javadoc.jitpack.io/com/github/Mentalab-hub/explore-android/V_0.2/javadoc/)

Troubleshooting
===============
Expand All @@ -82,6 +92,7 @@ Authors
=======

* [Salman Rahman](https://github.com/salman2135)
* [Alex Platt](https://github.com/Nujanauss)
* [Florian Sesser](https://github.com/hacklschorsch)


Expand Down
7 changes: 5 additions & 2 deletions app/build.gradle
Expand Up @@ -5,10 +5,11 @@ plugins {
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
ndkVersion = "21.1.6352462"

defaultConfig {
applicationId "com.mentalab"
minSdkVersion 22
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "1.0"
Expand Down Expand Up @@ -39,6 +40,8 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation project(path: ':mentalabMobileApi')
implementation files('lib/*')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand All @@ -52,7 +55,7 @@ task sourcesJar(type: Jar) {

task javadoc(type: Javadoc) {
options.charSet = 'UTF-8'
failOnError false
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Expand Up @@ -2,6 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mentalab">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand All @@ -17,5 +21,6 @@
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />

</manifest>
34 changes: 34 additions & 0 deletions app/src/main/java/com/mentalab/MainActivity.java
@@ -1,13 +1,47 @@
package com.mentalab;

import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import com.mentalab.exception.CommandFailedException;
import com.mentalab.exception.InvalidDataException;
import com.mentalab.exception.NoBluetoothException;
import com.mentalab.exception.NoConnectionException;
import java.io.InputStream;
import java.util.Map;
import java.util.Queue;
import java.util.Set;

public class MainActivity extends AppCompatActivity {

@RequiresApi(api = VERSION_CODES.R)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

try {
Set<String> deviceList = MentalabCommands.scan();
MentalabCommands.connect(deviceList.iterator().next());
InputStream inputStream = MentalabCommands.getRawData();
Map<String, Queue<Float>> map = MentalabCodec.decode(inputStream);

// Map<String, Boolean> configMap = Map.of(DeviceConfigSwitches.Channels[7], false,
// MentalabConstants.DeviceConfigSwitches.Channels[6], false);
// MentalabCommands.setEnabled(configMap);
// MentalabCommands.pushToLsl();
// MentalabCommands.formatDeviceMemory();
// Thread.sleep(2000);
// MentalabCodec.stopDecoder();
} catch (NoBluetoothException exception) {
exception.printStackTrace();
} catch (InvalidDataException exception) {
exception.printStackTrace();
} catch (NoConnectionException exception) {
exception.printStackTrace();
} catch (CommandFailedException e) {
e.printStackTrace();
}
}
}
199 changes: 0 additions & 199 deletions docs/allclasses-index.html

This file was deleted.

0 comments on commit 4f627b3

Please sign in to comment.