diff --git a/.gitignore b/.gitignore
index dece6c5..e632471 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ bin/
gen/
MANIFEST.MF
build.num
+*.java_
# Local configuration file (sdk path, etc)
local.properties
@@ -22,6 +23,11 @@ dist/
/.idea
/.gradle
/build
-/SmartGattLib.iml
-/SmartGattLib.ipr
-/SmartGattLib.iws
+*.iml
+*.ipr
+*.iws
+
+# eclipse files
+.project
+.classpath
+.settings/
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..144a637
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,47 @@
+
+# [3.6.0]
+
+- added application level encryption for over the air data
+- added method getOutgoingData to AbstractAttribute that replaces the method getBytes and needs CryptoManager as argument
+- added alternative signature for Characteristic.createAttribute: added new parameter for CryptoManager
+- to get the raw data representation of an attribute the method getRawData was added to AbstractAttribute
+
+
+# [3.2.0] (2019-09-03)
+
+ - Added putMstime to GattByteBuffer
+
+
+# [3.1.0] (2019-02-21)
+
+ - Added getCharacteristics to obtain all Characteristics as a Collection
+
+
+# [3.0.0](https://github.com/movisens/SmartGattLib/compare/v2.1...v3.0) (2017-11-07)
+
+This release comes with a significant api change to simplify
+
+### Upgrade Instructions
+
+* replace ```com.movisens.smartgattlib.Service``` with ```com.movisens.smartgattlib.Services```
+* replace ```com.movisens.smartgattlib.Characteristic``` with ```com.movisens.smartgattlib.Characteristics```
+
+It is now possible to parse Characteristics with:
+``` java
+AbstractAttribute a = Characteristics.lookup(uuid).createAttribute(data);
+if (a instanceof HeartRateMeasurement) {
+ HeartRateMeasurement heartRateMeasurement = ((HeartRateMeasurement) a);
+ heartRateMeasurement.getHr();
+ heartRateMeasurement.getEe();
+} else if (a instanceof DefaultAttribute) {
+ System.err.println("characteristic for " + uuid + " is unknown");
+} else {
+ System.out.println("unused characteristic " + a.getCharacteristic().getName());
+}
+```
+
+It is also possible to write Characteristics and convert them to bytes:
+``` java
+AbstractAttribute aa = new Weight(12.3);
+// TODO: Write aa.getBytes() to aa.getCharacteristic().getUuid();
+```
\ No newline at end of file
diff --git a/README.md b/README.md
index f49442a..a35d88d 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
SmartGattLib
============
-
+
SmartGattLib is a Java library that simplifies the work with **Bluetooth SMART** devices (a.k.a. **Bluetooth Low Energy** in Bluetooth 4.0). It provides all UUIDs of the adopted [GATT specification](http://developer.bluetooth.org/gatt/Pages/default.aspx) and an convenient way to interpret the characteristics (e.g. Heart Rate, BatteryLevel).
@@ -16,9 +16,7 @@ SmartGattLib is a Java library that simplifies the work with **Bluetooth SMART**
The library has **no dependencies** and can be use with **every Bluetooth SMART stack** e.g.:
* [Android API Level 18](http://developer.android.com/guide/topics/connectivity/bluetooth-le.html)
- * [Samsung BLE SDK](http://developer.samsung.com/ble)
- * [HTC OpenSense BLE API](http://www.htcdev.com/devcenter/opensense-sdk/partner-apis/bluetooth-low-energy/)
- * Motorola (seems obsolete)
+ * [RxAndroidBle](https://github.com/Polidea/RxAndroidBle)
### Integration ###
Working with Bluetooth SMART devices is usually done in the following way:
@@ -41,7 +39,7 @@ Example Android project with SmartGattLib available [here](https://github.com/mo
maven { url "https://jitpack.io/" }
}
dependencies {
- compile 'com.github.movisens:SmartGattLib:1.7'
+ compile 'com.github.movisens:SmartGattLib:3.6'
}
```
or download the latest .jar file from the [releases](https://github.com/movisens/SmartGattLib/releases) page and place it in your Android app’s libs/ folder.
@@ -50,34 +48,47 @@ Example Android project with SmartGattLib available [here](https://github.com/mo
### Example Usage ###
```java
import com.movisens.smartgattlib.*;
+import com.movisens.smartgattlib.attributes.*;
+import com.movisens.smartgattlib.helper.*;
// onConnected
-//TODO: iterate over available services
-UUID serviceUuid = service.getUuid();
-if (Service.HEART_RATE.equals(serviceUuid)) { // Identify Service
- //TODO: iterate over characteristics
- UUID characteristicUuid = characteristic.getUuid();
- if (Characteristic.HEART_RATE_MEASUREMENT.equals(characteristicUuid)) { // Identify Characteristic
- // TODO: Enable notification e.g. for Android API 18:
- // BluetoothGattDescriptor descriptor = characteristic.getDescriptor(Descriptor.CLIENT_CHARACTERISTIC_CONFIGURATION);
- // descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
- // mBluetoothGatt.writeDescriptor(descriptor);
- }
-}else{
- System.out.println("Found unused Service: " + Service.lookup(serviceUuid, "unknown"));
+// TODO: iterate over available services
+UUID serviceUuid = null;// service.getUuid();
+if (Services.HEART_RATE.getUuid().equals(serviceUuid)) {
+
+ // TODO: iterate over characteristics
+ UUID characteristicUuid = null;// characteristic.getUuid();
+ if (Characteristics.HEART_RATE_MEASUREMENT.getUuid().equals(characteristicUuid)) {
+ // TODO: Enable notification e.g. for Android API 18:
+ // BluetoothGattDescriptor descriptor = characteristic.getDescriptor(Descriptor.CLIENT_CHARACTERISTIC_CONFIGURATION);
+ // descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
+ // mBluetoothGatt.writeDescriptor(descriptor);
+ }
+} else {
+ System.out.println("Found unused Service: " + Services.lookup(serviceUuid));
}
// onCharacteristicChanged
-UUID characteristicUuid = characteristic.getUuid();
-if (Characteristic.HEART_RATE_MEASUREMENT.equals(characteristicUuid)) { // Identify Characteristic
- byte[] value = characteristic.getValue();
- HeartRateMeasurement hrm = new HeartRateMeasurement(value); // Interpret Characteristic
- System.out.println("HR: " + hrm.getHr() + "bpm");
- System.out.println("EE: " + hrm.getEe() + "kJ");
+UUID uuid = null;// characteristic.getUuid();
+byte[] data = null;// characteristic.getValue();
+
+AbstractAttribute a = Characteristics.lookup(uuid).createAttribute(data);
+if (a instanceof HeartRateMeasurement) {
+ HeartRateMeasurement heartRateMeasurement = ((HeartRateMeasurement) a);
+ heartRateMeasurement.getHr();
+ heartRateMeasurement.getEe();
+} else if (a instanceof DefaultAttribute) {
+ System.err.println("characteristic for " + uuid + " is unknown");
+} else {
+ System.out.println("unused characteristic " + a.getCharacteristic().getName());
}
+
+// write Attribute
+AbstractAttribute aa = new Weight(12.3);
+// TODO: Write aa.getBytes() to aa.getCharacteristic().getUuid();
```
### License ###
-Copyright 2013 movisens GmbH
+Copyright 2017 movisens GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/build.gradle b/build.gradle
index 67a4960..cb016cb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,27 +1,47 @@
-/*
- * This build file was auto generated by running the Gradle 'init' task
- * by 'Juergen' at '15.03.15 19:57' with Gradle 1.11
- *
- * This generated file contains a sample Java project to get you started.
- * For more details take a look at the Java Quickstart chapter in the Gradle
- * user guide available at http://gradle.org/docs/1.11/userguide/tutorial_java_projects.html
- */
-
-// Apply the java plugin to add support for Java
-apply plugin: 'java'
-apply plugin: 'eclipse'
-apply plugin: 'idea'
-apply plugin: 'maven'
+apply plugin: 'java-library'
+apply plugin: 'maven-publish'
group = 'com.github.movisens'
-targetCompatibility = 1.6
-sourceCompatibility = 1.6
+targetCompatibility = 1.8
+sourceCompatibility = 1.8
+
+compileJava.options.encoding = 'UTF-8'
+compileTestJava.options.encoding = 'UTF-8'
+
+version = '3.6.0'
repositories {
mavenCentral()
}
dependencies {
- testCompile group: 'junit', name: 'junit', version: '4.11'
-}
\ No newline at end of file
+ testImplementation group: 'junit', name: 'junit', version: '4.11'
+}
+
+sourceSets {
+ main {
+ java {
+ srcDir('src-gen/main/java')
+ }
+ }
+}
+
+//OSGI specific entries that are not automatically generated
+jar {
+ manifest {
+ attributes (
+ 'Bundle-SymbolicName': project.group + project.name,
+ 'Bundle-Version': project.version,
+ 'Export-Package': 'com.movisens.smartgattlib, com.movisens.smartgattlib.*'
+ )
+ }
+}
+
+publishing {
+ publications {
+ maven(MavenPublication) {
+ from components.java
+ }
+ }
+}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 3d0dee6..7454180 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 508df78..2ec77e5 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Sun Mar 15 19:58:12 CET 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip
diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755
index 91a7e26..1b6c787
--- a/gradlew
+++ b/gradlew
@@ -1,79 +1,129 @@
-#!/usr/bin/env bash
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
+APP_BASE_NAME=${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='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
-warn ( ) {
+warn () {
echo "$*"
-}
+} >&2
-die ( ) {
+die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# 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\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
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"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -82,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
- JAVACMD="java"
+ 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
@@ -90,75 +140,95 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "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
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
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
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
-# 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"`
-
- # 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\""
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
fi
- i=$((i+1))
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
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
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 8a0b282..107acd3 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -8,20 +24,23 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@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=
-
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@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="-Xmx64m" "-Xms64m"
+
@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
+if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-if exist "%JAVA_EXE%" goto init
+if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,34 +64,14 @@ echo location of your Java installation.
goto fail
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_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=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-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%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
diff --git a/settings.gradle b/settings.gradle
index b805aab..39b7886 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,19 +1,2 @@
-/*
- * This settings file was auto generated by the Gradle buildInit task
- * by 'Juergen' at '15.03.15 19:57' with Gradle 1.11
- *
- * The settings file is used to specify which projects to include in your build.
- * In a single project build this file can be empty or even removed.
- *
- * Detailed information about configuring a multi-project build in Gradle can be found
- * in the user guide at http://gradle.org/docs/1.11/userguide/multi_project_builds.html
- */
-
-/*
-// To declare projects as part of a multi-project build use the 'include' method
-include 'shared'
-include 'api'
-include 'services:webservice'
-*/
-
rootProject.name = 'SmartGattLib'
+
diff --git a/src-gen/main/java/com/movisens/smartgattlib/Characteristics.java b/src-gen/main/java/com/movisens/smartgattlib/Characteristics.java
new file mode 100644
index 0000000..910649b
--- /dev/null
+++ b/src-gen/main/java/com/movisens/smartgattlib/Characteristics.java
@@ -0,0 +1,469 @@
+package com.movisens.smartgattlib;
+
+import java.util.Collection;
+import java.util.UUID;
+
+import com.movisens.smartgattlib.attributes.DefaultAttribute;
+import com.movisens.smartgattlib.helper.Characteristic;
+import com.movisens.smartgattlib.helper.UuidObjectMap;
+import com.movisens.smartgattlib.helper.AbstractAttribute;
+import com.movisens.smartgattlib.attributes.*;
+
+public class Characteristics
+{
+
+ public static final Characteristic DEFAULT = new Characteristic("0000", "Default Characteristic", DefaultAttribute.class);
+ public static final Characteristic LONGITUDE = new Characteristic("2aaf", "Longitude", DefaultAttribute.class);
+ public static final Characteristic MAGNETIC_FLUX_DENSITY_2D = new Characteristic("2aa0", "Magnetic Flux Density - 2D", DefaultAttribute.class);
+ public static final Characteristic MAGNETIC_FLUX_DENSITY_3D = new Characteristic("2aa1", "Magnetic Flux Density - 3D", DefaultAttribute.class);
+ public static final Characteristic AEROBIC_HEART_RATE_LOWER_LIMIT = new Characteristic("2a7e", "Aerobic Heart Rate Lower Limit", DefaultAttribute.class);
+ public static final Characteristic AEROBIC_HEART_RATE_UPPER_LIMIT = new Characteristic("2a84", "Aerobic Heart Rate Upper Limit", DefaultAttribute.class);
+ public static final Characteristic AEROBIC_THRESHOLD = new Characteristic("2a7f", "Aerobic Threshold", DefaultAttribute.class);
+ public static final Characteristic AGE = new Characteristic("2a80", "Age", Age.class);
+ public static final Characteristic AGGREGATE = new Characteristic("2a5a", "Aggregate", DefaultAttribute.class);
+ public static final Characteristic ALERT_CATEGORY_ID = new Characteristic("2a43", "Alert Category ID", DefaultAttribute.class);
+ public static final Characteristic ALERT_CATEGORY_ID_BIT_MASK = new Characteristic("2a42", "Alert Category ID Bit Mask", DefaultAttribute.class);
+ public static final Characteristic ALERT_LEVEL = new Characteristic("2a06", "Alert Level", DefaultAttribute.class);
+ public static final Characteristic ALERT_NOTIFICATION_CONTROL_POINT = new Characteristic("2a44", "Alert Notification Control Point", DefaultAttribute.class);
+ public static final Characteristic ALERT_STATUS = new Characteristic("2a3f", "Alert Status", DefaultAttribute.class);
+ public static final Characteristic ALTITUDE = new Characteristic("2ab3", "Altitude", DefaultAttribute.class);
+ public static final Characteristic ANAEROBIC_HEART_RATE_LOWER_LIMIT = new Characteristic("2a81", "Anaerobic Heart Rate Lower Limit", DefaultAttribute.class);
+ public static final Characteristic ANAEROBIC_HEART_RATE_UPPER_LIMIT = new Characteristic("2a82", "Anaerobic Heart Rate Upper Limit", DefaultAttribute.class);
+ public static final Characteristic ANAEROBIC_THRESHOLD = new Characteristic("2a83", "Anaerobic Threshold", DefaultAttribute.class);
+ public static final Characteristic ANALOG = new Characteristic("2a58", "Analog", DefaultAttribute.class);
+ public static final Characteristic ANALOG_OUTPUT = new Characteristic("2a59", "Analog Output", DefaultAttribute.class);
+ public static final Characteristic APPARENT_WIND_DIRECTION = new Characteristic("2a73", "Apparent Wind Direction", DefaultAttribute.class);
+ public static final Characteristic APPARENT_WIND_SPEED = new Characteristic("2a72", "Apparent Wind Speed", DefaultAttribute.class);
+ public static final Characteristic APPEARANCE = new Characteristic("2a01", "Appearance", Appearance.class);
+ public static final Characteristic BAROMETRIC_PRESSURE_TREND = new Characteristic("2aa3", "Barometric Pressure Trend", DefaultAttribute.class);
+ public static final Characteristic BATTERY_LEVEL = new Characteristic("2a19", "Battery Level", BatteryLevel.class);
+ public static final Characteristic BATTERY_LEVEL_STATE = new Characteristic("2a1b", "Battery Level State", DefaultAttribute.class);
+ public static final Characteristic BATTERY_POWER_STATE = new Characteristic("2a1a", "Battery Power State", DefaultAttribute.class);
+ public static final Characteristic BLOOD_PRESSURE_FEATURE = new Characteristic("2a49", "Blood Pressure Feature", DefaultAttribute.class);
+ public static final Characteristic BLOOD_PRESSURE_MEASUREMENT = new Characteristic("2a35", "Blood Pressure Measurement", DefaultAttribute.class);
+ public static final Characteristic BODY_COMPOSITION_FEATURE = new Characteristic("2a9b", "Body Composition Feature", DefaultAttribute.class);
+ public static final Characteristic BODY_COMPOSITION_MEASUREMENT = new Characteristic("2a9c", "Body Composition Measurement", DefaultAttribute.class);
+ public static final Characteristic BODY_SENSOR_LOCATION = new Characteristic("2a38", "Body Sensor Location", BodySensorLocation.class);
+ public static final Characteristic BOND_MANAGEMENT_CONTROL_POINT = new Characteristic("2aa4", "Bond Management Control Point", DefaultAttribute.class);
+ public static final Characteristic BOND_MANAGEMENT_FEATURE = new Characteristic("2aa5", "Bond Management Features", DefaultAttribute.class);
+ public static final Characteristic BOOT_KEYBOARD_INPUT_REPORT = new Characteristic("2a22", "Boot Keyboard Input Report", DefaultAttribute.class);
+ public static final Characteristic BOOT_KEYBOARD_OUTPUT_REPORT = new Characteristic("2a32", "Boot Keyboard Output Report", DefaultAttribute.class);
+ public static final Characteristic BOOT_MOUSE_INPUT_REPORT = new Characteristic("2a33", "Boot Mouse Input Report", DefaultAttribute.class);
+ public static final Characteristic CGM_FEATURE = new Characteristic("2aa8", "CGM Feature", DefaultAttribute.class);
+ public static final Characteristic CGM_MEASUREMENT = new Characteristic("2aa7", "CGM Measurement", DefaultAttribute.class);
+ public static final Characteristic CGM_SESSION_RUN_TIME = new Characteristic("2aab", "CGM Session Run Time", DefaultAttribute.class);
+ public static final Characteristic CGM_SESSION_START_TIME = new Characteristic("2aaa", "CGM Session Start Time", DefaultAttribute.class);
+ public static final Characteristic CGM_SPECIFIC_OPS_CONTROL_POINT = new Characteristic("2aac", "CGM Specific Ops Control Point", DefaultAttribute.class);
+ public static final Characteristic CGM_STATUS = new Characteristic("2aa9", "CGM Status", DefaultAttribute.class);
+ public static final Characteristic CROSS_TRAINER_DATA = new Characteristic("2ace", "Cross Trainer Data", DefaultAttribute.class);
+ public static final Characteristic CSC_FEATURE = new Characteristic("2a5c", "CSC Feature", DefaultAttribute.class);
+ public static final Characteristic CSC_MEASUREMENT = new Characteristic("2a5b", "CSC Measurement", CscMeasurement.class);
+ public static final Characteristic CURRENT_TIME = new Characteristic("2a2b", "Current Time", DefaultAttribute.class);
+ public static final Characteristic CYCLING_POWER_CONTROL_POINT = new Characteristic("2a66", "Cycling Power Control Point", DefaultAttribute.class);
+ public static final Characteristic CYCLING_POWER_FEATURE = new Characteristic("2a65", "Cycling Power Feature", DefaultAttribute.class);
+ public static final Characteristic CYCLING_POWER_MEASUREMENT = new Characteristic("2a63", "Cycling Power Measurement", DefaultAttribute.class);
+ public static final Characteristic CYCLING_POWER_VECTOR = new Characteristic("2a64", "Cycling Power Vector", DefaultAttribute.class);
+ public static final Characteristic DATABASE_CHANGE_INCREMENT = new Characteristic("2a99", "Database Change Increment", DefaultAttribute.class);
+ public static final Characteristic DATE_OF_BIRTH = new Characteristic("2a85", "Date of Birth", DateOfBirth.class);
+ public static final Characteristic DATE_OF_THRESHOLD_ASSESSMENT = new Characteristic("2a86", "Date of Threshold Assessment", DefaultAttribute.class);
+ public static final Characteristic DATE_TIME = new Characteristic("2a08", "Date Time", DefaultAttribute.class);
+ public static final Characteristic DAY_DATE_TIME = new Characteristic("2a0a", "Day Date Time", DefaultAttribute.class);
+ public static final Characteristic DAY_OF_WEEK = new Characteristic("2a09", "Day of Week", DefaultAttribute.class);
+ public static final Characteristic DESCRIPTOR_VALUE_CHANGED = new Characteristic("2a7d", "Descriptor Value Changed", DefaultAttribute.class);
+ public static final Characteristic DEVICE_NAME = new Characteristic("2a00", "Device Name", DeviceName.class);
+ public static final Characteristic DEW_POINT = new Characteristic("2a7b", "Dew Point", DefaultAttribute.class);
+ public static final Characteristic DIGITAL = new Characteristic("2a56", "Digital", DefaultAttribute.class);
+ public static final Characteristic DIGITAL_OUTPUT = new Characteristic("2a57", "Digital Output", DefaultAttribute.class);
+ public static final Characteristic DST_OFFSET = new Characteristic("2a0d", "DST Offset", DefaultAttribute.class);
+ public static final Characteristic ELEVATION = new Characteristic("2a6c", "Elevation", DefaultAttribute.class);
+ public static final Characteristic EMAIL_ADDRESS = new Characteristic("2a87", "Email Address", DefaultAttribute.class);
+ public static final Characteristic EXACT_TIME_100 = new Characteristic("2a0b", "Exact Time 100", DefaultAttribute.class);
+ public static final Characteristic EXACT_TIME_256 = new Characteristic("2a0c", "Exact Time 256", DefaultAttribute.class);
+ public static final Characteristic FAT_BURN_HEART_RATE_LOWER_LIMIT = new Characteristic("2a88", "Fat Burn Heart Rate Lower Limit", DefaultAttribute.class);
+ public static final Characteristic FAT_BURN_HEART_RATE_UPPER_LIMIT = new Characteristic("2a89", "Fat Burn Heart Rate Upper Limit", DefaultAttribute.class);
+ public static final Characteristic FIRMWARE_REVISION_STRING = new Characteristic("2a26", "Firmware Revision String", FirmwareRevisionString.class);
+ public static final Characteristic FIRST_NAME = new Characteristic("2a8a", "First Name", DefaultAttribute.class);
+ public static final Characteristic FITNESS_MACHINE_CONTROL_POINT = new Characteristic("2ad9", "Fitness Machine Control Point", DefaultAttribute.class);
+ public static final Characteristic FITNESS_MACHINE_FEATURE = new Characteristic("2acc", "Fitness Machine Feature", DefaultAttribute.class);
+ public static final Characteristic FITNESS_MACHINE_STATUS = new Characteristic("2ada", "Fitness Machine Status", DefaultAttribute.class);
+ public static final Characteristic FIVE_ZONE_HEART_RATE_LIMITS = new Characteristic("2a8b", "Five Zone Heart Rate Limits", DefaultAttribute.class);
+ public static final Characteristic FLOOR_NUMBER = new Characteristic("2ab2", "Floor Number", DefaultAttribute.class);
+ public static final Characteristic GENDER = new Characteristic("2a8c", "Gender", Gender.class);
+ public static final Characteristic GLUCOSE_FEATURE = new Characteristic("2a51", "Glucose Feature", DefaultAttribute.class);
+ public static final Characteristic GLUCOSE_MEASUREMENT = new Characteristic("2a18", "Glucose Measurement", DefaultAttribute.class);
+ public static final Characteristic GLUCOSE_MEASUREMENT_CONTEXT = new Characteristic("2a34", "Glucose Measurement Context", DefaultAttribute.class);
+ public static final Characteristic GUST_FACTOR = new Characteristic("2a74", "Gust Factor", DefaultAttribute.class);
+ public static final Characteristic HARDWARE_REVISION_STRING = new Characteristic("2a27", "Hardware Revision String", DefaultAttribute.class);
+ public static final Characteristic HEART_RATE_CONTROL_POINT = new Characteristic("2a39", "Heart Rate Control Point", DefaultAttribute.class);
+ public static final Characteristic HEART_RATE_MAX = new Characteristic("2a8d", "Heart Rate Max", DefaultAttribute.class);
+ public static final Characteristic HEART_RATE_MEASUREMENT = new Characteristic("2a37", "Heart Rate Measurement", HeartRateMeasurement.class);
+ public static final Characteristic HEAT_INDEX = new Characteristic("2a7a", "Heat Index", DefaultAttribute.class);
+ public static final Characteristic HEIGHT = new Characteristic("2a8e", "Height", Height.class);
+ public static final Characteristic HID_CONTROL_POINT = new Characteristic("2a4c", "HID Control Point", DefaultAttribute.class);
+ public static final Characteristic HID_INFORMATION = new Characteristic("2a4a", "HID Information", DefaultAttribute.class);
+ public static final Characteristic HIP_CIRCUMFERENCE = new Characteristic("2a8f", "Hip Circumference", DefaultAttribute.class);
+ public static final Characteristic HTTP_CONTROL_POINT = new Characteristic("2aba", "HTTP Control Point", DefaultAttribute.class);
+ public static final Characteristic HTTP_ENTITY_BODY = new Characteristic("2ab9", "HTTP Entity Body", DefaultAttribute.class);
+ public static final Characteristic HTTP_HEADERS = new Characteristic("2ab7", "HTTP Headers", DefaultAttribute.class);
+ public static final Characteristic HTTP_STATUS_CODE = new Characteristic("2ab8", "HTTP Status Code", DefaultAttribute.class);
+ public static final Characteristic HTTPS_SECURITY = new Characteristic("2abb", "HTTPS Security", DefaultAttribute.class);
+ public static final Characteristic HUMIDITY = new Characteristic("2a6f", "Humidity", DefaultAttribute.class);
+ public static final Characteristic IEEE_11073_20601_REGULATORY_CERTIFICATION_DATA_LIST = new Characteristic("2a2a", "IEEE 11073-20601 Regulatory Certification Data List", DefaultAttribute.class);
+ public static final Characteristic INDOOR_BIKE_DATA = new Characteristic("2ad2", "Indoor Bike Data", DefaultAttribute.class);
+ public static final Characteristic INDOOR_POSITIONING_CONFIGURATION = new Characteristic("2aad", "Indoor Positioning Configuration", DefaultAttribute.class);
+ public static final Characteristic INTERMEDIATE_CUFF_PRESSURE = new Characteristic("2a36", "Intermediate Cuff Pressure", DefaultAttribute.class);
+ public static final Characteristic INTERMEDIATE_TEMPERATURE = new Characteristic("2a1e", "Intermediate Temperature", DefaultAttribute.class);
+ public static final Characteristic IRRADIANCE = new Characteristic("2a77", "Irradiance", DefaultAttribute.class);
+ public static final Characteristic LANGUAGE = new Characteristic("2aa2", "Language", DefaultAttribute.class);
+ public static final Characteristic LAST_NAME = new Characteristic("2a90", "Last Name", DefaultAttribute.class);
+ public static final Characteristic LATITUDE = new Characteristic("2aae", "Latitude", DefaultAttribute.class);
+ public static final Characteristic LN_CONTROL_POINT = new Characteristic("2a6b", "LN Control Point", DefaultAttribute.class);
+ public static final Characteristic LN_FEATURE = new Characteristic("2a6a", "LN Feature", DefaultAttribute.class);
+ public static final Characteristic LOCAL_EAST_COORDINATE = new Characteristic("2ab1", "Local East Coordinate", DefaultAttribute.class);
+ public static final Characteristic LOCAL_NORTH_COORDINATE = new Characteristic("2ab0", "Local North Coordinate", DefaultAttribute.class);
+ public static final Characteristic LOCAL_TIME_INFORMATION = new Characteristic("2a0f", "Local Time Information", DefaultAttribute.class);
+ public static final Characteristic LOCATION_AND_SPEED = new Characteristic("2a67", "Location and Speed Characteristic", DefaultAttribute.class);
+ public static final Characteristic LOCATION_NAME = new Characteristic("2ab5", "Location Name", DefaultAttribute.class);
+ public static final Characteristic MAGNETIC_DECLINATION = new Characteristic("2a2c", "Magnetic Declination", DefaultAttribute.class);
+ public static final Characteristic MANUFACTURER_NAME_STRING = new Characteristic("2a29", "Manufacturer Name String", ManufacturerNameString.class);
+ public static final Characteristic MAXIMUM_RECOMMENDED_HEART_RATE = new Characteristic("2a91", "Maximum Recommended Heart Rate", DefaultAttribute.class);
+ public static final Characteristic MEASUREMENT_INTERVAL = new Characteristic("2a21", "Measurement Interval", DefaultAttribute.class);
+ public static final Characteristic MODEL_NUMBER_STRING = new Characteristic("2a24", "Model Number String", ModelNumberString.class);
+ public static final Characteristic NAVIGATION = new Characteristic("2a68", "Navigation", DefaultAttribute.class);
+ public static final Characteristic NETWORK_AVAILABILITY = new Characteristic("2a3e", "Network Availability", DefaultAttribute.class);
+ public static final Characteristic NEW_ALERT = new Characteristic("2a46", "New Alert", DefaultAttribute.class);
+ public static final Characteristic OBJECT_ACTION_CONTROL_POINT = new Characteristic("2ac5", "Object Action Control Point", DefaultAttribute.class);
+ public static final Characteristic OBJECT_CHANGED = new Characteristic("2ac8", "Object Changed", DefaultAttribute.class);
+ public static final Characteristic OBJECT_FIRST_CREATED = new Characteristic("2ac1", "Object First-Created", DefaultAttribute.class);
+ public static final Characteristic OBJECT_ID = new Characteristic("2ac3", "Object ID", DefaultAttribute.class);
+ public static final Characteristic OBJECT_LAST_MODIFIED = new Characteristic("2ac2", "Object Last-Modified", DefaultAttribute.class);
+ public static final Characteristic OBJECT_LIST_CONTROL_POINT = new Characteristic("2ac6", "Object List Control Point", DefaultAttribute.class);
+ public static final Characteristic OBJECT_LIST_FILTER = new Characteristic("2ac7", "Object List Filter", DefaultAttribute.class);
+ public static final Characteristic