Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Feb 3, 2021
2 parents 00443dc + dc205cc commit 1688658
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 77 deletions.
53 changes: 3 additions & 50 deletions ble-android-library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'

group = 'network.xyo'

Expand Down Expand Up @@ -113,53 +111,6 @@ android {
}
}

publishing {
publications {
Production(MavenPublication) {
artifact("$buildDir/outputs/aar/ble-android-library-release.aar")
groupId 'network.xyo'
artifactId 'sdk-ble-android'
version verString

//The publication doesn't know about our dependencies, so we have to manually add them to the pom
pom.withXml {
def dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
dryRun = false
override = false
publish = true
pkg {
repo = 'xyo'
name = 'sdk-ble-android'
userOrg = 'xyoraclenetwork'
licenses = ['LGPL-3.0']
desc = 'Android Base Classes'
vcsUrl = 'https://github.com/xyoraclenetwork/sdk-ble-android.git'

version {
name = verString
vcsTag = verString
}
}
publications = ['Production']
}

ktlint {
disabledRules = ["no-wildcard-imports"]
}
Expand All @@ -168,9 +119,11 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.21'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.4.21'
implementation 'network.xyo:sdk-base-android:4.1.5'
implementation 'com.github.XYOracleNetwork:sdk-base-android:4.2.12'
implementation 'org.jetbrains:annotations:17.0.0'
implementation 'org.bouncycastle:bcpkix-jdk15on:1.64'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
implementation "androidx.annotation:annotation:1.1.0"
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { task ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import kotlin.math.pow
import network.xyo.base.XYBase
import network.xyo.ble.generic.devices.XYBluetoothDevice
import network.xyo.ble.generic.devices.XYCreator
import network.xyo.ble.generic.listeners.XYBluetoothDeviceListener
import network.xyo.ble.generic.scanner.XYScanResult

/**
Expand Down Expand Up @@ -133,7 +132,7 @@ open class XYIBeaconBluetoothDevice(context: Context, val scanResult: XYScanResu
UUID(high, low)
} catch (ex: BufferUnderflowException) {
// can throw a BufferUnderflowException if the beacon sends an invalid value for UUID.
log.error("BufferUnderflowException: $ex", true)
this.log.error("BufferUnderflowException: $ex", true)
return null
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import network.xyo.ble.generic.services.standard.*
import network.xyo.ble.listeners.XYFinderBluetoothDeviceListener
import network.xyo.ble.reporters.XYFinderBluetoothDeviceReporter
import network.xyo.ble.services.xy.*
import kotlinx.coroutines.*

/**
* Listener for XY3 Devices.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package network.xyo.ble.generic.gatt.peripheral
import android.bluetooth.*
import android.content.Context
import android.os.Handler
import com.jaredrummler.android.device.BuildConfig
import java.util.UUID
import java.util.concurrent.Executors
import java.lang.RuntimeException
Expand Down Expand Up @@ -314,7 +313,7 @@ open class XYBluetoothGatt protected constructor(

protected suspend fun readCharacteristic(characteristicToRead: BluetoothGattCharacteristic, timeout: Long = 10000) = queueBle(timeout, "readCharacteristic") {
log.info("readCharacteristic")
if(BuildConfig.DEBUG && connection?.state != BluetoothGatt.STATE_CONNECTED)
if(connection?.state != BluetoothGatt.STATE_CONNECTED)
throw RuntimeException("cannot read characteristic")
val gatt = connection?.gatt
if (gatt != null) {
Expand All @@ -332,7 +331,7 @@ open class XYBluetoothGatt protected constructor(
) = queueBle(timeout, "writeCharacteristic") {

log.info("writeCharacteristic")
if(BuildConfig.DEBUG && connection?.state != BluetoothGatt.STATE_CONNECTED)
if(connection?.state != BluetoothGatt.STATE_CONNECTED)
throw RuntimeException("cannot read characteristic")
val gatt = connection?.gatt
if (gatt != null) {
Expand Down Expand Up @@ -362,7 +361,7 @@ open class XYBluetoothGatt protected constructor(

protected suspend fun writeDescriptor(descriptorToWrite: BluetoothGattDescriptor, timeout: Long = 1100) = queueBle(timeout, "writeDescriptor") {
log.info("writeDescriptor")
if(BuildConfig.DEBUG && connection?.state != BluetoothGatt.STATE_CONNECTED)
if(connection?.state != BluetoothGatt.STATE_CONNECTED)
throw RuntimeException("cannot read characteristic")
val gatt = connection?.gatt
if (gatt != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import android.bluetooth.BluetoothGattService
import android.content.Context
import android.os.Build
import android.os.Handler
import com.jaredrummler.android.device.BuildConfig
import kotlinx.coroutines.*
import network.xyo.ble.generic.gatt.peripheral.*
import network.xyo.ble.utilities.XYCallByVersion
Expand Down Expand Up @@ -99,7 +98,7 @@ class XYBluetoothGattConnect(
val handler = null
var error = XYBluetoothResultErrorCode.None

if(BuildConfig.DEBUG && gatt == null)
if(gatt == null)
throw RuntimeException("cannot read characteristic")

val result = asyncBle {
Expand Down Expand Up @@ -128,7 +127,7 @@ class XYBluetoothGattConnect(

private suspend fun discover() = GlobalScope.async {
log.info("discover")
if(BuildConfig.DEBUG && state != BluetoothGatt.STATE_CONNECTED)
if(state != BluetoothGatt.STATE_CONNECTED)
throw RuntimeException("cannot read characteristic")
val gatt = this@XYBluetoothGattConnect.gatt // make thread safe
if (gatt != null) {
Expand Down
4 changes: 2 additions & 2 deletions ble-android-library/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Fri Jan 29 21:56:44 UTC 2021
VERSION_PATCH=13
#Wed Feb 03 21:47:42 UTC 2021
VERSION_PATCH=14
2 changes: 1 addition & 1 deletion ble-android-sample-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.2.1'
implementation project(':ble-android-library')
api 'network.xyo:sdk-base-android:4.1.5'
implementation 'com.github.XYOracleNetwork:sdk-base-android:4.2.12'
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
import android.view.ViewGroup;
import android.widget.TextView;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import network.xyo.ble.generic.scanner.XYSmartScanListener;
import network.xyo.ble.utilities.XYPromise;
import network.xyo.ble.devices.xy.XY2BluetoothDevice;
Expand Down Expand Up @@ -85,7 +82,7 @@ protected void onCreate(Bundle savedInstanceState) {
XY2BluetoothDevice.Companion.enable(true);
}

private void setupRecyclerView(@NotNull RecyclerView recyclerView) {
private void setupRecyclerView(RecyclerView recyclerView) {
recyclerView.setAdapter(new SimpleItemRecyclerViewAdapter(this, mTwoPane));
}

Expand All @@ -108,7 +105,7 @@ private XYSmartScanPromise getScanner() {
protected void onPause() {
getScanner().stop(new XYPromise<Boolean>() {
@Override
public void resolve(@Nullable Boolean value) {
public void resolve(Boolean value) {
super.resolve(value);
}
});
Expand Down Expand Up @@ -145,22 +142,21 @@ public void onClick(View view) {

parent.getScanner().getScanner().addListener("Wrapper", new XYSmartScanListener() {
@Override
public void entered(@NotNull XYBluetoothDevice device) {
public void entered(XYBluetoothDevice device) {
super.entered(device);
mValues.add(device);
mParentActivity.runOnUiThread(() -> notifyDataSetChanged());
}

@Override
public void exited(@NotNull XYBluetoothDevice device) {
public void exited(XYBluetoothDevice device) {
super.exited(device);
mValues.remove(device);
mParentActivity.runOnUiThread(() -> notifyDataSetChanged());
}
});
}

@NotNull
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
Expand Down
5 changes: 3 additions & 2 deletions ble-android-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-beta03'
classpath 'com.android.tools.build:gradle:4.2.0-beta04'
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
}
}
Expand All @@ -71,10 +71,11 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.21'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.4.21'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
implementation 'com.google.android.material:material:1.3.0-rc01'
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation "com.nabinbhandari.android:permissions:3.8"
implementation 'network.xyo:sdk-base-android:4.1.5'
implementation 'com.github.XYOracleNetwork:sdk-base-android:4.2.12'
implementation project(':ble-android-library')
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.ViewPager
import com.google.android.material.tabs.TabLayout
import network.xyo.base.XYBase
import network.xyo.base.XYLogging
import network.xyo.ble.devices.xy.*
import network.xyo.ble.generic.devices.XYBluetoothDevice
import network.xyo.ble.listeners.XYFinderBluetoothDeviceListener
Expand All @@ -25,7 +26,7 @@ class XYODeviceActivity : XYOAppBaseActivity() {
lateinit var device: XYBluetoothDevice
private lateinit var sectionsPagerAdapter: SectionsPagerAdapter
lateinit var data: XYDeviceData
private val log = XYBase.log("XYODeviceActivity")
private val log = XYLogging(this)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.viewbinding.ViewBinding
import network.xyo.base.XYBase
import network.xyo.base.XYLogging
import network.xyo.ble.sample.XYApplication
import network.xyo.ble.generic.scanner.XYSmartScan

@kotlin.ExperimentalUnsignedTypes
abstract class XYAppBaseFragment<T> : Fragment() where T: ViewBinding {

val log = XYBase.log("XYAppBaseFragment")
val log = XYLogging(this)

private var _binding: T? = null
val binding get() = _binding!!
Expand Down
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-beta03'
classpath 'com.android.tools.build:gradle:4.2.0-beta04'
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -35,6 +34,6 @@ allprojects {
repositories {
jcenter()
google()
maven { url "https://dl.bintray.com/xyoraclenetwork/xyo" }
maven { url "https://jitpack.io" }
}
}

0 comments on commit 1688658

Please sign in to comment.