mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-01-10 02:04:26 +01:00
Version 1.16.4 - Selection of EOL in UART added, support for Marshmallow in Wear
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,8 +1,7 @@
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/dictionaries/*.xml
|
||||
/.idea/libraries
|
||||
/.idea
|
||||
*.iml
|
||||
.DS_Store
|
||||
/build
|
||||
/key*
|
||||
1
.idea/.name
generated
1
.idea/.name
generated
@@ -1 +0,0 @@
|
||||
nRFToolbox
|
||||
23
.idea/compiler.xml
generated
23
.idea/compiler.xml
generated
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
9
.idea/copyright/BSD.xml
generated
9
.idea/copyright/BSD.xml
generated
@@ -1,9 +0,0 @@
|
||||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="Copyright (c) &#36;today.year, Nordic Semiconductor All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." />
|
||||
<option name="keyword" value="Copyright" />
|
||||
<option name="allowReplaceKeyword" value="This heading must NOT be removed from the file." />
|
||||
<option name="myName" value="BSD" />
|
||||
<option name="myLocal" value="true" />
|
||||
</copyright>
|
||||
</component>
|
||||
7
.idea/copyright/profiles_settings.xml
generated
7
.idea/copyright/profiles_settings.xml
generated
@@ -1,7 +0,0 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="BSD">
|
||||
<module2copyright>
|
||||
<element module="All" copyright="BSD" />
|
||||
</module2copyright>
|
||||
</settings>
|
||||
</component>
|
||||
6
.idea/encodings.xml
generated
6
.idea/encodings.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
20
.idea/gradle.xml
generated
20
.idea/gradle.xml
generated
@@ -1,20 +0,0 @@
|
||||
<?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="gradleJvm" value="1.7" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/common" />
|
||||
<option value="$PROJECT_DIR$/wear" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
33
.idea/misc.xml
generated
33
.idea/misc.xml
generated
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<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="4">
|
||||
<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="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="4">
|
||||
<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" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
11
.idea/modules.xml
generated
11
.idea/modules.xml
generated
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/common/common.iml" filepath="$PROJECT_DIR$/common/common.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/nRFToolbox.iml" filepath="$PROJECT_DIR$/nRFToolbox.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/wear/wear.iml" filepath="$PROJECT_DIR$/wear/wear.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/runConfigurations.xml
generated
12
.idea/runConfigurations.xml
generated
@@ -1,12 +0,0 @@
|
||||
<?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>
|
||||
5
.idea/scopes/scope_settings.xml
generated
5
.idea/scopes/scope_settings.xml
generated
@@ -1,5 +0,0 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<state>
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</state>
|
||||
</component>
|
||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
111
app/app.iml
111
app/app.iml
@@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="nRFToolbox" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":app" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
|
||||
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugAndroidTestSources</task>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.1.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/8.3.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/8.3.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/8.3.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/no.nordicsemi.android.support.v18/scanner/0.1.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/no.nordicsemi.android/dfu/0.6.2/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/no.nordicsemi.android/log/2.0.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="design-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="dfu-0.6.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="play-services-wearable-8.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="log-2.0.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="play-services-base-8.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="scanner-0.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="achartengine-1.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="simple-xml-2.7.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="play-services-basement-8.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="gson-2.5" level="project" />
|
||||
<orderEntry type="module" module-name="common" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion '23.0.2'
|
||||
buildToolsVersion '23.0.3'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "no.nordicsemi.android.nrftoolbox"
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 23
|
||||
versionCode 42
|
||||
versionName "1.16.3"
|
||||
versionCode 43
|
||||
versionName "1.16.4"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -21,10 +21,10 @@ android {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.google.android.gms:play-services-wearable:8.3.0'
|
||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||
compile 'com.android.support:design:23.1.1'
|
||||
compile 'no.nordicsemi.android.support.v18:scanner:0.1.1'
|
||||
compile 'com.google.android.gms:play-services-wearable:9.0.2'
|
||||
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||
compile 'com.android.support:design:23.4.0'
|
||||
compile 'no.nordicsemi.android.support.v18:scanner:0.2.0'
|
||||
compile 'no.nordicsemi.android:log:2.0.0'
|
||||
compile('org.simpleframework:simple-xml:2.7.1') {
|
||||
exclude group: 'stax', module: 'stax-api'
|
||||
|
||||
@@ -233,7 +233,9 @@
|
||||
android:label="@string/uart_feature_title" />
|
||||
<service android:name=".wearable.MainWearableListenerService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
|
||||
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
|
||||
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
|
||||
<data android:scheme="wear" android:host="*" android:pathPrefix="/nrftoolbox" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
|
||||
@@ -128,9 +128,9 @@ public class UARTActivity extends BleProfileServiceReadyActivity<UARTService.UAR
|
||||
private boolean mEditMode;
|
||||
|
||||
public interface ConfigurationListener {
|
||||
public void onConfigurationModified();
|
||||
public void onConfigurationChanged(final UartConfiguration configuration);
|
||||
public void setEditMode(final boolean editMode);
|
||||
void onConfigurationModified();
|
||||
void onConfigurationChanged(final UartConfiguration configuration);
|
||||
void setEditMode(final boolean editMode);
|
||||
}
|
||||
|
||||
public void setConfigurationListener(final ConfigurationListener listener) {
|
||||
@@ -318,8 +318,7 @@ public class UARTActivity extends BleProfileServiceReadyActivity<UARTService.UAR
|
||||
return;
|
||||
}
|
||||
if (mEditMode) {
|
||||
final UARTControlFragment fragment = (UARTControlFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_control);
|
||||
fragment.setEditMode(false);
|
||||
setEditMode(false);
|
||||
return;
|
||||
}
|
||||
super.onBackPressed();
|
||||
@@ -554,11 +553,12 @@ public class UARTActivity extends BleProfileServiceReadyActivity<UARTService.UAR
|
||||
}
|
||||
}
|
||||
|
||||
public void onCommandChanged(final int index, final String message, final boolean active, final int iconIndex) {
|
||||
public void onCommandChanged(final int index, final String message, final boolean active, final int eol, final int iconIndex) {
|
||||
final Command command = mConfiguration.getCommands()[index];
|
||||
|
||||
command.setCommand(message);
|
||||
command.setActive(active);
|
||||
command.setEol(eol);
|
||||
command.setIconIndex(iconIndex);
|
||||
mConfigurationListener.onConfigurationModified();
|
||||
saveConfiguration();
|
||||
@@ -808,6 +808,7 @@ public class UARTActivity extends BleProfileServiceReadyActivity<UARTService.UAR
|
||||
final Command command = new Command();
|
||||
command.setCommand(cmd);
|
||||
command.setActive(mPreferences.getBoolean(PREFS_BUTTON_ENABLED + i, false));
|
||||
command.setEol(0); // default one
|
||||
command.setIconIndex(mPreferences.getInt(PREFS_BUTTON_ICON + i, 0));
|
||||
commands[i] = command;
|
||||
}
|
||||
|
||||
@@ -102,9 +102,19 @@ public class UARTControlFragment extends Fragment implements GridView.OnItemClic
|
||||
final UARTEditDialog dialog = UARTEditDialog.getInstance(position, command);
|
||||
dialog.show(getChildFragmentManager(), null);
|
||||
} else {
|
||||
final String command = ((Command)mAdapter.getItem(position)).getCommand();
|
||||
final Command command = (Command)mAdapter.getItem(position);
|
||||
final Command.Eol eol = command.getEol();
|
||||
String text = command.getCommand();
|
||||
switch (eol) {
|
||||
case CR_LF:
|
||||
text = text.replaceAll("\n", "\r\n");
|
||||
break;
|
||||
case CR:
|
||||
text = text.replaceAll("\n", "\r");
|
||||
break;
|
||||
}
|
||||
final UARTInterface uart = (UARTInterface) getActivity();
|
||||
uart.send(command);
|
||||
uart.send(text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
package no.nordicsemi.android.nrftoolbox.uart;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
@@ -41,6 +39,7 @@ import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import no.nordicsemi.android.nrftoolbox.R;
|
||||
import no.nordicsemi.android.nrftoolbox.uart.domain.Command;
|
||||
@@ -48,11 +47,13 @@ import no.nordicsemi.android.nrftoolbox.uart.domain.Command;
|
||||
public class UARTEditDialog extends DialogFragment implements View.OnClickListener, GridView.OnItemClickListener {
|
||||
private final static String ARG_INDEX = "index";
|
||||
private final static String ARG_COMMAND = "command";
|
||||
private final static String ARG_EOL = "eol";
|
||||
private final static String ARG_ICON_INDEX = "iconIndex";
|
||||
private int mActiveIcon;
|
||||
|
||||
private EditText mField;
|
||||
private CheckBox mCheckBox;
|
||||
private CheckBox mActiveCheckBox;
|
||||
private RadioGroup mEOLGroup;
|
||||
private IconAdapter mIconAdapter;
|
||||
|
||||
public static UARTEditDialog getInstance(final int index, final Command command) {
|
||||
@@ -61,6 +62,7 @@ public class UARTEditDialog extends DialogFragment implements View.OnClickListen
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(ARG_INDEX, index);
|
||||
args.putString(ARG_COMMAND, command.getCommand());
|
||||
args.putInt(ARG_EOL, command.getEol().index);
|
||||
args.putInt(ARG_ICON_INDEX, command.getIconIndex());
|
||||
fragment.setArguments(args);
|
||||
|
||||
@@ -76,6 +78,7 @@ public class UARTEditDialog extends DialogFragment implements View.OnClickListen
|
||||
final Bundle args = getArguments();
|
||||
final int index = args.getInt(ARG_INDEX);
|
||||
final String command = args.getString(ARG_COMMAND);
|
||||
final int eol = args.getInt(ARG_EOL);
|
||||
final int iconIndex = args.getInt(ARG_ICON_INDEX);
|
||||
final boolean active = true; // change to active by default
|
||||
mActiveIcon = iconIndex;
|
||||
@@ -84,7 +87,7 @@ public class UARTEditDialog extends DialogFragment implements View.OnClickListen
|
||||
final View view = inflater.inflate(R.layout.feature_uart_dialog_edit, null);
|
||||
final EditText field = mField = (EditText) view.findViewById(R.id.field);
|
||||
final GridView grid = (GridView) view.findViewById(R.id.grid);
|
||||
final CheckBox checkBox = mCheckBox = (CheckBox) view.findViewById(R.id.active);
|
||||
final CheckBox checkBox = mActiveCheckBox = (CheckBox) view.findViewById(R.id.active);
|
||||
checkBox.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
|
||||
@@ -95,6 +98,20 @@ public class UARTEditDialog extends DialogFragment implements View.OnClickListen
|
||||
}
|
||||
});
|
||||
|
||||
final RadioGroup eolGroup = mEOLGroup = (RadioGroup) view.findViewById(R.id.uart_eol);
|
||||
switch (Command.Eol.values()[eol]) {
|
||||
case CR_LF:
|
||||
eolGroup.check(R.id.uart_eol_cr_lf);
|
||||
break;
|
||||
case CR:
|
||||
eolGroup.check(R.id.uart_eol_cr);
|
||||
break;
|
||||
case LF:
|
||||
default:
|
||||
eolGroup.check(R.id.uart_eol_lf);
|
||||
break;
|
||||
}
|
||||
|
||||
field.setText(command);
|
||||
field.setEnabled(active);
|
||||
checkBox.setChecked(active);
|
||||
@@ -112,13 +129,22 @@ public class UARTEditDialog extends DialogFragment implements View.OnClickListen
|
||||
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final boolean active = mCheckBox.isChecked();
|
||||
final boolean active = mActiveCheckBox.isChecked();
|
||||
final String command = mField.getText().toString();
|
||||
if (active && TextUtils.isEmpty(command)) {
|
||||
mField.setError(getString(R.string.uart_edit_command_error));
|
||||
return;
|
||||
int eol;
|
||||
|
||||
switch (mEOLGroup.getCheckedRadioButtonId()) {
|
||||
case R.id.uart_eol_cr_lf:
|
||||
eol = Command.Eol.CR_LF.index;
|
||||
break;
|
||||
case R.id.uart_eol_cr:
|
||||
eol = Command.Eol.CR.index;
|
||||
break;
|
||||
case R.id.uart_eol_lf:
|
||||
default:
|
||||
eol = Command.Eol.LF.index;
|
||||
break;
|
||||
}
|
||||
mField.setError(null);
|
||||
|
||||
// Save values
|
||||
final Bundle args = getArguments();
|
||||
@@ -126,7 +152,7 @@ public class UARTEditDialog extends DialogFragment implements View.OnClickListen
|
||||
|
||||
dismiss();
|
||||
final UARTActivity parent = (UARTActivity) getActivity();
|
||||
parent.onCommandChanged(index, command, active, mActiveIcon);
|
||||
parent.onCommandChanged(index, command, active, eol, mActiveIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,7 +187,7 @@ public class UARTEditDialog extends DialogFragment implements View.OnClickListen
|
||||
}
|
||||
final ImageView image = (ImageView) view;
|
||||
image.setImageLevel(position);
|
||||
image.setActivated(position == mActiveIcon && mCheckBox.isChecked());
|
||||
image.setActivated(position == mActiveIcon && mActiveCheckBox.isChecked());
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ package no.nordicsemi.android.nrftoolbox.uart;
|
||||
|
||||
public interface UARTInterface {
|
||||
|
||||
public void send(final String text);
|
||||
void send(final String text);
|
||||
}
|
||||
|
||||
@@ -50,9 +50,21 @@ public class Command {
|
||||
NUMBER_8(18),
|
||||
NUMBER_9(19);
|
||||
|
||||
public int index;
|
||||
public final int index;
|
||||
|
||||
private Icon(final int index) {
|
||||
Icon(final int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Eol {
|
||||
LF(0),
|
||||
CR(1),
|
||||
CR_LF(2);
|
||||
|
||||
public final int index;
|
||||
|
||||
Eol(final int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
@@ -63,6 +75,9 @@ public class Command {
|
||||
@Attribute(required = false)
|
||||
private boolean active = false;
|
||||
|
||||
@Attribute(required = false)
|
||||
private Eol eol = Eol.LF;
|
||||
|
||||
@Attribute(required = false)
|
||||
private Icon icon = Icon.LEFT;
|
||||
|
||||
@@ -78,10 +93,18 @@ public class Command {
|
||||
* Sets whether the command is active.
|
||||
* @param active true to make it active
|
||||
*/
|
||||
public void setActive(boolean active) {
|
||||
public void setActive(final boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the new line type.
|
||||
* @param eol end of line terminator
|
||||
*/
|
||||
public void setEol(final int eol) {
|
||||
this.eol = Eol.values()[eol];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon index.
|
||||
* @param index index of the icon.
|
||||
@@ -106,6 +129,14 @@ public class Command {
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the new line type.
|
||||
* @return end of line terminator
|
||||
*/
|
||||
public Eol getEol() {
|
||||
return eol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon index.
|
||||
* @return the icon index
|
||||
@@ -113,4 +144,11 @@ public class Command {
|
||||
public int getIconIndex() {
|
||||
return icon.index;
|
||||
}
|
||||
/**
|
||||
* Returns the EOL index.
|
||||
* @return the EOL index
|
||||
*/
|
||||
public int getEolIndex() {
|
||||
return eol.index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ public class UARTConfigurationSynchronizer {
|
||||
final DataMap item = new DataMap();
|
||||
item.putInt(Constants.UART.Configuration.Command.ICON_ID, command.getIconIndex());
|
||||
item.putString(Constants.UART.Configuration.Command.MESSAGE, command.getCommand());
|
||||
item.putInt(Constants.UART.Configuration.Command.EOL, command.getEolIndex());
|
||||
commands.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,10 +46,47 @@
|
||||
android:text="@string/uart_edit_active"/>
|
||||
</LinearLayout>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/uart_eol"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/uart_eol"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/uart_eol_lf"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="80dp"
|
||||
android:checked="true"
|
||||
android:text="@string/uart_eol_lf"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/uart_eol_cr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="80dp"
|
||||
android:text="@string/uart_eol_cr"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/uart_eol_cr_lf"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="80dp"
|
||||
android:text="@string/uart_eol_cr_lf"/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:text="@string/uart_edit_select"/>
|
||||
|
||||
<GridView
|
||||
|
||||
@@ -57,13 +57,17 @@
|
||||
|
||||
<string name="uart_edit_title">Configure button</string>
|
||||
<string name="uart_edit_command_hint">Enter command</string>
|
||||
<string name="uart_edit_command_error">Command must not be empty</string>
|
||||
<string name="uart_edit_active">Active</string>
|
||||
<string name="uart_edit_select">Select icon:</string>
|
||||
|
||||
<string name="uart_notification_action_disconnect">Disconnect</string>
|
||||
<string name="uart_notification_connected_message">%s is connected.</string>
|
||||
|
||||
|
||||
<string name="uart_eol">EOL:</string>
|
||||
<string name="uart_eol_cr_lf">CR+LF</string>
|
||||
<string name="uart_eol_lf">LF</string>
|
||||
<string name="uart_eol_cr">CR</string>
|
||||
|
||||
<string name="uart_about_text">UART profile (Universal Asynchronous Receiver and Transmitter) is a Bluetooth Smart implementation of the UART standard. It allows for bidirectional
|
||||
text based communication that is often used for debugging and control.
|
||||
\nEach configuration contains 9 programmable buttons that may send commands to the UART TX characteristic. Click on the EDIT menu item to edit buttons actions.
|
||||
|
||||
@@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
||||
classpath 'com.android.tools.build:gradle:2.1.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
@@ -24,7 +24,7 @@ apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.2"
|
||||
buildToolsVersion "23.0.3"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 18
|
||||
@@ -42,5 +42,5 @@ android {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:support-v4:23.1.1'
|
||||
compile 'com.android.support:support-v4:23.4.0'
|
||||
}
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":common" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="nRFToolbox" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":common" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
|
||||
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugAndroidTestSources</task>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
<option name="LIBRARY_PROJECT" value="true" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -60,6 +60,7 @@ public final class Constants {
|
||||
public static final class Command {
|
||||
public static final String ICON_ID = "icon_id";
|
||||
public static final String MESSAGE = "message";
|
||||
public static final String EOL = "eol";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Mon Nov 02 11:30:44 CET 2015
|
||||
#Tue Jun 14 13:22:53 CEST 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="nRFToolbox" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||
<option name="BUILDABLE" value="false" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.2"
|
||||
buildToolsVersion "23.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "no.nordicsemi.android.nrftoolbox"
|
||||
@@ -23,7 +23,7 @@ android {
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.google.android.support:wearable:1.3.0'
|
||||
compile 'com.google.android.gms:play-services-wearable:8.3.0'
|
||||
compile 'com.google.android.gms:play-services-wearable:9.0.2'
|
||||
compile 'no.nordicsemi.android.support.v18:scanner:0.1.1'
|
||||
compile project(':common')
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH"/>
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
@@ -66,7 +67,9 @@
|
||||
<!-- Service for handling Android Wear synchronization events. -->
|
||||
<service android:name=".wearable.MainWearableListenerService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
|
||||
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
|
||||
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
|
||||
<data android:scheme="wear" android:host="*" android:pathPrefix="/nrftoolbox" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
package no.nordicsemi.android.nrftoolbox;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -29,9 +30,14 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.content.PermissionChecker;
|
||||
import android.support.wearable.view.WearableListView;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -43,6 +49,8 @@ import no.nordicsemi.android.nrftoolbox.uart.UARTConfigurationsActivity;
|
||||
public class ScannerActivity extends Activity {
|
||||
private static final String TAG = "ScannerActivity";
|
||||
|
||||
private static final int PERMISSION_REQUEST_LOCATION = 1;
|
||||
|
||||
private DevicesAdapter mDeviceAdapter;
|
||||
private View mHeader;
|
||||
|
||||
@@ -108,9 +116,30 @@ public class ScannerActivity extends Activity {
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(mServiceBroadcastReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(final int requestCode, @NonNull final String[] permissions, @NonNull final int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case PERMISSION_REQUEST_LOCATION:
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
mDeviceAdapter.startLeScan();
|
||||
} else {
|
||||
Toast.makeText(ScannerActivity.this, "Location permission required", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(new String[] { Manifest.permission.ACCESS_COARSE_LOCATION}, PERMISSION_REQUEST_LOCATION);
|
||||
return;
|
||||
}
|
||||
}
|
||||
mDeviceAdapter.startLeScan();
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ public class UARTCommandsActivity extends Activity implements UARTCommandsAdapte
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionFailed(final ConnectionResult connectionResult) {
|
||||
public void onConnectionFailed(@NonNull final ConnectionResult connectionResult) {
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -248,10 +248,21 @@ public class UARTCommandsActivity extends Activity implements UARTCommandsAdapte
|
||||
@Override
|
||||
public void onCommandSelected(final Command command) {
|
||||
// Send command to handheld if the watch is not connected directly to the UART device.
|
||||
final Command.Eol eol = command.getEol();
|
||||
String text = command.getCommand();
|
||||
switch (eol) {
|
||||
case CR_LF:
|
||||
text = text.replaceAll("\n", "\r\n");
|
||||
break;
|
||||
case CR:
|
||||
text = text.replaceAll("\n", "\r");
|
||||
break;
|
||||
}
|
||||
|
||||
if (mProfile != null)
|
||||
mProfile.send(command.getCommand());
|
||||
mProfile.send(text);
|
||||
else
|
||||
sendMessageToHandheld(this, command.getCommand());
|
||||
sendMessageToHandheld(this, text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,22 +54,37 @@ public class Command implements Parcelable {
|
||||
|
||||
public int index;
|
||||
|
||||
private Icon(final int index) {
|
||||
Icon(final int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Eol {
|
||||
LF(0),
|
||||
CR(1),
|
||||
CR_LF(2);
|
||||
|
||||
public final int index;
|
||||
|
||||
Eol(final int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
private Eol eol = Eol.LF;
|
||||
private Icon icon = Icon.LEFT;
|
||||
private String command;
|
||||
|
||||
/* package */ Command(final DataMap dataMap) {
|
||||
icon = Icon.values()[dataMap.getInt(Constants.UART.Configuration.Command.ICON_ID)];
|
||||
command = dataMap.getString(Constants.UART.Configuration.Command.MESSAGE);
|
||||
eol = Eol.values()[dataMap.getInt(Constants.UART.Configuration.Command.EOL)];
|
||||
}
|
||||
|
||||
private Command(final Parcel in) {
|
||||
icon = (Icon) in.readSerializable();
|
||||
command = in.readString();
|
||||
eol = (Eol) in.readSerializable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,6 +95,14 @@ public class Command implements Parcelable {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the new line type.
|
||||
* @param eol end of line terminator
|
||||
*/
|
||||
/* package */ void setEol(final int eol) {
|
||||
this.eol = Eol.values()[eol];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon index.
|
||||
* @param index index of the icon.
|
||||
@@ -96,6 +119,14 @@ public class Command implements Parcelable {
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the new line type.
|
||||
* @return end of line terminator
|
||||
*/
|
||||
public Eol getEol() {
|
||||
return eol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon index.
|
||||
* @return the icon index
|
||||
@@ -125,5 +156,6 @@ public class Command implements Parcelable {
|
||||
public void writeToParcel(final Parcel dest, int flags) {
|
||||
dest.writeSerializable(icon);
|
||||
dest.writeString(command);
|
||||
dest.writeSerializable(eol);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":wear" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="nRFToolbox" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":wear" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
|
||||
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugAndroidTestSources</task>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.0.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.support/wearable/1.3.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="play-services-base-8.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="play-services-wearable-8.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="scanner-0.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="wearable-1.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="play-services-basement-8.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="recyclerview-v7-22.0.0" level="project" />
|
||||
<orderEntry type="module" module-name="common" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user