diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs
index e889521..2be73b5 100644
--- a/.settings/org.eclipse.buildship.core.prefs
+++ b/.settings/org.eclipse.buildship.core.prefs
@@ -1,2 +1,13 @@
+arguments=
+auto.sync=false
+build.scans.enabled=false
+connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
+gradle.user.home=
+java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
+jvm.arguments=
+offline.mode=false
+override.workspace.settings=true
+show.console.view=true
+show.executions.view=true
diff --git a/README.md b/README.md
index 6e6358c..23e00de 100644
--- a/README.md
+++ b/README.md
@@ -27,10 +27,12 @@
A high-level SDK for interacting with the XYO network.
Including BLE, TCP/IP, Bound Witnessing, and Bridging. Use this instead of `sdk-core-kotlin` for integration with your app project.
+> As you are developing on the SDK, be sure to keep an eye out for updates, as they may include core and ble updates
+
## Gradle Build
```gradle
- compile 'network.xyo:sdk-xyo-android:3.1.31'
+ compile 'network.xyo:sdk-xyo-android:3.1.34'
```
## Maven Build
@@ -39,12 +41,33 @@ Including BLE, TCP/IP, Bound Witnessing, and Bridging. Use this instead of `sdk
network.xyo
sdk-xyo-android
- 3.1.26
+ 3.1.34
pom
```
+## Permissions and Set Up
+
+When using Android Studio and an Android device to test BLE Client and Server be sure to enable permissions and add an initialization function in your `MainActivity`
+
+`AndroidManifest.xml`
+
+```xml
+
+
+
+```
+
+`MainActivity.kt`
+
+```kotlin
+GlobalScope.launch {
+ // place initialization function here for node build needed
+ // you can look at the sample app for code example
+}
+```
+
## Examples
Copy this code to test. Look below for specific usage.
diff --git a/build.gradle b/build.gradle
index f26a3a2..7a9318d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,8 +19,8 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.5.3'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
+ classpath 'com.android.tools.build:gradle:3.6.2'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
// NOTE: Do not place your application dependencies here; they belong
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e7f51e4..920f9f3 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
diff --git a/xyo-android-library/build.gradle b/xyo-android-library/build.gradle
index 3eb34af..64c1177 100644
--- a/xyo-android-library/build.gradle
+++ b/xyo-android-library/build.gradle
@@ -52,6 +52,7 @@ task printVersion {
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
+ ndkVersion "21.0.6113669"
versionProps['VERSION_PATCH'] = patch.toString()
versionProps.store(versionPropsFile.newWriter(), null)
@@ -150,13 +151,13 @@ ktlint {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61"
- implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.61"
+ implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.72"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'network.xyo:sdk-base-android:2.1.288'
- implementation 'network.xyo:sdk-ble-android:3.1.1144'
- implementation 'network.xyo:sdk-core-kotlin:3.0.42'
+ implementation 'network.xyo:sdk-ble-android:3.1.1145'
+ implementation 'network.xyo:sdk-core-kotlin:3.0.44'
implementation 'com.snappydb:snappydb-lib:0.5.2'
api 'org.bouncycastle:bcpkix-jdk15on:1.64'
}
diff --git a/xyo-android-library/src/main/java/network/xyo/sdk/XyoBleClient.kt b/xyo-android-library/src/main/java/network/xyo/sdk/XyoBleClient.kt
index fe7e3a0..e12c5d6 100644
--- a/xyo-android-library/src/main/java/network/xyo/sdk/XyoBleClient.kt
+++ b/xyo-android-library/src/main/java/network/xyo/sdk/XyoBleClient.kt
@@ -1,5 +1,8 @@
+@file:Suppress("SpellCheckingInspection")
+
package network.xyo.sdk
import android.content.Context
+import android.util.Log
import java.util.*
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
@@ -42,51 +45,67 @@ class XyoBleClient(
var lastBoundWitnessTime = Date().time - minBWTimeGap // ten seconds ago
- var scanner: XYSmartScanModern
+ private var scanner: XYSmartScanModern
private val boundWitnessMutex = Mutex()
override var scan: Boolean
- get() { return scanner.started() }
+ get() {
+// val tag = "TAG "
+// Log.i(tag, "Does this scan??")
+ return scanner.started()
+ }
set(value) {
GlobalScope.launch {
if (value && !scanner.started()) {
+ val tag = "TAG "
+ Log.i(tag, "Does this trigger a start??")
scanner.start()
+ Log.i(tag, "Is this scanner working?? $scanner")
} else if (!value && scanner.started()) {
+ val tag = "TAG "
+ Log.i(tag, "Does this trigger a stop??")
scanner.stop()
}
}
}
private val scannerListener = object : XYSmartScan.Listener() {
+// override fun onStart
override fun entered(device: XYBluetoothDevice) {
+ val tag = "TAG "
super.entered(device)
deviceCount++
- if (device is XyoBluetoothClient) {
- log.info("Xyo Device Entered: ${device.id}")
- xyoDeviceCount++
- }
+ Log.i(tag,"Xyo Device Entered: ${device.id}")
+ xyoDeviceCount++
}
override fun exited(device: XYBluetoothDevice) {
+ val tag = "TAG "
super.exited(device)
deviceCount--
- if (device is XyoBluetoothClient) {
- log.info("Xyo Device Exited: ${device.id}")
- xyoDeviceCount--
- }
+ Log.i(tag, "Xyo Device Exited: ${device.id}")
+ xyoDeviceCount--
}
override fun detected(device: XYBluetoothDevice) {
+ val tag = "TAG "
super.detected(device)
+ Log.i(tag, "do we even get a device here? $device")
+ Log.i(tag, "are we detecting anything??")
if (this@XyoBleClient.autoBoundWitness) {
+ Log.i(tag, "hello ?? $autoBoundWitness")
if (Date().time - lastBoundWitnessTime > minBWTimeGap) {
+ Log.i(tag, "hello again ???")
(device as? XyoBluetoothClient)?.let { client ->
+ Log.i(tag, "Hello again again???")
device.rssi?.let { rssi ->
+ Log.i(tag, "Hello wtf 3???")
if (rssi < minimumRssi) {
log.info("Rssi too low: $rssi")
return
}
(client as? XyoBridgeX)?.let {
+ Log.i(tag, "Hello one more time???")
if (!supportBridgeX) {
log.info("BridgeX not Supported: $rssi")
return
@@ -111,6 +130,8 @@ class XyoBleClient(
suspend fun tryBoundWitnessWithDevice(device: XyoBluetoothClient) {
if (boundWitnessMutex.tryLock()) {
+ val tag = "TAG "
+ Log.i(tag, "is there a bound witness attempt here?")
boundWitnessStarted(device)
var errorMessage: String? = null
diff --git a/xyo-android-library/version.properties b/xyo-android-library/version.properties
index 0f62125..23c0a35 100644
--- a/xyo-android-library/version.properties
+++ b/xyo-android-library/version.properties
@@ -1,2 +1,2 @@
-#Fri Apr 10 00:51:29 UTC 2020
-VERSION_PATCH=33
+#Wed Apr 22 22:10:21 UTC 2020
+VERSION_PATCH=34
diff --git a/xyo-android-sample/build.gradle b/xyo-android-sample/build.gradle
index 8880a4a..af57677 100644
--- a/xyo-android-sample/build.gradle
+++ b/xyo-android-sample/build.gradle
@@ -7,6 +7,7 @@ apply plugin: 'maven-publish'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
+ ndkVersion "21.0.6113669"
defaultConfig {
applicationId "network.xyo.sdk.sample"
minSdkVersion 21
@@ -20,6 +21,13 @@ android {
targetCompatibility = 1.8
}
+ lintOptions {
+ htmlReport false
+ abortOnError true
+ warningsAsErrors true
+ disable "HardwareIds", "MissingPermission"
+ }
+
kotlinOptions {
jvmTarget = "1.8"
}
@@ -33,23 +41,27 @@ android {
debuggable true
}
}
+
+ configurations {
+ all {
+ exclude group: 'org.json', module: 'json'
+ }
+ }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61"
- implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.61"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61"
+ implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.72"
implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'androidx.core:core-ktx:1.1.0'
- implementation 'com.google.android.material:material:1.0.0'
+ implementation 'androidx.core:core-ktx:1.2.0'
+ implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
- implementation 'androidx.navigation:navigation-fragment:2.1.0'
- implementation 'androidx.navigation:navigation-ui:2.1.0'
- implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
- implementation 'androidx.navigation:navigation-fragment-ktx:2.1.0'
- implementation 'androidx.navigation:navigation-ui-ktx:2.1.0'
+ implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
+ implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
+ implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
implementation 'network.xyo:sdk-base-android:2.1.288'
- implementation 'network.xyo:sdk-ble-android:3.1.1144'
- implementation 'network.xyo:sdk-core-kotlin:3.0.42'
+ implementation 'network.xyo:sdk-ble-android:3.1.1145'
+ implementation 'network.xyo:sdk-core-kotlin:3.0.44'
implementation project(':xyo-android-library')
}
diff --git a/xyo-android-sample/gradle/wrapper/gradle-wrapper.properties b/xyo-android-sample/gradle/wrapper/gradle-wrapper.properties
index 1889b97..dba71f7 100644
--- a/xyo-android-sample/gradle/wrapper/gradle-wrapper.properties
+++ b/xyo-android-sample/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Nov 22 08:51:11 PST 2019
+#Mon Apr 13 13:11:06 PDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
diff --git a/xyo-android-sample/gradlew b/xyo-android-sample/gradlew
old mode 100644
new mode 100755
diff --git a/xyo-android-sample/src/main/java/network/xyo/sdk/sample/MainActivity.kt b/xyo-android-sample/src/main/java/network/xyo/sdk/sample/MainActivity.kt
index 2bfd728..3a02a31 100644
--- a/xyo-android-sample/src/main/java/network/xyo/sdk/sample/MainActivity.kt
+++ b/xyo-android-sample/src/main/java/network/xyo/sdk/sample/MainActivity.kt
@@ -3,6 +3,7 @@ package network.xyo.sdk.sample
import android.content.Context
import android.content.pm.PackageManager
import android.location.LocationManager
+import android.util.Log
import android.os.Bundle
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
@@ -27,11 +28,11 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GlobalScope.launch {
- initializeXyoSimpleWithGps()
+// initializeXyoSimpleWithGps()
//initializeXyoSimple()
- //initializeXyoBleClientOnly()
+// initializeXyoBleClientOnly()
//initializeXyoBleServerOnly()
- //initializeXyoBleOnly()
+ initializeXyoBleOnly()
ui {
setContentView(R.layout.activity_main)
val navView: BottomNavigationView = findViewById(R.id.nav_view)
@@ -85,11 +86,14 @@ class MainActivity : AppCompatActivity() {
private suspend fun initializeXyoBleClientOnly() {
val builder = XyoNodeBuilder()
+ val tag = "TAG: "
node = builder.build(this)
(node.networks["ble"] as? XyoBleNetwork)?.let { network ->
+ Log.i(tag, "Ble? Hello? ")
network.client.autoBridge = true
network.client.autoBoundWitness = true
network.client.scan = true
+ Log.i(tag, "Client Scan? $network.client.scan ")
network.server.autoBridge = false
network.server.listen = false
}