Detect heart rate sensor
11
.gitignore
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches/build_file_checksums.ser
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
29
.idea/codeStyles/Project.xml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<Objective-C-extensions>
|
||||||
|
<file>
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||||
|
</file>
|
||||||
|
<class>
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||||
|
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||||
|
</class>
|
||||||
|
<extensions>
|
||||||
|
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||||
|
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||||
|
</extensions>
|
||||||
|
</Objective-C-extensions>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
18
.idea/gradle.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
38
.idea/misc.xml
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="NullableNotNullManager">
|
||||||
|
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||||
|
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||||
|
<option name="myNullables">
|
||||||
|
<value>
|
||||||
|
<list size="7">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myNotNulls">
|
||||||
|
<value>
|
||||||
|
<list size="6">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
</project>
|
12
.idea/runConfigurations.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
1
app/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
31
app/build.gradle
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 28
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.rubenvandeven.heartbeatstreamer"
|
||||||
|
minSdkVersion 21
|
||||||
|
targetSdkVersion 28
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||||
|
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||||
|
testImplementation 'junit:junit:4.12'
|
||||||
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||||
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||||
|
|
||||||
|
implementation files("libs/antpluginlib_3-6-0.jar")
|
||||||
|
implementation files("libs/fit_16.00.jar")
|
||||||
|
}
|
BIN
app/libs/antpluginlib_3-6-0.jar
Normal file
BIN
app/libs/fit_16.00.jar
Normal file
21
app/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.rubenvandeven.heartbeatstreamer;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||||
|
|
||||||
|
assertEquals("com.rubenvandeven.heartbeatstreamer", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
42
app/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.rubenvandeven.heartbeatstreamer">
|
||||||
|
|
||||||
|
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
<activity android:name=".MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".heartrate.Activity_SearchUiHeartRateSampler"
|
||||||
|
android:label="Heart Rate Plugin Sampler"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:configChanges="orientation"/>
|
||||||
|
<activity
|
||||||
|
android:name=".heartrate.Activity_AsyncScanHeartRateSampler"
|
||||||
|
android:label="Async Scan Demo Sampler"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:configChanges="orientation"/>
|
||||||
|
<activity
|
||||||
|
android:name=".multidevicesearch.Activity_MultiDeviceFilter"
|
||||||
|
android:label="Multi-Device Search Plugin Sampler"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".multidevicesearch.Activity_MultiDeviceSearchSampler"
|
||||||
|
android:label="Multi-Device Search Plugin Sampler"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
package com.rubenvandeven.heartbeatstreamer;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.rubenvandeven.heartbeatstreamer.heartrate.Activity_SearchUiHeartRateSampler;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
Intent intent = new Intent(this, Activity_SearchUiHeartRateSampler.class);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,235 @@
|
||||||
|
/*
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2013
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.rubenvandeven.heartbeatstreamer.heartrate;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.AntPlusHeartRatePcc;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.defines.DeviceState;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.defines.RequestAccessResult;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc.IPluginAccessResultReceiver;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AsyncScanController;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AsyncScanController.AsyncScanResultDeviceInfo;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AsyncScanController.IAsyncScanResultReceiver;
|
||||||
|
import com.rubenvandeven.heartbeatstreamer.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests access to the heart rate using the asynchronous scan method, showing the scan results as a list.
|
||||||
|
*/
|
||||||
|
public class Activity_AsyncScanHeartRateSampler extends Activity_HeartRateDisplayBase
|
||||||
|
{
|
||||||
|
TextView mTextView_Status;
|
||||||
|
ArrayList<AsyncScanController.AsyncScanResultDeviceInfo> mAlreadyConnectedDeviceInfos;
|
||||||
|
ArrayList<AsyncScanController.AsyncScanResultDeviceInfo> mScannedDeviceInfos;
|
||||||
|
ArrayAdapter<String> adapter_devNameList;
|
||||||
|
ArrayAdapter<String> adapter_connDevNameList;
|
||||||
|
|
||||||
|
AsyncScanController<AntPlusHeartRatePcc> hrScanCtrl;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
initScanDisplay();
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initScanDisplay()
|
||||||
|
{
|
||||||
|
setContentView(R.layout.activity_async_scan);
|
||||||
|
|
||||||
|
mTextView_Status = (TextView)findViewById(R.id.textView_Status);
|
||||||
|
mTextView_Status.setText("Scanning for heart rate devices asynchronously...");
|
||||||
|
|
||||||
|
mAlreadyConnectedDeviceInfos = new ArrayList<AsyncScanController.AsyncScanResultDeviceInfo>();
|
||||||
|
mScannedDeviceInfos = new ArrayList<AsyncScanController.AsyncScanResultDeviceInfo>();
|
||||||
|
|
||||||
|
//Setup already connected devices list
|
||||||
|
adapter_connDevNameList = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1);
|
||||||
|
ListView listView_alreadyConnectedDevs = (ListView)findViewById(R.id.listView_AlreadyConnectedDevices);
|
||||||
|
listView_alreadyConnectedDevs.setAdapter(adapter_connDevNameList);
|
||||||
|
listView_alreadyConnectedDevs.setOnItemClickListener(new OnItemClickListener()
|
||||||
|
{
|
||||||
|
//Return the id of the selected already connected device
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int pos, long id)
|
||||||
|
{
|
||||||
|
requestConnectToResult(mAlreadyConnectedDeviceInfos.get(pos));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//Setup found devices display list
|
||||||
|
adapter_devNameList = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1);
|
||||||
|
ListView listView_Devices = (ListView)findViewById(R.id.listView_FoundDevices);
|
||||||
|
listView_Devices.setAdapter(adapter_devNameList);
|
||||||
|
listView_Devices.setOnItemClickListener(new OnItemClickListener()
|
||||||
|
{
|
||||||
|
//Return the id of the selected already connected device
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int pos, long id)
|
||||||
|
{
|
||||||
|
requestConnectToResult(mScannedDeviceInfos.get(pos));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests access to the given search result.
|
||||||
|
* @param asyncScanResultDeviceInfo The search result to attempt to connect to.
|
||||||
|
*/
|
||||||
|
protected void requestConnectToResult(final AsyncScanResultDeviceInfo asyncScanResultDeviceInfo)
|
||||||
|
{
|
||||||
|
//Inform the user we are connecting
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
mTextView_Status.setText("Connecting to " + asyncScanResultDeviceInfo.getDeviceDisplayName());
|
||||||
|
releaseHandle = hrScanCtrl.requestDeviceAccess(asyncScanResultDeviceInfo,
|
||||||
|
new IPluginAccessResultReceiver<AntPlusHeartRatePcc>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onResultReceived(AntPlusHeartRatePcc result,
|
||||||
|
RequestAccessResult resultCode, DeviceState initialDeviceState)
|
||||||
|
{
|
||||||
|
if(resultCode == RequestAccessResult.SEARCH_TIMEOUT)
|
||||||
|
{
|
||||||
|
//On a connection timeout the scan automatically resumes, so we inform the user, and go back to scanning
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Toast.makeText(Activity_AsyncScanHeartRateSampler.this, "Timed out attempting to connect, try again", Toast.LENGTH_LONG).show();
|
||||||
|
mTextView_Status.setText("Scanning for heart rate devices asynchronously...");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Otherwise the results, including SUCCESS, behave the same as
|
||||||
|
base_IPluginAccessResultReceiver.onResultReceived(result, resultCode, initialDeviceState);
|
||||||
|
hrScanCtrl = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, base_IDeviceStateChangeReceiver);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests the asynchronous scan controller
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void requestAccessToPcc()
|
||||||
|
{
|
||||||
|
initScanDisplay();
|
||||||
|
hrScanCtrl = AntPlusHeartRatePcc.requestAsyncScanController(this, 0,
|
||||||
|
new IAsyncScanResultReceiver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onSearchStopped(RequestAccessResult reasonStopped)
|
||||||
|
{
|
||||||
|
//The triggers calling this function use the same codes and require the same actions as those received by the standard access result receiver
|
||||||
|
base_IPluginAccessResultReceiver.onResultReceived(null, reasonStopped, DeviceState.DEAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSearchResult(final AsyncScanResultDeviceInfo deviceFound)
|
||||||
|
{
|
||||||
|
for(AsyncScanResultDeviceInfo i: mScannedDeviceInfos)
|
||||||
|
{
|
||||||
|
//The current implementation of the async scan will reset it's ignore list every 30s,
|
||||||
|
//So we have to handle checking for duplicates in our list if we run longer than that
|
||||||
|
if(i.getAntDeviceNumber() == deviceFound.getAntDeviceNumber())
|
||||||
|
{
|
||||||
|
//Found already connected device, ignore
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//We split up devices already connected to the plugin from un-connected devices to make this information more visible to the user,
|
||||||
|
//since the user most likely wants to be aware of which device they are already using in another app
|
||||||
|
if(deviceFound.isAlreadyConnected())
|
||||||
|
{
|
||||||
|
mAlreadyConnectedDeviceInfos.add(deviceFound);
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if(adapter_connDevNameList.isEmpty()) //connected device category is invisible unless there are some present
|
||||||
|
{
|
||||||
|
findViewById(R.id.listView_AlreadyConnectedDevices).setVisibility(View.VISIBLE);
|
||||||
|
findViewById(R.id.textView_AlreadyConnectedTitle).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
adapter_connDevNameList.add(deviceFound.getDeviceDisplayName());
|
||||||
|
adapter_connDevNameList.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mScannedDeviceInfos.add(deviceFound);
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
adapter_devNameList.add(deviceFound.getDeviceDisplayName());
|
||||||
|
adapter_devNameList.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures our controller is closed whenever we reset
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void handleReset()
|
||||||
|
{
|
||||||
|
if(hrScanCtrl != null)
|
||||||
|
{
|
||||||
|
hrScanCtrl.closeScanController();
|
||||||
|
hrScanCtrl = null;
|
||||||
|
}
|
||||||
|
super.handleReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures our controller is closed whenever we exit
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onDestroy()
|
||||||
|
{
|
||||||
|
if(hrScanCtrl != null)
|
||||||
|
{
|
||||||
|
hrScanCtrl.closeScanController();
|
||||||
|
hrScanCtrl = null;
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,453 @@
|
||||||
|
/*
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2013
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.rubenvandeven.heartbeatstreamer.heartrate;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.AntPlusHeartRatePcc;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.AntPlusHeartRatePcc.DataState;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.AntPlusHeartRatePcc.ICalculatedRrIntervalReceiver;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.AntPlusHeartRatePcc.IHeartRateDataReceiver;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.AntPlusHeartRatePcc.IPage4AddtDataReceiver;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.AntPlusHeartRatePcc.RrFlag;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.defines.DeviceState;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.defines.EventFlag;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.defines.RequestAccessResult;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AntPlusCommonPcc.IRssiReceiver;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.PccReleaseHandle;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc.IDeviceStateChangeReceiver;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc.IPluginAccessResultReceiver;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AntPlusLegacyCommonPcc.ICumulativeOperatingTimeReceiver;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AntPlusLegacyCommonPcc.IManufacturerAndSerialReceiver;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.AntPlusLegacyCommonPcc.IVersionAndModelReceiver;
|
||||||
|
import com.rubenvandeven.heartbeatstreamer.R;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class to connects to Heart Rate Plugin and display all the event data.
|
||||||
|
*/
|
||||||
|
public abstract class Activity_HeartRateDisplayBase extends Activity
|
||||||
|
{
|
||||||
|
protected abstract void requestAccessToPcc();
|
||||||
|
|
||||||
|
AntPlusHeartRatePcc hrPcc = null;
|
||||||
|
protected PccReleaseHandle<AntPlusHeartRatePcc> releaseHandle = null;
|
||||||
|
|
||||||
|
TextView tv_status;
|
||||||
|
|
||||||
|
TextView tv_estTimestamp;
|
||||||
|
|
||||||
|
TextView tv_rssi;
|
||||||
|
|
||||||
|
TextView tv_computedHeartRate;
|
||||||
|
TextView tv_heartBeatCounter;
|
||||||
|
TextView tv_heartBeatEventTime;
|
||||||
|
|
||||||
|
TextView tv_manufacturerSpecificByte;
|
||||||
|
TextView tv_previousHeartBeatEventTime;
|
||||||
|
|
||||||
|
TextView tv_calculatedRrInterval;
|
||||||
|
|
||||||
|
TextView tv_cumulativeOperatingTime;
|
||||||
|
|
||||||
|
TextView tv_manufacturerID;
|
||||||
|
TextView tv_serialNumber;
|
||||||
|
|
||||||
|
TextView tv_hardwareVersion;
|
||||||
|
TextView tv_softwareVersion;
|
||||||
|
TextView tv_modelNumber;
|
||||||
|
|
||||||
|
TextView tv_dataStatus;
|
||||||
|
TextView tv_rrFlag;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
handleReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the PCC connection to request access again and clears any existing display data.
|
||||||
|
*/
|
||||||
|
protected void handleReset()
|
||||||
|
{
|
||||||
|
//Release the old access if it exists
|
||||||
|
if(releaseHandle != null)
|
||||||
|
{
|
||||||
|
releaseHandle.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
requestAccessToPcc();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showDataDisplay(String status)
|
||||||
|
{
|
||||||
|
setContentView(R.layout.activity_heart_rate);
|
||||||
|
|
||||||
|
tv_status = (TextView)findViewById(R.id.textView_Status);
|
||||||
|
|
||||||
|
tv_estTimestamp = (TextView)findViewById(R.id.textView_EstTimestamp);
|
||||||
|
|
||||||
|
tv_rssi = (TextView)findViewById(R.id.textView_Rssi);
|
||||||
|
|
||||||
|
tv_computedHeartRate = (TextView)findViewById(R.id.textView_ComputedHeartRate);
|
||||||
|
tv_heartBeatCounter = (TextView)findViewById(R.id.textView_HeartBeatCounter);
|
||||||
|
tv_heartBeatEventTime = (TextView)findViewById(R.id.textView_HeartBeatEventTime);
|
||||||
|
|
||||||
|
tv_manufacturerSpecificByte = (TextView)findViewById(R.id.textView_ManufacturerSpecificByte);
|
||||||
|
tv_previousHeartBeatEventTime = (TextView)findViewById(R.id.textView_PreviousHeartBeatEventTime);
|
||||||
|
|
||||||
|
tv_calculatedRrInterval = (TextView)findViewById(R.id.textView_CalculatedRrInterval);
|
||||||
|
|
||||||
|
tv_cumulativeOperatingTime = (TextView)findViewById(R.id.textView_CumulativeOperatingTime);
|
||||||
|
|
||||||
|
tv_manufacturerID = (TextView)findViewById(R.id.textView_ManufacturerID);
|
||||||
|
tv_serialNumber = (TextView)findViewById(R.id.textView_SerialNumber);
|
||||||
|
|
||||||
|
tv_hardwareVersion = (TextView)findViewById(R.id.textView_HardwareVersion);
|
||||||
|
tv_softwareVersion = (TextView)findViewById(R.id.textView_SoftwareVersion);
|
||||||
|
tv_modelNumber = (TextView)findViewById(R.id.textView_ModelNumber);
|
||||||
|
|
||||||
|
tv_dataStatus = (TextView)findViewById(R.id.textView_DataStatus);
|
||||||
|
tv_rrFlag = (TextView)findViewById(R.id.textView_rRFlag);
|
||||||
|
|
||||||
|
//Reset the text display
|
||||||
|
tv_status.setText(status);
|
||||||
|
|
||||||
|
tv_estTimestamp.setText("---");
|
||||||
|
|
||||||
|
tv_rssi.setText("---");
|
||||||
|
|
||||||
|
tv_computedHeartRate.setText("---");
|
||||||
|
tv_heartBeatCounter.setText("---");
|
||||||
|
tv_heartBeatEventTime.setText("---");
|
||||||
|
|
||||||
|
tv_manufacturerSpecificByte.setText("---");
|
||||||
|
tv_previousHeartBeatEventTime.setText("---");
|
||||||
|
|
||||||
|
tv_calculatedRrInterval.setText("---");
|
||||||
|
|
||||||
|
tv_cumulativeOperatingTime.setText("---");
|
||||||
|
|
||||||
|
tv_manufacturerID.setText("---");
|
||||||
|
tv_serialNumber.setText("---");
|
||||||
|
|
||||||
|
tv_hardwareVersion.setText("---");
|
||||||
|
tv_softwareVersion.setText("---");
|
||||||
|
tv_modelNumber.setText("---");
|
||||||
|
tv_dataStatus.setText("---");
|
||||||
|
tv_rrFlag.setText("---");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switches the active view to the data display and subscribes to all the data events
|
||||||
|
*/
|
||||||
|
public void subscribeToHrEvents()
|
||||||
|
{
|
||||||
|
hrPcc.subscribeHeartRateDataEvent(new IHeartRateDataReceiver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onNewHeartRateData(final long estTimestamp, EnumSet<EventFlag> eventFlags,
|
||||||
|
final int computedHeartRate, final long heartBeatCount,
|
||||||
|
final BigDecimal heartBeatEventTime, final DataState dataState)
|
||||||
|
{
|
||||||
|
// Mark heart rate with asterisk if zero detected
|
||||||
|
final String textHeartRate = String.valueOf(computedHeartRate)
|
||||||
|
+ ((DataState.ZERO_DETECTED.equals(dataState)) ? "*" : "");
|
||||||
|
|
||||||
|
// Mark heart beat count and heart beat event time with asterisk if initial value
|
||||||
|
final String textHeartBeatCount = String.valueOf(heartBeatCount)
|
||||||
|
+ ((DataState.INITIAL_VALUE.equals(dataState)) ? "*" : "");
|
||||||
|
final String textHeartBeatEventTime = String.valueOf(heartBeatEventTime)
|
||||||
|
+ ((DataState.INITIAL_VALUE.equals(dataState)) ? "*" : "");
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
tv_estTimestamp.setText(String.valueOf(estTimestamp));
|
||||||
|
|
||||||
|
tv_computedHeartRate.setText(textHeartRate);
|
||||||
|
tv_heartBeatCounter.setText(textHeartBeatCount);
|
||||||
|
tv_heartBeatEventTime.setText(textHeartBeatEventTime);
|
||||||
|
|
||||||
|
tv_dataStatus.setText(dataState.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
hrPcc.subscribePage4AddtDataEvent(new IPage4AddtDataReceiver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onNewPage4AddtData(final long estTimestamp, final EnumSet<EventFlag> eventFlags,
|
||||||
|
final int manufacturerSpecificByte,
|
||||||
|
final BigDecimal previousHeartBeatEventTime)
|
||||||
|
{
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
tv_estTimestamp.setText(String.valueOf(estTimestamp));
|
||||||
|
|
||||||
|
tv_manufacturerSpecificByte.setText(String.format("0x%02X", manufacturerSpecificByte));
|
||||||
|
tv_previousHeartBeatEventTime.setText(String.valueOf(previousHeartBeatEventTime));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
hrPcc.subscribeCumulativeOperatingTimeEvent(new ICumulativeOperatingTimeReceiver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onNewCumulativeOperatingTime(final long estTimestamp, final EnumSet<EventFlag> eventFlags, final long cumulativeOperatingTime)
|
||||||
|
{
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
tv_estTimestamp.setText(String.valueOf(estTimestamp));
|
||||||
|
|
||||||
|
tv_cumulativeOperatingTime.setText(String.valueOf(cumulativeOperatingTime));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
hrPcc.subscribeManufacturerAndSerialEvent(new IManufacturerAndSerialReceiver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onNewManufacturerAndSerial(final long estTimestamp, final EnumSet<EventFlag> eventFlags, final int manufacturerID,
|
||||||
|
final int serialNumber)
|
||||||
|
{
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
tv_estTimestamp.setText(String.valueOf(estTimestamp));
|
||||||
|
|
||||||
|
tv_manufacturerID.setText(String.valueOf(manufacturerID));
|
||||||
|
tv_serialNumber.setText(String.valueOf(serialNumber));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
hrPcc.subscribeVersionAndModelEvent(new IVersionAndModelReceiver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onNewVersionAndModel(final long estTimestamp, final EnumSet<EventFlag> eventFlags, final int hardwareVersion,
|
||||||
|
final int softwareVersion, final int modelNumber)
|
||||||
|
{
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
tv_estTimestamp.setText(String.valueOf(estTimestamp));
|
||||||
|
|
||||||
|
tv_hardwareVersion.setText(String.valueOf(hardwareVersion));
|
||||||
|
tv_softwareVersion.setText(String.valueOf(softwareVersion));
|
||||||
|
tv_modelNumber.setText(String.valueOf(modelNumber));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
hrPcc.subscribeCalculatedRrIntervalEvent(new ICalculatedRrIntervalReceiver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onNewCalculatedRrInterval(final long estTimestamp,
|
||||||
|
EnumSet<EventFlag> eventFlags, final BigDecimal rrInterval, final RrFlag flag)
|
||||||
|
{
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
tv_estTimestamp.setText(String.valueOf(estTimestamp));
|
||||||
|
tv_rrFlag.setText(flag.toString());
|
||||||
|
|
||||||
|
// Mark RR with asterisk if source is not cached or page 4
|
||||||
|
if (flag.equals(RrFlag.DATA_SOURCE_CACHED)
|
||||||
|
|| flag.equals(RrFlag.DATA_SOURCE_PAGE_4))
|
||||||
|
tv_calculatedRrInterval.setText(String.valueOf(rrInterval));
|
||||||
|
else
|
||||||
|
tv_calculatedRrInterval.setText(String.valueOf(rrInterval) + "*");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
hrPcc.subscribeRssiEvent(new IRssiReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onRssiData(final long estTimestamp, final EnumSet<EventFlag> evtFlags, final int rssi) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
tv_estTimestamp.setText(String.valueOf(estTimestamp));
|
||||||
|
tv_rssi.setText(String.valueOf(rssi) + " dBm");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IPluginAccessResultReceiver<AntPlusHeartRatePcc> base_IPluginAccessResultReceiver =
|
||||||
|
new IPluginAccessResultReceiver<AntPlusHeartRatePcc>()
|
||||||
|
{
|
||||||
|
//Handle the result, connecting to events on success or reporting failure to user.
|
||||||
|
@Override
|
||||||
|
public void onResultReceived(AntPlusHeartRatePcc result, RequestAccessResult resultCode,
|
||||||
|
DeviceState initialDeviceState)
|
||||||
|
{
|
||||||
|
showDataDisplay("Connecting...");
|
||||||
|
switch(resultCode)
|
||||||
|
{
|
||||||
|
case SUCCESS:
|
||||||
|
hrPcc = result;
|
||||||
|
tv_status.setText(result.getDeviceName() + ": " + initialDeviceState);
|
||||||
|
subscribeToHrEvents();
|
||||||
|
if(!result.supportsRssi()) tv_rssi.setText("N/A");
|
||||||
|
break;
|
||||||
|
case CHANNEL_NOT_AVAILABLE:
|
||||||
|
Toast.makeText(Activity_HeartRateDisplayBase.this, "Channel Not Available", Toast.LENGTH_SHORT).show();
|
||||||
|
tv_status.setText("Error. Do Menu->Reset.");
|
||||||
|
break;
|
||||||
|
case ADAPTER_NOT_DETECTED:
|
||||||
|
Toast.makeText(Activity_HeartRateDisplayBase.this, "ANT Adapter Not Available. Built-in ANT hardware or external adapter required.", Toast.LENGTH_SHORT).show();
|
||||||
|
tv_status.setText("Error. Do Menu->Reset.");
|
||||||
|
break;
|
||||||
|
case BAD_PARAMS:
|
||||||
|
//Note: Since we compose all the params ourself, we should never see this result
|
||||||
|
Toast.makeText(Activity_HeartRateDisplayBase.this, "Bad request parameters.", Toast.LENGTH_SHORT).show();
|
||||||
|
tv_status.setText("Error. Do Menu->Reset.");
|
||||||
|
break;
|
||||||
|
case OTHER_FAILURE:
|
||||||
|
Toast.makeText(Activity_HeartRateDisplayBase.this, "RequestAccess failed. See logcat for details.", Toast.LENGTH_SHORT).show();
|
||||||
|
tv_status.setText("Error. Do Menu->Reset.");
|
||||||
|
break;
|
||||||
|
case DEPENDENCY_NOT_INSTALLED:
|
||||||
|
tv_status.setText("Error. Do Menu->Reset.");
|
||||||
|
AlertDialog.Builder adlgBldr = new AlertDialog.Builder(Activity_HeartRateDisplayBase.this);
|
||||||
|
adlgBldr.setTitle("Missing Dependency");
|
||||||
|
adlgBldr.setMessage("The required service\n\"" + AntPlusHeartRatePcc.getMissingDependencyName() + "\"\n was not found. You need to install the ANT+ Plugins service or you may need to update your existing version if you already have it. Do you want to launch the Play Store to get it?");
|
||||||
|
adlgBldr.setCancelable(true);
|
||||||
|
adlgBldr.setPositiveButton("Go to Store", new OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which)
|
||||||
|
{
|
||||||
|
Intent startStore = null;
|
||||||
|
startStore = new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id=" + AntPlusHeartRatePcc.getMissingDependencyPackageName()));
|
||||||
|
startStore.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
|
Activity_HeartRateDisplayBase.this.startActivity(startStore);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
adlgBldr.setNegativeButton("Cancel", new OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which)
|
||||||
|
{
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final AlertDialog waitDialog = adlgBldr.create();
|
||||||
|
waitDialog.show();
|
||||||
|
break;
|
||||||
|
case USER_CANCELLED:
|
||||||
|
tv_status.setText("Cancelled. Do Menu->Reset.");
|
||||||
|
break;
|
||||||
|
case UNRECOGNIZED:
|
||||||
|
Toast.makeText(Activity_HeartRateDisplayBase.this,
|
||||||
|
"Failed: UNRECOGNIZED. PluginLib Upgrade Required?",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
tv_status.setText("Error. Do Menu->Reset.");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Toast.makeText(Activity_HeartRateDisplayBase.this, "Unrecognized result: " + resultCode, Toast.LENGTH_SHORT).show();
|
||||||
|
tv_status.setText("Error. Do Menu->Reset.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//Receives state changes and shows it on the status display line
|
||||||
|
protected IDeviceStateChangeReceiver base_IDeviceStateChangeReceiver =
|
||||||
|
new IDeviceStateChangeReceiver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onDeviceStateChange(final DeviceState newDeviceState)
|
||||||
|
{
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
tv_status.setText(hrPcc.getDeviceName() + ": " + newDeviceState);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy()
|
||||||
|
{
|
||||||
|
if(releaseHandle != null)
|
||||||
|
{
|
||||||
|
releaseHandle.close();
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
|
{
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
getMenuInflater().inflate(R.menu.activity_heart_rate, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
|
{
|
||||||
|
switch(item.getItemId())
|
||||||
|
{
|
||||||
|
case R.id.menu_reset:
|
||||||
|
handleReset();
|
||||||
|
tv_status.setText("Resetting...");
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2013
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.rubenvandeven.heartbeatstreamer.heartrate;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.rubenvandeven.heartbeatstreamer.multidevicesearch.Activity_MultiDeviceSearchSampler;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.AntPlusHeartRatePcc;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.MultiDeviceSearch.MultiDeviceSearchResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests access to the heart rate using the plugin automatic search activity.
|
||||||
|
*/
|
||||||
|
public class Activity_SearchUiHeartRateSampler extends Activity_HeartRateDisplayBase
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
showDataDisplay("Connecting...");
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void requestAccessToPcc()
|
||||||
|
{
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (intent.hasExtra(Activity_MultiDeviceSearchSampler.EXTRA_KEY_MULTIDEVICE_SEARCH_RESULT))
|
||||||
|
{
|
||||||
|
// device has already been selected through the multi-device search
|
||||||
|
MultiDeviceSearchResult result = intent
|
||||||
|
.getParcelableExtra(Activity_MultiDeviceSearchSampler.EXTRA_KEY_MULTIDEVICE_SEARCH_RESULT);
|
||||||
|
releaseHandle = AntPlusHeartRatePcc.requestAccess(this, result.getAntDeviceNumber(), 0,
|
||||||
|
base_IPluginAccessResultReceiver, base_IDeviceStateChangeReceiver);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
// starts the plugins UI search
|
||||||
|
releaseHandle = AntPlusHeartRatePcc.requestAccess(this, this,
|
||||||
|
base_IPluginAccessResultReceiver, base_IDeviceStateChangeReceiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,206 @@
|
||||||
|
/*
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2014
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.rubenvandeven.heartbeatstreamer.multidevicesearch;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.util.SparseBooleanArray;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.AntPlusHeartRatePcc;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.defines.DeviceType;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.defines.RequestAccessResult;
|
||||||
|
import com.rubenvandeven.heartbeatstreamer.R;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the search activity after allowing user to select desired device types
|
||||||
|
*/
|
||||||
|
public class Activity_MultiDeviceFilter extends Activity
|
||||||
|
{
|
||||||
|
Context mContext;
|
||||||
|
ListView mListView;
|
||||||
|
Button mSearch;
|
||||||
|
Button mSelectAll;
|
||||||
|
|
||||||
|
ArrayAdapter<String> mDeviceTypeListAdapter;
|
||||||
|
SparseArray<DeviceType> mDeviceTypeList = new SparseArray<DeviceType>();
|
||||||
|
SparseBooleanArray mIsChecked;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_multidevice_filter);
|
||||||
|
|
||||||
|
mContext = getApplicationContext();
|
||||||
|
mSearch = (Button) findViewById(R.id.button_StartMultiDeviceSearch);
|
||||||
|
mSelectAll = (Button) findViewById(R.id.button_SelectAll);
|
||||||
|
|
||||||
|
mListView = (ListView) findViewById(R.id.listView_MultiDeviceFilter);
|
||||||
|
mListView.setItemsCanFocus(false);
|
||||||
|
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||||
|
|
||||||
|
mDeviceTypeListAdapter = new ArrayAdapter<String>(this,
|
||||||
|
android.R.layout.simple_list_item_checked, getResources().getStringArray(
|
||||||
|
R.array.device_types));
|
||||||
|
mListView.setAdapter(mDeviceTypeListAdapter);
|
||||||
|
|
||||||
|
mIsChecked = mListView.getCheckedItemPositions();
|
||||||
|
|
||||||
|
// Add all device types
|
||||||
|
int i = 0;
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.BIKE_POWER);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.CONTROLLABLE_DEVICE);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.FITNESS_EQUIPMENT);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.BLOOD_PRESSURE);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.GEOCACHE);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.ENVIRONMENT);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.WEIGHT_SCALE);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.HEARTRATE);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.BIKE_SPDCAD);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.BIKE_CADENCE);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.BIKE_SPD);
|
||||||
|
mDeviceTypeList.put(i++, DeviceType.STRIDE_SDM);
|
||||||
|
|
||||||
|
mSearch.setOnClickListener(new OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(View v)
|
||||||
|
{
|
||||||
|
EnumSet<DeviceType> set = EnumSet.noneOf(DeviceType.class);
|
||||||
|
|
||||||
|
for (int j = 0; j < mIsChecked.size(); j++)
|
||||||
|
{
|
||||||
|
int key = mIsChecked.keyAt(j);
|
||||||
|
if (mIsChecked.get(key))
|
||||||
|
set.add(mDeviceTypeList.get(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (set.isEmpty())
|
||||||
|
{
|
||||||
|
Toast.makeText(mContext, "Please select device type(s) to filter on.",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Intent i = new Intent(mContext, Activity_MultiDeviceSearchSampler.class);
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putSerializable(Activity_MultiDeviceSearchSampler.FILTER_KEY, set);
|
||||||
|
i.putExtra(Activity_MultiDeviceSearchSampler.BUNDLE_KEY, args);
|
||||||
|
// Listen for search stopped results
|
||||||
|
startActivityForResult(i, Activity_MultiDeviceSearchSampler.RESULT_SEARCH_STOPPED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mSelectAll.setOnClickListener(new OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < mListView.getCount(); i++)
|
||||||
|
{
|
||||||
|
mListView.setItemChecked(i, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||||
|
{
|
||||||
|
if(resultCode == Activity_MultiDeviceSearchSampler.RESULT_SEARCH_STOPPED)
|
||||||
|
{
|
||||||
|
RequestAccessResult result = RequestAccessResult.getValueFromInt(data.getIntExtra(Activity_MultiDeviceSearchSampler.EXTRA_KEY_MULTIDEVICE_SEARCH_RESULT, 0));
|
||||||
|
switch(result)
|
||||||
|
{
|
||||||
|
case SUCCESS:
|
||||||
|
// Do nothing on success
|
||||||
|
break;
|
||||||
|
case CHANNEL_NOT_AVAILABLE:
|
||||||
|
Toast.makeText(this, "Channel Not Available", Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
case ADAPTER_NOT_DETECTED:
|
||||||
|
Toast.makeText(
|
||||||
|
this,
|
||||||
|
"ANT Adapter Not Available. Built-in ANT hardware or external adapter required.",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
case BAD_PARAMS:
|
||||||
|
// Note: Since we compose all the params ourself, we should
|
||||||
|
// never see this result
|
||||||
|
Toast.makeText(this, "Bad request parameters.", Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
case OTHER_FAILURE:
|
||||||
|
Toast.makeText(this, "RequestAccess failed. See logcat for details.",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
case DEPENDENCY_NOT_INSTALLED:
|
||||||
|
AlertDialog.Builder adlgBldr = new AlertDialog.Builder(this);
|
||||||
|
adlgBldr.setTitle("Missing Dependency");
|
||||||
|
adlgBldr.setMessage("The required service\n\""
|
||||||
|
+ AntPlusHeartRatePcc.getMissingDependencyName()
|
||||||
|
+ "\"\n was not found. You need to install the ANT+ Plugins service or you may need to update your existing version if you already have it. Do you want to launch the Play Store to get it?");
|
||||||
|
adlgBldr.setCancelable(true);
|
||||||
|
adlgBldr.setPositiveButton("Go to Store", new android.content.DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which)
|
||||||
|
{
|
||||||
|
Intent startStore = null;
|
||||||
|
startStore = new Intent(
|
||||||
|
Intent.ACTION_VIEW,
|
||||||
|
Uri.parse("market://details?id="
|
||||||
|
+ AntPlusHeartRatePcc.getMissingDependencyPackageName()));
|
||||||
|
startStore.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
|
mContext.startActivity(startStore);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
adlgBldr.setNegativeButton("Cancel", new android.content.DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which)
|
||||||
|
{
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final AlertDialog waitDialog = adlgBldr.create();
|
||||||
|
waitDialog.show();
|
||||||
|
break;
|
||||||
|
case USER_CANCELLED:
|
||||||
|
break;
|
||||||
|
case UNRECOGNIZED:
|
||||||
|
Toast.makeText(this, "Failed: UNRECOGNIZED. PluginLib Upgrade Required?",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Toast.makeText(this, "Unrecognized result: " + result, Toast.LENGTH_SHORT)
|
||||||
|
.show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,262 @@
|
||||||
|
/*
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2014
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.rubenvandeven.heartbeatstreamer.multidevicesearch;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.rubenvandeven.heartbeatstreamer.R;
|
||||||
|
import com.rubenvandeven.heartbeatstreamer.heartrate.Activity_SearchUiHeartRateSampler;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.MultiDeviceSearch;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.MultiDeviceSearch.RssiSupport;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.defines.DeviceType;
|
||||||
|
import com.dsi.ant.plugins.antplus.pcc.defines.RequestAccessResult;
|
||||||
|
import com.dsi.ant.plugins.antplus.pccbase.MultiDeviceSearch.MultiDeviceSearchResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches for multiple devices on the same channel using the multi-device
|
||||||
|
* search interface
|
||||||
|
*/
|
||||||
|
public class Activity_MultiDeviceSearchSampler extends Activity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Relates a MultiDeviceSearchResult with an RSSI value
|
||||||
|
*/
|
||||||
|
public class MultiDeviceSearchResultWithRSSI
|
||||||
|
{
|
||||||
|
public MultiDeviceSearchResult mDevice;
|
||||||
|
public int mRSSI = Integer.MIN_VALUE;
|
||||||
|
}
|
||||||
|
public static final String EXTRA_KEY_MULTIDEVICE_SEARCH_RESULT = "com.rubenvandeven.heartbeatstreamer.multidevicesearch.result";
|
||||||
|
public static final String BUNDLE_KEY = "com.rubenvandeven.heartbeatstreamer.multidevicesearch.bundle";
|
||||||
|
public static final String FILTER_KEY = "com.rubenvandeven.heartbeatstreamer.multidevicesearch.filter";
|
||||||
|
public static final int RESULT_SEARCH_STOPPED = RESULT_FIRST_USER;
|
||||||
|
|
||||||
|
Context mContext;
|
||||||
|
TextView mStatus;
|
||||||
|
|
||||||
|
ListView mFoundDevicesList;
|
||||||
|
ArrayList<MultiDeviceSearchResultWithRSSI> mFoundDevices = new ArrayList<MultiDeviceSearchResultWithRSSI>();
|
||||||
|
ArrayAdapter_MultiDeviceSearchResult mFoundAdapter;
|
||||||
|
|
||||||
|
ListView mConnectedDevicesList;
|
||||||
|
ArrayList<MultiDeviceSearchResultWithRSSI> mConnectedDevices = new ArrayList<MultiDeviceSearchResultWithRSSI>();
|
||||||
|
ArrayAdapter_MultiDeviceSearchResult mConnectedAdapter;
|
||||||
|
|
||||||
|
MultiDeviceSearch mSearch;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_multidevice_scan);
|
||||||
|
|
||||||
|
mContext = getApplicationContext();
|
||||||
|
mStatus = (TextView) findViewById(R.id.textView_Status);
|
||||||
|
|
||||||
|
mFoundDevicesList = (ListView) findViewById(R.id.listView_FoundDevices);
|
||||||
|
|
||||||
|
mFoundAdapter = new ArrayAdapter_MultiDeviceSearchResult(this, mFoundDevices);
|
||||||
|
mFoundDevicesList.setAdapter(mFoundAdapter);
|
||||||
|
|
||||||
|
mFoundDevicesList.setOnItemClickListener(new OnItemClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||||
|
{
|
||||||
|
launchConnection(mFoundAdapter.getItem(position).mDevice);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mConnectedDevicesList = (ListView) findViewById(R.id.listView_AlreadyConnectedDevices);
|
||||||
|
|
||||||
|
mConnectedAdapter = new ArrayAdapter_MultiDeviceSearchResult(this, mConnectedDevices);
|
||||||
|
mConnectedDevicesList.setAdapter(mConnectedAdapter);
|
||||||
|
|
||||||
|
mConnectedDevicesList.setOnItemClickListener(new OnItemClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||||
|
{
|
||||||
|
launchConnection(mConnectedAdapter.getItem(position).mDevice);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Intent i = getIntent();
|
||||||
|
Bundle args = i.getBundleExtra(BUNDLE_KEY);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
EnumSet<DeviceType> devices = (EnumSet<DeviceType>) args.getSerializable(FILTER_KEY);
|
||||||
|
|
||||||
|
// start the multi-device search
|
||||||
|
mSearch = new MultiDeviceSearch(this, devices, mCallback, mRssiCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy()
|
||||||
|
{
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
// close and clean-up the multi-device search
|
||||||
|
mSearch.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void launchConnection(MultiDeviceSearchResult result)
|
||||||
|
{
|
||||||
|
Class activity = null;
|
||||||
|
switch (result.getAntDeviceType())
|
||||||
|
{
|
||||||
|
case HEARTRATE:
|
||||||
|
activity = Activity_SearchUiHeartRateSampler.class;
|
||||||
|
break;
|
||||||
|
case BIKE_CADENCE:
|
||||||
|
case BIKE_POWER:
|
||||||
|
case BIKE_SPD:
|
||||||
|
case BIKE_SPDCAD:
|
||||||
|
case BLOOD_PRESSURE:
|
||||||
|
case ENVIRONMENT:
|
||||||
|
case WEIGHT_SCALE:
|
||||||
|
case STRIDE_SDM:
|
||||||
|
case FITNESS_EQUIPMENT:
|
||||||
|
case GEOCACHE:
|
||||||
|
case CONTROLLABLE_DEVICE:
|
||||||
|
Toast.makeText(this, "Not currently supported", Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
case UNKNOWN:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (activity != null)
|
||||||
|
{
|
||||||
|
Intent intent = new Intent(this, activity);
|
||||||
|
intent.putExtra(EXTRA_KEY_MULTIDEVICE_SEARCH_RESULT, result);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callbacks from the multi-device search interface
|
||||||
|
*/
|
||||||
|
private MultiDeviceSearch.SearchCallbacks mCallback = new MultiDeviceSearch.SearchCallbacks()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Called when a device is found. Display found devices in connected and
|
||||||
|
* found lists
|
||||||
|
*/
|
||||||
|
public void onDeviceFound(final MultiDeviceSearchResult deviceFound)
|
||||||
|
{
|
||||||
|
final MultiDeviceSearchResultWithRSSI result = new MultiDeviceSearchResultWithRSSI();
|
||||||
|
result.mDevice = deviceFound;
|
||||||
|
|
||||||
|
// We split up devices already connected to the plugin from
|
||||||
|
// un-connected devices to make this information more visible to the
|
||||||
|
// user, since the user most likely wants to be aware of which
|
||||||
|
// device they are already using in another app
|
||||||
|
if (deviceFound.isAlreadyConnected())
|
||||||
|
{
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
// connected device category is invisible unless there
|
||||||
|
// are some present
|
||||||
|
if (mConnectedAdapter.isEmpty())
|
||||||
|
{
|
||||||
|
findViewById(R.id.textView_AlreadyConnectedTitle).setVisibility(
|
||||||
|
View.VISIBLE);
|
||||||
|
mConnectedDevicesList.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
mConnectedAdapter.add(result);
|
||||||
|
mConnectedAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
mFoundAdapter.add(result);
|
||||||
|
mFoundAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The search has been stopped unexpectedly
|
||||||
|
*/
|
||||||
|
public void onSearchStopped(RequestAccessResult reason)
|
||||||
|
{
|
||||||
|
Intent result = new Intent();
|
||||||
|
result.putExtra(EXTRA_KEY_MULTIDEVICE_SEARCH_RESULT, reason.getIntValue());
|
||||||
|
setResult(RESULT_SEARCH_STOPPED, result);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSearchStarted(RssiSupport supportsRssi) {
|
||||||
|
if(supportsRssi == RssiSupport.UNAVAILABLE)
|
||||||
|
{
|
||||||
|
Toast.makeText(mContext, "Rssi information not available.", Toast.LENGTH_SHORT).show();
|
||||||
|
} else if(supportsRssi == RssiSupport.UNKNOWN_OLDSERVICE)
|
||||||
|
{
|
||||||
|
Toast.makeText(mContext, "Rssi might be supported. Please upgrade the plugin service.", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for RSSI data of previously found devices
|
||||||
|
*/
|
||||||
|
private MultiDeviceSearch.RssiCallback mRssiCallback = new MultiDeviceSearch.RssiCallback()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Receive an RSSI data update from a specific found device
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onRssiUpdate(final int resultId, final int rssi)
|
||||||
|
{
|
||||||
|
runOnUiThread(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
for (MultiDeviceSearchResultWithRSSI result : mFoundDevices)
|
||||||
|
{
|
||||||
|
if (result.mDevice.resultID == resultId)
|
||||||
|
{
|
||||||
|
result.mRSSI = rssi;
|
||||||
|
mFoundAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2014
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.rubenvandeven.heartbeatstreamer.multidevicesearch;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.rubenvandeven.heartbeatstreamer.multidevicesearch.Activity_MultiDeviceSearchSampler.MultiDeviceSearchResultWithRSSI;
|
||||||
|
import com.rubenvandeven.heartbeatstreamer.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapter that displays MultiDeviceSearchResultWithRSSI in a List View with
|
||||||
|
* layout R.layout.layout_multidevice_searchresult
|
||||||
|
*/
|
||||||
|
public class ArrayAdapter_MultiDeviceSearchResult extends
|
||||||
|
ArrayAdapter<MultiDeviceSearchResultWithRSSI>
|
||||||
|
{
|
||||||
|
private static final int DEFAULT_MIN_RSSI = -1;
|
||||||
|
|
||||||
|
private ArrayList<MultiDeviceSearchResultWithRSSI> mData;
|
||||||
|
private String[] mDeviceTypes;
|
||||||
|
private int mMinRSSI = DEFAULT_MIN_RSSI;
|
||||||
|
|
||||||
|
public ArrayAdapter_MultiDeviceSearchResult(Context context,
|
||||||
|
ArrayList<MultiDeviceSearchResultWithRSSI> data)
|
||||||
|
{
|
||||||
|
super(context, R.layout.layout_multidevice_searchresult, data);
|
||||||
|
mData = data;
|
||||||
|
mDeviceTypes = context.getResources().getStringArray(R.array.device_types);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the display with new data for the specified position
|
||||||
|
*/
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
|
{
|
||||||
|
if (convertView == null)
|
||||||
|
{
|
||||||
|
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
|
||||||
|
Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
convertView = inflater.inflate(R.layout.layout_multidevice_searchresult, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiDeviceSearchResultWithRSSI i = mData.get(position);
|
||||||
|
|
||||||
|
if (i != null)
|
||||||
|
{
|
||||||
|
TextView tv_deviceType = (TextView) convertView
|
||||||
|
.findViewById(R.id.textView_multiDeviceType);
|
||||||
|
TextView tv_deviceName = (TextView) convertView
|
||||||
|
.findViewById(R.id.textView_multiDeviceName);
|
||||||
|
ProgressBar pb_RSSI = (ProgressBar) convertView
|
||||||
|
.findViewById(R.id.progressBar_multiDeviceRSSI);
|
||||||
|
|
||||||
|
if (tv_deviceType != null)
|
||||||
|
{
|
||||||
|
tv_deviceType.setText(mDeviceTypes[i.mDevice.getAntDeviceType().ordinal()]);
|
||||||
|
}
|
||||||
|
if (tv_deviceName != null)
|
||||||
|
{
|
||||||
|
tv_deviceName.setText(i.mDevice.getDeviceDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// only update once i.mRSSI value has been populated
|
||||||
|
if (pb_RSSI != null && i.mRSSI != Integer.MIN_VALUE)
|
||||||
|
{
|
||||||
|
// display RSSI data
|
||||||
|
if (pb_RSSI.getVisibility() != View.VISIBLE)
|
||||||
|
{
|
||||||
|
convertView.findViewById(R.id.label_RSSI).setVisibility(View.VISIBLE);
|
||||||
|
pb_RSSI.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Device is nearest it can be, cap to zero
|
||||||
|
if (i.mRSSI >= 0)
|
||||||
|
{
|
||||||
|
i.mRSSI = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0 is farthest away, (- mMinRSSI) is nearest
|
||||||
|
int nearness = i.mRSSI - mMinRSSI;
|
||||||
|
|
||||||
|
// find the new farthest
|
||||||
|
if (nearness < 0)
|
||||||
|
{
|
||||||
|
mMinRSSI = i.mRSSI;
|
||||||
|
nearness = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int display = 100 * nearness / -mMinRSSI;
|
||||||
|
pb_RSSI.setProgress(display);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
34
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="78.5885"
|
||||||
|
android:endY="90.9159"
|
||||||
|
android:startX="48.7653"
|
||||||
|
android:startY="61.0927"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#008577"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
68
app/src/main/res/layout/activity_async_scan.xml
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2013
|
||||||
|
All rights reserved.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_Status"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:text="Searching for heart rate devices asynchronously..." />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar_Spinner"
|
||||||
|
style="?android:attr/progressBarStyleLarge"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_AlreadyConnectedTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Already Connected Devices:"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listView_AlreadyConnectedDevices"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone" >
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_FoundDeviceTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Devices Found In Scan:"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listView_FoundDevices"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
404
app/src/main/res/layout/activity_heart_rate.xml
Normal file
|
@ -0,0 +1,404 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context=".Activity_HeartRate">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout_TitleAndStatus"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_Status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="[status]"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scrollView1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/linearLayout_TitleAndStatus">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#D7D7D7"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="EstTimestamp:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_EstTimestamp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#EBEBEB"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="Data Status:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_DataStatus"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#D7D7D7"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="ComputedHeartRate:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_ComputedHeartRate"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#EBEBEB"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="HeartBeatCounter:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_HeartBeatCounter"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#D7D7D7"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="HeartBeatEventTime:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_HeartBeatEventTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#EBEBEB"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="ManufacturerSpecificByte:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_ManufacturerSpecificByte"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#D7D7D7"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="PreviousHeartBeatEventTime:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_PreviousHeartBeatEventTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#EBEBEB"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="RR Flag:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_rRFlag"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#D7D7D7"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="Calculated R-R Interval:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_CalculatedRrInterval"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#EBEBEB"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="CumulativeOperatingTime:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_CumulativeOperatingTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#D7D7D7"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="ManufacturerID:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_ManufacturerID"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#EBEBEB"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="SerialNumber:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_SerialNumber"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#D7D7D7"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="HardwareVersion:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_HardwareVersion"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#EBEBEB"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="SoftwareVersion:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_SoftwareVersion"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#D7D7D7"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="ModelNumber:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_ModelNumber"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/viewGroup_rssi"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#EBEBEB"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingTop="3dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:text="Rssi:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_Rssi"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
</RelativeLayout>
|
18
app/src/main/res/layout/activity_main.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Hello World!"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
54
app/src/main/res/layout/activity_multidevice_filter.xml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2014
|
||||||
|
All rights reserved.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_StartMultiDeviceSearch"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:text="@string/label_multiDeviceSearchButton"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Large" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="5"
|
||||||
|
android:text="@string/label_deviceTypeFilter"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_SelectAll"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:text="@string/label_selectAll"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listView_MultiDeviceFilter"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
46
app/src/main/res/layout/activity_multidevice_scan.xml
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2014
|
||||||
|
All rights reserved.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_AlreadyConnectedTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:text="@string/label_alreadyConnected"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listView_AlreadyConnectedDevices"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_FoundDeviceTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="@string/label_foundDevices"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listView_FoundDevices"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
59
app/src/main/res/layout/layout_multidevice_searchresult.xml
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This software is subject to the license described in the License.txt file
|
||||||
|
included with this software distribution. You may not use this file except in compliance
|
||||||
|
with this license.
|
||||||
|
|
||||||
|
Copyright (c) Dynastream Innovations Inc. 2014
|
||||||
|
All rights reserved.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_multiDeviceType"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:gravity="right"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_multiDeviceName"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/label_RSSI"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="@string/label_RSSI"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar_multiDeviceRSSI"
|
||||||
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:max="100"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:background="@android:color/darker_gray" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
10
app/src/main/res/menu/activity_heart_rate.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_reset"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/menu_reset"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
</menu>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 15 KiB |
6
app/src/main/res/values/colors.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="colorPrimary">#008577</color>
|
||||||
|
<color name="colorPrimaryDark">#00574B</color>
|
||||||
|
<color name="colorAccent">#D81B60</color>
|
||||||
|
</resources>
|
25
app/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Heartbeat Streamer</string>
|
||||||
|
<string name="menu_reset">Reset Connection</string>
|
||||||
|
<string name="label_multiDeviceSearchButton">Start Search</string>
|
||||||
|
<string name="label_deviceTypeFilter">Select device types to search:</string>
|
||||||
|
<string name="label_selectAll">Select All</string>
|
||||||
|
<string name="label_alreadyConnected">Already connected devices:</string>
|
||||||
|
<string name="label_foundDevices">Devices Found In Scan:</string>
|
||||||
|
<string name="label_RSSI">RSSI:</string>
|
||||||
|
<string name="label_"></string>
|
||||||
|
<string-array name="device_types">
|
||||||
|
<item>Bike Power</item>
|
||||||
|
<item>Controllable Device</item>
|
||||||
|
<item>Fitness Equipment</item>
|
||||||
|
<item>Blood Pressure</item>
|
||||||
|
<item>Geocache</item>
|
||||||
|
<item>Environment</item>
|
||||||
|
<item>Weight Scale</item>
|
||||||
|
<item>Heart Rate</item>
|
||||||
|
<item>Bike Speed and Cadence</item>
|
||||||
|
<item>Bike Cadence</item>
|
||||||
|
<item>Bike Speed</item>
|
||||||
|
<item>Stride-based Speed and Distance</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
11
app/src/main/res/values/styles.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.rubenvandeven.heartbeatstreamer;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
27
build.gradle
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||||
|
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
15
gradle.properties
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx1536m
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
172
gradlew
vendored
Executable file
|
@ -0,0 +1,172 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
84
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
1
settings.gradle
Normal file
|
@ -0,0 +1 @@
|
||||||
|
include ':app'
|