cloud log upload bug fix

This commit is contained in:
miyeongkim 2022-09-02 14:10:56 +09:00
parent b8e332e9d7
commit 9ddeb29b10
4 changed files with 14 additions and 0 deletions

View file

@ -19,6 +19,9 @@ class DiaconnG8Pump @Inject constructor(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val dateUtil: DateUtil private val dateUtil: DateUtil
) { ) {
var isPumplogUploadFailed: Boolean = false
//var bleResultInfo: Pair<Int?, Boolean> = Pair(null, false) //var bleResultInfo: Pair<Int?, Boolean> = Pair(null, false)
var bolusConfirmMessage: Byte = 0 var bolusConfirmMessage: Byte = 0
var isReadyToBolus: Boolean = false var isReadyToBolus: Boolean = false

View file

@ -846,6 +846,8 @@ class BigLogInquireResponsePacket(
} }
} }
override fun onFailure(call: Call<ApiResponse>, t: Throwable) { override fun onFailure(call: Call<ApiResponse>, t: Throwable) {
aapsLogger.error(LTag.PUMPCOMM, "api uploadPumplogs failed")
diaconnG8Pump.isPumplogUploadFailed = true
t.printStackTrace() t.printStackTrace()
} }
} }

View file

@ -270,6 +270,11 @@ class BLECommonService @Inject internal constructor(
val bytes = message.encode(sequence) val bytes = message.encode(sequence)
processedMessageByte = bytes processedMessageByte = bytes
if (bluetoothGatt == null) {
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> IGNORING (NOT CONNECTED) " + message.friendlyName )
return
}
aapsLogger.debug(LTag.PUMPBTCOMM, "sendMessage() before mSendQueue.size :: ${mSendQueue.size}") aapsLogger.debug(LTag.PUMPBTCOMM, "sendMessage() before mSendQueue.size :: ${mSendQueue.size}")
// 펌프에 요청 보내기. // 펌프에 요청 보내기.
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes) writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)

View file

@ -330,6 +330,9 @@ class DiaconnG8Service : DaggerService() {
if(platformLoopSize > 0) { if(platformLoopSize > 0) {
diaconnG8Pump.isPlatformUploadStarted = true diaconnG8Pump.isPlatformUploadStarted = true
for (i in 0 until platformLoopSize) { for (i in 0 until platformLoopSize) {
if(diaconnG8Pump.isPumplogUploadFailed) {
break
}
rxBus.send(EventPumpStatusChanged("클라우드동기화 진행 중 : $i / $platformLoopSize")) rxBus.send(EventPumpStatusChanged("클라우드동기화 진행 중 : $i / $platformLoopSize"))
val startLogNo: Int = platformStart + i * pumpLogPageSize val startLogNo: Int = platformStart + i * pumpLogPageSize
val endLogNo: Int = startLogNo + min(platformEnd - startLogNo, pumpLogPageSize) val endLogNo: Int = startLogNo + min(platformEnd - startLogNo, pumpLogPageSize)
@ -338,6 +341,7 @@ class DiaconnG8Service : DaggerService() {
} }
SystemClock.sleep(1000) SystemClock.sleep(1000)
diaconnG8Pump.isPlatformUploadStarted = false diaconnG8Pump.isPlatformUploadStarted = false
diaconnG8Pump.isPumplogUploadFailed = false
} }
} }
} catch (e:Exception) { } catch (e:Exception) {