Skip to content

Commit

Permalink
20240228: PumpX2 api updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoglom committed Mar 24, 2024
1 parent 96d6a5f commit 2de562d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
controlx2_version = "1.0.0-20230523"
pumpx2_version = "1.3.0"
controlx2_version = "1.0.0-20240228"
pumpx2_version = "1.3.1"
use_local_pumpx2 = System.properties.getOrDefault('use_local_pumpx2', 'false') == 'true'
m2_repository = "${System.properties['user.home']}/.m2/repository"
compose_version = '1.3.1'
Expand Down
7 changes: 4 additions & 3 deletions mobile/src/main/java/com/jwoglom/controlx2/CommService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class CommService : WearableListenerService(), GoogleApiClient.ConnectionCallbac
private lateinit var pump: Pump
private lateinit var tandemBTHandler: TandemBluetoothHandler

private inner class Pump(var filterToBluetoothMac: Optional<String>) : TandemPump(applicationContext, filterToBluetoothMac) {
private inner class Pump(var tandemConfig: TandemConfig) : TandemPump(applicationContext, tandemConfig) {
private val scope = CoroutineScope(SupervisorJob(parent = supervisorJob) + Dispatchers.IO)
var lastPeripheral: BluetoothPeripheral? = null
var isConnected = false
Expand Down Expand Up @@ -398,8 +398,9 @@ class CommService : WearableListenerService(), GoogleApiClient.ConnectionCallbac
if (msg.obj == null && msg.obj != "") {
filterToBluetoothMac = Optional.of(msg.obj as String)
}
Timber.i("pumpCommHandler: init_pump_comm: $filterToBluetoothMac")
pump = Pump(filterToBluetoothMac)
Timber.i("pumpCommHandler: init_pump_comm: filterToBluetoothMac=$filterToBluetoothMac")
val cfg = TandemConfig().withFilterToBluetoothMac(filterToBluetoothMac)
pump = Pump(cfg)
tandemBTHandler =
TandemBluetoothHandler.getInstance(applicationContext, pump, null)
} catch (e: SecurityException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import com.jwoglom.controlx2.presentation.components.ServiceDisabledMessage
import com.jwoglom.controlx2.presentation.navigation.Screen
import com.jwoglom.controlx2.presentation.theme.ControlX2Theme
import com.jwoglom.pumpx2.pump.messages.models.PairingCodeType
import com.jwoglom.pumpx2.pump.messages.response.authentication.CentralChallengeResponse
import timber.log.Timber

@Composable
Expand Down Expand Up @@ -120,7 +121,7 @@ fun PumpSetup(
try {
val code = PumpChallengeRequestBuilder.processPairingCode(pairingCodeText, ds.setupPairingCodeType.value)
// sanity check builder
PumpChallengeRequestBuilder.create(0, code, ByteArray(0))
PumpChallengeRequestBuilder.create(CentralChallengeResponse(), code)
sendMessage("/to-phone/set-pairing-code", code.toByteArray())
ds.pumpSetupStage.value = setupStage.value!!.nextStage(PumpSetupStage.WAITING_PUMP_FINDER_CLEANUP)
} catch (e: Exception) {
Expand All @@ -137,7 +138,7 @@ fun PumpSetup(
try {
val code = PumpChallengeRequestBuilder.processPairingCode(pairingCodeText, ds.setupPairingCodeType.value)
// sanity check builder
PumpChallengeRequestBuilder.create(0, code, ByteArray(0))
PumpChallengeRequestBuilder.create(CentralChallengeResponse(), code)
sendMessage("/to-phone/set-pairing-code", code.toByteArray())
ds.pumpSetupStage.value = setupStage.value!!.nextStage(PumpSetupStage.PUMPX2_WAITING_TO_PAIR)
} catch (e: Exception) {
Expand Down

0 comments on commit 2de562d

Please sign in to comment.