Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ble-common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apply plugin: 'com.android.library'

android {
namespace 'no.nordicsemi.android.ble.common'

compileSdkVersion 30

defaultConfig {
Expand Down
2 changes: 1 addition & 1 deletion ble-common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="no.nordicsemi.android.ble.common"/>
<manifest />
2 changes: 2 additions & 0 deletions ble-ktx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {
}

android {
namespace 'no.nordicsemi.android.ble.ktx'

compileSdkVersion 30

defaultConfig {
Expand Down
2 changes: 1 addition & 1 deletion ble-ktx/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="no.nordicsemi.android.ble.ktx" />
<manifest />
2 changes: 2 additions & 0 deletions ble-livedata/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
}

android {
namespace 'no.nordicsemi.android.ble.livedata'

compileSdkVersion 30

defaultConfig {
Expand Down
2 changes: 1 addition & 1 deletion ble-livedata/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="no.nordicsemi.android.ble.livedata" />
<manifest />
2 changes: 2 additions & 0 deletions ble/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apply plugin: 'com.android.library'

android {
namespace 'no.nordicsemi.android.ble'

compileSdkVersion 30

defaultConfig {
Expand Down
3 changes: 1 addition & 2 deletions ble/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="no.nordicsemi.android.ble">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,11 @@ public WaitForReadRequest split(@NonNull final WriteProgressCallback callback) {
* @param mtu the current MTU.
* @return The next bytes to be sent.
*/
@NonNull
byte[] getData(@IntRange(from = 23, to = 517) final int mtu) {
if (dataSplitter == null || data == null) {
complete = true;
return data;
return data != null ? data : new byte[] {};
}

// Read [procedure requires 3 bytes for handler and op code.
Expand All @@ -220,7 +221,7 @@ byte[] getData(@IntRange(from = 23, to = 517) final int mtu) {
if (nextChunk == null) {
complete = true;
}
return chunk;
return chunk != null ? chunk : new byte[] {};
}

/**
Expand Down
7 changes: 5 additions & 2 deletions ble/src/main/java/no/nordicsemi/android/ble/WriteRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,12 @@ void forceSplit() {
* @param mtu the current MTU.
* @return The next bytes to be sent.
*/
@NonNull
byte[] getData(@IntRange(from = 23, to = 517) final int mtu) {
if (dataSplitter == null || data == null) {
complete = true;
return currentChunk = data;
currentChunk = data;
return data != null ? data : new byte[] {};
}

// Write Request and Write Command require 3 bytes for handler and op code.
Expand All @@ -256,7 +258,8 @@ byte[] getData(@IntRange(from = 23, to = 517) final int mtu) {
if (nextChunk == null) {
complete = true;
}
return currentChunk = chunk;
currentChunk = chunk;
return chunk != null ? chunk : new byte[] {};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ public interface DataSplitter {
*/
@Nullable
byte[] chunk(@NonNull final byte[] message,
@IntRange(from = 0) final int index, @IntRange(from = 20) final int maxLength);
@IntRange(from = 0) final int index,
@IntRange(from = 20) final int maxLength);
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.github.gradle-nexus:publish-plugin:$gradle_nexus_publish_plugin"
}
Expand Down