Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refreshing project #92

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
33a9834
Merge pull request #1 from JuulLabs-OSS/master
philips77 May 16, 2020
e4db2b2
New app icon
philips77 May 22, 2020
82dafb6
Nordic splashscreen
philips77 May 25, 2020
94054a8
New icon
philips77 Jun 9, 2020
52f15e6
Adding Device Manager to nRF Toolbox
philips77 Jun 9, 2020
2846075
Nordic license in modified files
philips77 Jun 9, 2020
003f4e8
Adding support for nRF Logger
philips77 Jun 10, 2020
393aed8
Icon removed
philips77 Jun 10, 2020
8e1e512
Merge pull request #2 from JuulLabs-OSS/master
philips77 Jun 10, 2020
fc3cc00
Merge branch 'master' into nordic
philips77 Jun 10, 2020
0e16fa4
Merge pull request #3 from JuulLabs-OSS/master
philips77 Jun 24, 2020
e93798e
Merge branch 'master' into nordic
philips77 Jun 24, 2020
4fe78ee
Merge pull request #4 from JuulLabs-OSS/master
philips77 Jul 2, 2020
2b5059a
Merge branch 'master' into nordic
philips77 Jul 2, 2020
79eae02
Intro screen
philips77 Jul 2, 2020
d13772d
Nordic applicationId
philips77 Jul 2, 2020
241aa9e
Default mount point changed to lfs
philips77 Jul 2, 2020
ed18efe
Using darker blue for widgets
philips77 Jul 2, 2020
f293306
BLE Library updated to 2.2.2
philips77 Jul 3, 2020
71a7a74
Other dependencies
philips77 Jul 3, 2020
3efa372
Merge branch 'pull/80'
philips77 Jul 3, 2020
d7e0945
Merge branch 'master' into nordic
philips77 Jul 3, 2020
28eb846
Information about nRF Connect Device Manager added
philips77 Aug 5, 2020
e358f64
Migration to Android Studio Arctic Fox and new dependencies
philips77 Aug 25, 2021
416bf0a
Post-migration warnings fixed
philips77 Aug 25, 2021
cc71924
Moving code from deprecated onActivityCreated(Bundle)
philips77 Aug 25, 2021
627ff11
Making 2 properties final
philips77 Aug 25, 2021
8293257
Adding query required in API 30+ for checking File Browser app
philips77 Aug 25, 2021
91b7ceb
Obtaining files refactored
philips77 Aug 25, 2021
8f9e5fe
Migration from ButterKnife to ViewBindings
philips77 Aug 25, 2021
88bde41
Kotlin 1.5.30
philips77 Aug 25, 2021
2e712de
Bug fix: Returning error if request failed
philips77 Aug 25, 2021
bc52fbe
NotNull -> NonNull
philips77 Aug 25, 2021
45d69b5
Warning suppressed
philips77 Aug 25, 2021
e5c3495
Unused imports
philips77 Aug 25, 2021
8723c47
Warnings removed
philips77 Aug 25, 2021
6235e49
Bug fix: Possible leak removed
philips77 Aug 25, 2021
a690857
Externalizing error strings
philips77 Aug 26, 2021
d57009e
Merge pull request #6 from JuulLabs-OSS/master
philips77 Aug 27, 2021
7a5acbd
Merge branch 'nordic' into master
philips77 Aug 27, 2021
c2a62f1
Merge branch 'master' into migration/arctic-fox
philips77 Aug 30, 2021
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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# nRF Connect Device Manager

This repository extends the [McuManager Android Library](https://github.com/JuulLabs-OSS/mcumgr-android).
It contains the Android library for nRF Connect Device Manager and a sample app, called nRF Connect Device Manager.
All changes in the *nordic* branch modify only to the app, to which Nordic look & feel has been applied.
The underlying library, as of now, is 1 to 1 copy of the original. All PRs should be submitted to
the original repository.

nRF Connect Device Manager is compatible with Mcu Manager that is supported by Apache Mynewt and Zephyr.

Below find the original documentation from the forked repository.

---

[![codecov](https://codecov.io/gh/JuulLabs-OSS/mcumgr-android/branch/master/graph/badge.svg)](https://codecov.io/gh/JuulLabs-OSS/mcumgr-android)

# McuManager Android
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
*/

buildscript {
ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.5.30'
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:7.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.hiya:jacoco-android:0.2'
}
Expand All @@ -24,6 +24,6 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
14 changes: 6 additions & 8 deletions mcumgr-ble/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply from: rootProject.file('gradle/jacoco-android.gradle')

android {
compileSdkVersion 29
compileSdkVersion 30

defaultConfig {
minSdkVersion 18
targetSdkVersion 29
targetSdkVersion 30
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -21,20 +21,18 @@ android {

dependencies {
// Import the BLE Library
// TODO need to get new release with fixes.
api 'no.nordicsemi.android:ble:2.2.3'
api 'no.nordicsemi.android:ble:2.3.0'

// Logging
implementation 'org.slf4j:slf4j-api:1.7.30'
implementation 'org.slf4j:slf4j-api:1.7.32'

// Import mcumgr-core
api project(':mcumgr-core')

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1"

testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}

Expand Down
285 changes: 133 additions & 152 deletions mcumgr-ble/src/main/java/io/runtime/mcumgr/ble/McuMgrBleTransport.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,22 @@ internal class SmpProtocolSession(
private val handler: Handler? = null
) {

private data class Outgoing(val data: ByteArray, val transaction: SmpTransaction)
private data class Outgoing(val data: ByteArray, val transaction: SmpTransaction) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

other as Outgoing

if (!data.contentEquals(other.data)) return false

return true
}

override fun hashCode(): Int {
return data.contentHashCode()
}
}

private val scope = CoroutineScope(EmptyCoroutineContext)
private val txChannel: Channel<Outgoing> = Channel(SMP_SEQ_NUM_MAX + 1)
Expand Down Expand Up @@ -48,13 +63,13 @@ internal class SmpProtocolSession(
}

fun send(data: ByteArray, transaction: SmpTransaction) {
check(txChannel.offer(Outgoing(data, transaction))) {
check(txChannel.trySend(Outgoing(data, transaction)).isSuccess) {
"Cannot send request, transmit channel buffer is full."
}
}

fun receive(data: ByteArray) {
check(rxChannel.offer(data)) {
check(rxChannel.trySend(data).isSuccess) {
"Cannot receive response, receive channel buffer is full."
}
}
Expand Down
19 changes: 9 additions & 10 deletions mcumgr-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ apply plugin: 'kotlin-android'
apply from: rootProject.file('gradle/jacoco-android.gradle')

android {
compileSdkVersion 29
compileSdkVersion 30

defaultConfig {
minSdkVersion 18
targetSdkVersion 29
targetSdkVersion 30
}

buildTypes {
Expand All @@ -28,22 +28,21 @@ android {
dependencies {

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1"

// Annotations
implementation 'org.jetbrains:annotations:16.0.1'
implementation 'org.jetbrains:annotations:22.0.0'

// Logging
implementation 'org.slf4j:slf4j-api:1.7.30'
implementation 'org.slf4j:slf4j-api:1.7.32'

// Import CBOR parser
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.11.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.11.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.12.4'
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.4'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.4'

// Test
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ abstract class Uploader(

val resultChannel: Channel<UploadResult> = Channel(1)
write(chunk.data, chunk.offset) {
resultChannel.offer(it)
resultChannel.trySend(it)
}

return if (resend) {
Expand Down
43 changes: 19 additions & 24 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
compileSdkVersion 30

defaultConfig {
applicationId "io.runtime.mcumgr"
applicationId "no.nordicsemi.android.nrfconnectdevicemanager"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
resConfigs "en"
Expand All @@ -23,52 +22,48 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
viewBinding true
}

buildTypes {
release {
minifyEnabled true
consumerProguardFiles 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha04'
implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta7'
implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.material:material:1.5.0-alpha02'

// Lifecycle extensions
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

// Butter Knife
implementation 'com.jakewharton:butterknife:10.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'

// Dagger 2
implementation 'com.google.dagger:dagger:2.27'
implementation 'com.google.dagger:dagger-android:2.27'
implementation 'com.google.dagger:dagger:2.35.1'
implementation 'com.google.dagger:dagger-android:2.35.1'
implementation 'com.google.dagger:dagger-android-support:2.27'
annotationProcessor 'com.google.dagger:dagger-compiler:2.27'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.27'

// Brings the new BluetoothLeScanner API to older platforms
implementation 'no.nordicsemi.android.support.v18:scanner:1.4.3'
implementation 'no.nordicsemi.android.support.v18:scanner:1.5.0'

// Timber & SLF4J
implementation 'com.arcao:slf4j-timber:3.1@aar'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'no.nordicsemi.android:log-timber:2.3.0'

// Mcu Mgr
implementation project(':mcumgr-ble')

// Test
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
testImplementation 'junit:junit:4.13.2'
}
56 changes: 34 additions & 22 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.runtime.mcumgr.sample"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<!--
Bluetooth permission is required in order to communicate with Bluetooth LE devices.
-->
<uses-permission android:name="android.permission.BLUETOOTH"/>

<!--
Bluetooth Admin permission is required in order to scan for Bluetooth LE devices.
-->
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.runtime.mcumgr.sample">
<!-- Bluetooth permission is required in order to communicate with Bluetooth LE devices. -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<!-- Bluetooth Admin permission is required in order to scan for Bluetooth LE devices. -->
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!--
Location permission is required from Android 6 to be able to scan for advertising
Bluetooth LE devices. Some BLE devices, called beacons, may be used to position the phone.
This is to ensure that the user agrees to do so.
This app does not use this location information in any way.
Since Android 10 ACCESS_FINE_LOCATION is required.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:name=".application.Dagger2Application"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="@style/AppTheme"
android:name=".application.Dagger2Application"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".SplashScreenActivity"
android:launchMode="singleTop"
android:noHistory="true"
android:theme="@style/AppTheme.SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".IntroActivity"
android:theme="@style/AppTheme.SplashScreen"
android:launchMode="singleTop"/>
<activity
android:name=".ScannerActivity"
android:launchMode="singleTop">
android:icon="@drawable/ic_mcumgr_feature"
android:label="@string/feature_name"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN" />

<category android:name="no.nordicsemi.android.nrftoolbox.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustPan"
android:parentActivityName=".ScannerActivity"/>
android:parentActivityName=".ScannerActivity"
android:windowSoftInputMode="adjustPan" />
</application>

</manifest>
</manifest>
Loading