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
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ class ServiceDiscoverer(
}
logger.debug(LTag.PUMPBTCOMM, "Services discovered")
val service = gatt.getService(SERVICE_UUID.toUuid())
?: throw ConnectException("Service not found: $SERVICE_UUID")
?: run {
for (service in gatt.services) {
logger.debug(LTag.PUMPBTCOMM, "Found service: ${service.uuid}")
}
throw ConnectException("Service not found: $SERVICE_UUID")
}
val cmdChar = service.getCharacteristic(CharacteristicType.CMD.uuid)
?: throw ConnectException("Characteristic not found: ${CharacteristicType.CMD.value}")
val dataChar = service.getCharacteristic(CharacteristicType.DATA.uuid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
if (activeCommand == null) {
Completable.complete()
} else {
logger.warn(LTag.PUMP, "Active command already existing: $activeCommand")
logger.warn(LTag.PUMPCOMM, "Active command already existing: $activeCommand")
Completable.error(
java.lang.IllegalStateException(
"Trying to send a command " +
Expand Down Expand Up @@ -432,7 +432,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
override fun updateActiveCommand() = Maybe.create<CommandConfirmed> { source ->
val activeCommand = podState.activeCommand
if (activeCommand == null) {
logger.error("No active command to update")
logger.error(LTag.PUMPCOMM, "No active command to update")
source.onComplete()
return@create
}
Expand Down Expand Up @@ -502,6 +502,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
override fun getCommandConfirmationFromState(): CommandConfirmationFromState {
return podState.activeCommand?.run {
logger.debug(
LTag.PUMPCOMM,
"Getting command state with parameters: $activeCommand " +
"lastResponse=$lastStatusResponseReceived " +
"$sequenceNumberOfLastProgrammingCommand $historyId"
Expand Down Expand Up @@ -634,7 +635,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(

override fun updateFromAlarmStatusResponse(response: AlarmStatusResponse) {
logger.info(
LTag.PUMP,
LTag.PUMPCOMM,
"Received AlarmStatusResponse: $response"
)
podState.deliveryStatus = response.deliveryStatus
Expand Down Expand Up @@ -678,12 +679,12 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
private fun store() {
try {
val cleanPodState = podState.copy(ltk = byteArrayOf()) // do not log ltk
logger.debug(LTag.PUMP, "Storing Pod state: ${Gson().toJson(cleanPodState)}")
logger.debug(LTag.PUMPCOMM, "Storing Pod state: ${Gson().toJson(cleanPodState)}")

val serialized = Gson().toJson(podState)
sharedPreferences.putString(R.string.key_omnipod_dash_pod_state, serialized)
} catch (ex: Exception) {
logger.error(LTag.PUMP, "Failed to store Pod state", ex)
logger.error(LTag.PUMPCOMM, "Failed to store Pod state", ex)
}
}

Expand All @@ -695,7 +696,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
PodState::class.java
)
} catch (ex: Exception) {
logger.error(LTag.PUMP, "Failed to deserialize Pod state", ex)
logger.error(LTag.PUMPCOMM, "Failed to deserialize Pod state", ex)
}
}
return PodState()
Expand Down