Dana msg refactor
This commit is contained in:
parent
879882f3e8
commit
903555ed9f
|
@ -7,7 +7,7 @@ import dagger.android.AndroidInjector
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.core.di.CoreModule
|
||||
import info.nightscout.androidaps.dana.di.DanaModule
|
||||
import info.nightscout.androidaps.danar.di.DanaRServicesModule
|
||||
import info.nightscout.androidaps.danar.di.DanaRModule
|
||||
import info.nightscout.androidaps.danars.di.DanaRSModule
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
@ -35,7 +35,7 @@ import javax.inject.Singleton
|
|||
UIModule::class,
|
||||
CoreModule::class,
|
||||
DanaModule::class,
|
||||
DanaRServicesModule::class,
|
||||
DanaRModule::class,
|
||||
DanaRSModule::class
|
||||
]
|
||||
)
|
||||
|
|
|
@ -60,9 +60,6 @@ class DanaRS_Packet_APS_History_EventsTest : DanaRSTestBase() {
|
|||
Assert.assertEquals(expectedValues[4], returnedValues[4])
|
||||
// second
|
||||
Assert.assertEquals(expectedValues[5], returnedValues[5])
|
||||
// test message decoding
|
||||
testPacket.handleMessage(createArray(50, 0.toByte()))
|
||||
Assert.assertEquals(false, testPacket.failed)
|
||||
Assert.assertEquals("APS_HISTORY_EVENTS", testPacket.friendlyName)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.danars.comm
|
|||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -26,7 +27,7 @@ class DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest : DanaRSTestBase() {
|
|||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 0.toByte()))
|
||||
// are pump units MG/DL ???
|
||||
Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL, danaPump.units)
|
||||
Assert.assertEquals(DanaPump.UNITS_MGDL, danaPump.units)
|
||||
Assert.assertEquals(false, packet.failed)
|
||||
packet.handleMessage(createArray(34, 3.toByte()))
|
||||
Assert.assertEquals(true, packet.failed)
|
||||
|
|
|
@ -31,8 +31,6 @@ class DanaRS_Packet_General_Get_Shipping_InformationTest : DanaRSTestBase() {
|
|||
Assert.assertEquals(true, packet.failed)
|
||||
// everything ok :)
|
||||
packet = DanaRS_Packet_General_Get_Shipping_Information(packetInjector)
|
||||
packet.handleMessage(createArray(18, 0.toByte()))
|
||||
Assert.assertEquals(false, packet.failed)
|
||||
Assert.assertEquals("REVIEW__GET_SHIPPING_INFORMATION", packet.friendlyName)
|
||||
}
|
||||
}
|
|
@ -3,18 +3,26 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.db.TemporaryBasal
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.db.TemporaryBasal
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Before
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
|
||||
@PrepareForTest(DetailedBolusInfoStorage::class, ConstraintChecker::class)
|
||||
open class DanaRTestBase : TestBase() {
|
||||
|
||||
@Mock lateinit var sp: SP
|
||||
|
@ -23,6 +31,15 @@ open class DanaRTestBase : TestBase() {
|
|||
@Mock lateinit var dateUtil: DateUtil
|
||||
@Mock lateinit var databaseHelper: DatabaseHelperInterface
|
||||
@Mock lateinit var treatmentsInterface: TreatmentsInterface
|
||||
@Mock lateinit var danaRPlugin: DanaRPlugin
|
||||
@Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
@Mock lateinit var danaRv2Plugin: DanaRv2Plugin
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var configBuilder: ConfigBuilderInterface
|
||||
@Mock lateinit var commandQueue: CommandQueueProvider
|
||||
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
@Mock lateinit var nsUpload: NSUpload
|
||||
|
||||
@Before
|
||||
fun prepareMock() {
|
||||
|
@ -31,6 +48,23 @@ open class DanaRTestBase : TestBase() {
|
|||
|
||||
val injector = HasAndroidInjector {
|
||||
AndroidInjector {
|
||||
if (it is MessageBase) {
|
||||
it.aapsLogger = aapsLogger
|
||||
it.dateUtil = dateUtil
|
||||
it.danaPump = danaPump
|
||||
it.danaRPlugin = danaRPlugin
|
||||
it.danaRKoreanPlugin = danaRKoreanPlugin
|
||||
it.danaRv2Plugin = danaRv2Plugin
|
||||
it.rxBus = RxBusWrapper()
|
||||
it.resourceHelper = resourceHelper
|
||||
it.activePlugin = activePluginProvider
|
||||
it.configBuilder = configBuilder
|
||||
it.detailedBolusInfoStorage = detailedBolusInfoStorage
|
||||
it.constraintChecker = constraintChecker
|
||||
it.nsUpload = nsUpload
|
||||
it.databaseHelper = databaseHelper
|
||||
it.commandQueue = commandQueue
|
||||
}
|
||||
if (it is TemporaryBasal) {
|
||||
it.aapsLogger = aapsLogger
|
||||
it.activePlugin = activePluginProvider
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danar.comm.MessageHashTableR
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -25,21 +16,10 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class, ConfigBuilderPlugin::class)
|
||||
class MessageHashTableRTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var rxBus: RxBusWrapper
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
@Mock lateinit var danaRPlugin: DanaRPlugin
|
||||
@Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
@Mock lateinit var configBuilderPlugin: ConfigBuilderPlugin
|
||||
@Mock lateinit var commandQueue: CommandQueueProvider
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
||||
@Mock lateinit var treatmentsPlugin: TreatmentsPlugin
|
||||
@Mock lateinit var nsUpload: NSUpload
|
||||
|
||||
@Test fun runTest() {
|
||||
Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
|
||||
val messageHashTable = MessageHashTableR(aapsLogger, rxBus, resourceHelper, constraintChecker, danaPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, nsUpload, injector, databaseHelper, dateUtil)
|
||||
val messageHashTable = MessageHashTableR(injector)
|
||||
val testMessage = messageHashTable.findMessage(0x41f2)
|
||||
Assert.assertEquals("CMD_HISTORY_ALL", testMessage.messageName)
|
||||
}
|
||||
|
|
|
@ -5,27 +5,22 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.danar.comm.MsgBolusProgress
|
||||
import info.nightscout.androidaps.db.Treatment
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.ArgumentMatchers
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
class MsgBolusProgressTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
val rxBus = RxBusWrapper()
|
||||
|
||||
@Test fun runTest() {
|
||||
`when`(resourceHelper.gs(ArgumentMatchers.eq(R.string.bolusdelivering), ArgumentMatchers.anyDouble())).thenReturn("Delivering %1\$.2fU")
|
||||
danaPump.bolusingTreatment = Treatment(HasAndroidInjector { AndroidInjector { } })
|
||||
danaPump.bolusAmountToBeDelivered = 3.0
|
||||
val packet = MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaPump)
|
||||
val packet = MsgBolusProgress(injector)
|
||||
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
|
|
|
@ -6,7 +6,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
|||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -15,11 +14,9 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(ConstraintChecker::class)
|
||||
class MsgBolusStartTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
|
||||
@Test fun runTest() {
|
||||
`when`(constraintChecker.applyBolusConstraints(Constraint(anyObject()))).thenReturn(Constraint(0.0))
|
||||
val packet = MsgBolusStart(aapsLogger, constraintChecker, danaPump, 1.0)
|
||||
val packet = MsgBolusStart(injector, 1.0)
|
||||
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
|
|
|
@ -6,7 +6,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
|||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -15,11 +14,9 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(ConstraintChecker::class)
|
||||
class MsgBolusStartWithSpeedTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
|
||||
@Test fun runTest() {
|
||||
Mockito.`when`(constraintChecker.applyBolusConstraints(Constraint(anyObject()))).thenReturn(Constraint(0.0))
|
||||
val packet = MsgBolusStartWithSpeed(aapsLogger, constraintChecker, danaPump, 0.0, 0)
|
||||
val packet = MsgBolusStartWithSpeed(injector, 0.0, 0)
|
||||
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
|
|
|
@ -4,26 +4,20 @@ import dagger.android.AndroidInjector
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.danar.comm.MsgBolusStop
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.db.Treatment
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
class MsgBolusStopTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
val rxBus = RxBusWrapper()
|
||||
|
||||
@Test fun runTest() {
|
||||
`when`(resourceHelper.gs(R.string.overview_bolusprogress_delivered)).thenReturn("Delivered")
|
||||
danaPump.bolusingTreatment = Treatment(HasAndroidInjector { AndroidInjector { } })
|
||||
val packet = MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaPump)
|
||||
val packet = MsgBolusStop(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(ByteArray(100))
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danar.comm.MsgCheckValue
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
class MsgCheckValueTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var danaRPlugin: DanaRPlugin
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgCheckValue(aapsLogger, danaPump, danaRPlugin)
|
||||
val packet = MsgCheckValue(injector)
|
||||
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
putByteToArray(array, 0, info.nightscout.androidaps.dana.DanaPump.EXPORT_MODEL.toByte())
|
||||
putByteToArray(array, 0, DanaPump.EXPORT_MODEL.toByte())
|
||||
packet.handleMessage(array)
|
||||
Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.EXPORT_MODEL, danaPump.hwModel)
|
||||
Assert.assertEquals(DanaPump.EXPORT_MODEL, danaPump.hwModel)
|
||||
}
|
||||
}
|
|
@ -1,13 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgError
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.api.mockito.PowerMockito
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -16,13 +13,9 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(NSUpload::class)
|
||||
class MsgErrorTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var nsUpload: NSUpload
|
||||
val rxBus = RxBusWrapper()
|
||||
|
||||
@Test fun runTest() {
|
||||
PowerMockito.mockStatic(NSUpload::class.java)
|
||||
val packet = MsgError(aapsLogger, rxBus, resourceHelper, danaPump, nsUpload)
|
||||
val packet = MsgError(injector)
|
||||
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryAlarm
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -9,10 +8,8 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@RunWith(PowerMockRunner::class)
|
||||
class MsgHistoryAlarmTest : DanaRTestBase() {
|
||||
|
||||
val rxBus = RxBusWrapper()
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryAlarm(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryAllDoneTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryAllDone(aapsLogger, danaPump)
|
||||
val packet = MsgHistoryAllDone(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(ByteArray(0))
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryAll
|
||||
import info.nightscout.androidaps.db.DatabaseHelper
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -13,16 +12,13 @@ import org.powermock.core.classloader.annotations.PrepareForTest
|
|||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(MainApp::class)
|
||||
class MsgHistoryAllTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
PowerMockito.mockStatic(MainApp::class.java)
|
||||
`when`(MainApp.getDbHelper()).thenReturn(PowerMockito.mock(DatabaseHelper::class.java))
|
||||
val packet = MsgHistoryAll(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryAll(injector)
|
||||
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
val array = createArray(100, 2)
|
||||
|
||||
putByteToArray(array, 0, 1)
|
||||
packet.handleMessage(array)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryBasalHour
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -10,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryBasalHourTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryBasalHour(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryBasalHour(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryBolus
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -10,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryBolusTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryBolus(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryBolus(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryCarbo
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -10,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryCarboTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryCarbo(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryCarbo(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryDailyInsulin
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -10,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryDailyInsulinTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryDailyInsulin(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryDailyInsulin(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryDoneTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryDone(aapsLogger, danaPump)
|
||||
val packet = MsgHistoryDone(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryError
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -10,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryErrorTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryError(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryError(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryGlucose
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -10,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryGlucoseTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryGlucose(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryGlucose(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryNewDoneTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryNewDone(aapsLogger, danaPump)
|
||||
val packet = MsgHistoryNewDone(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryNew
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -10,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryNewTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryNew(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryNew(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistoryRefill
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -10,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistoryRefillTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistoryRefill(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistoryRefill(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgHistorySuspend
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -10,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgHistorySuspendTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgHistorySuspend(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
|
||||
val packet = MsgHistorySuspend(injector)
|
||||
// nothing left to test
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgInitConnStatusBasicTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgInitConnStatusBasic(aapsLogger, danaPump)
|
||||
val packet = MsgInitConnStatusBasic(injector)
|
||||
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBolus
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
class MsgInitConnStatusBolusTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgInitConnStatusBolus(aapsLogger, RxBusWrapper(), resourceHelper, danaPump)
|
||||
val packet = MsgInitConnStatusBolus(injector)
|
||||
|
||||
// test message decoding
|
||||
var array = ByteArray(100)
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusOption
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.api.mockito.PowerMockito
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
|
@ -18,12 +14,9 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(VirtualPumpPlugin::class)
|
||||
class MsgInitConnStatusOptionTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
|
||||
@Test fun runTest() {
|
||||
`when`(activePlugin.activePump).thenReturn(PowerMockito.mock(VirtualPumpPlugin::class.java))
|
||||
val packet = MsgInitConnStatusOption(aapsLogger, RxBusWrapper(), resourceHelper, danaPump, activePlugin)
|
||||
`when`(activePluginProvider.activePump).thenReturn(PowerMockito.mock(VirtualPumpPlugin::class.java))
|
||||
val packet = MsgInitConnStatusOption(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(20, 1.toByte()))
|
||||
|
|
|
@ -1,31 +1,22 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusTime
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin::class, info.nightscout.androidaps.danar.DanaRPlugin::class, ConfigBuilderPlugin::class)
|
||||
@PrepareForTest(DanaRKoreanPlugin::class, DanaRPlugin::class, ConfigBuilderPlugin::class, CommandQueueProvider::class)
|
||||
class MsgInitConnStatusTimeTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var danaRPlugin: DanaRPlugin
|
||||
@Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
@Mock lateinit var configBuilderPlugin: ConfigBuilderPlugin
|
||||
@Mock lateinit var commandQueue: CommandQueueProvider
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgInitConnStatusTime(aapsLogger, RxBusWrapper(), resourceHelper, danaPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil)
|
||||
val packet = MsgInitConnStatusTime(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(20, 1.toByte()))
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgPCCommStartTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgPCCommStart(aapsLogger)
|
||||
val packet = MsgPCCommStart(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 1.toByte()))
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgPCCommStopTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgPCCommStop(aapsLogger)
|
||||
val packet = MsgPCCommStop(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 1.toByte()))
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSetActivateBasalProfileTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSetActivateBasalProfile(aapsLogger, 1.toByte())
|
||||
val packet = MsgSetActivateBasalProfile(injector, 1.toByte())
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgSetBasalProfile
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
class MsgSetBasalProfileTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSetBasalProfile(aapsLogger, RxBusWrapper(), resourceHelper, 1.toByte(), Array(24) { 1.0 })
|
||||
val packet = MsgSetBasalProfile(injector, 1.toByte(), Array(24) { 1.0 })
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 2.toByte()))
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSetCarbsEntryTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSetCarbsEntry(aapsLogger, System.currentTimeMillis(), 10)
|
||||
val packet = MsgSetCarbsEntry(injector, System.currentTimeMillis(), 10)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
|
|
|
@ -6,7 +6,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
|||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -15,11 +14,9 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(ConstraintChecker::class)
|
||||
class MsgSetExtendedBolusStartTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
|
||||
@Test fun runTest() {
|
||||
`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
|
||||
val packet = MsgSetExtendedBolusStart(aapsLogger, constraintChecker, 2.0, 2.toByte())
|
||||
val packet = MsgSetExtendedBolusStart(injector, 2.0, 2.toByte())
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSetExtendedBolusStopTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSetExtendedBolusStop(aapsLogger)
|
||||
val packet = MsgSetExtendedBolusStop(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgSetSingleBasalProfile
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
class MsgSetSingleBasalProfileTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSetSingleBasalProfile(aapsLogger, RxBusWrapper(), resourceHelper, createArray(24, 2.0))
|
||||
val packet = MsgSetSingleBasalProfile(injector, createArray(24, 2.0))
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSetTempBasalStartTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSetTempBasalStart(aapsLogger, 250, 1)
|
||||
val packet = MsgSetTempBasalStart(injector, 250, 1)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
|
|
|
@ -5,13 +5,12 @@ import org.junit.Assert
|
|||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
import java.util.*
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
class MsgSetTimeTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSetTime(aapsLogger, dateUtil, Date(System.currentTimeMillis()))
|
||||
val packet = MsgSetTime(injector, System.currentTimeMillis())
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSetUserOptionsTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSetUserOptions(aapsLogger, danaPump)
|
||||
val packet = MsgSetUserOptions(injector)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(true, packet.failed)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.danar.comm.MsgSettingActiveProfile
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -11,10 +10,10 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSettingActiveProfileTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingActiveProfile(aapsLogger, danaPump)
|
||||
val packet = MsgSettingActiveProfile(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(MessageBase.intFromBuff(createArray(34, 7.toByte()), 0, 1), danaPump.activeProfile)
|
||||
Assert.assertEquals(packet.intFromBuff(createArray(34, 7.toByte()), 0, 1), danaPump.activeProfile)
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSettingBasalProfileAllTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingBasalProfileAll(aapsLogger, danaPump)
|
||||
val packet = MsgSettingBasalProfileAll(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(400, 1.toByte()))
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.danar.comm.MsgSettingBasal
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -16,15 +13,13 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(info.nightscout.androidaps.danar.DanaRPlugin::class)
|
||||
class MsgSettingBasalTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var danaRPlugin: DanaRPlugin
|
||||
|
||||
@Test fun runTest() {
|
||||
`when`(danaRPlugin.getPumpDescription()).thenReturn(PumpDescription())
|
||||
val packet = MsgSettingBasal(aapsLogger, danaPump, danaRPlugin)
|
||||
val packet = MsgSettingBasal(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(100, 1.toByte()))
|
||||
val expected = MessageBase.intFromBuff(createArray(100, 1.toByte()), 2 * 1, 2)
|
||||
val expected = packet.intFromBuff(createArray(100, 1.toByte()), 2 * 1, 2)
|
||||
Assert.assertEquals(expected.toDouble() / 100.0, danaPump.pumpProfiles!![danaPump.activeProfile][1], 0.0)
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSettingGlucoseTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingGlucose(aapsLogger, danaPump)
|
||||
val packet = MsgSettingGlucose(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 1.toByte()))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.danar.comm.MsgSettingMaxValues
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -11,10 +10,10 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSettingMaxValuesTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingMaxValues(aapsLogger, danaPump)
|
||||
val packet = MsgSettingMaxValues(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 0, 2).toDouble() / 100.0, danaPump.maxBolus, 0.0)
|
||||
Assert.assertEquals(packet.intFromBuff(createArray(10, 7.toByte()), 0, 2).toDouble() / 100.0, danaPump.maxBolus, 0.0)
|
||||
}
|
||||
}
|
|
@ -1,31 +1,23 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danar.comm.MsgSettingMeal
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(info.nightscout.androidaps.danar.DanaRPlugin::class, info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin::class)
|
||||
@PrepareForTest(DanaRPlugin::class, DanaRKoreanPlugin::class)
|
||||
class MsgSettingMealTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var danaRPlugin: DanaRPlugin
|
||||
@Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingMeal(aapsLogger, RxBusWrapper(), resourceHelper, danaPump, danaRKoreanPlugin)
|
||||
val packet = MsgSettingMeal(injector)
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 1.toByte()))
|
||||
Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 1.toByte()), 0, 1).toDouble() / 100.0, danaPump.bolusStep, 0.0)
|
||||
Assert.assertEquals(packet.intFromBuff(createArray(10, 1.toByte()), 0, 1).toDouble() / 100.0, danaPump.bolusStep, 0.0)
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatiosAll
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -11,11 +11,11 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSettingProfileRatiosAllTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingProfileRatiosAll(aapsLogger, danaPump)
|
||||
danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
|
||||
val packet = MsgSettingProfileRatiosAll(injector)
|
||||
danaPump.units = DanaPump.UNITS_MGDL
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 0, 2), danaPump.morningCIR)
|
||||
Assert.assertEquals(packet.intFromBuff(createArray(10, 7.toByte()), 0, 2), danaPump.morningCIR)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -11,10 +11,10 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSettingProfileRatiosTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingProfileRatios(aapsLogger, danaPump)
|
||||
danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
|
||||
val packet = MsgSettingProfileRatios(injector)
|
||||
danaPump.units = DanaPump.UNITS_MGDL
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 0, 2), danaPump.currentCIR)
|
||||
Assert.assertEquals(packet.intFromBuff(createArray(10, 7.toByte()), 0, 2), danaPump.currentCIR)
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -12,17 +12,17 @@ import java.util.*
|
|||
class MsgSettingPumpTimeTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingPumpTime(aapsLogger, danaPump, dateUtil)
|
||||
danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
|
||||
val packet = MsgSettingPumpTime(injector)
|
||||
danaPump.units = DanaPump.UNITS_MGDL
|
||||
// test message decoding
|
||||
val bytes = createArray(34, 7.toByte())
|
||||
val time = Date(
|
||||
100 + MessageBase.intFromBuff(bytes, 5, 1),
|
||||
MessageBase.intFromBuff(bytes, 4, 1) - 1,
|
||||
MessageBase.intFromBuff(bytes, 3, 1),
|
||||
MessageBase.intFromBuff(bytes, 2, 1),
|
||||
MessageBase.intFromBuff(bytes, 1, 1),
|
||||
MessageBase.intFromBuff(bytes, 0, 1)
|
||||
100 + packet.intFromBuff(bytes, 5, 1),
|
||||
packet.intFromBuff(bytes, 4, 1) - 1,
|
||||
packet.intFromBuff(bytes, 3, 1),
|
||||
packet.intFromBuff(bytes, 2, 1),
|
||||
packet.intFromBuff(bytes, 1, 1),
|
||||
packet.intFromBuff(bytes, 0, 1)
|
||||
).time
|
||||
packet.handleMessage(bytes)
|
||||
Assert.assertEquals(time, danaPump.pumpTime)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo
|
||||
import org.junit.Assert
|
||||
|
@ -11,8 +12,8 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSettingShippingInfoTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingShippingInfo(aapsLogger, danaPump)
|
||||
danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
|
||||
val packet = MsgSettingShippingInfo(injector)
|
||||
danaPump.units = DanaPump.UNITS_MGDL
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(MessageBase.stringFromBuff(createArray(34, 7.toByte()), 0, 10), danaPump.serialNumber)
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSettingUserOptionsTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgSettingUserOptions(aapsLogger, danaPump)
|
||||
val packet = MsgSettingUserOptions(injector)
|
||||
danaPump.units = DanaPump.UNITS_MGDL
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(48, 7.toByte()))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.danar.comm.MsgStatusBasic
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -11,9 +10,9 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgStatusBasicTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgStatusBasic(aapsLogger, danaPump)
|
||||
val packet = MsgStatusBasic(injector)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(MessageBase.intFromBuff(createArray(34, 7.toByte()), 0, 3).toDouble() / 750.0, danaPump.dailyTotalUnits, 0.0)
|
||||
Assert.assertEquals(packet.intFromBuff(createArray(34, 7.toByte()), 0, 3).toDouble() / 750.0, danaPump.dailyTotalUnits, 0.0)
|
||||
}
|
||||
}
|
|
@ -1,25 +1,19 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
class MsgStatusBolusExtendedTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
@Mock lateinit var treatmentsPlugin: TreatmentsPlugin
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
`when`(activePlugin.activeTreatments).thenReturn(treatmentsPlugin)
|
||||
val packet = MsgStatusBolusExtended(injector, aapsLogger, danaPump, activePlugin, dateUtil)
|
||||
`when`(activePluginProvider.activeTreatments).thenReturn(treatmentsInterface)
|
||||
val packet = MsgStatusBolusExtended(injector)
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
putByteToArray(array, 0, 1)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danar.comm.MsgStatusProfile
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -11,10 +11,10 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgStatusProfileTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgStatusProfile(aapsLogger, danaPump)
|
||||
danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
|
||||
val packet = MsgStatusProfile(injector)
|
||||
danaPump.units = DanaPump.UNITS_MGDL
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 0, 2), danaPump.currentCIR)
|
||||
Assert.assertEquals(packet.intFromBuff(createArray(10, 7.toByte()), 0, 2), danaPump.currentCIR)
|
||||
}
|
||||
}
|
|
@ -1,13 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -16,12 +13,9 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(ConfigBuilderPlugin::class)
|
||||
class MsgStatusTempBasalTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
@Mock lateinit var treatmentsPlugin: TreatmentsPlugin
|
||||
|
||||
@Test fun runTest() {
|
||||
`when`(activePlugin.activeTreatments).thenReturn(treatmentsPlugin)
|
||||
val packet = MsgStatusTempBasal(aapsLogger, danaPump, activePlugin, injector)
|
||||
`when`(activePluginProvider.activeTreatments).thenReturn(treatmentsInterface)
|
||||
val packet = MsgStatusTempBasal(injector)
|
||||
// test message decoding
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 1.toByte()))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm
|
||||
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.danar.comm.MsgStatus
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -11,9 +10,9 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgStatusTest : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = MsgStatus(aapsLogger, danaPump)
|
||||
val packet = MsgStatus(injector)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(MessageBase.intFromBuff(createArray(34, 7.toByte()), 0, 3).toDouble() / 750.0, danaPump.dailyTotalUnits, 0.0)
|
||||
Assert.assertEquals(packet.intFromBuff(createArray(34, 7.toByte()), 0, 3).toDouble() / 750.0, danaPump.dailyTotalUnits, 0.0)
|
||||
}
|
||||
}
|
|
@ -1,42 +1,26 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRKorean.comm
|
||||
|
||||
import info.nightscout.androidaps.danars.comm.DanaRSTestBase
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MessageHashTableRKorean
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MessageHashTableRKorean
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class, ConfigBuilderPlugin::class)
|
||||
class MessageHashTableRKoreanTest : DanaRSTestBase() {
|
||||
class MessageHashTableRKoreanTest : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
@Mock lateinit var danaRPlugin: DanaRPlugin
|
||||
@Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
@Mock lateinit var configBuilderPlugin: ConfigBuilderPlugin
|
||||
@Mock lateinit var commandQueue: CommandQueueProvider
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
||||
@Mock lateinit var nsUpload: NSUpload
|
||||
@Mock lateinit var databaseHelper: DatabaseHelperInterface
|
||||
|
||||
@Test fun runTest() {
|
||||
Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
|
||||
val messageHashTable = MessageHashTableRKorean(aapsLogger, rxBus, resourceHelper, constraintChecker, danaPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, dateUtil, nsUpload, databaseHelper, injector)
|
||||
val messageHashTable = MessageHashTableRKorean(injector)
|
||||
val testMessage = messageHashTable.findMessage(0x41f2)
|
||||
Assert.assertEquals("CMD_HISTORY_ALL", testMessage.messageName)
|
||||
}
|
||||
|
|
|
@ -1,28 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm
|
||||
|
||||
import android.content.Context
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danaRv2.comm.MessageHashTableRv2
|
||||
import info.nightscout.androidaps.danaRv2.comm.MsgStatusAPS_v2
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
@ -31,29 +19,15 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class, ConfigBuilderPlugin::class)
|
||||
class MessageHashTable_rv2Test : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var context: Context
|
||||
@Mock lateinit var rxBus: RxBusWrapper
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
@Mock lateinit var danaRPlugin: DanaRPlugin
|
||||
@Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
@Mock lateinit var danaRv2Plugin: DanaRv2Plugin
|
||||
@Mock lateinit var configBuilderPlugin: ConfigBuilderPlugin
|
||||
@Mock lateinit var commandQueue: CommandQueueProvider
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
||||
@Mock lateinit var treatmentsPlugin: TreatmentsPlugin
|
||||
@Mock lateinit var nsUpload: NSUpload
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
|
||||
val messageHashTableRv2 = MessageHashTableRv2(aapsLogger, rxBus, resourceHelper, constraintChecker, danaPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue, activePlugin, detailedBolusInfoStorage, nsUpload, injector, DateUtil(context, resourceHelper), databaseHelper)
|
||||
val forTesting: MessageBase = MsgStatusAPS_v2(aapsLogger, danaPump)
|
||||
val messageHashTableRv2 = MessageHashTableRv2(injector)
|
||||
val forTesting: MessageBase = MsgStatusAPS_v2(injector)
|
||||
val testPacket: MessageBase = messageHashTableRv2.findMessage(forTesting.command)
|
||||
Assert.assertEquals(0xE001, testPacket.command.toLong())
|
||||
// try putting another command
|
||||
val testMessage = MessageBase()
|
||||
val testMessage = MessageBase(injector)
|
||||
testMessage.SetCommand(0xE005)
|
||||
messageHashTableRv2.put(testMessage)
|
||||
Assert.assertEquals(0xE005, messageHashTableRv2.findMessage(0xE005).command.toLong())
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danaRv2.comm.MsgCheckValue_v2
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
|
@ -20,19 +17,11 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(DanaRKoreanPlugin::class, DanaRPlugin::class, DanaRv2Plugin::class, ConfigBuilderPlugin::class)
|
||||
class MsgCheckValue_v2Test : DanaRTestBase() {
|
||||
|
||||
val rxBus = RxBusWrapper()
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var danaRPlugin: DanaRPlugin
|
||||
@Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
@Mock lateinit var danaRv2Plugin: DanaRv2Plugin
|
||||
@Mock lateinit var configBuilderPlugin: ConfigBuilderPlugin
|
||||
@Mock lateinit var commandQueue: CommandQueueProvider
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
val packet = MsgCheckValue_v2(aapsLogger, rxBus, resourceHelper, danaPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue)
|
||||
val packet = MsgCheckValue_v2(injector)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 3.toByte()))
|
||||
Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.EXPORT_MODEL, danaPump.hwModel)
|
||||
Assert.assertEquals(DanaPump.EXPORT_MODEL, danaPump.hwModel)
|
||||
}
|
||||
}
|
|
@ -1,17 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm
|
||||
|
||||
import android.content.Context
|
||||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danaRv2.comm.MsgHistoryEvents_v2
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
|
@ -19,16 +13,11 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(DetailedBolusInfoStorage::class)
|
||||
class MsgHistoryEvents_v2Test : DanaRTestBase() {
|
||||
|
||||
@Mock lateinit var context: Context
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
||||
@Mock lateinit var danaRv2Plugin: DanaRv2Plugin
|
||||
|
||||
@Test @Throws(Exception::class) fun runTest() {
|
||||
val packet = MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, RxBusWrapper(), activePluginProvider, injector, DateUtil(context, resourceHelper), 0)
|
||||
val packet = MsgHistoryEvents_v2(injector, 0)
|
||||
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
val array = createArray(100, 2)
|
||||
|
||||
putByteToArray(array, 0, 0xFF.toByte())
|
||||
packet.handleMessage(array)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase.intFromBuff
|
||||
import info.nightscout.androidaps.danars.comm.DanaRS_Packet_APS_Basal_Set_Temporary_Basal.Companion.PARAM30MIN
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -14,33 +13,33 @@ class MsgSetAPSTempBasalStart_v2Test : DanaRTestBase() {
|
|||
@Test fun runTest() {
|
||||
|
||||
// test low hard limit
|
||||
var packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, -1, true, false)
|
||||
Assert.assertEquals(0, intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))
|
||||
var packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, -1, true, false)
|
||||
Assert.assertEquals(0, packet.intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1))
|
||||
// test high hard limit
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 550, true, false)
|
||||
Assert.assertEquals(500, intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 550, true, false)
|
||||
Assert.assertEquals(500, packet.intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1))
|
||||
// test setting 15 min
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 50, true, false)
|
||||
Assert.assertEquals(50, intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 50, true, false)
|
||||
Assert.assertEquals(50, packet.intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1))
|
||||
// test setting 30 min
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 50, false, true)
|
||||
Assert.assertEquals(50, intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(PARAM30MIN, intFromBuff(packet.buffer, 2, 1))
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 50, false, true)
|
||||
Assert.assertEquals(50, packet.intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(PARAM30MIN, packet.intFromBuff(packet.buffer, 2, 1))
|
||||
// over 200% set always 15 min
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 250, false, true)
|
||||
Assert.assertEquals(250, intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 250, false, true)
|
||||
Assert.assertEquals(250, packet.intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1))
|
||||
// test low hard limit
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, -1, false, true)
|
||||
Assert.assertEquals(0, intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(PARAM30MIN, intFromBuff(packet.buffer, 2, 1))
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, -1, false, true)
|
||||
Assert.assertEquals(0, packet.intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(PARAM30MIN, packet.intFromBuff(packet.buffer, 2, 1))
|
||||
// test high hard limit
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 550, false, true)
|
||||
Assert.assertEquals(500, intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))
|
||||
packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 550, false, true)
|
||||
Assert.assertEquals(500, packet.intFromBuff(packet.buffer, 0, 2))
|
||||
Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1))
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte(), 0.toByte(), 0.toByte(), 0.toByte(), 0.toByte()))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.danaRv2.comm.MsgSetHistoryEntry_v2
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -10,7 +11,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgSetHistoryEntry_v2Test : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
var packet = info.nightscout.androidaps.danaRv2.comm.MsgSetHistoryEntry_v2(aapsLogger, 1, System.currentTimeMillis(), 1, 0)
|
||||
val packet = MsgSetHistoryEntry_v2(injector, 1, System.currentTimeMillis(), 1, 0)
|
||||
// test message decoding
|
||||
// != 1 fails
|
||||
packet.handleMessage(createArray(34, 2.toByte()))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.danaRv2.comm.MsgStatusAPS_v2
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -12,11 +12,11 @@ class MsgStatusAPS_v2Test : DanaRTestBase() {
|
|||
|
||||
@Test
|
||||
fun runTest() {
|
||||
val packet = info.nightscout.androidaps.danaRv2.comm.MsgStatusAPS_v2(aapsLogger, danaPump)
|
||||
val packet = MsgStatusAPS_v2(injector)
|
||||
// test iob
|
||||
//TODO Find a way to mock treatments plugin
|
||||
val testArray = createArray(34, 7.toByte())
|
||||
val iob = MessageBase.intFromBuff(testArray, 0, 2) / 100.0
|
||||
val iob = packet.intFromBuff(testArray, 0, 2) / 100.0
|
||||
packet.handleMessage(testArray)
|
||||
Assert.assertEquals(iob, danaPump.iob, 0.0)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.danaRv2.comm.MsgStatusBolusExtended_v2
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -12,9 +12,9 @@ class MsgStatusBolusExtended_v2Test : DanaRTestBase() {
|
|||
|
||||
@Test
|
||||
fun runTest() {
|
||||
val packet = info.nightscout.androidaps.danaRv2.comm.MsgStatusBolusExtended_v2(aapsLogger, danaPump)
|
||||
val packet = MsgStatusBolusExtended_v2(injector)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 7.toByte()))
|
||||
Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 2, 2).toDouble() / 100.0, danaPump.extendedBolusAmount, 0.0)
|
||||
Assert.assertEquals(packet.intFromBuff(createArray(10, 7.toByte()), 2, 2).toDouble() / 100.0, danaPump.extendedBolusAmount, 0.0)
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.danaRv2.comm.MsgStatusTempBasal_v2
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -10,7 +11,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
class MsgStatusTempBasal_v2Test : DanaRTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = info.nightscout.androidaps.danaRv2.comm.MsgStatusTempBasal_v2(aapsLogger, danaPump, dateUtil)
|
||||
val packet = MsgStatusTempBasal_v2(injector)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 1.toByte()))
|
||||
Assert.assertEquals(true, danaPump.isTempBasalInProgress)
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
package info.nightscout.androidaps.core
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
|
@ -1,82 +1,56 @@
|
|||
package info.nightscout.androidaps.danaRKorean.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danar.comm.*
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class MessageHashTableRKorean @Inject constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
resourceHelper: ResourceHelper,
|
||||
constraintChecker: ConstraintChecker,
|
||||
danaPump: DanaPump,
|
||||
danaRPlugin: DanaRPlugin,
|
||||
danaRKoreanPlugin: DanaRKoreanPlugin,
|
||||
configBuilderPlugin: ConfigBuilderInterface,
|
||||
commandQueue: CommandQueueProvider,
|
||||
activePlugin: ActivePluginProvider,
|
||||
dateUtil: DateUtil,
|
||||
nsUpload: NSUpload,
|
||||
databaseHelper: DatabaseHelperInterface,
|
||||
injector: HasAndroidInjector
|
||||
private val injector: HasAndroidInjector
|
||||
) : MessageHashTableBase {
|
||||
|
||||
private var messages: HashMap<Int, MessageBase> = HashMap()
|
||||
|
||||
init {
|
||||
put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaPump)) // 0x0101 CMD_MEALINS_STOP
|
||||
put(MsgBolusStart(aapsLogger, constraintChecker, danaPump, 0.0)) // 0x0102 CMD_MEALINS_START_DATA
|
||||
put(MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaPump)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
|
||||
put(MsgStatusProfile(aapsLogger, danaPump)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
|
||||
put(MsgStatusTempBasal(aapsLogger, danaPump, activePlugin, injector)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusBolusExtended(injector, aapsLogger, danaPump, activePlugin, dateUtil)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBasic_k(aapsLogger, danaPump)) // 0x020A CMD_PUMP_INITVIEW_I
|
||||
put(MsgStatus_k(aapsLogger, danaPump)) // 0x020B CMD_PUMP_STATUS
|
||||
put(MsgInitConnStatusTime_k(aapsLogger, rxBus, resourceHelper, danaPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil)) // 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusBolus_k(aapsLogger, rxBus, resourceHelper, danaPump, activePlugin)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
|
||||
put(MsgInitConnStatusBasic_k(aapsLogger, rxBus, resourceHelper, danaPump)) // 0x0303 CMD_PUMPINIT_INIT_INFO
|
||||
put(MsgSetTempBasalStart(aapsLogger, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
|
||||
put(MsgSetCarbsEntry(aapsLogger, 0, 0)) // 0x0402 CMD_PUMPSET_HIS_S
|
||||
put(MsgSetTempBasalStop(aapsLogger)) // 0x0403 CMD_PUMPSET_EXERCISE_STOP
|
||||
put(MsgSetExtendedBolusStop(aapsLogger)) // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
|
||||
put(MsgSetExtendedBolusStart(aapsLogger, constraintChecker, 0.0, 0)) // 0x0407 CMD_PUMPSET_EXPANS_INS_S
|
||||
put(MsgError(aapsLogger, rxBus, resourceHelper, danaPump, nsUpload)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
|
||||
put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
|
||||
put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
|
||||
put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgSettingBasal_k(aapsLogger, danaPump, danaRKoreanPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I
|
||||
put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
|
||||
put(MsgSettingProfileRatios(aapsLogger, danaPump)) // 0x3204 CMD_SETTING_V_CCC_I
|
||||
put(MsgSettingMaxValues(aapsLogger, danaPump)) // 0x3205 CMD_SETTING_V_MAX_VALUE_I
|
||||
put(MsgSettingBasalProfileAll_k(aapsLogger, danaPump)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
|
||||
put(MsgSettingShippingInfo(aapsLogger, danaPump)) // 0x3207 CMD_SETTING_V_SHIPPING_I
|
||||
put(MsgSettingGlucose(aapsLogger, danaPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(MsgSettingPumpTime(aapsLogger, danaPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
|
||||
put(MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryNewDone(aapsLogger, danaPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
|
||||
put(MsgHistoryNew(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgCheckValue_k(aapsLogger, danaPump, danaRKoreanPlugin)) // 0xF0F1 CMD_PUMP_CHECK_VALUE
|
||||
put(MsgBolusStop(injector)) // 0x0101 CMD_MEALINS_STOP
|
||||
put(MsgBolusStart(injector, 0.0)) // 0x0102 CMD_MEALINS_START_DATA
|
||||
put(MsgBolusProgress(injector)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
|
||||
put(MsgStatusProfile(injector)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
|
||||
put(MsgStatusTempBasal(injector)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusBolusExtended(injector)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBasic_k(injector)) // 0x020A CMD_PUMP_INITVIEW_I
|
||||
put(MsgStatus_k(injector)) // 0x020B CMD_PUMP_STATUS
|
||||
put(MsgInitConnStatusTime_k(injector)) // 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusBolus_k(injector)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
|
||||
put(MsgInitConnStatusBasic_k(injector)) // 0x0303 CMD_PUMPINIT_INIT_INFO
|
||||
put(MsgSetTempBasalStart(injector, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
|
||||
put(MsgSetCarbsEntry(injector, 0, 0)) // 0x0402 CMD_PUMPSET_HIS_S
|
||||
put(MsgSetTempBasalStop(injector)) // 0x0403 CMD_PUMPSET_EXERCISE_STOP
|
||||
put(MsgSetExtendedBolusStop(injector)) // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
|
||||
put(MsgSetExtendedBolusStart(injector, 0.0, 0)) // 0x0407 CMD_PUMPSET_EXPANS_INS_S
|
||||
put(MsgError(injector)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
|
||||
put(MsgPCCommStart(injector)) // 0x3001 CMD_CONNECT
|
||||
put(MsgPCCommStop(injector)) // 0x3002 CMD_DISCONNECT
|
||||
put(MsgHistoryBolus(injector)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(injector)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(injector)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(injector)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryCarbo(injector)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgSettingBasal_k(injector)) // 0x3202 CMD_SETTING_V_BASAL_INS_I
|
||||
put(MsgSettingMeal(injector)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
|
||||
put(MsgSettingProfileRatios(injector)) // 0x3204 CMD_SETTING_V_CCC_I
|
||||
put(MsgSettingMaxValues(injector)) // 0x3205 CMD_SETTING_V_MAX_VALUE_I
|
||||
put(MsgSettingBasalProfileAll_k(injector)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
|
||||
put(MsgSettingShippingInfo(injector)) // 0x3207 CMD_SETTING_V_SHIPPING_I
|
||||
put(MsgSettingGlucose(injector)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(MsgSettingPumpTime(injector)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSetSingleBasalProfile(injector, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
|
||||
put(MsgHistoryAll(injector)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryNewDone(injector)) // 0x42F1 CMD_HISTORY_NEW_DONE
|
||||
put(MsgHistoryNew(injector)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgCheckValue_k(injector)) // 0xF0F1 CMD_PUMP_CHECK_VALUE
|
||||
}
|
||||
|
||||
override fun put(message: MessageBase) {
|
||||
|
@ -84,6 +58,6 @@ class MessageHashTableRKorean @Inject constructor(
|
|||
}
|
||||
|
||||
override fun findMessage(command: Int): MessageBase {
|
||||
return messages[command] ?: MessageBase()
|
||||
return messages[command] ?: MessageBase(injector)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
package info.nightscout.androidaps.danaRKorean.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
||||
class MsgCheckValue_k(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump,
|
||||
private val danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0xF0F1)
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
package info.nightscout.androidaps.danaRKorean.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
||||
class MsgInitConnStatusBasic_k(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaPump: DanaPump
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0303)
|
||||
|
|
|
@ -1,24 +1,16 @@
|
|||
package info.nightscout.androidaps.danaRKorean.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
||||
class MsgInitConnStatusBolus_k(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaPump: DanaPump,
|
||||
private val activePlugin: ActivePluginProvider
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0302)
|
||||
|
|
|
@ -1,33 +1,17 @@
|
|||
package info.nightscout.androidaps.danaRKorean.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
|
||||
import info.nightscout.androidaps.interfaces.PluginType
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
||||
class MsgInitConnStatusTime_k(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaPump: DanaPump,
|
||||
private val danaRPlugin: DanaRPlugin,
|
||||
private val danaRKoreanPlugin: DanaRKoreanPlugin,
|
||||
private val configBuilderPlugin: ConfigBuilderInterface,
|
||||
private val commandQueue: CommandQueueProvider,
|
||||
private val dateUtil: DateUtil
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0301)
|
||||
|
@ -46,7 +30,7 @@ class MsgInitConnStatusTime_k(
|
|||
danaRPlugin.setFragmentVisible(PluginType.PUMP, true)
|
||||
danaPump.reset() // mark not initialized
|
||||
//If profile coming from pump, switch it as well
|
||||
configBuilderPlugin.storeSettings("ChangingKoreanDanaDriver")
|
||||
configBuilder.storeSettings("ChangingKoreanDanaDriver")
|
||||
rxBus.send(EventRebuildTabs())
|
||||
commandQueue.readStatus("PumpDriverChange", null) // force new connection
|
||||
return
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package info.nightscout.androidaps.danaRKorean.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import java.util.*
|
||||
|
||||
|
@ -15,9 +14,8 @@ import java.util.*
|
|||
* THIS IS BROKEN IN PUMP... SENDING ONLY 1 PROFILE
|
||||
*/
|
||||
class MsgSettingBasalProfileAll_k(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3206)
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package info.nightscout.androidaps.danaRKorean.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import java.util.*
|
||||
|
||||
class MsgSettingBasal_k(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump,
|
||||
private val danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3202)
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package info.nightscout.androidaps.danaRKorean.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
||||
class MsgStatusBasic_k(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x020A)
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package info.nightscout.androidaps.danaRKorean.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
||||
class MsgStatus_k(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x020B)
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.os.Binder;
|
|||
import android.os.SystemClock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -12,6 +11,10 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.dana.DanaPump;
|
||||
import info.nightscout.androidaps.dana.events.EventDanaRNewStatus;
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MessageHashTableRKorean;
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MsgCheckValue_k;
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MsgSettingBasal_k;
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MsgStatusBasic_k;
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin;
|
||||
import info.nightscout.androidaps.danar.R;
|
||||
import info.nightscout.androidaps.danar.SerialIOThread;
|
||||
|
@ -50,10 +53,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
|
|||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MessageHashTableRKorean;
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MsgCheckValue_k;
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MsgSettingBasal_k;
|
||||
import info.nightscout.androidaps.danaRKorean.comm.MsgStatusBasic_k;
|
||||
import info.nightscout.androidaps.queue.commands.Command;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.T;
|
||||
|
@ -128,10 +127,10 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
try {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpstatus)));
|
||||
//MsgStatus_k statusMsg = new MsgStatus_k();
|
||||
MsgStatusBasic_k statusBasicMsg = new MsgStatusBasic_k(aapsLogger, danaPump);
|
||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal(aapsLogger, danaPump, activePlugin, injector);
|
||||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended(injector, aapsLogger, danaPump, activePlugin, dateUtil);
|
||||
MsgCheckValue_k checkValue = new MsgCheckValue_k(aapsLogger, danaPump, danaRKoreanPlugin);
|
||||
MsgStatusBasic_k statusBasicMsg = new MsgStatusBasic_k(injector);
|
||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal(injector);
|
||||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended(injector);
|
||||
MsgCheckValue_k checkValue = new MsgCheckValue_k(injector);
|
||||
|
||||
if (danaPump.isNewPump()) {
|
||||
mSerialIOThread.sendMessage(checkValue);
|
||||
|
@ -154,7 +153,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
Profile profile = profileFunction.getProfile();
|
||||
if (profile != null && Math.abs(danaPump.getCurrentBasal() - profile.getBasal()) >= danaRKoreanPlugin.getPumpDescription().basalStep) {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingBasal(aapsLogger, danaPump, danaRPlugin));
|
||||
mSerialIOThread.sendMessage(new MsgSettingBasal(injector));
|
||||
if (!danaRKoreanPlugin.isThisProfileSet(profile) && !commandQueue.isRunning(Command.CommandType.BASAL_PROFILE)) {
|
||||
rxBus.send(new EventProfileNeedsUpdate());
|
||||
}
|
||||
|
@ -162,15 +161,15 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
|
||||
if (danaPump.getLastSettingsRead() + 60 * 60 * 1000L < now || !danaRKoreanPlugin.isInitialized()) {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaPump, danaRKoreanPlugin));
|
||||
mSerialIOThread.sendMessage(new MsgSettingBasal_k(aapsLogger, danaPump, danaRKoreanPlugin));
|
||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingMeal(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingBasal_k(injector));
|
||||
//0x3201
|
||||
mSerialIOThread.sendMessage(new MsgSettingMaxValues(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingGlucose(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingMaxValues(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingGlucose(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios(injector));
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaPump, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(injector));
|
||||
if (danaPump.getPumpTime() == 0) {
|
||||
// initial handshake was not successfull
|
||||
// deinitialize pump
|
||||
|
@ -184,8 +183,8 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
if (Math.abs(timeDiff) > 10) {
|
||||
waitForWholeMinute(); // Dana can set only whole minute
|
||||
// add 10sec to be sure we are over minute (will be cutted off anyway)
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(aapsLogger, dateUtil, new Date(DateUtil.now() + T.secs(10).msecs())));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaPump, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(injector, DateUtil.now() + T.secs(10).msecs()));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(injector));
|
||||
timeDiff = (danaPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
|
||||
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds");
|
||||
}
|
||||
|
@ -213,12 +212,12 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
if (danaPump.isTempBasalInProgress()) {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(injector));
|
||||
SystemClock.sleep(500);
|
||||
}
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(aapsLogger, percent, durationInHours));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal(aapsLogger, danaPump, activePlugin, injector));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(injector, percent, durationInHours));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal(injector));
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
}
|
||||
|
@ -226,8 +225,8 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
public boolean tempBasalStop() {
|
||||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal(aapsLogger, danaPump, activePlugin, injector));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(injector));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal(injector));
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
}
|
||||
|
@ -235,8 +234,8 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
||||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingextendedbolus)));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(aapsLogger, constraintChecker, insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaPump, activePlugin, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(injector, insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector));
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
}
|
||||
|
@ -244,8 +243,8 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
public boolean extendedBolusStop() {
|
||||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaPump, activePlugin, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop(injector));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector));
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
}
|
||||
|
@ -261,12 +260,12 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
|
||||
danaPump.setBolusingTreatment(t);
|
||||
danaPump.setBolusDone(false);
|
||||
MsgBolusStart start = new MsgBolusStart(aapsLogger, constraintChecker, danaPump, amount);
|
||||
MsgBolusStart start = new MsgBolusStart(injector, amount);
|
||||
danaPump.setBolusStopped(false);
|
||||
danaPump.setBolusStopForced(false);
|
||||
|
||||
if (carbs > 0) {
|
||||
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(aapsLogger, carbtime, carbs));
|
||||
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(injector, carbtime, carbs));
|
||||
}
|
||||
|
||||
if (amount > 0) {
|
||||
|
@ -298,7 +297,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
|
||||
public boolean carbsEntry(int amount) {
|
||||
if (!isConnected()) return false;
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(aapsLogger, System.currentTimeMillis(), amount);
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(injector, System.currentTimeMillis(), amount);
|
||||
mSerialIOThread.sendMessage(msg);
|
||||
return true;
|
||||
}
|
||||
|
@ -317,7 +316,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.updatingbasalrates)));
|
||||
Double[] basal = danaPump.buildDanaRProfileRecord(profile);
|
||||
MsgSetSingleBasalProfile msgSet = new MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, basal);
|
||||
MsgSetSingleBasalProfile msgSet = new MsgSetSingleBasalProfile(injector, basal);
|
||||
mSerialIOThread.sendMessage(msgSet);
|
||||
danaPump.setLastSettingsRead(0); // force read full settings
|
||||
getPumpStatus();
|
||||
|
|
|
@ -1,104 +1,74 @@
|
|||
package info.nightscout.androidaps.danaRv2.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danar.comm.*
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class MessageHashTableRv2 @Inject constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
resourceHelper: ResourceHelper,
|
||||
constraintChecker: ConstraintChecker,
|
||||
danaPump: DanaPump,
|
||||
danaRPlugin: DanaRPlugin,
|
||||
danaRKoreanPlugin: DanaRKoreanPlugin,
|
||||
danaRv2Plugin: DanaRv2Plugin,
|
||||
configBuilderPlugin: ConfigBuilderInterface,
|
||||
commandQueue: CommandQueueProvider,
|
||||
activePlugin: ActivePluginProvider,
|
||||
detailedBolusInfoStorage: DetailedBolusInfoStorage,
|
||||
nsUpload: NSUpload,
|
||||
injector: HasAndroidInjector,
|
||||
dateUtil: DateUtil,
|
||||
databaseHelper: DatabaseHelperInterface
|
||||
private val injector: HasAndroidInjector
|
||||
) : MessageHashTableBase {
|
||||
|
||||
private var messages: HashMap<Int, MessageBase> = HashMap()
|
||||
|
||||
init {
|
||||
put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaPump)) // 0x0101 CMD_MEALINS_STOP
|
||||
put(MsgBolusStart(aapsLogger, constraintChecker, danaPump, 0.0)) // 0x0102 CMD_MEALINS_START_DATA
|
||||
put(MsgBolusStartWithSpeed(aapsLogger, constraintChecker, danaPump, 0.0, 0)) // 0x0104 CMD_MEALINS_START_DATA_SPEED
|
||||
put(MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaPump)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
|
||||
put(MsgStatusProfile(aapsLogger, danaPump)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
|
||||
put(MsgStatusTempBasal_v2(aapsLogger, danaPump, dateUtil)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusBolusExtended_v2(aapsLogger, danaPump)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBasic(aapsLogger, danaPump)) // 0x020A CMD_PUMP_INITVIEW_I
|
||||
put(MsgStatus(aapsLogger, danaPump)) // 0x020B CMD_PUMP_STATUS
|
||||
put(MsgInitConnStatusTime(aapsLogger, rxBus, resourceHelper, danaPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil)) // 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusBolus(aapsLogger, rxBus, resourceHelper, danaPump)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
|
||||
put(MsgInitConnStatusBasic(aapsLogger, danaPump)) // 0x0303 CMD_PUMPINIT_INIT_INFO
|
||||
put(MsgInitConnStatusOption(aapsLogger, rxBus, resourceHelper, danaPump, activePlugin)) // 0x0304 CMD_PUMPINIT_OPTION
|
||||
put(MsgSetTempBasalStart(aapsLogger, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
|
||||
put(MsgSetCarbsEntry(aapsLogger, 0, 0)) // 0x0402 CMD_PUMPSET_HIS_S
|
||||
put(MsgSetTempBasalStop(aapsLogger)) // 0x0403 CMD_PUMPSET_EXERCISE_STOP
|
||||
put(MsgSetExtendedBolusStop(aapsLogger)) // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
|
||||
put(MsgSetExtendedBolusStart(aapsLogger, constraintChecker, 0.0, 0)) // 0x0407 CMD_PUMPSET_EXPANS_INS_S
|
||||
put(MsgError(aapsLogger, rxBus, resourceHelper, danaPump, nsUpload)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
|
||||
put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
|
||||
put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
|
||||
put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryError(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3106 CMD_HISTORY_ERROR
|
||||
put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3108 CMD_HISTORY_REFILL
|
||||
put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3109 CMD_HISTORY_SUSPEND
|
||||
put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x310A CMD_HISTORY_BASAL_HOUR
|
||||
put(MsgHistoryDone(aapsLogger, danaPump)) // 0x31F1 CMD_HISTORY_DONT_USED
|
||||
put(MsgSettingBasal(aapsLogger, danaPump, danaRPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I
|
||||
put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
|
||||
put(MsgSettingProfileRatios(aapsLogger, danaPump)) // 0x3204 CMD_SETTING_V_CCC_I
|
||||
put(MsgSettingMaxValues(aapsLogger, danaPump)) // 0x3205 CMD_SETTING_V_MAX_VALUE_I
|
||||
put(MsgSettingBasalProfileAll(aapsLogger, danaPump)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
|
||||
put(MsgSettingShippingInfo(aapsLogger, danaPump)) // 0x3207 CMD_SETTING_V_SHIPPING_I
|
||||
put(MsgSettingGlucose(aapsLogger, danaPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(MsgSettingPumpTime(aapsLogger, danaPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSettingUserOptions(aapsLogger, danaPump)) // 0x320B CMD_SETTING_V_USER_OPTIONS
|
||||
put(MsgSettingActiveProfile(aapsLogger, danaPump)) // 0x320C CMD_SETTING_V_PROFILE_NUMBER
|
||||
put(MsgSettingProfileRatiosAll(aapsLogger, danaPump)) // 0x320D CMD_SETTING_V_CIR_CF_VALUE
|
||||
put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
|
||||
put(MsgSetBasalProfile(aapsLogger, rxBus, resourceHelper, 0.toByte(), Array(24) { 0.0 })) // 0x3306 CMD_SETTING_BASAL_PROFILE_S
|
||||
put(MsgSetUserOptions(aapsLogger, danaPump)) // 0x330B CMD_SETTING_USER_OPTIONS_S
|
||||
put(MsgSetActivateBasalProfile(aapsLogger, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S
|
||||
put(MsgHistoryAllDone(aapsLogger, danaPump)) // 0x41F1 CMD_HISTORY_ALL_DONE
|
||||
put(MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryNewDone(aapsLogger, danaPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
|
||||
put(MsgHistoryNew(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgCheckValue_v2(aapsLogger, rxBus, resourceHelper, danaPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue)) // 0xF0F1 CMD_PUMP_CHECK_VALUE
|
||||
put(MsgStatusAPS_v2(aapsLogger, danaPump)) // 0xE001 CMD_PUMPSTATUS_APS
|
||||
put(MsgSetAPSTempBasalStart_v2(aapsLogger, 0, false, false)) // 0xE002 CMD_PUMPSET_APSTEMP
|
||||
put(MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, rxBus, activePlugin, injector, dateUtil)) // 0xE003 CMD_GET_HISTORY
|
||||
put(MsgSetHistoryEntry_v2(aapsLogger, 0, 0, 0, 0)) // 0xE004 CMD_SET_HISTORY_ENTRY
|
||||
put(MsgBolusStop(injector)) // 0x0101 CMD_MEALINS_STOP
|
||||
put(MsgBolusStart(injector, 0.0)) // 0x0102 CMD_MEALINS_START_DATA
|
||||
put(MsgBolusStartWithSpeed(injector, 0.0, 0)) // 0x0104 CMD_MEALINS_START_DATA_SPEED
|
||||
put(MsgBolusProgress(injector)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
|
||||
put(MsgStatusProfile(injector)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
|
||||
put(MsgStatusTempBasal_v2(injector)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusBolusExtended_v2(injector)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBasic(injector)) // 0x020A CMD_PUMP_INITVIEW_I
|
||||
put(MsgStatus(injector)) // 0x020B CMD_PUMP_STATUS
|
||||
put(MsgInitConnStatusTime(injector)) // 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusBolus(injector)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
|
||||
put(MsgInitConnStatusBasic(injector)) // 0x0303 CMD_PUMPINIT_INIT_INFO
|
||||
put(MsgInitConnStatusOption(injector)) // 0x0304 CMD_PUMPINIT_OPTION
|
||||
put(MsgSetTempBasalStart(injector, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
|
||||
put(MsgSetCarbsEntry(injector, 0, 0)) // 0x0402 CMD_PUMPSET_HIS_S
|
||||
put(MsgSetTempBasalStop(injector)) // 0x0403 CMD_PUMPSET_EXERCISE_STOP
|
||||
put(MsgSetExtendedBolusStop(injector)) // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
|
||||
put(MsgSetExtendedBolusStart(injector, 0.0, 0)) // 0x0407 CMD_PUMPSET_EXPANS_INS_S
|
||||
put(MsgError(injector)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
|
||||
put(MsgPCCommStart(injector)) // 0x3001 CMD_CONNECT
|
||||
put(MsgPCCommStop(injector)) // 0x3002 CMD_DISCONNECT
|
||||
put(MsgHistoryBolus(injector)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(injector)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(injector)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(injector)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryError(injector)) // 0x3106 CMD_HISTORY_ERROR
|
||||
put(MsgHistoryCarbo(injector)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgHistoryRefill(injector)) // 0x3108 CMD_HISTORY_REFILL
|
||||
put(MsgHistorySuspend(injector)) // 0x3109 CMD_HISTORY_SUSPEND
|
||||
put(MsgHistoryBasalHour(injector)) // 0x310A CMD_HISTORY_BASAL_HOUR
|
||||
put(MsgHistoryDone(injector)) // 0x31F1 CMD_HISTORY_DONT_USED
|
||||
put(MsgSettingBasal(injector)) // 0x3202 CMD_SETTING_V_BASAL_INS_I
|
||||
put(MsgSettingMeal(injector)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
|
||||
put(MsgSettingProfileRatios(injector)) // 0x3204 CMD_SETTING_V_CCC_I
|
||||
put(MsgSettingMaxValues(injector)) // 0x3205 CMD_SETTING_V_MAX_VALUE_I
|
||||
put(MsgSettingBasalProfileAll(injector)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
|
||||
put(MsgSettingShippingInfo(injector)) // 0x3207 CMD_SETTING_V_SHIPPING_I
|
||||
put(MsgSettingGlucose(injector)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(MsgSettingPumpTime(injector)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSettingUserOptions(injector)) // 0x320B CMD_SETTING_V_USER_OPTIONS
|
||||
put(MsgSettingActiveProfile(injector)) // 0x320C CMD_SETTING_V_PROFILE_NUMBER
|
||||
put(MsgSettingProfileRatiosAll(injector)) // 0x320D CMD_SETTING_V_CIR_CF_VALUE
|
||||
put(MsgSetSingleBasalProfile(injector, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
|
||||
put(MsgSetBasalProfile(injector, 0.toByte(), Array(24) { 0.0 })) // 0x3306 CMD_SETTING_BASAL_PROFILE_S
|
||||
put(MsgSetUserOptions(injector)) // 0x330B CMD_SETTING_USER_OPTIONS_S
|
||||
put(MsgSetActivateBasalProfile(injector, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S
|
||||
put(MsgHistoryAllDone(injector)) // 0x41F1 CMD_HISTORY_ALL_DONE
|
||||
put(MsgHistoryAll(injector)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryNewDone(injector)) // 0x42F1 CMD_HISTORY_NEW_DONE
|
||||
put(MsgHistoryNew(injector)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgCheckValue_v2(injector)) // 0xF0F1 CMD_PUMP_CHECK_VALUE
|
||||
put(MsgStatusAPS_v2(injector)) // 0xE001 CMD_PUMPSTATUS_APS
|
||||
put(MsgSetAPSTempBasalStart_v2(injector, 0, false, false)) // 0xE002 CMD_PUMPSET_APSTEMP
|
||||
put(MsgHistoryEvents_v2(injector)) // 0xE003 CMD_GET_HISTORY
|
||||
put(MsgSetHistoryEntry_v2(injector, 0, 0, 0, 0)) // 0xE004 CMD_SET_HISTORY_ENTRY
|
||||
}
|
||||
|
||||
override fun put(message: MessageBase) {
|
||||
|
@ -106,6 +76,6 @@ class MessageHashTableRv2 @Inject constructor(
|
|||
}
|
||||
|
||||
override fun findMessage(command: Int): MessageBase {
|
||||
return messages[command] ?: MessageBase()
|
||||
return messages[command] ?: MessageBase(injector)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,18 @@
|
|||
package info.nightscout.androidaps.danaRv2.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
|
||||
import info.nightscout.androidaps.interfaces.PluginType
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
||||
class MsgCheckValue_v2(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaPump: DanaPump,
|
||||
private val danaRPlugin: DanaRPlugin,
|
||||
private val danaRKoreanPlugin: DanaRKoreanPlugin,
|
||||
private val danaRv2Plugin: DanaRv2Plugin,
|
||||
private val configBuilderPlugin: ConfigBuilderInterface,
|
||||
private val commandQueue: CommandQueueProvider
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
|
||||
init {
|
||||
|
@ -41,7 +26,7 @@ class MsgCheckValue_v2(
|
|||
danaPump.hwModel = intFromBuff(bytes, 0, 1)
|
||||
danaPump.protocol = intFromBuff(bytes, 1, 1)
|
||||
danaPump.productCode = intFromBuff(bytes, 2, 1)
|
||||
if (danaPump.hwModel != info.nightscout.androidaps.dana.DanaPump.EXPORT_MODEL) {
|
||||
if (danaPump.hwModel != DanaPump.EXPORT_MODEL) {
|
||||
danaPump.reset()
|
||||
val notification = Notification(Notification.WRONG_DRIVER, resourceHelper.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
|
@ -53,7 +38,7 @@ class MsgCheckValue_v2(
|
|||
danaRPlugin.setFragmentVisible(PluginType.PUMP, false)
|
||||
danaPump.reset() // mark not initialized
|
||||
//If profile coming from pump, switch it as well
|
||||
configBuilderPlugin.storeSettings("ChangingDanaRv2Driver")
|
||||
configBuilder.storeSettings("ChangingDanaRv2Driver")
|
||||
rxBus.send(EventRebuildTabs())
|
||||
commandQueue.readStatus("PumpDriverChange", null) // force new connection
|
||||
return
|
||||
|
@ -69,7 +54,7 @@ class MsgCheckValue_v2(
|
|||
danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
|
||||
danaRPlugin.setFragmentVisible(PluginType.PUMP, true)
|
||||
//If profile coming from pump, switch it as well
|
||||
configBuilderPlugin.storeSettings("ChangingDanaRv2Driver")
|
||||
configBuilder.storeSettings("ChangingDanaRv2Driver")
|
||||
rxBus.send(EventRebuildTabs())
|
||||
commandQueue.readStatus("PumpDriverChange", null) // force new connection
|
||||
return
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.danaRv2.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
|
@ -9,26 +8,14 @@ import info.nightscout.androidaps.db.ExtendedBolus
|
|||
import info.nightscout.androidaps.db.Source
|
||||
import info.nightscout.androidaps.db.TemporaryBasal
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import java.util.*
|
||||
|
||||
class MsgHistoryEvents_v2 constructor(
|
||||
val aapsLogger: AAPSLogger,
|
||||
val resourceHelper: ResourceHelper,
|
||||
private val detailedBolusInfoStorage: DetailedBolusInfoStorage,
|
||||
val danaRv2Plugin: DanaRv2Plugin,
|
||||
val rxBus: RxBusWrapper,
|
||||
val activePlugin: ActivePluginProvider,
|
||||
private val injector: HasAndroidInjector,
|
||||
private val dateUtil: DateUtil,
|
||||
var from: Long = 0
|
||||
) : MessageBase() {
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0xE003)
|
||||
|
@ -175,7 +162,7 @@ class MsgHistoryEvents_v2 constructor(
|
|||
status = "CARBS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
else -> {
|
||||
else -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Event: " + recordCode + " " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Param1: " + param1 + " Param2: " + param2)
|
||||
status = "UNKNOWN " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package info.nightscout.androidaps.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class MsgSetAPSTempBasalStart_v2(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var percent: Int,
|
||||
fifteenMinutes: Boolean,
|
||||
thirtyMinutes: Boolean
|
||||
) : MessageBase() {
|
||||
) : MessageBase(injector) {
|
||||
|
||||
val PARAM30MIN = 160
|
||||
val PARAM15MIN = 150
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package info.nightscout.androidaps.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import java.util.*
|
||||
|
||||
class MsgSetHistoryEntry_v2(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
type: Int, time: Long, param1: Int, param2: Int
|
||||
) : MessageBase() {
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0xE004)
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package info.nightscout.androidaps.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
||||
class MsgStatusAPS_v2(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0xE001)
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import kotlin.math.ceil
|
||||
|
||||
class MsgStatusBolusExtended_v2(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0207)
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package info.nightscout.androidaps.danaRv2.comm
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import kotlin.math.ceil
|
||||
|
||||
class MsgStatusTempBasal_v2(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump,
|
||||
private val dateUtil: DateUtil
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0205)
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.os.Binder;
|
|||
import android.os.SystemClock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -157,11 +156,11 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
public void getPumpStatus() {
|
||||
try {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpstatus)));
|
||||
MsgStatus statusMsg = new MsgStatus(aapsLogger, danaPump);
|
||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic(aapsLogger, danaPump);
|
||||
MsgStatusTempBasal_v2 tempStatusMsg = new MsgStatusTempBasal_v2(aapsLogger, danaPump, dateUtil);
|
||||
MsgStatusBolusExtended_v2 exStatusMsg = new MsgStatusBolusExtended_v2(aapsLogger, danaPump);
|
||||
MsgCheckValue_v2 checkValue = new MsgCheckValue_v2(aapsLogger, rxBus, resourceHelper, danaPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue);
|
||||
MsgStatus statusMsg = new MsgStatus(injector);
|
||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic(injector);
|
||||
MsgStatusTempBasal_v2 tempStatusMsg = new MsgStatusTempBasal_v2(injector);
|
||||
MsgStatusBolusExtended_v2 exStatusMsg = new MsgStatusBolusExtended_v2(injector);
|
||||
MsgCheckValue_v2 checkValue = new MsgCheckValue_v2(injector);
|
||||
|
||||
if (danaPump.isNewPump()) {
|
||||
mSerialIOThread.sendMessage(checkValue);
|
||||
|
@ -184,14 +183,14 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
PumpInterface pump = activePlugin.getActivePump();
|
||||
if (profile != null && Math.abs(danaPump.getCurrentBasal() - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingBasal(aapsLogger, danaPump, danaRPlugin));
|
||||
mSerialIOThread.sendMessage(new MsgSettingBasal(injector));
|
||||
if (!pump.isThisProfileSet(profile) && !commandQueue.isRunning(Command.CommandType.BASAL_PROFILE)) {
|
||||
rxBus.send(new EventProfileNeedsUpdate());
|
||||
}
|
||||
}
|
||||
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaPump, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(injector));
|
||||
if (danaPump.getPumpTime() == 0) {
|
||||
// initial handshake was not successfull
|
||||
// deinitialize pump
|
||||
|
@ -221,8 +220,8 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
} else {
|
||||
waitForWholeMinute(); // Dana can set only whole minute
|
||||
// add 10sec to be sure we are over minute (will be cutted off anyway)
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(aapsLogger, dateUtil, new Date(DateUtil.now() + T.secs(10).msecs())));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaPump, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(injector, DateUtil.now() + T.secs(10).msecs()));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(injector));
|
||||
timeDiff = (danaPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
|
||||
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds");
|
||||
}
|
||||
|
@ -231,17 +230,17 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
long now = System.currentTimeMillis();
|
||||
if (danaPump.getLastSettingsRead() + 60 * 60 * 1000L < now || !pump.isInitialized()) {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaPump, danaRKoreanPlugin));
|
||||
mSerialIOThread.sendMessage(new MsgSettingBasal(aapsLogger, danaPump, danaRPlugin));
|
||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingMeal(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingBasal(injector));
|
||||
//0x3201
|
||||
mSerialIOThread.sendMessage(new MsgSettingMaxValues(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingGlucose(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingUserOptions(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingMaxValues(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingGlucose(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingUserOptions(injector));
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll(injector));
|
||||
danaPump.setLastSettingsRead(now);
|
||||
}
|
||||
|
||||
|
@ -268,12 +267,12 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
if (danaPump.isTempBasalInProgress()) {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(injector));
|
||||
SystemClock.sleep(500);
|
||||
}
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(aapsLogger, percent, durationInHours));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaPump, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(injector, percent, durationInHours));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(injector));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -283,12 +282,12 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
if (danaPump.isTempBasalInProgress()) {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(injector));
|
||||
SystemClock.sleep(500);
|
||||
}
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetAPSTempBasalStart_v2(aapsLogger, percent, durationInMinutes == 15, durationInMinutes == 30));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaPump, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSetAPSTempBasalStart_v2(injector, percent, durationInMinutes == 15, durationInMinutes == 30));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(injector));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -303,12 +302,12 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
if (danaPump.isTempBasalInProgress()) {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(injector));
|
||||
SystemClock.sleep(500);
|
||||
}
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetAPSTempBasalStart_v2(aapsLogger, percent, durationInMinutes == 15, durationInMinutes == 30));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaPump, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSetAPSTempBasalStart_v2(injector, percent, durationInMinutes == 15, durationInMinutes == 30));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(injector));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -317,8 +316,8 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
public boolean tempBasalStop() {
|
||||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaPump, dateUtil));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(injector));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(injector));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -327,8 +326,8 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
||||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingextendedbolus)));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(aapsLogger, constraintChecker, insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended_v2(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(injector, insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended_v2(injector));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -337,8 +336,8 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
public boolean extendedBolusStop() {
|
||||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended_v2(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop(injector));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended_v2(injector));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -354,16 +353,16 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
final int preferencesSpeed = sp.getInt(R.string.key_danars_bolusspeed, 0);
|
||||
MessageBase start;
|
||||
if (preferencesSpeed == 0)
|
||||
start = new MsgBolusStart(aapsLogger, constraintChecker, danaPump, amount);
|
||||
start = new MsgBolusStart(injector, amount);
|
||||
else
|
||||
start = new MsgBolusStartWithSpeed(aapsLogger, constraintChecker, danaPump, amount, preferencesSpeed);
|
||||
start = new MsgBolusStartWithSpeed(injector, amount, preferencesSpeed);
|
||||
danaPump.setBolusStopped(false);
|
||||
danaPump.setBolusStopForced(false);
|
||||
|
||||
if (carbs > 0) {
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(aapsLogger, carbtime, carbs);
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(injector, carbtime, carbs);
|
||||
mSerialIOThread.sendMessage(msg);
|
||||
MsgSetHistoryEntry_v2 msgSetHistoryEntry_v2 = new MsgSetHistoryEntry_v2(aapsLogger, DanaPump.CARBS, carbtime, carbs, 0);
|
||||
MsgSetHistoryEntry_v2 msgSetHistoryEntry_v2 = new MsgSetHistoryEntry_v2(injector, DanaPump.CARBS, carbtime, carbs, 0);
|
||||
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
|
||||
lastHistoryFetched = Math.min(lastHistoryFetched, carbtime - T.mins(1).msecs());
|
||||
}
|
||||
|
@ -420,7 +419,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
public void run() {
|
||||
// load last bolus status
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)));
|
||||
mSerialIOThread.sendMessage(new MsgStatus(aapsLogger, danaPump));
|
||||
mSerialIOThread.sendMessage(new MsgStatus(injector));
|
||||
bolusingEvent.setPercent(100);
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.disconnecting)));
|
||||
}
|
||||
|
@ -430,9 +429,9 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
|
||||
public boolean carbsEntry(int amount, long time) {
|
||||
if (!isConnected()) return false;
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(aapsLogger, time, amount);
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(injector, time, amount);
|
||||
mSerialIOThread.sendMessage(msg);
|
||||
MsgSetHistoryEntry_v2 msgSetHistoryEntry_v2 = new MsgSetHistoryEntry_v2(aapsLogger, DanaPump.CARBS, time, amount, 0);
|
||||
MsgSetHistoryEntry_v2 msgSetHistoryEntry_v2 = new MsgSetHistoryEntry_v2(injector, DanaPump.CARBS, time, amount, 0);
|
||||
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
|
||||
lastHistoryFetched = Math.min(lastHistoryFetched, time - T.mins(1).msecs());
|
||||
return true;
|
||||
|
@ -449,7 +448,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected())
|
||||
return new PumpEnactResult(injector).success(false);
|
||||
SystemClock.sleep(300);
|
||||
MsgHistoryEvents_v2 msg = new MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, rxBus, activePlugin, injector, dateUtil, lastHistoryFetched);
|
||||
MsgHistoryEvents_v2 msg = new MsgHistoryEvents_v2(injector, lastHistoryFetched);
|
||||
aapsLogger.debug(LTag.PUMP, "Loading event history from: " + dateUtil.dateAndTimeString(lastHistoryFetched));
|
||||
|
||||
mSerialIOThread.sendMessage(msg);
|
||||
|
@ -469,9 +468,9 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.updatingbasalrates)));
|
||||
Double[] basal = danaPump.buildDanaRProfileRecord(profile);
|
||||
MsgSetBasalProfile msgSet = new MsgSetBasalProfile(aapsLogger, rxBus, resourceHelper, (byte) 0, basal);
|
||||
MsgSetBasalProfile msgSet = new MsgSetBasalProfile(injector, (byte) 0, basal);
|
||||
mSerialIOThread.sendMessage(msgSet);
|
||||
MsgSetActivateBasalProfile msgActivate = new MsgSetActivateBasalProfile(aapsLogger, (byte) 0);
|
||||
MsgSetActivateBasalProfile msgActivate = new MsgSetActivateBasalProfile(injector, (byte) 0);
|
||||
mSerialIOThread.sendMessage(msgActivate);
|
||||
danaPump.setLastSettingsRead(0); // force read full settings
|
||||
getPumpStatus();
|
||||
|
@ -483,7 +482,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected())
|
||||
return new PumpEnactResult(injector).success(false);
|
||||
SystemClock.sleep(300);
|
||||
MsgSetUserOptions msg = new MsgSetUserOptions(aapsLogger, danaPump);
|
||||
MsgSetUserOptions msg = new MsgSetUserOptions(injector);
|
||||
mSerialIOThread.sendMessage(msg);
|
||||
SystemClock.sleep(200);
|
||||
return new PumpEnactResult(injector).success(!msg.failed);
|
||||
|
|
|
@ -3,19 +3,33 @@ package info.nightscout.androidaps.danar.comm;
|
|||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.dana.DanaPump;
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin;
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface;
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage;
|
||||
import info.nightscout.androidaps.utils.CRC;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
||||
/*
|
||||
* 00 01 02 03 04 05 06
|
||||
|
@ -24,22 +38,39 @@ import info.nightscout.androidaps.utils.CRC;
|
|||
*/
|
||||
|
||||
public class MessageBase {
|
||||
private static Logger log = StacktraceLoggerWrapper.getLogger(LTag.PUMPCOMM);
|
||||
@Inject public AAPSLogger aapsLogger;
|
||||
@Inject public DateUtil dateUtil;
|
||||
@Inject public DanaPump danaPump;
|
||||
@Inject public DanaRPlugin danaRPlugin;
|
||||
@Inject public DanaRKoreanPlugin danaRKoreanPlugin;
|
||||
@Inject public DanaRv2Plugin danaRv2Plugin;
|
||||
@Inject public RxBusWrapper rxBus;
|
||||
@Inject public ResourceHelper resourceHelper;
|
||||
@Inject public ActivePluginProvider activePlugin;
|
||||
@Inject public ConfigBuilderInterface configBuilder;
|
||||
@Inject public CommandQueueProvider commandQueue;
|
||||
@Inject public DetailedBolusInfoStorage detailedBolusInfoStorage;
|
||||
@Inject public ConstraintChecker constraintChecker;
|
||||
@Inject public NSUpload nsUpload;
|
||||
@Inject public DatabaseHelperInterface databaseHelper;
|
||||
HasAndroidInjector injector;
|
||||
|
||||
public byte[] buffer = new byte[512];
|
||||
private int position = 6;
|
||||
|
||||
public boolean received = false;
|
||||
public boolean failed = false;
|
||||
|
||||
public MessageBase(HasAndroidInjector injector) {
|
||||
injector.androidInjector().inject(this);
|
||||
this. injector = injector;
|
||||
}
|
||||
|
||||
public void SetCommand(int cmd) {
|
||||
this.buffer[4] = (byte) (cmd >> 8 & 0xFF);
|
||||
this.buffer[5] = (byte) (cmd & 0xFF);
|
||||
}
|
||||
|
||||
public void resetBuffer() {
|
||||
position = 6;
|
||||
}
|
||||
|
||||
public void AddParamByte(byte data) {
|
||||
this.buffer[this.position++] = data;
|
||||
}
|
||||
|
@ -66,13 +97,15 @@ public class MessageBase {
|
|||
AddParamByte((byte) (date.get(Calendar.SECOND)));
|
||||
}
|
||||
|
||||
public void AddParamDateTime(Date date) {
|
||||
AddParamByte((byte) (date.getSeconds()));
|
||||
AddParamByte((byte) (date.getMinutes()));
|
||||
AddParamByte((byte) (date.getHours()));
|
||||
AddParamByte((byte) (date.getDate()));
|
||||
AddParamByte((byte) (date.getMonth() + 1));
|
||||
AddParamByte((byte) (date.getYear() - 100));
|
||||
public void AddParamDateTimeReversed(long timestamp) {
|
||||
GregorianCalendar date = new GregorianCalendar();
|
||||
date.setTimeInMillis(timestamp);
|
||||
AddParamByte((byte) (date.get(Calendar.SECOND)));
|
||||
AddParamByte((byte) (date.get(Calendar.MINUTE)));
|
||||
AddParamByte((byte) (date.get(Calendar.HOUR_OF_DAY)));
|
||||
AddParamByte((byte) (date.get(Calendar.DAY_OF_MONTH)));
|
||||
AddParamByte((byte) (date.get(Calendar.MONTH) + 1));
|
||||
AddParamByte((byte) (date.get(Calendar.YEAR) - 1900 - 100));
|
||||
}
|
||||
|
||||
public byte[] getRawMessageBytes() {
|
||||
|
@ -97,13 +130,11 @@ public class MessageBase {
|
|||
}
|
||||
|
||||
public void handleMessage(byte[] bytes) {
|
||||
if (L.isEnabled(LTag.PUMPCOMM)) {
|
||||
if (bytes.length > 6) {
|
||||
int command = (bytes[5] & 0xFF) | ((bytes[4] << 8) & 0xFF00);
|
||||
log.debug("UNPROCESSED MSG: " + getMessageName() + " Command: " + String.format("%04X", command) + " Data: " + toHexString(bytes));
|
||||
} else {
|
||||
log.debug("MISFORMATTED MSG: " + toHexString(bytes));
|
||||
}
|
||||
if (bytes.length > 6) {
|
||||
int command = (bytes[5] & 0xFF) | ((bytes[4] << 8) & 0xFF00);
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "UNPROCESSED MSG: " + getMessageName() + " Command: " + String.format("%04X", command) + " Data: " + toHexString(bytes));
|
||||
} else {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "MISFORMATTED MSG: " + toHexString(bytes));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,11 +146,11 @@ public class MessageBase {
|
|||
return command;
|
||||
}
|
||||
|
||||
public static int byteFromRawBuff(byte[] buff, int offset) {
|
||||
public int byteFromRawBuff(byte[] buff, int offset) {
|
||||
return buff[offset] & 0xFF;
|
||||
}
|
||||
|
||||
public static int intFromBuff(byte[] buff, int offset, int length) {
|
||||
public int intFromBuff(byte[] buff, int offset, int length) {
|
||||
offset += 6;
|
||||
switch (length) {
|
||||
case 1:
|
||||
|
@ -134,37 +165,39 @@ public class MessageBase {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static long dateTimeFromBuff(byte[] buff, int offset) {
|
||||
public long dateTimeFromBuff(byte[] buff, int offset) {
|
||||
return
|
||||
new Date(
|
||||
100 + intFromBuff(buff, offset, 1),
|
||||
intFromBuff(buff, offset + 1, 1) - 1,
|
||||
new DateTime(
|
||||
2000 + intFromBuff(buff, offset, 1),
|
||||
intFromBuff(buff, offset + 1, 1),
|
||||
intFromBuff(buff, offset + 2, 1),
|
||||
intFromBuff(buff, offset + 3, 1),
|
||||
intFromBuff(buff, offset + 4, 1),
|
||||
0
|
||||
).getTime();
|
||||
).getMillis();
|
||||
}
|
||||
|
||||
public static synchronized long dateTimeSecFromBuff(byte[] buff, int offset) {
|
||||
public synchronized long dateTimeSecFromBuff(byte[] buff, int offset) {
|
||||
return
|
||||
new Date(
|
||||
100 + intFromBuff(buff, offset, 1),
|
||||
intFromBuff(buff, offset + 1, 1) - 1,
|
||||
new DateTime(
|
||||
2000 + intFromBuff(buff, offset, 1),
|
||||
intFromBuff(buff, offset + 1, 1),
|
||||
intFromBuff(buff, offset + 2, 1),
|
||||
intFromBuff(buff, offset + 3, 1),
|
||||
intFromBuff(buff, offset + 4, 1),
|
||||
intFromBuff(buff, offset + 5, 1)
|
||||
).getTime();
|
||||
).getMillis();
|
||||
}
|
||||
|
||||
public static long dateFromBuff(byte[] buff, int offset) {
|
||||
public long dateFromBuff(byte[] buff, int offset) {
|
||||
return
|
||||
new Date(
|
||||
100 + intFromBuff(buff, offset, 1),
|
||||
intFromBuff(buff, offset + 1, 1) - 1,
|
||||
intFromBuff(buff, offset + 2, 1)
|
||||
).getTime();
|
||||
new DateTime(
|
||||
2000 + intFromBuff(buff, offset, 1),
|
||||
intFromBuff(buff, offset + 1, 1),
|
||||
intFromBuff(buff, offset + 2, 1),
|
||||
0,
|
||||
0
|
||||
).getMillis();
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.KITKAT)
|
||||
|
@ -184,7 +217,7 @@ public class MessageBase {
|
|||
}
|
||||
|
||||
public static String toHexString(byte[] buff) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
int count = 0;
|
||||
for (byte element : buff) {
|
||||
|
|
|
@ -1,99 +1,73 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class MessageHashTableR @Inject constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
resourceHelper: ResourceHelper,
|
||||
constraintChecker: ConstraintChecker,
|
||||
danaPump: DanaPump,
|
||||
danaRPlugin: DanaRPlugin,
|
||||
danaRKoreanPlugin: DanaRKoreanPlugin,
|
||||
configBuilderPlugin: ConfigBuilderInterface,
|
||||
commandQueue: CommandQueueProvider,
|
||||
activePlugin: ActivePluginProvider,
|
||||
nsUpload: NSUpload,
|
||||
injector: HasAndroidInjector,
|
||||
databaseHelper: DatabaseHelperInterface,
|
||||
dateUtil: DateUtil
|
||||
private val injector: HasAndroidInjector
|
||||
) : MessageHashTableBase {
|
||||
|
||||
var messages: HashMap<Int, MessageBase> = HashMap()
|
||||
|
||||
init {
|
||||
put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaPump)) // 0x0101 CMD_MEALINS_STOP
|
||||
put(MsgBolusStart(aapsLogger, constraintChecker, danaPump, 0.0)) // 0x0102 CMD_MEALINS_START_DATA
|
||||
put(MsgBolusStartWithSpeed(aapsLogger, constraintChecker, danaPump, 0.0, 0)) // 0x0104 CMD_MEALINS_START_DATA_SPEED
|
||||
put(MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaPump)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
|
||||
put(MsgStatusProfile(aapsLogger, danaPump)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
|
||||
put(MsgStatusTempBasal(aapsLogger, danaPump, activePlugin, injector)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusBolusExtended(injector, aapsLogger, danaPump, activePlugin, dateUtil)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBasic(aapsLogger, danaPump)) // 0x020A CMD_PUMP_INITVIEW_I
|
||||
put(MsgStatus(aapsLogger, danaPump)) // 0x020B CMD_PUMP_STATUS
|
||||
put(MsgBolusStop(injector)) // 0x0101 CMD_MEALINS_STOP
|
||||
put(MsgBolusStart(injector, 0.0)) // 0x0102 CMD_MEALINS_START_DATA
|
||||
put(MsgBolusStartWithSpeed(injector, 0.0, 0)) // 0x0104 CMD_MEALINS_START_DATA_SPEED
|
||||
put(MsgBolusProgress(injector)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
|
||||
put(MsgStatusProfile(injector)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
|
||||
put(MsgStatusTempBasal(injector)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusBolusExtended(injector)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBasic(injector)) // 0x020A CMD_PUMP_INITVIEW_I
|
||||
put(MsgStatus(injector)) // 0x020B CMD_PUMP_STATUS
|
||||
// 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusTime(aapsLogger, rxBus, resourceHelper, danaPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil))
|
||||
put(MsgInitConnStatusBolus(aapsLogger, rxBus, resourceHelper, danaPump)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
|
||||
put(MsgInitConnStatusBasic(aapsLogger, danaPump)) // 0x0303 CMD_PUMPINIT_INIT_INFO
|
||||
put(MsgInitConnStatusOption(aapsLogger, rxBus, resourceHelper, danaPump, activePlugin)) // 0x0304 CMD_PUMPINIT_OPTION
|
||||
put(MsgSetTempBasalStart(aapsLogger, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
|
||||
put(MsgSetCarbsEntry(aapsLogger, 0, 0)) // 0x0402 CMD_PUMPSET_HIS_S
|
||||
put(MsgSetTempBasalStop(aapsLogger)) // 0x0403 CMD_PUMPSET_EXERCISE_STOP
|
||||
put(MsgSetExtendedBolusStop(aapsLogger)) // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
|
||||
put(MsgSetExtendedBolusStart(aapsLogger, constraintChecker, 0.0, 0)) // 0x0407 CMD_PUMPSET_EXPANS_INS_S
|
||||
put(MsgError(aapsLogger, rxBus, resourceHelper, danaPump, nsUpload)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
|
||||
put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
|
||||
put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
|
||||
put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryError(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3106 CMD_HISTORY_ERROR
|
||||
put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3108 CMD_HISTORY_REFILL
|
||||
put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3109 CMD_HISTORY_SUSPEND
|
||||
put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x310A CMD_HISTORY_BASAL_HOUR
|
||||
put(MsgHistoryDone(aapsLogger, danaPump)) // 0x31F1 CMD_HISTORY_DONT_USED
|
||||
put(MsgInitConnStatusTime(injector))
|
||||
put(MsgInitConnStatusBolus(injector)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
|
||||
put(MsgInitConnStatusBasic(injector)) // 0x0303 CMD_PUMPINIT_INIT_INFO
|
||||
put(MsgInitConnStatusOption(injector)) // 0x0304 CMD_PUMPINIT_OPTION
|
||||
put(MsgSetTempBasalStart(injector, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
|
||||
put(MsgSetCarbsEntry(injector, 0, 0)) // 0x0402 CMD_PUMPSET_HIS_S
|
||||
put(MsgSetTempBasalStop(injector)) // 0x0403 CMD_PUMPSET_EXERCISE_STOP
|
||||
put(MsgSetExtendedBolusStop(injector)) // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
|
||||
put(MsgSetExtendedBolusStart(injector, 0.0, 0)) // 0x0407 CMD_PUMPSET_EXPANS_INS_S
|
||||
put(MsgError(injector)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
|
||||
put(MsgPCCommStart(injector)) // 0x3001 CMD_CONNECT
|
||||
put(MsgPCCommStop(injector)) // 0x3002 CMD_DISCONNECT
|
||||
put(MsgHistoryBolus(injector)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(injector)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(injector)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(injector)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryError(injector)) // 0x3106 CMD_HISTORY_ERROR
|
||||
put(MsgHistoryCarbo(injector)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgHistoryRefill(injector)) // 0x3108 CMD_HISTORY_REFILL
|
||||
put(MsgHistorySuspend(injector)) // 0x3109 CMD_HISTORY_SUSPEND
|
||||
put(MsgHistoryBasalHour(injector)) // 0x310A CMD_HISTORY_BASAL_HOUR
|
||||
put(MsgHistoryDone(injector)) // 0x31F1 CMD_HISTORY_DONT_USED
|
||||
// 0x3202 CMD_SETTING_V_BASAL_INS_I
|
||||
put(MsgSettingBasal(aapsLogger, danaPump, danaRPlugin))
|
||||
put(MsgSettingBasal(injector))
|
||||
// 0x3203 CMD_SETTING_V_MEAL_SETTING_I
|
||||
put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaPump, danaRKoreanPlugin))
|
||||
put(MsgSettingProfileRatios(aapsLogger, danaPump)) // 0x3204 CMD_SETTING_V_CCC_I
|
||||
put(MsgSettingMaxValues(aapsLogger, danaPump)) // 0x3205 CMD_SETTING_V_MAX_VALUE_I
|
||||
put(MsgSettingBasalProfileAll(aapsLogger, danaPump)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
|
||||
put(MsgSettingShippingInfo(aapsLogger, danaPump)) // 0x3207 CMD_SETTING_V_SHIPPING_I
|
||||
put(MsgSettingGlucose(aapsLogger, danaPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(MsgSettingPumpTime(aapsLogger, danaPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSettingUserOptions(aapsLogger, danaPump)) // 0x320B CMD_SETTING_V_USER_OPTIONS
|
||||
put(MsgSettingActiveProfile(aapsLogger, danaPump)) // 0x320C CMD_SETTING_V_PROFILE_NUMBER
|
||||
put(MsgSettingProfileRatiosAll(aapsLogger, danaPump)) // 0x320D CMD_SETTING_V_CIR_CF_VALUE
|
||||
put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
|
||||
put(MsgSetBasalProfile(aapsLogger, rxBus, resourceHelper, 0.toByte(), Array(24) { 0.0 })) // 0x3306 CMD_SETTING_BASAL_PROFILE_S
|
||||
put(MsgSetUserOptions(aapsLogger, danaPump)) // 0x330B CMD_SETTING_USER_OPTIONS_S
|
||||
put(MsgSetActivateBasalProfile(aapsLogger, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S
|
||||
put(MsgHistoryAllDone(aapsLogger, danaPump)) // 0x41F1 CMD_HISTORY_ALL_DONE
|
||||
put(MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryNewDone(aapsLogger, danaPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
|
||||
put(MsgHistoryNew(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgSettingMeal(injector))
|
||||
put(MsgSettingProfileRatios(injector)) // 0x3204 CMD_SETTING_V_CCC_I
|
||||
put(MsgSettingMaxValues(injector)) // 0x3205 CMD_SETTING_V_MAX_VALUE_I
|
||||
put(MsgSettingBasalProfileAll(injector)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
|
||||
put(MsgSettingShippingInfo(injector)) // 0x3207 CMD_SETTING_V_SHIPPING_I
|
||||
put(MsgSettingGlucose(injector)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(MsgSettingPumpTime(injector)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSettingUserOptions(injector)) // 0x320B CMD_SETTING_V_USER_OPTIONS
|
||||
put(MsgSettingActiveProfile(injector)) // 0x320C CMD_SETTING_V_PROFILE_NUMBER
|
||||
put(MsgSettingProfileRatiosAll(injector)) // 0x320D CMD_SETTING_V_CIR_CF_VALUE
|
||||
put(MsgSetSingleBasalProfile(injector, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
|
||||
put(MsgSetBasalProfile(injector, 0.toByte(), Array(24) { 0.0 })) // 0x3306 CMD_SETTING_BASAL_PROFILE_S
|
||||
put(MsgSetUserOptions(injector)) // 0x330B CMD_SETTING_USER_OPTIONS_S
|
||||
put(MsgSetActivateBasalProfile(injector, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S
|
||||
put(MsgHistoryAllDone(injector)) // 0x41F1 CMD_HISTORY_ALL_DONE
|
||||
put(MsgHistoryAll(injector)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryNewDone(injector)) // 0x42F1 CMD_HISTORY_NEW_DONE
|
||||
put(MsgHistoryNew(injector)) // 0x42F2 CMD_HISTORY_NEW
|
||||
// 0xF0F1 CMD_PUMP_CHECK_VALUE
|
||||
put(MsgCheckValue(aapsLogger, danaPump, danaRPlugin))
|
||||
put(MsgCheckValue(injector))
|
||||
}
|
||||
|
||||
override fun put(message: MessageBase) {
|
||||
|
@ -101,6 +75,6 @@ class MessageHashTableR @Inject constructor(
|
|||
}
|
||||
|
||||
override fun findMessage(command: Int): MessageBase {
|
||||
return messages[command] ?: MessageBase()
|
||||
return messages[command] ?: MessageBase(injector)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import kotlin.math.min
|
||||
|
||||
class MsgBolusProgress(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val danaPump: DanaPump
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0202)
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
|
||||
class MsgBolusStart(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
constraintChecker: ConstraintChecker,
|
||||
private val danaPump: DanaPump,
|
||||
injector: HasAndroidInjector,
|
||||
private var amount: Double
|
||||
) : MessageBase() {
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0102)
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
|
||||
class MsgBolusStartWithSpeed(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
constraintChecker: ConstraintChecker,
|
||||
private val danaPump: DanaPump,
|
||||
injector: HasAndroidInjector,
|
||||
private var amount: Double,
|
||||
speed: Int
|
||||
) : MessageBase() {
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0104)
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
||||
class MsgBolusStop(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaPump: DanaPump
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0101)
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
||||
class MsgCheckValue(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump,
|
||||
private val danaRPlugin: DanaRPlugin
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0xF0F1)
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
||||
class MsgError(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaPump: DanaPump,
|
||||
private val nsUpload: NSUpload
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x0601)
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryAlarm(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
databaseHelper: DatabaseHelperInterface
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) {
|
||||
injector: HasAndroidInjector
|
||||
) : MsgHistoryAll(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3105)
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.db.DanaRHistoryRecord
|
||||
import info.nightscout.androidaps.events.EventDanaRSyncStatus
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
open class MsgHistoryAll(
|
||||
val aapsLogger: AAPSLogger,
|
||||
val rxBus: RxBusWrapper,
|
||||
private val dateUtil: DateUtil,
|
||||
private val databaseHelper: DatabaseHelperInterface
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x41F2)
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.dana.DanaPump
|
||||
|
||||
class MsgHistoryAllDone(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaPump: DanaPump
|
||||
) : MessageBase() {
|
||||
injector: HasAndroidInjector
|
||||
) : MessageBase(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x41F1)
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryBasalHour(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
databaseHelper: DatabaseHelperInterface
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) {
|
||||
injector: HasAndroidInjector
|
||||
) : MsgHistoryAll(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x310A)
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryBolus(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
databaseHelper: DatabaseHelperInterface
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) {
|
||||
injector: HasAndroidInjector
|
||||
) : MsgHistoryAll(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3101)
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package info.nightscout.androidaps.danar.comm
|
||||
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryCarbo(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
databaseHelper: DatabaseHelperInterface
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) {
|
||||
injector: HasAndroidInjector
|
||||
) : MsgHistoryAll(injector) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3107)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue