LAMP_Connect_v1
This commit is contained in:
2
common/.gitignore
vendored
Normal file
2
common/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
*.iml
|
||||
31
common/build.gradle
Normal file
31
common/build.gradle
Normal file
@@ -0,0 +1,31 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
resConfigs "en"
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
buildTypes {
|
||||
debug {
|
||||
minifyEnabled true
|
||||
useProguard false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
release {
|
||||
minifyEnabled true
|
||||
useProguard true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
}
|
||||
17
common/proguard-rules.pro
vendored
Normal file
17
common/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\Users\alno\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# 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 *;
|
||||
#}
|
||||
26
common/src/main/AndroidManifest.xml
Normal file
26
common/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<!--
|
||||
~ Copyright (c) 2015, 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.
|
||||
-->
|
||||
|
||||
<manifest
|
||||
package="no.nordicsemi.android.nrftoolbox.common">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
package no.nordicsemi.android.nrftoolbox.utility;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import no.nordicsemi.android.nrftoolbox.common.BuildConfig;
|
||||
|
||||
public class DebugLogger {
|
||||
public static void v(final String tag, final String text) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.v(tag, text);
|
||||
}
|
||||
|
||||
public static void d(final String tag, final String text) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(tag, text);
|
||||
}
|
||||
}
|
||||
|
||||
public static void i(final String tag, final String text) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.i(tag, text);
|
||||
}
|
||||
|
||||
public static void w(final String tag, final String text) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.w(tag, text);
|
||||
}
|
||||
}
|
||||
|
||||
public static void e(final String tag, final String text) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.e(tag, text);
|
||||
}
|
||||
|
||||
public static void e(final String tag, final String text, final Throwable e) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.e(tag, text, e);
|
||||
}
|
||||
|
||||
public static void wtf(final String tag, final String text) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.wtf(tag, text);
|
||||
}
|
||||
}
|
||||
|
||||
public static void wtf(final String tag, final String text, final Throwable e) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.wtf(tag, text, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
|
||||
package no.nordicsemi.android.nrftoolbox.wearable.common;
|
||||
|
||||
/**
|
||||
* Constants used for exchanging data and messages between handheld and Android Wear devices.
|
||||
*/
|
||||
public final class Constants {
|
||||
/** Base path for all messages between the handheld and wearable. */
|
||||
private static final String BASE_PATH = "/nrftoolbox";
|
||||
|
||||
/** Action sent from a wearable to disconnect from a device. It must have the profile name set as data. */
|
||||
public static final String ACTION_DISCONNECT = BASE_PATH + "/disconnect";
|
||||
|
||||
/**
|
||||
* Constants for the UART profile.
|
||||
*/
|
||||
public static final class UART {
|
||||
/** The profile name. */
|
||||
public static final String PROFILE = "uart";
|
||||
|
||||
/** Base path for UART messages between the handheld and wearable. */
|
||||
private static final String PROFILE_PATH = BASE_PATH + "/uart";
|
||||
|
||||
/** An UART device is connected. */
|
||||
public static final String DEVICE_CONNECTED = PROFILE_PATH + "/connected";
|
||||
/** An UART device is disconnected. */
|
||||
public static final String DEVICE_DISCONNECTED = PROFILE_PATH + "/disconnected";
|
||||
/** An UART device is disconnected due to a link loss. */
|
||||
public static final String DEVICE_LINKLOSS = PROFILE_PATH + "/link_loss";
|
||||
/** Path used for syncing UART configurations. */
|
||||
public static final String CONFIGURATIONS = PROFILE_PATH + "/configurations";
|
||||
/** An action with a command was clicked. */
|
||||
public static final String COMMAND = PROFILE_PATH + "/command";
|
||||
|
||||
public static final class Configuration {
|
||||
public static final String NAME = "name";
|
||||
public static final String COMMANDS = "commands";
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
common/src/main/res/values/strings.xml
Normal file
34
common/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
~ Copyright (c) 2015, 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="bonding">Bonding with the device…</string>
|
||||
<string name="bonded">The device is now bonded.</string>
|
||||
<string name="bonding_failed">Bonding failed.</string>
|
||||
|
||||
<string name="channel_connected_devices_title">Background connections</string>
|
||||
<string name="channel_connected_devices_description">Shows a notification when a device is connected in background.</string>
|
||||
<string name="channel_files_title">Files</string>
|
||||
<string name="channel_files_description">Shows notifications when new files has been saved.</string>
|
||||
<string name="channel_proximity_warnings_title">Proximity warnings</string>
|
||||
<string name="channel_proximity_warnings_description">Shows notifications when a proximity device got out of range.</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user