Skip to content

Commit

Permalink
HTS service with new blek library
Browse files Browse the repository at this point in the history
  • Loading branch information
himalia416 committed Aug 9, 2024
1 parent 53ed66f commit 214e65b
Show file tree
Hide file tree
Showing 32 changed files with 683 additions and 1,260 deletions.
18 changes: 4 additions & 14 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
plugins {
alias(libs.plugins.nordic.application.compose)
alias(libs.plugins.nordic.hilt)
alias(libs.plugins.kotlin.parcelize)
}

if (getGradle().getStartParameter().getTaskRequests().toString().contains("Release")) {
Expand All @@ -43,18 +44,7 @@ android {
}

dependencies {
//Hilt requires to implement every module in the main app module
//https://github.com/google/dagger/issues/2123
implementation(project(":profile_bps"))
implementation(project(":profile_csc"))
implementation(project(":profile_cgms"))
implementation(project(":profile_gls"))
implementation(project(":profile_hrs"))
implementation(project(":profile_hts"))
implementation(project(":profile_prx"))
implementation(project(":profile_rscs"))

implementation(project(":profile_uart"))

implementation(project(":lib_analytics"))
implementation(project(":lib_ui"))
Expand All @@ -64,13 +54,11 @@ dependencies {

implementation(libs.nordic.core)
implementation(libs.nordic.theme)
implementation(libs.nordic.ui)
implementation(libs.nordic.navigation)
implementation(libs.nordic.blek.uiscanner)
implementation(libs.nordic.logger)
implementation(libs.nordic.permissions.ble)
implementation(libs.nordic.analytics)

implementation(libs.nordic.blek.client)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.compose.material3)
Expand All @@ -83,4 +71,6 @@ dependencies {
// Timber & SLF4J
implementation (libs.slf4j.timber)
implementation(libs.nordic.log.timber)

implementation("no.nordicsemi.kotlin.ble:client-android")
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ import android.app.Application
import dagger.hilt.android.HiltAndroidApp
import no.nordicsemi.android.analytics.AppAnalytics
import no.nordicsemi.android.analytics.AppOpenEvent
import no.nordicsemi.android.gls.GLSServer
import no.nordicsemi.android.uart.UartServer
import timber.log.Timber
import javax.inject.Inject

Expand All @@ -46,20 +44,11 @@ class NrfToolboxApplication : Application() {
@Inject
lateinit var analytics: AppAnalytics

@Inject
lateinit var uartServer: UartServer

@Inject
lateinit var glsServer: GLSServer

override fun onCreate() {
super.onCreate()

analytics.logEvent(AppOpenEvent)

uartServer.start(this)
glsServer.start(this)

Timber.plant(Timber.DebugTree())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,45 +31,10 @@

package no.nordicsemi.android.nrftoolbox

import no.nordicsemi.android.bps.view.BPSScreen
import no.nordicsemi.android.cgms.view.CGMScreen
import no.nordicsemi.android.common.navigation.createSimpleDestination
import no.nordicsemi.android.common.navigation.defineDestination
import no.nordicsemi.android.csc.view.CSCScreen
import no.nordicsemi.android.gls.main.view.GLSScreen
import no.nordicsemi.android.hrs.view.HRSScreen
import no.nordicsemi.android.hts.view.HTSScreen
import no.nordicsemi.android.nrftoolbox.view.HomeScreen
import no.nordicsemi.android.prx.view.PRXScreen
import no.nordicsemi.android.rscs.view.RSCSScreen
import no.nordicsemi.android.toolbox.scanner.ScannerDestination
import no.nordicsemi.android.uart.view.UARTScreen
import no.nordicsemi.android.nrftoolbox.view.HomeView

val HomeDestinationId = createSimpleDestination("home-destination")

val HomeDestinations = listOf(
defineDestination(HomeDestinationId) { HomeScreen() },
ScannerDestination
)

val CSCDestinationId = createSimpleDestination("csc-destination")
val HRSDestinationId = createSimpleDestination("hrs-destination")
val HTSDestinationId = createSimpleDestination("hts-destination")
val GLSDestinationId = createSimpleDestination("gls-destination")
val BPSDestinationId = createSimpleDestination("bps-destination")
val PRXDestinationId = createSimpleDestination("prx-destination")
val RSCSDestinationId = createSimpleDestination("rscs-destination")
val CGMSDestinationId = createSimpleDestination("cgms-destination")
val UARTDestinationId = createSimpleDestination("uart-destination")

val ProfileDestinations = listOf(
defineDestination(CSCDestinationId) { CSCScreen() },
defineDestination(HRSDestinationId) { HRSScreen() },
defineDestination(HTSDestinationId) { HTSScreen() },
defineDestination(GLSDestinationId) { GLSScreen() },
defineDestination(BPSDestinationId) { BPSScreen() },
defineDestination(PRXDestinationId) { PRXScreen() },
defineDestination(RSCSDestinationId) { RSCSScreen() },
defineDestination(CGMSDestinationId) { CGMScreen() },
defineDestination(UARTDestinationId) { UARTScreen() },
)
val HomeDestinations = defineDestination(HomeDestinationId) { HomeView() }
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ import no.nordicsemi.android.common.analytics.view.AnalyticsPermissionRequestDia
import no.nordicsemi.android.common.navigation.NavigationView
import no.nordicsemi.android.common.theme.NordicActivity
import no.nordicsemi.android.common.theme.NordicTheme
import no.nordicsemi.android.gls.GLSDestination
import no.nordicsemi.android.hts.HTSDestination
import no.nordicsemi.android.nrftoolbox.repository.ActivitySignals
import no.nordicsemi.android.toolbox.scanner.ScannerDestination
import javax.inject.Inject

@AndroidEntryPoint
Expand All @@ -62,7 +61,7 @@ class MainActivity : NordicActivity() {
color = MaterialTheme.colorScheme.surface,
modifier = Modifier.fillMaxSize()
) {
NavigationView(HomeDestinations + ProfileDestinations + ScannerDestination + GLSDestination)
NavigationView(HomeDestinations + HTSDestination)
}

AnalyticsPermissionRequestDialog()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package no.nordicsemi.android.nrftoolbox.data

import java.util.UUID

val HTS_SERVICE_UUID: UUID = UUID.fromString("00001809-0000-1000-8000-00805f9b34fb")
val BPS_SERVICE_UUID: UUID = UUID.fromString("00001810-0000-1000-8000-00805f9b34fb")
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package no.nordicsemi.android.nrftoolbox
package no.nordicsemi.android.nrftoolbox.di

import dagger.Module
import dagger.Provides
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package no.nordicsemi.android.nrftoolbox.di

import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ViewModelComponent
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.CoroutineScope
import no.nordicsemi.kotlin.ble.client.android.CentralManager
import no.nordicsemi.kotlin.ble.client.android.native

@Module
@InstallIn(ViewModelComponent::class)
object CentralManagerModule {

@Provides
fun provideCentralManager(
@ApplicationContext context: Context,
scope: CoroutineScope
): CentralManager {
return CentralManager.Factory.native(context, scope)
}
}

This file was deleted.

Loading

0 comments on commit 214e65b

Please sign in to comment.