RS refactor & test fix
This commit is contained in:
parent
ffde47d531
commit
1e1fac90b3
150 changed files with 593 additions and 2049 deletions
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugi
|
||||||
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective
|
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective
|
||||||
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
||||||
|
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||||
|
@ -51,7 +52,7 @@ import java.util.*
|
||||||
ConstraintChecker::class, SP::class, Context::class,
|
ConstraintChecker::class, SP::class, Context::class,
|
||||||
OpenAPSAMAPlugin::class, OpenAPSSMBPlugin::class,
|
OpenAPSAMAPlugin::class, OpenAPSSMBPlugin::class,
|
||||||
VirtualPumpPlugin::class, DetailedBolusInfoStorage::class, TemporaryBasalStorage::class, GlimpPlugin::class, Profiler::class,
|
VirtualPumpPlugin::class, DetailedBolusInfoStorage::class, TemporaryBasalStorage::class, GlimpPlugin::class, Profiler::class,
|
||||||
UserEntryLogger::class, LoggerUtils::class, AppRepository::class, InsightDatabaseDao::class)
|
UserEntryLogger::class, PrefFileListProvider::class, AppRepository::class, InsightDatabaseDao::class)
|
||||||
class ConstraintsCheckerTest : TestBaseWithProfile() {
|
class ConstraintsCheckerTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Mock lateinit var activePlugin: ActivePlugin
|
@Mock lateinit var activePlugin: ActivePlugin
|
||||||
|
@ -64,7 +65,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var sensitivityOref1Plugin: SensitivityOref1Plugin
|
@Mock lateinit var sensitivityOref1Plugin: SensitivityOref1Plugin
|
||||||
@Mock lateinit var profiler: Profiler
|
@Mock lateinit var profiler: Profiler
|
||||||
@Mock lateinit var uel: UserEntryLogger
|
@Mock lateinit var uel: UserEntryLogger
|
||||||
@Mock lateinit var loggerUtils: LoggerUtils
|
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||||
@Mock lateinit var repository: AppRepository
|
@Mock lateinit var repository: AppRepository
|
||||||
@Mock lateinit var pumpSync: PumpSync
|
@Mock lateinit var pumpSync: PumpSync
|
||||||
@Mock lateinit var insightDatabaseDao: InsightDatabaseDao
|
@Mock lateinit var insightDatabaseDao: InsightDatabaseDao
|
||||||
|
@ -145,7 +146,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
||||||
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, sp, commandQueue, profileFunction, context, ConfigImpl(), dateUtil, insightDbHelper, pumpSync)
|
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, sp, commandQueue, profileFunction, context, ConfigImpl(), dateUtil, insightDbHelper, pumpSync)
|
||||||
openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, sp, dateUtil, repository, glucoseStatusProvider)
|
openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, sp, dateUtil, repository, glucoseStatusProvider)
|
||||||
openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, fabricPrivacy, dateUtil, repository, glucoseStatusProvider)
|
openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, fabricPrivacy, dateUtil, repository, glucoseStatusProvider)
|
||||||
safetyPlugin = SafetyPlugin(injector, aapsLogger, resourceHelper, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, BuildHelper(ConfigImpl(), loggerUtils), iobCobCalculator, ConfigImpl(), dateUtil)
|
safetyPlugin = SafetyPlugin(injector, aapsLogger, resourceHelper, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, BuildHelper(ConfigImpl(), fileListProvider), iobCobCalculator, ConfigImpl(), dateUtil)
|
||||||
val constraintsPluginsList = ArrayList<PluginBase>()
|
val constraintsPluginsList = ArrayList<PluginBase>()
|
||||||
constraintsPluginsList.add(safetyPlugin)
|
constraintsPluginsList.add(safetyPlugin)
|
||||||
constraintsPluginsList.add(objectivesPlugin)
|
constraintsPluginsList.add(objectivesPlugin)
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
@PrepareForTest(NSSettingsStatus::class, BuildHelper::class, LoggerUtils::class)
|
@PrepareForTest(NSSettingsStatus::class, BuildHelper::class, LoggerUtils::class, PrefFileListProvider::class)
|
||||||
class MaintenancePluginTest : TestBase() {
|
class MaintenancePluginTest : TestBase() {
|
||||||
|
|
||||||
@Mock lateinit var injector: HasAndroidInjector
|
@Mock lateinit var injector: HasAndroidInjector
|
||||||
|
@ -29,14 +29,16 @@ class MaintenancePluginTest : TestBase() {
|
||||||
@Mock lateinit var nsSettingsStatus: NSSettingsStatus
|
@Mock lateinit var nsSettingsStatus: NSSettingsStatus
|
||||||
@Mock lateinit var buildHelper: BuildHelper
|
@Mock lateinit var buildHelper: BuildHelper
|
||||||
@Mock lateinit var loggerUtils: LoggerUtils
|
@Mock lateinit var loggerUtils: LoggerUtils
|
||||||
|
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||||
|
|
||||||
lateinit var sut: MaintenancePlugin
|
lateinit var sut: MaintenancePlugin
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun mock() {
|
fun mock() {
|
||||||
sut = MaintenancePlugin(injector, context, resourceHelper, sp, nsSettingsStatus, aapsLogger, buildHelper, ConfigImpl(), loggerUtils)
|
sut = MaintenancePlugin(injector, context, resourceHelper, sp, nsSettingsStatus, aapsLogger, buildHelper, ConfigImpl(), fileListProvider, loggerUtils)
|
||||||
`when`(loggerUtils.suffix).thenReturn(".log.zip")
|
`when`(loggerUtils.suffix).thenReturn(".log.zip")
|
||||||
`when`(loggerUtils.logDirectory).thenReturn("src/test/res/logger")
|
`when`(loggerUtils.logDirectory).thenReturn("src/test/res/logger")
|
||||||
|
`when`(fileListProvider.ensureExportDirExists()).thenReturn(File("src/test/res/logger"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun logFilesTest() {
|
@Test fun logFilesTest() {
|
||||||
|
|
|
@ -18,7 +18,7 @@ import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.androidaps.queue.commands.*
|
import info.nightscout.androidaps.queue.commands.*
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
@ -44,16 +44,16 @@ import java.util.*
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
@PrepareForTest(
|
@PrepareForTest(
|
||||||
ConstraintChecker::class, VirtualPumpPlugin::class, ToastUtils::class, Context::class,
|
ConstraintChecker::class, VirtualPumpPlugin::class, ToastUtils::class, Context::class,
|
||||||
FabricPrivacy::class, LoggerUtils::class, PowerManager::class,
|
FabricPrivacy::class, PrefFileListProvider::class, PowerManager::class,
|
||||||
AppRepository::class)
|
AppRepository::class)
|
||||||
class CommandQueueTest : TestBaseWithProfile() {
|
class CommandQueueTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||||
@Mock lateinit var activePlugin: ActivePlugin
|
@Mock lateinit var activePlugin: ActivePlugin
|
||||||
@Mock lateinit var sp: SP
|
@Mock lateinit var sp: SP
|
||||||
@Mock lateinit var loggerUtils: LoggerUtils
|
|
||||||
@Mock lateinit var powerManager: PowerManager
|
@Mock lateinit var powerManager: PowerManager
|
||||||
@Mock lateinit var repository: AppRepository
|
@Mock lateinit var repository: AppRepository
|
||||||
|
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||||
|
|
||||||
class CommandQueueMocked(
|
class CommandQueueMocked(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
|
@ -106,7 +106,7 @@ class CommandQueueTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun prepare() {
|
fun prepare() {
|
||||||
commandQueue = CommandQueueMocked(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), loggerUtils), dateUtil, repository, fabricPrivacy)
|
commandQueue = CommandQueueMocked(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), fileListProvider), dateUtil, repository, fabricPrivacy)
|
||||||
testPumpPlugin = TestPumpPlugin(injector)
|
testPumpPlugin = TestPumpPlugin(injector)
|
||||||
|
|
||||||
testPumpPlugin.pumpDescription.basalMinimumRate = 0.1
|
testPumpPlugin.pumpDescription.basalMinimumRate = 0.1
|
||||||
|
@ -137,7 +137,7 @@ class CommandQueueTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun commandIsPickedUp() {
|
fun commandIsPickedUp() {
|
||||||
val commandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), loggerUtils), dateUtil, repository, fabricPrivacy)
|
val commandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), fileListProvider), dateUtil, repository, fabricPrivacy)
|
||||||
// start with empty queue
|
// start with empty queue
|
||||||
Assert.assertEquals(0, commandQueue.size())
|
Assert.assertEquals(0, commandQueue.size())
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
|
||||||
|
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.androidaps.queue.commands.Command
|
import info.nightscout.androidaps.queue.commands.Command
|
||||||
import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute
|
import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute
|
||||||
|
@ -33,13 +34,13 @@ import org.powermock.modules.junit4.PowerMockRunner
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
@PrepareForTest(
|
@PrepareForTest(
|
||||||
ConstraintChecker::class, VirtualPumpPlugin::class, ToastUtils::class, Context::class,
|
ConstraintChecker::class, VirtualPumpPlugin::class, ToastUtils::class, Context::class,
|
||||||
FabricPrivacy::class, LoggerUtils::class, PowerManager::class)
|
FabricPrivacy::class, PrefFileListProvider::class, PowerManager::class)
|
||||||
class QueueThreadTest : TestBaseWithProfile() {
|
class QueueThreadTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||||
@Mock lateinit var activePlugin: ActivePlugin
|
@Mock lateinit var activePlugin: ActivePlugin
|
||||||
@Mock lateinit var sp: SP
|
@Mock lateinit var sp: SP
|
||||||
@Mock lateinit var loggerUtils: LoggerUtils
|
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||||
@Mock lateinit var powerManager: PowerManager
|
@Mock lateinit var powerManager: PowerManager
|
||||||
@Mock lateinit var repository: AppRepository
|
@Mock lateinit var repository: AppRepository
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
||||||
@Before
|
@Before
|
||||||
fun prepare() {
|
fun prepare() {
|
||||||
pumpPlugin = TestPumpPlugin(injector)
|
pumpPlugin = TestPumpPlugin(injector)
|
||||||
commandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), loggerUtils), dateUtil, repository, fabricPrivacy)
|
commandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, BuildHelper(ConfigImpl(), fileListProvider), dateUtil, repository, fabricPrivacy)
|
||||||
|
|
||||||
val pumpDescription = PumpDescription()
|
val pumpDescription = PumpDescription()
|
||||||
pumpDescription.basalMinimumRate = 0.1
|
pumpDescription.basalMinimumRate = 0.1
|
||||||
|
|
|
@ -17,6 +17,7 @@ import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
@Suppress("SpellCheckingInspection")
|
||||||
@Singleton
|
@Singleton
|
||||||
class PrefFileListProvider @Inject constructor(
|
class PrefFileListProvider @Inject constructor(
|
||||||
private val resourceHelper: ResourceHelper,
|
private val resourceHelper: ResourceHelper,
|
||||||
|
@ -27,12 +28,13 @@ class PrefFileListProvider @Inject constructor(
|
||||||
private val versionCheckerUtils: VersionCheckerUtils
|
private val versionCheckerUtils: VersionCheckerUtils
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
private val path = File(Environment.getExternalStorageDirectory().toString())
|
||||||
|
private val aapsPath = File(path, "AAPS" + File.separator + "preferences")
|
||||||
|
private val exportsPath = File(path, "AAPS" + File.separator + "exports")
|
||||||
|
private val extraPath = File(path, "AAPS" + File.separator + "extra")
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
private val path = File(Environment.getExternalStorageDirectory().toString())
|
|
||||||
private val aapsPath = File(path, "AAPS" + File.separator + "preferences")
|
|
||||||
private val exportsPath = File(path, "AAPS" + File.separator + "exports")
|
|
||||||
private val extraPath = File(path, "AAPS" + File.separator + "extra")
|
|
||||||
private const val IMPORT_AGE_NOT_YET_OLD_DAYS = 60
|
private const val IMPORT_AGE_NOT_YET_OLD_DAYS = 60
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import info.nightscout.androidaps.core.databinding.WeekdayPickerBinding
|
||||||
import info.nightscout.androidaps.extensions.toVisibility
|
import info.nightscout.androidaps.extensions.toVisibility
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class WeekdayPicker @JvmOverloads constructor(
|
class WeekdayPicker constructor(
|
||||||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
|
|
|
@ -10,89 +10,73 @@ class DanaRSMessageHashTable @Inject constructor(
|
||||||
val injector: HasAndroidInjector
|
val injector: HasAndroidInjector
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var messages: HashMap<Int, DanaRS_Packet> = HashMap()
|
var messages: HashMap<Int, DanaRSPacket> = HashMap()
|
||||||
|
|
||||||
fun put(message: DanaRS_Packet) {
|
fun put(message: DanaRSPacket) {
|
||||||
messages[message.command] = message
|
messages[message.command] = message
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findMessage(command: Int): DanaRS_Packet {
|
fun findMessage(command: Int): DanaRSPacket {
|
||||||
return messages[command] ?: DanaRS_Packet(injector)
|
return messages[command] ?: DanaRSPacket(injector)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
put(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
|
put(DanaRSPacketBasalSetCancelTemporaryBasal(injector))
|
||||||
put(DanaRS_Packet_Basal_Get_Basal_Rate(injector))
|
put(DanaRSPacketBasalGetBasalRate(injector))
|
||||||
put(DanaRS_Packet_Basal_Get_Profile_Basal_Rate(injector))
|
put(DanaRSPacketBasalGetProfileNumber(injector))
|
||||||
put(DanaRS_Packet_Basal_Get_Profile_Number(injector))
|
put(DanaRSPacketBasalSetProfileBasalRate(injector, 0, arrayOf()))
|
||||||
put(DanaRS_Packet_Basal_Set_Basal_Rate(injector, arrayOf()))
|
put(DanaRSPacketBasalSetProfileNumber(injector))
|
||||||
put(DanaRS_Packet_Basal_Set_Profile_Basal_Rate(injector, 0, arrayOf()))
|
put(DanaRSPacketBasalSetSuspendOff(injector))
|
||||||
put(DanaRS_Packet_Basal_Set_Profile_Number(injector))
|
put(DanaRSPacketBasalSetSuspendOn(injector))
|
||||||
put(DanaRS_Packet_Basal_Set_Suspend_Off(injector))
|
put(DanaRSPacketBasalSetTemporaryBasal(injector))
|
||||||
put(DanaRS_Packet_Basal_Set_Suspend_On(injector))
|
put(DanaRSPacketBolusGetBolusOption(injector))
|
||||||
put(DanaRS_Packet_Basal_Set_Temporary_Basal(injector))
|
put(DanaRSPacketBolusGetCalculationInformation(injector))
|
||||||
put(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
|
put(DanaRSPacketBolusGetCIRCFArray(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_Bolus_Option(injector))
|
put(DanaRSPacketBolusGetStepBolusInformation(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_Initial_Bolus(injector))
|
put(DanaRSPacketBolusSetBolusOption(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_Calculation_Information(injector))
|
put(DanaRSPacketBolusSet24CIRCFArray(injector, null))
|
||||||
put(DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(injector))
|
put(DanaRSPacketBolusGet24CIRCFArray(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_CIR_CF_Array(injector))
|
put(DanaRSPacketBolusSetExtendedBolus(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_24_CIR_CF_Array(injector))
|
put(DanaRSPacketBolusSetExtendedBolusCancel(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_Dual_Bolus(injector))
|
put(DanaRSPacketBolusSetStepBolusStart(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_Extended_Bolus(injector))
|
put(DanaRSPacketBolusSetStepBolusStop(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(injector))
|
put(DanaRSPacketEtcKeepConnection(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(injector))
|
put(DanaRSPacketEtcSetHistorySave(injector))
|
||||||
put(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(injector))
|
put(DanaRSPacketGeneralInitialScreenInformation(injector))
|
||||||
put(DanaRS_Packet_Bolus_Set_Bolus_Option(injector))
|
put(DanaRSPacketNotifyAlarm(injector))
|
||||||
put(DanaRS_Packet_Bolus_Set_Initial_Bolus(injector))
|
put(DanaRSPacketNotifyDeliveryComplete(injector))
|
||||||
put(DanaRS_Packet_Bolus_Set_CIR_CF_Array(injector))
|
put(DanaRSPacketNotifyDeliveryRateDisplay(injector))
|
||||||
put(DanaRS_Packet_Bolus_Set_24_CIR_CF_Array(injector, null))
|
put(DanaRSPacketNotifyMissedBolusAlarm(injector))
|
||||||
put(DanaRS_Packet_Bolus_Set_Dual_Bolus(injector))
|
put(DanaRSPacketOptionGetPumpTime(injector))
|
||||||
put(DanaRS_Packet_Bolus_Set_Extended_Bolus(injector))
|
put(DanaRSPacketOptionGetPumpUTCAndTimeZone(injector))
|
||||||
put(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(injector))
|
put(DanaRSPacketOptionGetUserOption(injector))
|
||||||
put(DanaRS_Packet_Bolus_Set_Step_Bolus_Start(injector))
|
put(DanaRSPacketOptionSetPumpTime(injector))
|
||||||
put(DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(injector))
|
put(DanaRSPacketOptionSetPumpUTCAndTimeZone(injector))
|
||||||
put(DanaRS_Packet_Etc_Keep_Connection(injector))
|
put(DanaRSPacketOptionSetUserOption(injector))
|
||||||
put(DanaRS_Packet_Etc_Set_History_Save(injector))
|
|
||||||
put(DanaRS_Packet_General_Delivery_Status(injector))
|
|
||||||
put(DanaRS_Packet_General_Get_Password(injector))
|
|
||||||
put(DanaRS_Packet_General_Initial_Screen_Information(injector))
|
|
||||||
put(DanaRS_Packet_Notify_Alarm(injector))
|
|
||||||
put(DanaRS_Packet_Notify_Delivery_Complete(injector))
|
|
||||||
put(DanaRS_Packet_Notify_Delivery_Rate_Display(injector))
|
|
||||||
put(DanaRS_Packet_Notify_Missed_Bolus_Alarm(injector))
|
|
||||||
put(DanaRS_Packet_Option_Get_Pump_Time(injector))
|
|
||||||
put(DanaRS_Packet_Option_Get_Pump_UTC_And_TimeZone(injector))
|
|
||||||
put(DanaRS_Packet_Option_Get_User_Option(injector))
|
|
||||||
put(DanaRS_Packet_Option_Set_Pump_Time(injector))
|
|
||||||
put(DanaRS_Packet_Option_Set_Pump_UTC_And_TimeZone(injector))
|
|
||||||
put(DanaRS_Packet_Option_Set_User_Option(injector))
|
|
||||||
//put(new DanaRS_Packet_History_(injector));
|
//put(new DanaRS_Packet_History_(injector));
|
||||||
put(DanaRS_Packet_History_Alarm(injector))
|
put(DanaRSPacketHistoryAlarm(injector))
|
||||||
put(DanaRS_Packet_History_All_History(injector))
|
put(DanaRSPacketHistoryAllHistory(injector))
|
||||||
put(DanaRS_Packet_History_Basal(injector))
|
put(DanaRSPacketHistoryBasal(injector))
|
||||||
put(DanaRS_Packet_History_Blood_Glucose(injector))
|
put(DanaRSPacketHistoryBloodGlucose(injector))
|
||||||
put(DanaRS_Packet_History_Bolus(injector))
|
put(DanaRSPacketHistoryBolus(injector))
|
||||||
put(DanaRS_Packet_Review_Bolus_Avg(injector))
|
put(DanaRSPacketReviewBolusAvg(injector))
|
||||||
put(DanaRS_Packet_History_Carbohydrate(injector))
|
put(DanaRSPacketHistoryCarbohydrate(injector))
|
||||||
put(DanaRS_Packet_History_Daily(injector))
|
put(DanaRSPacketHistoryDaily(injector))
|
||||||
put(DanaRS_Packet_General_Get_More_Information(injector))
|
put(DanaRSPacketHistoryPrime(injector))
|
||||||
put(DanaRS_Packet_General_Get_Pump_Check(injector))
|
put(DanaRSPacketHistoryRefill(injector))
|
||||||
put(DanaRS_Packet_General_Get_Shipping_Information(injector))
|
put(DanaRSPacketHistorySuspend(injector))
|
||||||
put(DanaRS_Packet_General_Get_Today_Delivery_Total(injector))
|
put(DanaRSPacketHistoryTemporary(injector))
|
||||||
put(DanaRS_Packet_General_Get_User_Time_Change_Flag(injector))
|
put(DanaRSPacketGeneralGetPumpCheck(injector))
|
||||||
put(DanaRS_Packet_History_Prime(injector))
|
put(DanaRSPacketGeneralGetShippingInformation(injector))
|
||||||
put(DanaRS_Packet_History_Refill(injector))
|
put(DanaRSPacketGeneralGetUserTimeChangeFlag(injector))
|
||||||
put(DanaRS_Packet_General_Set_History_Upload_Mode(injector))
|
put(DanaRSPacketGeneralSetHistoryUploadMode(injector))
|
||||||
put(DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(injector))
|
put(DanaRSPacketGeneralSetUserTimeChangeFlagClear(injector))
|
||||||
put(DanaRS_Packet_History_Suspend(injector))
|
|
||||||
put(DanaRS_Packet_History_Temporary(injector))
|
|
||||||
// APS
|
// APS
|
||||||
put(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(injector, 0))
|
put(DanaRSPacketAPSBasalSetTemporaryBasal(injector, 0))
|
||||||
put(DanaRS_Packet_APS_History_Events(injector, 0))
|
put(DanaRSPacketAPSHistoryEvents(injector, 0))
|
||||||
put(DanaRS_Packet_APS_Set_Event_History(injector, 0, 0, 0, 0))
|
put(DanaRSPacketAPSSetEventHistory(injector, 0, 0, 0, 0))
|
||||||
// v3
|
// v3
|
||||||
put(DanaRS_Packet_General_Get_Shipping_Version(injector))
|
put(DanaRSPacketGeneralGetShippingVersion(injector))
|
||||||
put(DanaRS_Packet_Review_Get_Pump_Dec_Ratio(injector))
|
put(DanaRSPacketReviewGetPumpDecRatio(injector))
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ import org.joda.time.DateTime
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
open class DanaRS_Packet(protected var injector: HasAndroidInjector) {
|
open class DanaRSPacket(protected var injector: HasAndroidInjector) {
|
||||||
|
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
@Inject lateinit var aapsLogger: AAPSLogger
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@ -43,7 +43,7 @@ open class DanaRS_Packet(protected var injector: HasAndroidInjector) {
|
||||||
failed = true
|
failed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun getFriendlyName(): String = "UNKNOWN_PACKET"
|
open val friendlyName: String = "UNKNOWN_PACKET"
|
||||||
|
|
||||||
protected fun getBytes(data: ByteArray, srcStart: Int, srcLength: Int): ByteArray {
|
protected fun getBytes(data: ByteArray, srcStart: Int, srcLength: Int): ByteArray {
|
||||||
val ret = ByteArray(srcLength)
|
val ret = ByteArray(srcLength)
|
|
@ -4,10 +4,10 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_APS_Basal_Set_Temporary_Basal(
|
class DanaRSPacketAPSBasalSetTemporaryBasal(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var percent: Int
|
private var percent: Int
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
var temporaryBasalRatio = 0
|
var temporaryBasalRatio = 0
|
||||||
var temporaryBasalDuration = 0
|
var temporaryBasalDuration = 0
|
||||||
|
@ -48,11 +48,10 @@ class DanaRS_Packet_APS_Basal_Set_Temporary_Basal(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BASAL__APS_SET_TEMPORARY_BASAL"
|
||||||
return "BASAL__APS_SET_TEMPORARY_BASAL"
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val PARAM30MIN = 160
|
const val PARAM30MIN = 160
|
||||||
const val PARAM15MIN = 150
|
const val PARAM15MIN = 150
|
||||||
}
|
}
|
|
@ -19,10 +19,10 @@ import org.joda.time.DateTime
|
||||||
import org.joda.time.DateTimeZone
|
import org.joda.time.DateTimeZone
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
open class DanaRS_Packet_APS_History_Events(
|
open class DanaRSPacketAPSHistoryEvents(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var from: Long
|
private var from: Long
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
|
@ -300,7 +300,5 @@ open class DanaRS_Packet_APS_History_Events(
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.processinghistory) + ": " + status))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.processinghistory) + ": " + status))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "APS_HISTORY_EVENTS"
|
||||||
return "APS_HISTORY_EVENTS"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -8,13 +8,13 @@ import org.joda.time.DateTime
|
||||||
import org.joda.time.DateTimeZone
|
import org.joda.time.DateTimeZone
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_APS_Set_Event_History(
|
class DanaRSPacketAPSSetEventHistory(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var packetType: Int,
|
private var packetType: Int,
|
||||||
private var time: Long,
|
private var time: Long,
|
||||||
private var param1: Int,
|
private var param1: Int,
|
||||||
private var param2: Int
|
private var param2: Int
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -54,7 +54,5 @@ class DanaRS_Packet_APS_Set_Event_History(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "APS_SET_EVENT_HISTORY"
|
||||||
return "APS_SET_EVENT_HISTORY"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -13,9 +13,9 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Basal_Get_Basal_Rate(
|
class DanaRSPacketBasalGetBasalRate(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
|
@ -55,7 +55,5 @@ class DanaRS_Packet_Basal_Get_Basal_Rate(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BASAL__GET_BASAL_RATE"
|
||||||
return "BASAL__GET_BASAL_RATE"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,9 +6,9 @@ import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Basal_Get_Profile_Number(
|
class DanaRSPacketBasalGetProfileNumber(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -22,8 +22,5 @@ class DanaRS_Packet_Basal_Get_Profile_Number(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Active profile: " + danaPump.activeProfile)
|
aapsLogger.debug(LTag.PUMPCOMM, "Active profile: " + danaPump.activeProfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BASAL__GET_PROFILE_NUMBER"
|
||||||
return "BASAL__GET_PROFILE_NUMBER"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
package info.nightscout.androidaps.danars.comm
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
import info.nightscout.androidaps.logging.LTag
|
||||||
|
|
||||||
class DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(
|
class DanaRSPacketBasalSetCancelTemporaryBasal(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__CANCEL_TEMPORARY_BASAL
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__CANCEL_TEMPORARY_BASAL
|
||||||
|
@ -24,7 +24,5 @@ class DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BASAL__CANCEL_TEMPORARY_BASAL"
|
||||||
return "BASAL__CANCEL_TEMPORARY_BASAL"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,11 +4,11 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Basal_Set_Profile_Basal_Rate(
|
class DanaRSPacketBasalSetProfileBasalRate(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var profileNumber: Int,
|
private var profileNumber: Int,
|
||||||
private var profileBasalRate: Array<Double>
|
private var profileBasalRate: Array<Double>
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_BASAL_RATE
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_BASAL_RATE
|
||||||
|
@ -31,6 +31,7 @@ class DanaRS_Packet_Basal_Set_Profile_Basal_Rate(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -40,7 +41,5 @@ class DanaRS_Packet_Basal_Set_Profile_Basal_Rate(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BASAL__SET_PROFILE_BASAL_RATE"
|
||||||
return "BASAL__SET_PROFILE_BASAL_RATE"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
package info.nightscout.androidaps.danars.comm
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
import info.nightscout.androidaps.logging.LTag
|
||||||
|
|
||||||
class DanaRS_Packet_Basal_Set_Profile_Number(
|
class DanaRSPacketBasalSetProfileNumber(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var profileNumber: Int = 0
|
private var profileNumber: Int = 0
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_NUMBER
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_NUMBER
|
||||||
|
@ -22,6 +22,7 @@ class DanaRS_Packet_Basal_Set_Profile_Number(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -31,7 +32,5 @@ class DanaRS_Packet_Basal_Set_Profile_Number(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BASAL__SET_PROFILE_NUMBER"
|
||||||
return "BASAL__SET_PROFILE_NUMBER"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Basal_Set_Suspend_Off(
|
class DanaRSPacketBasalSetSuspendOff(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_OFF
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_OFF
|
||||||
|
@ -15,6 +15,7 @@ class DanaRS_Packet_Basal_Set_Suspend_Off(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -24,7 +25,5 @@ class DanaRS_Packet_Basal_Set_Suspend_Off(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BASAL__SET_SUSPEND_OFF"
|
||||||
return "BASAL__SET_SUSPEND_OFF"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Basal_Set_Suspend_On(
|
class DanaRSPacketBasalSetSuspendOn(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_ON
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_ON
|
||||||
|
@ -15,6 +15,7 @@ class DanaRS_Packet_Basal_Set_Suspend_On(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -24,7 +25,5 @@ class DanaRS_Packet_Basal_Set_Suspend_On(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BASAL__SET_SUSPEND_ON"
|
||||||
return "BASAL__SET_SUSPEND_ON"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,11 +4,11 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
open class DanaRS_Packet_Basal_Set_Temporary_Basal(
|
open class DanaRSPacketBasalSetTemporaryBasal(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var temporaryBasalRatio: Int = 0,
|
private var temporaryBasalRatio: Int = 0,
|
||||||
private var temporaryBasalDuration: Int = 0
|
private var temporaryBasalDuration: Int = 0
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_TEMPORARY_BASAL
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_TEMPORARY_BASAL
|
||||||
|
@ -24,6 +24,7 @@ open class DanaRS_Packet_Basal_Set_Temporary_Basal(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -33,7 +34,5 @@ open class DanaRS_Packet_Basal_Set_Temporary_Basal(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BASAL__SET_TEMPORARY_BASAL"
|
||||||
return "BASAL__SET_TEMPORARY_BASAL"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
package info.nightscout.androidaps.danars.comm
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_24_CIR_CF_Array(
|
class DanaRSPacketBolusGet24CIRCFArray(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ class DanaRS_Packet_Bolus_Get_24_CIR_CF_Array(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
danaPump.units = byteArrayToInt(getBytes(data, DATA_START, 1))
|
danaPump.units = byteArrayToInt(getBytes(data, DATA_START, 1))
|
||||||
for (i in 0 .. 23) {
|
for (i in 0..23) {
|
||||||
val cir = byteArrayToInt(getBytes(data, DATA_START + 1 + 2 * i, 2)).toDouble()
|
val cir = byteArrayToInt(getBytes(data, DATA_START + 1 + 2 * i, 2)).toDouble()
|
||||||
val cf = if (danaPump.units == DanaPump.UNITS_MGDL)
|
val cf = if (danaPump.units == DanaPump.UNITS_MGDL)
|
||||||
byteArrayToInt(getBytes(data, DATA_START + 1 + 48 + 2 * i, 2)).toDouble()
|
byteArrayToInt(getBytes(data, DATA_START + 1 + 48 + 2 * i, 2)).toDouble()
|
||||||
else
|
else
|
||||||
byteArrayToInt(getBytes(data, DATA_START + 1 + 48 + 2 * i, 2)) / 100.0
|
byteArrayToInt(getBytes(data, DATA_START + 1 + 48 + 2 * i, 2)) / 100.0
|
||||||
|
@ -33,7 +33,5 @@ class DanaRS_Packet_Bolus_Get_24_CIR_CF_Array(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump units: " + if (danaPump.units == DanaPump.UNITS_MGDL) "MGDL" else "MMOL")
|
aapsLogger.debug(LTag.PUMPCOMM, "Pump units: " + if (danaPump.units == DanaPump.UNITS_MGDL) "MGDL" else "MMOL")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName = "BOLUS__GET_24_ CIR_CF_ARRAY"
|
||||||
return "BOLUS__GET_24_ CIR_CF_ARRAY"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -12,9 +12,9 @@ import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_Bolus_Option(
|
class DanaRSPacketBolusGetBolusOption(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
|
@ -110,7 +110,5 @@ class DanaRS_Packet_Bolus_Get_Bolus_Option(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "missedBolus04EndMin: $missedBolus04EndMin")
|
aapsLogger.debug(LTag.PUMPCOMM, "missedBolus04EndMin: $missedBolus04EndMin")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__GET_BOLUS_OPTION"
|
||||||
return "BOLUS__GET_BOLUS_OPTION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,9 +6,9 @@ import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_CIR_CF_Array(
|
class DanaRSPacketBolusGetCIRCFArray(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -112,7 +112,5 @@ class DanaRS_Packet_Bolus_Get_CIR_CF_Array(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "cf06: $cf06")
|
aapsLogger.debug(LTag.PUMPCOMM, "cf06: $cf06")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__GET_CIR_CF_ARRAY"
|
||||||
return "BOLUS__GET_CIR_CF_ARRAY"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,9 +6,9 @@ import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_Calculation_Information(
|
class DanaRSPacketBolusGetCalculationInformation(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class DanaRS_Packet_Bolus_Get_Calculation_Information(
|
||||||
if (danaPump.units == DanaPump.UNITS_MMOL) {
|
if (danaPump.units == DanaPump.UNITS_MMOL) {
|
||||||
danaPump.currentCF = danaPump.currentCF / 100.0
|
danaPump.currentCF = danaPump.currentCF / 100.0
|
||||||
danaPump.currentTarget = danaPump.currentTarget / 100.0
|
danaPump.currentTarget = danaPump.currentTarget / 100.0
|
||||||
currentBG = currentBG / 100.0
|
currentBG /= 100.0
|
||||||
}
|
}
|
||||||
if (error != 0) failed = true
|
if (error != 0) failed = true
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
|
||||||
|
@ -58,7 +58,5 @@ class DanaRS_Packet_Bolus_Get_Calculation_Information(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump IOB: " + danaPump.iob)
|
aapsLogger.debug(LTag.PUMPCOMM, "Pump IOB: " + danaPump.iob)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__GET_CALCULATION_INFORMATION"
|
||||||
return "BOLUS__GET_CALCULATION_INFORMATION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -8,9 +8,9 @@ import org.joda.time.DateTime
|
||||||
import org.joda.time.DateTimeZone
|
import org.joda.time.DateTimeZone
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_Step_Bolus_Information(
|
class DanaRSPacketBolusGetStepBolusInformation(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -40,7 +40,5 @@ class DanaRS_Packet_Bolus_Get_Step_Bolus_Information(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Bolus step: " + danaPump.bolusStep + " U")
|
aapsLogger.debug(LTag.PUMPCOMM, "Bolus step: " + danaPump.bolusStep + " U")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__GET_STEP_BOLUS_INFORMATION"
|
||||||
return "BOLUS__GET_STEP_BOLUS_INFORMATION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -9,10 +9,10 @@ import info.nightscout.androidaps.logging.LTag
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.round
|
import kotlin.math.round
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Set_24_CIR_CF_Array(
|
class DanaRSPacketBolusSet24CIRCFArray(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private val profile: Profile?
|
private val profile: Profile?
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ class DanaRS_Packet_Bolus_Set_24_CIR_CF_Array(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -51,7 +52,5 @@ class DanaRS_Packet_Bolus_Set_24_CIR_CF_Array(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__SET_24_CIR_CF_ARRAY"
|
||||||
return "BOLUS__SET_24_CIR_CF_ARRAY"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Set_Bolus_Option(
|
class DanaRSPacketBolusSetBolusOption(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var extendedBolusOptionOnOff: Int = 0,
|
private var extendedBolusOptionOnOff: Int = 0,
|
||||||
private var bolusCalculationOption: Int = 0,
|
private var bolusCalculationOption: Int = 0,
|
||||||
|
@ -26,7 +26,7 @@ class DanaRS_Packet_Bolus_Set_Bolus_Option(
|
||||||
private var missedBolus04EndHour: Int = 0,
|
private var missedBolus04EndHour: Int = 0,
|
||||||
private var missedBolus04EndMin: Int = 0
|
private var missedBolus04EndMin: Int = 0
|
||||||
|
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_BOLUS_OPTION
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_BOLUS_OPTION
|
||||||
|
@ -59,6 +59,7 @@ class DanaRS_Packet_Bolus_Set_Bolus_Option(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -68,7 +69,5 @@ class DanaRS_Packet_Bolus_Set_Bolus_Option(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__SET_BOLUS_OPTION"
|
||||||
return "BOLUS__SET_BOLUS_OPTION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,15 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Set_Extended_Bolus(
|
class DanaRSPacketBolusSetExtendedBolus(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var extendedAmount: Double = 0.0,
|
private var extendedAmount: Double = 0.0,
|
||||||
private var extendedBolusDurationInHalfHours: Int = 0
|
private var extendedBolusDurationInHalfHours: Int = 0
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus start : $extendedAmount U halfhours: $extendedBolusDurationInHalfHours")
|
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus start : $extendedAmount U half-hours: $extendedBolusDurationInHalfHours")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getRequestParams(): ByteArray {
|
override fun getRequestParams(): ByteArray {
|
||||||
|
@ -26,6 +26,7 @@ class DanaRS_Packet_Bolus_Set_Extended_Bolus(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -35,7 +36,5 @@ class DanaRS_Packet_Bolus_Set_Extended_Bolus(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__SET_EXTENDED_BOLUS"
|
||||||
return "BOLUS__SET_EXTENDED_BOLUS"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(
|
class DanaRSPacketBolusSetExtendedBolusCancel(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS_CANCEL
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS_CANCEL
|
||||||
|
@ -15,6 +15,7 @@ class DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -24,7 +25,5 @@ class DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__SET_EXTENDED_BOLUS_CANCEL"
|
||||||
return "BOLUS__SET_EXTENDED_BOLUS_CANCEL"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -8,11 +8,11 @@ import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Set_Step_Bolus_Start(
|
class DanaRSPacketBolusSetStepBolusStart(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var amount: Double = 0.0,
|
private var amount: Double = 0.0,
|
||||||
private var speed: Int = 0
|
private var speed: Int = 0
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
@Inject lateinit var constraintChecker: ConstraintChecker
|
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||||
|
@ -45,7 +45,5 @@ class DanaRS_Packet_Bolus_Set_Step_Bolus_Start(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__SET_STEP_BOLUS_START"
|
||||||
return "BOLUS__SET_STEP_BOLUS_START"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -10,9 +10,9 @@ import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
open class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(
|
open class DanaRSPacketBolusSetStepBolusStop(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
|
@ -24,6 +24,7 @@ open class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -44,7 +45,5 @@ open class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(
|
||||||
rxBus.send(bolusingEvent)
|
rxBus.send(bolusingEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "BOLUS__SET_STEP_BOLUS_STOP"
|
||||||
return "BOLUS__SET_STEP_BOLUS_STOP"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Etc_Keep_Connection(
|
class DanaRSPacketEtcKeepConnection(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__KEEP_CONNECTION
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__KEEP_CONNECTION
|
||||||
|
@ -15,6 +15,7 @@ class DanaRS_Packet_Etc_Keep_Connection(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -24,7 +25,5 @@ class DanaRS_Packet_Etc_Keep_Connection(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "ETC__KEEP_CONNECTION"
|
||||||
return "ETC__KEEP_CONNECTION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Etc_Set_History_Save(
|
class DanaRSPacketEtcSetHistorySave(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var historyType: Int = 0,
|
private var historyType: Int = 0,
|
||||||
private var historyYear: Int = 0,
|
private var historyYear: Int = 0,
|
||||||
|
@ -15,7 +15,7 @@ class DanaRS_Packet_Etc_Set_History_Save(
|
||||||
private var historySecond: Int = 0,
|
private var historySecond: Int = 0,
|
||||||
private var historyCode: Int = 0,
|
private var historyCode: Int = 0,
|
||||||
private var historyValue: Int = 0
|
private var historyValue: Int = 0
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__SET_HISTORY_SAVE
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__SET_HISTORY_SAVE
|
||||||
|
@ -39,6 +39,7 @@ class DanaRS_Packet_Etc_Set_History_Save(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -48,7 +49,5 @@ class DanaRS_Packet_Etc_Set_History_Save(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "ETC__SET_HISTORY_SAVE"
|
||||||
return "ETC__SET_HISTORY_SAVE"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -11,9 +11,9 @@ import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_General_Get_Pump_Check(
|
class DanaRSPacketGeneralGetPumpCheck(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
|
@ -47,7 +47,5 @@ class DanaRS_Packet_General_Get_Pump_Check(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__GET_PUMP_CHECK"
|
||||||
return "REVIEW__GET_PUMP_CHECK"
|
}
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,9 +6,9 @@ import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_General_Get_Shipping_Information(
|
class DanaRSPacketGeneralGetShippingInformation(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -30,7 +30,5 @@ class DanaRS_Packet_General_Get_Shipping_Information(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Shipping country: " + danaPump.shippingCountry)
|
aapsLogger.debug(LTag.PUMPCOMM, "Shipping country: " + danaPump.shippingCountry)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__GET_SHIPPING_INFORMATION"
|
||||||
return "REVIEW__GET_SHIPPING_INFORMATION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -7,9 +7,9 @@ import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_General_Get_Shipping_Version(
|
class DanaRSPacketGeneralGetShippingVersion(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -24,7 +24,5 @@ class DanaRS_Packet_General_Get_Shipping_Version(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "BLE Model: " + danaPump.bleModel)
|
aapsLogger.debug(LTag.PUMPCOMM, "BLE Model: " + danaPump.bleModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "GENERAL__GET_SHIPPING_VERSION"
|
||||||
return "GENERAL__GET_SHIPPING_VERSION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_General_Get_User_Time_Change_Flag(
|
class DanaRSPacketGeneralGetUserTimeChangeFlag(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_USER_TIME_CHANGE_FLAG
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_USER_TIME_CHANGE_FLAG
|
||||||
|
@ -24,7 +24,5 @@ class DanaRS_Packet_General_Get_User_Time_Change_Flag(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "UserTimeChangeFlag: $userTimeChangeFlag")
|
aapsLogger.debug(LTag.PUMPCOMM, "UserTimeChangeFlag: $userTimeChangeFlag")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__GET_USER_TIME_CHANGE_FLAG"
|
||||||
return "REVIEW__GET_USER_TIME_CHANGE_FLAG"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,9 +6,9 @@ import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_General_Initial_Screen_Information(
|
class DanaRSPacketGeneralInitialScreenInformation(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -70,11 +70,9 @@ class DanaRS_Packet_General_Initial_Screen_Information(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Reservoir remaining units: " + danaPump.reservoirRemainingUnits)
|
aapsLogger.debug(LTag.PUMPCOMM, "Reservoir remaining units: " + danaPump.reservoirRemainingUnits)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Battery: " + danaPump.batteryRemaining)
|
aapsLogger.debug(LTag.PUMPCOMM, "Battery: " + danaPump.batteryRemaining)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Current basal: " + danaPump.currentBasal)
|
aapsLogger.debug(LTag.PUMPCOMM, "Current basal: " + danaPump.currentBasal)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Temp basal percent: " + tempBasalPercent)
|
aapsLogger.debug(LTag.PUMPCOMM, "Temp basal percent: $tempBasalPercent")
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended absolute rate: $extendedBolusAbsoluteRate")
|
aapsLogger.debug(LTag.PUMPCOMM, "Extended absolute rate: $extendedBolusAbsoluteRate")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__INITIAL_SCREEN_INFORMATION"
|
||||||
return "REVIEW__INITIAL_SCREEN_INFORMATION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,10 +4,10 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_General_Set_History_Upload_Mode(
|
class DanaRSPacketGeneralSetHistoryUploadMode(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var mode: Int = 0
|
private var mode: Int = 0
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_HISTORY_UPLOAD_MODE
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_HISTORY_UPLOAD_MODE
|
||||||
|
@ -22,6 +22,7 @@ class DanaRS_Packet_General_Set_History_Upload_Mode(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -31,7 +32,5 @@ class DanaRS_Packet_General_Set_History_Upload_Mode(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__SET_HISTORY_UPLOAD_MODE"
|
||||||
return "REVIEW__SET_HISTORY_UPLOAD_MODE"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(
|
class DanaRSPacketGeneralSetUserTimeChangeFlagClear(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_USER_TIME_CHANGE_FLAG_CLEAR
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_USER_TIME_CHANGE_FLAG_CLEAR
|
||||||
|
@ -15,6 +15,7 @@ class DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -24,7 +25,5 @@ class DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__SET_USER_TIME_CHANGE_FLAG_CLEAR"
|
||||||
return "REVIEW__SET_USER_TIME_CHANGE_FLAG_CLEAR"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -15,10 +15,10 @@ import org.joda.time.DateTime
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
abstract class DanaRS_Packet_History_(
|
abstract class DanaRSPacketHistory(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
protected val from: Long
|
protected val from: Long
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var danaHistoryRecordDao: DanaHistoryRecordDao
|
@Inject lateinit var danaHistoryRecordDao: DanaHistoryRecordDao
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Alarm @JvmOverloads constructor(
|
class DanaRSPacketHistoryAlarm constructor(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALARM
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALARM
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__ALARM"
|
||||||
return "REVIEW__ALARM"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_All_History(
|
class DanaRSPacketHistoryAllHistory(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALL_HISTORY
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALL_HISTORY
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__ALL_HISTORY"
|
||||||
return "REVIEW__ALL_HISTORY"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Basal @JvmOverloads constructor(
|
class DanaRSPacketHistoryBasal @JvmOverloads constructor(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BASAL
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BASAL
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__BASAL"
|
||||||
return "REVIEW__BASAL"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Blood_Glucose @JvmOverloads constructor(
|
class DanaRSPacketHistoryBloodGlucose constructor(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BLOOD_GLUCOSE
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BLOOD_GLUCOSE
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__BLOOD_GLUCOSE"
|
||||||
return "REVIEW__BLOOD_GLUCOSE"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Bolus @JvmOverloads constructor(
|
class DanaRSPacketHistoryBolus constructor(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__BOLUS"
|
||||||
return "REVIEW__BOLUS"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Carbohydrate @JvmOverloads constructor(
|
class DanaRSPacketHistoryCarbohydrate constructor(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__CARBOHYDRATE
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__CARBOHYDRATE
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__CARBOHYDRATE"
|
||||||
return "REVIEW__CARBOHYDRATE"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Daily @JvmOverloads constructor(
|
class DanaRSPacketHistoryDaily constructor(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__DAILY
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__DAILY
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__DAILY"
|
||||||
return "REVIEW__DAILY"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Prime @JvmOverloads constructor(
|
class DanaRSPacketHistoryPrime @JvmOverloads constructor(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__PRIME
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__PRIME
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__PRIME"
|
||||||
return "REVIEW__PRIME"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Refill @JvmOverloads constructor(
|
class DanaRSPacketHistoryRefill constructor(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__REFILL
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__REFILL
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__REFILL"
|
||||||
return "REVIEW__REFILL"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Suspend @JvmOverloads constructor(
|
class DanaRSPacketHistorySuspend constructor(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SUSPEND
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SUSPEND
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__SUSPEND"
|
||||||
return "REVIEW__SUSPEND"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_History_Temporary(
|
class DanaRSPacketHistoryTemporary(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
from: Long = 0
|
from: Long = 0
|
||||||
) : DanaRS_Packet_History_(injector, from) {
|
) : DanaRSPacketHistory(injector, from) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__TEMPORARY
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__TEMPORARY
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__TEMPORARY"
|
||||||
return "REVIEW__TEMPORARY"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -12,9 +12,9 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Notify_Alarm(
|
class DanaRSPacketNotifyAlarm(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
|
@ -69,7 +69,5 @@ class DanaRS_Packet_Notify_Alarm(
|
||||||
pumpSync.insertAnnouncement(errorString, null, danaPump.pumpType(), danaPump.serialNumber)
|
pumpSync.insertAnnouncement(errorString, null, danaPump.pumpType(), danaPump.serialNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "NOTIFY__ALARM"
|
||||||
return "NOTIFY__ALARM"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -11,9 +11,9 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
class DanaRS_Packet_Notify_Delivery_Complete(
|
class DanaRSPacketNotifyDeliveryComplete(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
|
@ -37,7 +37,5 @@ class DanaRS_Packet_Notify_Delivery_Complete(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Delivered insulin: $deliveredInsulin")
|
aapsLogger.debug(LTag.PUMPCOMM, "Delivered insulin: $deliveredInsulin")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "NOTIFY__DELIVERY_COMPLETE"
|
||||||
return "NOTIFY__DELIVERY_COMPLETE"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -11,9 +11,9 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
class DanaRS_Packet_Notify_Delivery_Rate_Display(
|
class DanaRSPacketNotifyDeliveryRateDisplay(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
|
@ -37,7 +37,5 @@ class DanaRS_Packet_Notify_Delivery_Rate_Display(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Delivered insulin so far: $deliveredInsulin")
|
aapsLogger.debug(LTag.PUMPCOMM, "Delivered insulin so far: $deliveredInsulin")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "NOTIFY__DELIVERY_RATE_DISPLAY"
|
||||||
return "NOTIFY__DELIVERY_RATE_DISPLAY"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Notify_Missed_Bolus_Alarm(
|
class DanaRSPacketNotifyMissedBolusAlarm(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY
|
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY
|
||||||
|
@ -38,7 +38,5 @@ class DanaRS_Packet_Notify_Missed_Bolus_Alarm(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "End min: $endMin")
|
aapsLogger.debug(LTag.PUMPCOMM, "End min: $endMin")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "NOTIFY__MISSED_BOLUS_ALARM"
|
||||||
return "NOTIFY__MISSED_BOLUS_ALARM"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -7,9 +7,9 @@ import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Option_Get_Pump_Time(
|
class DanaRSPacketOptionGetPumpTime(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -35,7 +35,5 @@ class DanaRS_Packet_Option_Get_Pump_Time(
|
||||||
danaPump.resetPumpTime()
|
danaPump.resetPumpTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "OPTION__GET_PUMP_TIME"
|
||||||
return "OPTION__GET_PUMP_TIME"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -7,9 +7,9 @@ import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Option_Get_Pump_UTC_And_TimeZone(
|
class DanaRSPacketOptionGetPumpUTCAndTimeZone(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -36,7 +36,5 @@ class DanaRS_Packet_Option_Get_Pump_UTC_And_TimeZone(
|
||||||
danaPump.resetPumpTime()
|
danaPump.resetPumpTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "OPTION__GET_PUMP_UTC_AND_TIMEZONE"
|
||||||
return "OPTION__GET_PUMP_UTC_AND_TIMEZONE"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,9 +6,9 @@ import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Option_Get_User_Option(
|
class DanaRSPacketOptionGetUserOption(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -57,7 +57,5 @@ class DanaRS_Packet_Option_Get_User_Option(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "target: ${if (danaPump.units == DanaPump.UNITS_MGDL) danaPump.target else danaPump.target / 100}")
|
aapsLogger.debug(LTag.PUMPCOMM, "target: ${if (danaPump.units == DanaPump.UNITS_MGDL) danaPump.target else danaPump.target / 100}")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "OPTION__GET_USER_OPTION"
|
||||||
return "OPTION__GET_USER_OPTION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -5,10 +5,10 @@ import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
class DanaRS_Packet_Option_Set_Pump_Time(
|
class DanaRSPacketOptionSetPumpTime(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var time: Long = 0
|
private var time: Long = 0
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
var error = 0
|
var error = 0
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ class DanaRS_Packet_Option_Set_Pump_Time(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -40,7 +41,5 @@ class DanaRS_Packet_Option_Set_Pump_Time(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "OPTION__SET_PUMP_TIME"
|
||||||
return "OPTION__SET_PUMP_TIME"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,11 +6,11 @@ import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import org.joda.time.DateTimeZone
|
import org.joda.time.DateTimeZone
|
||||||
|
|
||||||
class DanaRS_Packet_Option_Set_Pump_UTC_And_TimeZone(
|
class DanaRSPacketOptionSetPumpUTCAndTimeZone(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
private var time: Long = 0,
|
private var time: Long = 0,
|
||||||
private var zoneOffset: Int = 0
|
private var zoneOffset: Int = 0
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
var error = 0
|
var error = 0
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ class DanaRS_Packet_Option_Set_Pump_UTC_And_TimeZone(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -43,7 +44,5 @@ class DanaRS_Packet_Option_Set_Pump_UTC_And_TimeZone(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "OPTION__SET_PUMP_UTC_AND_TIMEZONE"
|
||||||
return "OPTION__SET_PUMP_UTC_AND_TIMEZONE"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,9 +6,9 @@ import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Option_Set_User_Option(
|
class DanaRSPacketOptionSetUserOption(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ class DanaRS_Packet_Option_Set_User_Option(
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val result = intFromBuff(data, 0, 1)
|
val result = intFromBuff(data, 0, 1)
|
||||||
|
@Suppress("LiftReturnOrAssignment")
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
||||||
failed = false
|
failed = false
|
||||||
|
@ -63,7 +64,5 @@ class DanaRS_Packet_Option_Set_User_Option(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "OPTION__SET_USER_OPTION"
|
||||||
return "OPTION__SET_USER_OPTION"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
|
|
||||||
class DanaRS_Packet_Review_Bolus_Avg(
|
class DanaRSPacketReviewBolusAvg(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS_AVG
|
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS_AVG
|
||||||
|
@ -38,7 +38,5 @@ class DanaRS_Packet_Review_Bolus_Avg(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Bolus average 28d: $bolusAvg28 U")
|
aapsLogger.debug(LTag.PUMPCOMM, "Bolus average 28d: $bolusAvg28 U")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__BOLUS_AVG"
|
||||||
return "REVIEW__BOLUS_AVG"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,9 +6,9 @@ import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DanaRS_Packet_Review_Get_Pump_Dec_Ratio(
|
class DanaRSPacketReviewGetPumpDecRatio(
|
||||||
injector: HasAndroidInjector
|
injector: HasAndroidInjector
|
||||||
) : DanaRS_Packet(injector) {
|
) : DanaRSPacket(injector) {
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
|
|
||||||
|
@ -23,7 +23,5 @@ class DanaRS_Packet_Review_Get_Pump_Dec_Ratio(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Dec ratio: ${danaPump.decRatio}%")
|
aapsLogger.debug(LTag.PUMPCOMM, "Dec ratio: ${danaPump.decRatio}%")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override val friendlyName: String = "REVIEW__GET_PUMP_DEC_RATIO"
|
||||||
return "REVIEW__GET_PUMP_DEC_RATIO"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,47 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import java.util.*
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
open class DanaRS_Packet_Basal_Get_Profile_Basal_Rate(
|
|
||||||
injector: HasAndroidInjector,
|
|
||||||
private val profileNumber: Int = 0
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_BASAL_RATE
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Requesting basal rates for profile $profileNumber")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getRequestParams(): ByteArray {
|
|
||||||
val request = ByteArray(1)
|
|
||||||
request[0] = (profileNumber and 0xff).toByte()
|
|
||||||
return request
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
var dataIndex = DATA_START
|
|
||||||
var dataSize = 2
|
|
||||||
danaPump.pumpProfiles = Array(4) { Array(48) { 0.0 } }
|
|
||||||
var i = 0
|
|
||||||
val size = 24
|
|
||||||
while (i < size) {
|
|
||||||
danaPump.pumpProfiles!![profileNumber][i] = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
for (index in 0..23)
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Basal " + String.format(Locale.ENGLISH, "%02d", index) + "h: " + danaPump.pumpProfiles!![profileNumber][index])
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BASAL__GET_PROFILE_BASAL_RATE"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import javax.inject.Inject
|
|
||||||
import kotlin.math.abs
|
|
||||||
import kotlin.math.ceil
|
|
||||||
|
|
||||||
class DanaRS_Packet_Basal_Get_Temporary_Basal_State(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__TEMPORARY_BASAL_STATE
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Requesting temporary basal status")
|
|
||||||
}
|
|
||||||
|
|
||||||
var isTempBasalInProgress: Boolean = false
|
|
||||||
var tempBasalTotalSec: Int = 0
|
|
||||||
var tempBasalPercent: Int = 0
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
val error = byteArrayToInt(getBytes(data, DATA_START, 1))
|
|
||||||
isTempBasalInProgress = byteArrayToInt(getBytes(data, DATA_START + 1, 1)) == 0x01
|
|
||||||
val isAPSTempBasalInProgress = byteArrayToInt(getBytes(data, DATA_START + 1, 1)) == 0x02
|
|
||||||
tempBasalPercent = byteArrayToInt(getBytes(data, DATA_START + 2, 1))
|
|
||||||
if (tempBasalPercent > 200) tempBasalPercent = (tempBasalPercent - 200) * 10
|
|
||||||
val durationHour = byteArrayToInt(getBytes(data, DATA_START + 3, 1))
|
|
||||||
tempBasalTotalSec = if (durationHour == 150) 15 * 60 else if (durationHour == 160) 30 * 60 else durationHour * 60 * 60
|
|
||||||
val runningMin = byteArrayToInt(getBytes(data, DATA_START + 4, 2))
|
|
||||||
if (error != 0) failed = true
|
|
||||||
val tempBasalRemainingMin = (danaPump.tempBasalTotalSec - runningMin * 60) / 60
|
|
||||||
val tempBasalStart = if (isTempBasalInProgress) getDateFromTempBasalSecAgo(runningMin * 60) else 0
|
|
||||||
if (!isTempBasalInProgress) danaPump.isTempBasalInProgress = false
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Error code: $error")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Is temp basal running: $isTempBasalInProgress")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Is APS temp basal running: $isAPSTempBasalInProgress")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal percent: $tempBasalPercent")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal remaining min: $tempBasalRemainingMin")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal total sec: $tempBasalTotalSec")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal start: " + dateUtil.dateAndTimeString(tempBasalStart))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BASAL__TEMPORARY_BASAL_STATE"
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getDateFromTempBasalSecAgo(tempBasalAgoSecs: Int): Long {
|
|
||||||
return (ceil(System.currentTimeMillis() / 1000.0) - tempBasalAgoSecs).toLong() * 1000
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
|
|
||||||
class DanaRS_Packet_Basal_Set_Basal_Rate(
|
|
||||||
injector: HasAndroidInjector,
|
|
||||||
private var profileBasalRate: Array<Double>
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_BASAL_RATE
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Setting new basal rates")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getRequestParams(): ByteArray {
|
|
||||||
val request = ByteArray(48)
|
|
||||||
var i = 0
|
|
||||||
val size = 24
|
|
||||||
while (i < size) {
|
|
||||||
val rate = (profileBasalRate[i] * 100.0).toInt()
|
|
||||||
request[0 + i * 2] = (rate and 0xff).toByte()
|
|
||||||
request[1 + i * 2] = (rate ushr 8 and 0xff).toByte()
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
return request
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
val result = intFromBuff(data, 0, 1)
|
|
||||||
if (result == 0) {
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
|
||||||
failed = false
|
|
||||||
} else {
|
|
||||||
aapsLogger.error("Result Error: $result")
|
|
||||||
failed = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BASAL__SET_BASAL_RATE"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CARBOHYDRATE_CALCULATION_INFORMATION
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
var dataIndex = DATA_START
|
|
||||||
var dataSize = 1
|
|
||||||
val error = byteArrayToInt(getBytes(data, dataIndex, dataSize))
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
val carbs = byteArrayToInt(getBytes(data, dataIndex, dataSize))
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
danaPump.currentCIR = byteArrayToInt(getBytes(data, dataIndex, dataSize))
|
|
||||||
if (error != 0) failed = true
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Carbs: $carbs")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Current CIR: " + danaPump.currentCIR)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BOLUS__GET_CARBOHYDRATE_CALCULATION_INFORMATION"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_Dual_Bolus(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_DUAL_BOLUS
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
val error = byteArrayToInt(getBytes(data, DATA_START, 1))
|
|
||||||
danaPump.bolusStep = byteArrayToInt(getBytes(data, DATA_START + 1, 2)) / 100.0
|
|
||||||
val extendedBolusAbsoluteRate = byteArrayToInt(getBytes(data, DATA_START + 3, 2)) / 100.0
|
|
||||||
danaPump.maxBolus = byteArrayToInt(getBytes(data, DATA_START + 5, 2)) / 100.0
|
|
||||||
val bolusIncrement = byteArrayToInt(getBytes(data, DATA_START + 7, 1)) / 100.0
|
|
||||||
failed = error != 0
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Bolus step: ${danaPump.bolusStep} U")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus running: $extendedBolusAbsoluteRate U/h")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Max bolus: " + danaPump.maxBolus + " U")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "bolusIncrement: $bolusIncrement U")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BOLUS__GET_DUAL_BOLUS"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_Extended_Bolus(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
var dataIndex = DATA_START
|
|
||||||
var dataSize = 1
|
|
||||||
val error = byteArrayToInt(getBytes(data, dataIndex, dataSize))
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
val extendedBolusAbsoluteRate = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
danaPump.maxBolus = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 1
|
|
||||||
danaPump.bolusStep = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
failed = error != 0
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus running: $extendedBolusAbsoluteRate U/h")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Max bolus: " + danaPump.maxBolus + " U")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Bolus step: " + danaPump.bolusStep + " U")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BOLUS__GET_EXTENDED_BOLUS"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import info.nightscout.androidaps.utils.T
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_Extended_Bolus_State(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS_STATE
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
var isExtendedInProgress: Boolean = false
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
var dataIndex = DATA_START
|
|
||||||
var dataSize = 1
|
|
||||||
val error = byteArrayToInt(getBytes(data, dataIndex, dataSize))
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 1
|
|
||||||
isExtendedInProgress = byteArrayToInt(getBytes(data, dataIndex, dataSize)) == 0x01
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 1
|
|
||||||
val extendedBolusDuration = T.mins(byteArrayToInt(getBytes(data, dataIndex, dataSize)) * 30L).msecs()
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
val extendedBolusAbsoluteRate = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0 // duration must be set first for recalculation to amount
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
val extendedBolusSoFarInMinutes = byteArrayToInt(getBytes(data, dataIndex, dataSize))
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
val extendedBolusDeliveredSoFar = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
failed = error != 0
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Is extended bolus running: $isExtendedInProgress")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus running: $extendedBolusAbsoluteRate U/h")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus duration: " + T.msecs(extendedBolusDuration).mins() + " min")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus so far: $extendedBolusSoFarInMinutes min")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus delivered so far: $extendedBolusDeliveredSoFar U")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BOLUS__GET_EXTENDED_BOLUS_STATE"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_MENU_OPTION_STATE
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
var isExtendedInProgress: Boolean = false
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
var dataIndex = DATA_START
|
|
||||||
var dataSize = 1
|
|
||||||
val extendedMenuOption = byteArrayToInt(getBytes(data, dataIndex, dataSize))
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 1
|
|
||||||
isExtendedInProgress = byteArrayToInt(getBytes(data, dataIndex, dataSize)) == 0x01
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "extendedMenuOption: $extendedMenuOption")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BOLUS__GET_EXTENDED_MENU_OPTION_STATE"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Get_Initial_Bolus(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_BOLUS_RATE
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
val initialBolusValue01: Double
|
|
||||||
val initialBolusValue02: Double
|
|
||||||
val initialBolusValue03: Double
|
|
||||||
val initialBolusValue04: Double
|
|
||||||
var dataIndex = DATA_START
|
|
||||||
var dataSize = 2
|
|
||||||
initialBolusValue01 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
initialBolusValue02 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
initialBolusValue03 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
initialBolusValue04 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
failed = initialBolusValue01 == 0.0 && initialBolusValue02 == 0.0 && initialBolusValue03 == 0.0 && initialBolusValue04 == 0.0
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Initial bolus amount 01: $initialBolusValue01")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Initial bolus amount 02: $initialBolusValue02")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Initial bolus amount 03: $initialBolusValue03")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Initial bolus amount 04: $initialBolusValue04")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BOLUS__GET_BOLUS_RATE"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Set_CIR_CF_Array(
|
|
||||||
injector: HasAndroidInjector,
|
|
||||||
private var cir01: Int = 0,
|
|
||||||
private var cir02: Int = 0,
|
|
||||||
private var cir03: Int = 0,
|
|
||||||
private var cir04: Int = 0,
|
|
||||||
private var cir05: Int = 0,
|
|
||||||
private var cir06: Int = 0,
|
|
||||||
private var cir07: Int = 0,
|
|
||||||
private var cf01: Int = 0,
|
|
||||||
private var cf02: Int = 0,
|
|
||||||
private var cf03: Int = 0,
|
|
||||||
private var cf04: Int = 0,
|
|
||||||
private var cf05: Int = 0,
|
|
||||||
private var cf06: Int = 0,
|
|
||||||
private var cf07: Int = 0
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_CIR_CF_ARRAY
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getRequestParams(): ByteArray {
|
|
||||||
val request = ByteArray(28)
|
|
||||||
request[0] = (cir01 and 0xff).toByte()
|
|
||||||
request[1] = (cir01 ushr 8 and 0xff).toByte()
|
|
||||||
request[2] = (cir02 and 0xff).toByte()
|
|
||||||
request[3] = (cir02 ushr 8 and 0xff).toByte()
|
|
||||||
request[4] = (cir03 and 0xff).toByte()
|
|
||||||
request[5] = (cir03 ushr 8 and 0xff).toByte()
|
|
||||||
request[6] = (cir04 and 0xff).toByte()
|
|
||||||
request[7] = (cir04 ushr 8 and 0xff).toByte()
|
|
||||||
request[8] = (cir05 and 0xff).toByte()
|
|
||||||
request[9] = (cir05 ushr 8 and 0xff).toByte()
|
|
||||||
request[10] = (cir06 and 0xff).toByte()
|
|
||||||
request[11] = (cir06 ushr 8 and 0xff).toByte()
|
|
||||||
request[12] = (cir07 and 0xff).toByte()
|
|
||||||
request[13] = (cir07 ushr 8 and 0xff).toByte()
|
|
||||||
request[14] = (cf01 and 0xff).toByte()
|
|
||||||
request[15] = (cf01 ushr 8 and 0xff).toByte()
|
|
||||||
request[16] = (cf02 and 0xff).toByte()
|
|
||||||
request[17] = (cf02 ushr 8 and 0xff).toByte()
|
|
||||||
request[18] = (cf03 and 0xff).toByte()
|
|
||||||
request[19] = (cf03 ushr 8 and 0xff).toByte()
|
|
||||||
request[20] = (cf04 and 0xff).toByte()
|
|
||||||
request[21] = (cf04 ushr 8 and 0xff).toByte()
|
|
||||||
request[22] = (cf05 and 0xff).toByte()
|
|
||||||
request[23] = (cf05 ushr 8 and 0xff).toByte()
|
|
||||||
request[24] = (cf06 and 0xff).toByte()
|
|
||||||
request[25] = (cf06 ushr 8 and 0xff).toByte()
|
|
||||||
request[26] = (cf07 and 0xff).toByte()
|
|
||||||
request[27] = (cf07 ushr 8 and 0xff).toByte()
|
|
||||||
return request
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
val result = intFromBuff(data, 0, 1)
|
|
||||||
if (result == 0) {
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
|
||||||
failed = false
|
|
||||||
} else {
|
|
||||||
aapsLogger.error("Result Error: $result")
|
|
||||||
failed = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BOLUS__SET_CIR_CF_ARRAY"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Set_Dual_Bolus(
|
|
||||||
injector: HasAndroidInjector,
|
|
||||||
private var amount: Double = 0.0,
|
|
||||||
private var extendedAmount: Double = 0.0,
|
|
||||||
private var extendedBolusDurationInHalfHours: Int = 0
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_DUAL_BOLUS
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Dual bolus start : $amount U extended: $extendedAmount U halfhours: $extendedBolusDurationInHalfHours")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getRequestParams(): ByteArray {
|
|
||||||
val stepBolusRate = (amount / 100.0).toInt()
|
|
||||||
val extendedBolusRate = (extendedAmount / 100.0).toInt()
|
|
||||||
val request = ByteArray(5)
|
|
||||||
request[0] = (stepBolusRate and 0xff).toByte()
|
|
||||||
request[1] = (stepBolusRate ushr 8 and 0xff).toByte()
|
|
||||||
request[2] = (extendedBolusRate and 0xff).toByte()
|
|
||||||
request[3] = (extendedBolusRate ushr 8 and 0xff).toByte()
|
|
||||||
request[4] = (extendedBolusDurationInHalfHours and 0xff).toByte()
|
|
||||||
return request
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
val result = intFromBuff(data, 0, 1)
|
|
||||||
if (result == 0) {
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
|
||||||
failed = false
|
|
||||||
} else {
|
|
||||||
aapsLogger.error("Result Error: $result")
|
|
||||||
failed = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BOLUS__SET_DUAL_BOLUS"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
|
|
||||||
class DanaRS_Packet_Bolus_Set_Initial_Bolus(
|
|
||||||
injector: HasAndroidInjector,
|
|
||||||
private var bolusRate01: Int = 0,
|
|
||||||
private var bolusRate02: Int = 0,
|
|
||||||
private var bolusRate03: Int = 0,
|
|
||||||
private var bolusRate04: Int = 0
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_BOLUS_RATE
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getRequestParams(): ByteArray {
|
|
||||||
val request = ByteArray(8)
|
|
||||||
request[0] = (bolusRate01 and 0xff).toByte()
|
|
||||||
request[1] = (bolusRate01 ushr 8 and 0xff).toByte()
|
|
||||||
request[2] = (bolusRate02 and 0xff).toByte()
|
|
||||||
request[3] = (bolusRate02 ushr 8 and 0xff).toByte()
|
|
||||||
request[4] = (bolusRate03 and 0xff).toByte()
|
|
||||||
request[5] = (bolusRate03 ushr 8 and 0xff).toByte()
|
|
||||||
request[6] = (bolusRate04 and 0xff).toByte()
|
|
||||||
request[7] = (bolusRate04 ushr 8 and 0xff).toByte()
|
|
||||||
return request
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
val result = intFromBuff(data, 0, 1)
|
|
||||||
if (result == 0) {
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
|
||||||
failed = false
|
|
||||||
} else {
|
|
||||||
aapsLogger.error("Result Error: $result")
|
|
||||||
failed = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "BOLUS__SET_BOLUS_RATE"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
|
|
||||||
class DanaRS_Packet_General_Delivery_Status(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__DELIVERY_STATUS
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
val result = intFromBuff(data, 0, 1)
|
|
||||||
if (result == 0) {
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
|
|
||||||
failed = false
|
|
||||||
} else {
|
|
||||||
aapsLogger.error("Result Error: $result")
|
|
||||||
failed = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "REVIEW__DELIVERY_STATUS"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import org.joda.time.DateTime
|
|
||||||
import org.joda.time.DateTimeZone
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class DanaRS_Packet_General_Get_More_Information(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_MORE_INFORMATION
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
if (data.size < 15) {
|
|
||||||
failed = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
danaPump.iob = intFromBuff(data, 0, 2) / 100.0
|
|
||||||
danaPump.dailyTotalUnits = intFromBuff(data, 2, 2) / 100.0
|
|
||||||
val isExtendedInProgress = intFromBuff(data, 4, 1) == 0x01
|
|
||||||
val extendedBolusRemainingMinutes = intFromBuff(data, 5, 2)
|
|
||||||
// val remainRate = intFromBuff(data, 7, 2) / 100.0
|
|
||||||
val hours = intFromBuff(data, 9, 1)
|
|
||||||
val minutes = intFromBuff(data, 10, 1)
|
|
||||||
if (danaPump.usingUTC) danaPump.lastBolusTime = DateTime.now().withZone(DateTimeZone.UTC).withHourOfDay(hours).withMinuteOfHour(minutes).millis
|
|
||||||
else danaPump.lastBolusTime = DateTime.now().withHourOfDay(hours).withMinuteOfHour(minutes).millis
|
|
||||||
danaPump.lastBolusAmount = intFromBuff(data, 11, 2) / 100.0
|
|
||||||
// On DanaRS DailyUnits can't be more than 160
|
|
||||||
if (danaPump.dailyTotalUnits > 160) failed = true
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Daily total units: " + danaPump.dailyTotalUnits.toString() + " U")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Is extended in progress: $isExtendedInProgress")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus remaining minutes: $extendedBolusRemainingMinutes")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Last bolus time: " + dateUtil.dateAndTimeAndSecondsString(danaPump.lastBolusTime))
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Last bolus amount: " + danaPump.lastBolusAmount)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "REVIEW__GET_MORE_INFORMATION"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class DanaRS_Packet_General_Get_Password(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PASSWORD
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
if (data.size < 2) { // returned data size is too small
|
|
||||||
failed = true
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
failed = false
|
|
||||||
}
|
|
||||||
var pass: Int = (data[DATA_START + 1].toInt() and 0x000000FF shl 8) + (data[DATA_START + 0].toInt() and 0x000000FF)
|
|
||||||
pass = pass xor 3463
|
|
||||||
danaPump.rsPassword = Integer.toHexString(pass)
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump password: " + danaPump.rsPassword)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "REVIEW__GET_PASSWORD"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.logging.LTag
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class DanaRS_Packet_General_Get_Today_Delivery_Total(
|
|
||||||
injector: HasAndroidInjector
|
|
||||||
) : DanaRS_Packet(injector) {
|
|
||||||
|
|
||||||
@Inject lateinit var danaPump: DanaPump
|
|
||||||
|
|
||||||
init {
|
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_TODAY_DELIVERY_TOTAL
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray) {
|
|
||||||
if (data.size < 8) {
|
|
||||||
failed = true
|
|
||||||
return
|
|
||||||
} else failed = false
|
|
||||||
var dataIndex = DATA_START
|
|
||||||
var dataSize = 2
|
|
||||||
danaPump.dailyTotalUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
danaPump.dailyTotalBasalUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
dataIndex += dataSize
|
|
||||||
dataSize = 2
|
|
||||||
danaPump.dailyTotalBolusUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Daily total: " + danaPump.dailyTotalUnits + " U")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Daily total bolus: " + danaPump.dailyTotalBolusUnits + " U")
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Daily total basal: " + danaPump.dailyTotalBasalUnits + " U")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
|
||||||
return "REVIEW__GET_TODAY_DELIVERY_TOTAL"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,76 +8,60 @@ import info.nightscout.androidaps.danars.comm.*
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
abstract class DanaRSCommModule {
|
abstract class DanaRSCommModule {
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet(): DanaRS_Packet
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacket(): DanaRSPacket
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(): DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBasalSetCancelTemporaryBasal(): DanaRSPacketBasalSetCancelTemporaryBasal
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Get_Basal_Rate(): DanaRS_Packet_Basal_Get_Basal_Rate
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBasalGetBasalRate(): DanaRSPacketBasalGetBasalRate
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Get_Profile_Basal_Rate(): DanaRS_Packet_Basal_Get_Profile_Basal_Rate
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBasalGetProfileNumber(): DanaRSPacketBasalGetProfileNumber
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Get_Profile_Number(): DanaRS_Packet_Basal_Get_Profile_Number
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBasalSetProfileBasalRate(): DanaRSPacketBasalSetProfileBasalRate
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Basal_Rate(): DanaRS_Packet_Basal_Set_Basal_Rate
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBasalSetProfileNumber(): DanaRSPacketBasalSetProfileNumber
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Profile_Basal_Rate(): DanaRS_Packet_Basal_Set_Profile_Basal_Rate
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBasalSetSuspendOff(): DanaRSPacketBasalSetSuspendOff
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Profile_Number(): DanaRS_Packet_Basal_Set_Profile_Number
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBasalSetSuspendOn(): DanaRSPacketBasalSetSuspendOn
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Suspend_Off(): DanaRS_Packet_Basal_Set_Suspend_Off
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBasalSetTemporaryBasal(): DanaRSPacketBasalSetTemporaryBasal
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Suspend_On(): DanaRS_Packet_Basal_Set_Suspend_On
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusGetBolusOption(): DanaRSPacketBolusGetBolusOption
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Temporary_Basal(): DanaRS_Packet_Basal_Set_Temporary_Basal
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusGetCalculationInformation(): DanaRSPacketBolusGetCalculationInformation
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Get_Temporary_Basal_State(): DanaRS_Packet_Basal_Get_Temporary_Basal_State
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusGetCIRCFArray(): DanaRSPacketBolusGetCIRCFArray
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Bolus_Option(): DanaRS_Packet_Bolus_Get_Bolus_Option
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusGetStepBolusInformation(): DanaRSPacketBolusGetStepBolusInformation
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Initial_Bolus(): DanaRS_Packet_Bolus_Get_Initial_Bolus
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusSetBolusOption(): DanaRSPacketBolusSetBolusOption
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Calculation_Information(): DanaRS_Packet_Bolus_Get_Calculation_Information
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusGet24CIRCFArray(): DanaRSPacketBolusGet24CIRCFArray
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(): DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusSet24CIRCFArray(): DanaRSPacketBolusSet24CIRCFArray
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_CIR_CF_Array(): DanaRS_Packet_Bolus_Get_CIR_CF_Array
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusSetExtendedBolus(): DanaRSPacketBolusSetExtendedBolus
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_24_CIR_CF_Array(): DanaRS_Packet_Bolus_Get_24_CIR_CF_Array
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusSetExtendedBolusCancel(): DanaRSPacketBolusSetExtendedBolusCancel
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Dual_Bolus(): DanaRS_Packet_Bolus_Get_Dual_Bolus
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusSetStepBolusStart(): DanaRSPacketBolusSetStepBolusStart
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Extended_Bolus(): DanaRS_Packet_Bolus_Get_Extended_Bolus
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketBolusSetStepBolusStop(): DanaRSPacketBolusSetStepBolusStop
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Extended_Bolus_State(): DanaRS_Packet_Bolus_Get_Extended_Bolus_State
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketEtcKeepConnection(): DanaRSPacketEtcKeepConnection
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(): DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketEtcSetHistorySave(): DanaRSPacketEtcSetHistorySave
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Step_Bolus_Information(): DanaRS_Packet_Bolus_Get_Step_Bolus_Information
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketGeneralInitialScreenInformation(): DanaRSPacketGeneralInitialScreenInformation
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Bolus_Option(): DanaRS_Packet_Bolus_Set_Bolus_Option
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketNotifyDeliveryRateDisplay(): DanaRSPacketNotifyDeliveryRateDisplay
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Initial_Bolus(): DanaRS_Packet_Bolus_Set_Initial_Bolus
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketNotifyAlarm(): DanaRSPacketNotifyAlarm
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_CIR_CF_Array(): DanaRS_Packet_Bolus_Set_CIR_CF_Array
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketNotifyDeliveryComplete(): DanaRSPacketNotifyDeliveryComplete
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_24_CIR_CF_Array(): DanaRS_Packet_Bolus_Set_24_CIR_CF_Array
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketNotifyMissedBolusAlarm(): DanaRSPacketNotifyMissedBolusAlarm
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Dual_Bolus(): DanaRS_Packet_Bolus_Set_Dual_Bolus
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketOptionGetPumpTime(): DanaRSPacketOptionGetPumpTime
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Extended_Bolus(): DanaRS_Packet_Bolus_Set_Extended_Bolus
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketOptionGetUserOption(): DanaRSPacketOptionGetUserOption
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(): DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketOptionSetPumpTime(): DanaRSPacketOptionSetPumpTime
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Step_Bolus_Start(): DanaRS_Packet_Bolus_Set_Step_Bolus_Start
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketOptionSetUserOption(): DanaRSPacketOptionSetUserOption
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Step_Bolus_Stop(): DanaRS_Packet_Bolus_Set_Step_Bolus_Stop
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistory(): DanaRSPacketHistory
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Etc_Keep_Connection(): DanaRS_Packet_Etc_Keep_Connection
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryAlarm(): DanaRSPacketHistoryAlarm
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Etc_Set_History_Save(): DanaRS_Packet_Etc_Set_History_Save
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryAllHistory(): DanaRSPacketHistoryAllHistory
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Delivery_Status(): DanaRS_Packet_General_Delivery_Status
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryBasal(): DanaRSPacketHistoryBasal
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Password(): DanaRS_Packet_General_Get_Password
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryBloodGlucose(): DanaRSPacketHistoryBloodGlucose
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Initial_Screen_Information(): DanaRS_Packet_General_Initial_Screen_Information
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryBolus(): DanaRSPacketHistoryBolus
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Notify_Alarm(): DanaRS_Packet_Notify_Alarm
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketReviewBolusAvg(): DanaRSPacketReviewBolusAvg
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Notify_Delivery_Complete(): DanaRS_Packet_Notify_Delivery_Complete
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryCarbohydrate(): DanaRSPacketHistoryCarbohydrate
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Notify_Delivery_Rate_Display(): DanaRS_Packet_Notify_Delivery_Rate_Display
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryDaily(): DanaRSPacketHistoryDaily
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Notify_Missed_Bolus_Alarm(): DanaRS_Packet_Notify_Missed_Bolus_Alarm
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketGeneralGetPumpCheck(): DanaRSPacketGeneralGetPumpCheck
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Get_Pump_Time(): DanaRS_Packet_Option_Get_Pump_Time
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketGeneralGetShippingInformation(): DanaRSPacketGeneralGetShippingInformation
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Get_User_Option(): DanaRS_Packet_Option_Get_User_Option
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketGeneralGetUserTimeChangeFlag(): DanaRSPacketGeneralGetUserTimeChangeFlag
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Set_Pump_Time(): DanaRS_Packet_Option_Set_Pump_Time
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryPrime(): DanaRSPacketHistoryPrime
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Set_User_Option(): DanaRS_Packet_Option_Set_User_Option
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryRefill(): DanaRSPacketHistoryRefill
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_(): DanaRS_Packet_History_
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketGeneralSetHistoryUploadMode(): DanaRSPacketGeneralSetHistoryUploadMode
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Alarm(): DanaRS_Packet_History_Alarm
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketGeneralSetUserTimeChangeFlagClear(): DanaRSPacketGeneralSetUserTimeChangeFlagClear
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_All_History(): DanaRS_Packet_History_All_History
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistorySuspend(): DanaRSPacketHistorySuspend
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Basal(): DanaRS_Packet_History_Basal
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketHistoryTemporary(): DanaRSPacketHistoryTemporary
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Blood_Glucose(): DanaRS_Packet_History_Blood_Glucose
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketAPSBasalSetTemporaryBasal(): DanaRSPacketAPSBasalSetTemporaryBasal
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Bolus(): DanaRS_Packet_History_Bolus
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketAPSHistoryEvents(): DanaRSPacketAPSHistoryEvents
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Review_Bolus_Avg(): DanaRS_Packet_Review_Bolus_Avg
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketAPSSetEventHistory(): DanaRSPacketAPSSetEventHistory
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Carbohydrate(): DanaRS_Packet_History_Carbohydrate
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketGeneralGetShippingVersion(): DanaRSPacketGeneralGetShippingVersion
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Daily(): DanaRS_Packet_History_Daily
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketReviewGetPumpDecRatio(): DanaRSPacketReviewGetPumpDecRatio
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_More_Information(): DanaRS_Packet_General_Get_More_Information
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketOptionGetPumpUTCAndTimeZone(): DanaRSPacketOptionGetPumpUTCAndTimeZone
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Pump_Check(): DanaRS_Packet_General_Get_Pump_Check
|
@ContributesAndroidInjector abstract fun contributesDanaRSPacketOptionSetPumpUTCAndTimeZone(): DanaRSPacketOptionSetPumpUTCAndTimeZone
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Shipping_Information(): DanaRS_Packet_General_Get_Shipping_Information
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Today_Delivery_Total(): DanaRS_Packet_General_Get_Today_Delivery_Total
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_User_Time_Change_Flag(): DanaRS_Packet_General_Get_User_Time_Change_Flag
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Prime(): DanaRS_Packet_History_Prime
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Refill(): DanaRS_Packet_History_Refill
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Set_History_Upload_Mode(): DanaRS_Packet_General_Set_History_Upload_Mode
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(): DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Suspend(): DanaRS_Packet_History_Suspend
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Temporary(): DanaRS_Packet_History_Temporary
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_APS_Basal_Set_Temporary_Basal(): DanaRS_Packet_APS_Basal_Set_Temporary_Basal
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_APS_History_Events(): DanaRS_Packet_APS_History_Events
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_APS_Set_Event_History(): DanaRS_Packet_APS_Set_Event_History
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Shipping_Version(): DanaRS_Packet_General_Get_Shipping_Version
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Review_Get_Pump_Dec_Ratio(): DanaRS_Packet_Review_Get_Pump_Dec_Ratio
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Get_Pump_UTC_And_TimeZone(): DanaRS_Packet_Option_Get_Pump_UTC_And_TimeZone
|
|
||||||
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Set_Pump_UTC_And_TimeZone(): DanaRS_Packet_Option_Set_Pump_UTC_And_TimeZone
|
|
||||||
}
|
}
|
|
@ -12,8 +12,8 @@ import info.nightscout.androidaps.danars.R
|
||||||
import info.nightscout.androidaps.danars.activities.EnterPinActivity
|
import info.nightscout.androidaps.danars.activities.EnterPinActivity
|
||||||
import info.nightscout.androidaps.danars.activities.PairingHelperActivity
|
import info.nightscout.androidaps.danars.activities.PairingHelperActivity
|
||||||
import info.nightscout.androidaps.danars.comm.DanaRSMessageHashTable
|
import info.nightscout.androidaps.danars.comm.DanaRSMessageHashTable
|
||||||
import info.nightscout.androidaps.danars.comm.DanaRS_Packet
|
import info.nightscout.androidaps.danars.comm.DanaRSPacket
|
||||||
import info.nightscout.androidaps.danars.comm.DanaRS_Packet_Etc_Keep_Connection
|
import info.nightscout.androidaps.danars.comm.DanaRSPacketEtcKeepConnection
|
||||||
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
import info.nightscout.androidaps.danars.encryption.BleEncryption
|
||||||
import info.nightscout.androidaps.danars.encryption.EncryptionType
|
import info.nightscout.androidaps.danars.encryption.EncryptionType
|
||||||
import info.nightscout.androidaps.danars.events.EventDanaRSPairingSuccess
|
import info.nightscout.androidaps.danars.events.EventDanaRSPairingSuccess
|
||||||
|
@ -67,7 +67,7 @@ class BLEComm @Inject internal constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private var scheduledDisconnection: ScheduledFuture<*>? = null
|
private var scheduledDisconnection: ScheduledFuture<*>? = null
|
||||||
private var processedMessage: DanaRS_Packet? = null
|
private var processedMessage: DanaRSPacket? = null
|
||||||
private val mSendQueue = ArrayList<ByteArray>()
|
private val mSendQueue = ArrayList<ByteArray>()
|
||||||
private var bluetoothManager: BluetoothManager? = null
|
private var bluetoothManager: BluetoothManager? = null
|
||||||
private var bluetoothAdapter: BluetoothAdapter? = null
|
private var bluetoothAdapter: BluetoothAdapter? = null
|
||||||
|
@ -408,10 +408,8 @@ class BLEComm @Inject internal constructor(
|
||||||
bufferLength -= length + 7
|
bufferLength -= length + 7
|
||||||
// now we have encrypted packet in inputBuffer
|
// now we have encrypted packet in inputBuffer
|
||||||
|
|
||||||
val decrypted = bleEncryption.getDecryptedPacket(inputBuffer)
|
|
||||||
//aapsLogger.debug(LTag.PUMPBTCOMM, "XXXXXX <<<<< PROCESSING: " + DanaRS_Packet.toHexString(inputBuffer))
|
|
||||||
//aapsLogger.debug(LTag.PUMPBTCOMM, "XXXXXY <<<<< PROCESSING: " + DanaRS_Packet.toHexString(decrypted))
|
|
||||||
// decrypt the packet
|
// decrypt the packet
|
||||||
|
val decrypted = bleEncryption.getDecryptedPacket(inputBuffer)
|
||||||
decrypted?.let { decryptedBuffer ->
|
decrypted?.let { decryptedBuffer ->
|
||||||
if (decryptedBuffer[0] == BleEncryption.DANAR_PACKET__TYPE_ENCRYPTION_RESPONSE.toByte()) {
|
if (decryptedBuffer[0] == BleEncryption.DANAR_PACKET__TYPE_ENCRYPTION_RESPONSE.toByte()) {
|
||||||
when (decryptedBuffer[1]) {
|
when (decryptedBuffer[1]) {
|
||||||
|
@ -470,7 +468,7 @@ class BLEComm @Inject internal constructor(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val bytes = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__PUMP_CHECK, null, deviceName)
|
val bytes = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__PUMP_CHECK, null, deviceName)
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__PUMP_CHECK (0x00)" + " " + DanaRS_Packet.toHexString(bytes))
|
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__PUMP_CHECK (0x00)" + " " + DanaRSPacket.toHexString(bytes))
|
||||||
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +477,7 @@ class BLEComm @Inject internal constructor(
|
||||||
private fun processConnectResponse(decryptedBuffer: ByteArray) {
|
private fun processConnectResponse(decryptedBuffer: ByteArray) {
|
||||||
// response OK v1
|
// response OK v1
|
||||||
if (decryptedBuffer.size == 4 && decryptedBuffer[2] == 'O'.code.toByte() && decryptedBuffer[3] == 'K'.code.toByte()) {
|
if (decryptedBuffer.size == 4 && decryptedBuffer[2] == 'O'.code.toByte() && decryptedBuffer[3] == 'K'.code.toByte()) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (OK)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (OK)" + " " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
encryption = EncryptionType.ENCRYPTION_DEFAULT
|
encryption = EncryptionType.ENCRYPTION_DEFAULT
|
||||||
danaPump.ignoreUserPassword = false
|
danaPump.ignoreUserPassword = false
|
||||||
// Grab pairing key from preferences if exists
|
// Grab pairing key from preferences if exists
|
||||||
|
@ -502,11 +500,11 @@ class BLEComm @Inject internal constructor(
|
||||||
sp.putString(resourceHelper.gs(R.string.key_danars_v3_randomsynckey) + danaRSPlugin.mDeviceName, String.format("%02x", decryptedBuffer[decryptedBuffer.size - 1]))
|
sp.putString(resourceHelper.gs(R.string.key_danars_v3_randomsynckey) + danaRSPlugin.mDeviceName, String.format("%02x", decryptedBuffer[decryptedBuffer.size - 1]))
|
||||||
|
|
||||||
if (danaPump.hwModel == 0x05) {
|
if (danaPump.hwModel == 0x05) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK V3 (OK)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK V3 (OK)" + " " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
// Dana RS Pump
|
// Dana RS Pump
|
||||||
sendV3PairingInformation()
|
sendV3PairingInformation()
|
||||||
} else if (danaPump.hwModel == 0x06) {
|
} else if (danaPump.hwModel == 0x06) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK V3 EASY (OK)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK V3 EASY (OK)" + " " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
// Dana RS Easy
|
// Dana RS Easy
|
||||||
sendEasyMenuCheck()
|
sendEasyMenuCheck()
|
||||||
}
|
}
|
||||||
|
@ -517,17 +515,17 @@ class BLEComm @Inject internal constructor(
|
||||||
danaPump.ignoreUserPassword = true
|
danaPump.ignoreUserPassword = true
|
||||||
danaPump.hwModel = decryptedBuffer[5].toInt()
|
danaPump.hwModel = decryptedBuffer[5].toInt()
|
||||||
danaPump.protocol = decryptedBuffer[7].toInt()
|
danaPump.protocol = decryptedBuffer[7].toInt()
|
||||||
val pairingKey = DanaRS_Packet.asciiStringFromBuff(decryptedBuffer, 8, 6) // used while bonding
|
val pairingKey = DanaRSPacket.asciiStringFromBuff(decryptedBuffer, 8, 6) // used while bonding
|
||||||
|
|
||||||
if (danaPump.hwModel == 0x09) {
|
if (danaPump.hwModel == 0x09) {
|
||||||
bleEncryption.setBle5Key(pairingKey.encodeToByteArray())
|
bleEncryption.setBle5Key(pairingKey.encodeToByteArray())
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK BLE5 (OK)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK BLE5 (OK)" + " " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
// Dana-i BLE5 Pump
|
// Dana-i BLE5 Pump
|
||||||
sendBLE5PairingInformation()
|
sendBLE5PairingInformation()
|
||||||
}
|
}
|
||||||
// response PUMP : error status
|
// response PUMP : error status
|
||||||
} else if (decryptedBuffer.size == 6 && decryptedBuffer[2] == 'P'.code.toByte() && decryptedBuffer[3] == 'U'.code.toByte() && decryptedBuffer[4] == 'M'.code.toByte() && decryptedBuffer[5] == 'P'.code.toByte()) {
|
} else if (decryptedBuffer.size == 6 && decryptedBuffer[2] == 'P'.code.toByte() && decryptedBuffer[3] == 'U'.code.toByte() && decryptedBuffer[4] == 'M'.code.toByte() && decryptedBuffer[5] == 'P'.code.toByte()) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (PUMP)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (PUMP)" + " " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
mSendQueue.clear()
|
mSendQueue.clear()
|
||||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, resourceHelper.gs(R.string.pumperror)))
|
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, resourceHelper.gs(R.string.pumperror)))
|
||||||
pumpSync.insertAnnouncement(resourceHelper.gs(R.string.pumperror), null, danaPump.pumpType(), danaPump.serialNumber)
|
pumpSync.insertAnnouncement(resourceHelper.gs(R.string.pumperror), null, danaPump.pumpType(), danaPump.serialNumber)
|
||||||
|
@ -535,12 +533,12 @@ class BLEComm @Inject internal constructor(
|
||||||
rxBus.send(EventNewNotification(n))
|
rxBus.send(EventNewNotification(n))
|
||||||
// response BUSY: error status
|
// response BUSY: error status
|
||||||
} else if (decryptedBuffer.size == 6 && decryptedBuffer[2] == 'B'.code.toByte() && decryptedBuffer[3] == 'U'.code.toByte() && decryptedBuffer[4] == 'S'.code.toByte() && decryptedBuffer[5] == 'Y'.code.toByte()) {
|
} else if (decryptedBuffer.size == 6 && decryptedBuffer[2] == 'B'.code.toByte() && decryptedBuffer[3] == 'U'.code.toByte() && decryptedBuffer[4] == 'S'.code.toByte() && decryptedBuffer[5] == 'Y'.code.toByte()) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (BUSY)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (BUSY)" + " " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
mSendQueue.clear()
|
mSendQueue.clear()
|
||||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, resourceHelper.gs(R.string.pumpbusy)))
|
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, resourceHelper.gs(R.string.pumpbusy)))
|
||||||
} else {
|
} else {
|
||||||
// ERROR in response, wrong serial number
|
// ERROR in response, wrong serial number
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (ERROR)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (ERROR)" + " " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
mSendQueue.clear()
|
mSendQueue.clear()
|
||||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, resourceHelper.gs(R.string.connectionerror)))
|
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, resourceHelper.gs(R.string.connectionerror)))
|
||||||
danaRSPlugin.clearPairing()
|
danaRSPlugin.clearPairing()
|
||||||
|
@ -551,15 +549,15 @@ class BLEComm @Inject internal constructor(
|
||||||
|
|
||||||
// 2nd packet v1 check passkey
|
// 2nd packet v1 check passkey
|
||||||
private fun sendPasskeyCheck(pairingKey: String) {
|
private fun sendPasskeyCheck(pairingKey: String) {
|
||||||
val encodedPairingKey = DanaRS_Packet.hexToBytes(pairingKey)
|
val encodedPairingKey = DanaRSPacket.hexToBytes(pairingKey)
|
||||||
val bytes = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__CHECK_PASSKEY, encodedPairingKey, null)
|
val bytes = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__CHECK_PASSKEY, encodedPairingKey, null)
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__CHECK_PASSKEY" + " " + DanaRS_Packet.toHexString(bytes))
|
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__CHECK_PASSKEY" + " " + DanaRSPacket.toHexString(bytes))
|
||||||
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2nd packet v1 response
|
// 2nd packet v1 response
|
||||||
private fun processPasskeyCheck(decryptedBuffer: ByteArray) {
|
private fun processPasskeyCheck(decryptedBuffer: ByteArray) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__CHECK_PASSKEY" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__CHECK_PASSKEY" + " " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
// Paring is not requested, sending time info
|
// Paring is not requested, sending time info
|
||||||
if (decryptedBuffer[2] == 0x00.toByte()) sendTimeInfo()
|
if (decryptedBuffer[2] == 0x00.toByte()) sendTimeInfo()
|
||||||
// Pairing on pump is requested
|
// Pairing on pump is requested
|
||||||
|
@ -590,20 +588,20 @@ class BLEComm @Inject internal constructor(
|
||||||
private fun sendBLE5PairingInformation() {
|
private fun sendBLE5PairingInformation() {
|
||||||
val params = ByteArray(4) { 0.toByte() }
|
val params = ByteArray(4) { 0.toByte() }
|
||||||
val bytes: ByteArray = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION, params, null)
|
val bytes: ByteArray = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION, params, null)
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__TIME_INFORMATION BLE5" + " " + DanaRS_Packet.toHexString(bytes))
|
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__TIME_INFORMATION BLE5" + " " + DanaRSPacket.toHexString(bytes))
|
||||||
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun sendV3PairingInformation(requestNewPairing: Int) {
|
private fun sendV3PairingInformation(requestNewPairing: Int) {
|
||||||
val params = byteArrayOf(requestNewPairing.toByte())
|
val params = byteArrayOf(requestNewPairing.toByte())
|
||||||
val bytes: ByteArray = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION, params, null)
|
val bytes: ByteArray = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION, params, null)
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__TIME_INFORMATION" + " " + DanaRS_Packet.toHexString(bytes))
|
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__TIME_INFORMATION" + " " + DanaRSPacket.toHexString(bytes))
|
||||||
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2nd packet response
|
// 2nd packet response
|
||||||
private fun processEncryptionResponse(decryptedBuffer: ByteArray) {
|
private fun processEncryptionResponse(decryptedBuffer: ByteArray) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__TIME_INFORMATION " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__TIME_INFORMATION " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
if (encryption == EncryptionType.ENCRYPTION_BLE5) {
|
if (encryption == EncryptionType.ENCRYPTION_BLE5) {
|
||||||
isConnected = true
|
isConnected = true
|
||||||
isConnecting = false
|
isConnecting = false
|
||||||
|
@ -651,7 +649,7 @@ class BLEComm @Inject internal constructor(
|
||||||
// 3rd packet v1 existing pairing
|
// 3rd packet v1 existing pairing
|
||||||
private fun sendTimeInfo() {
|
private fun sendTimeInfo() {
|
||||||
val bytes = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION, null, null)
|
val bytes = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION, null, null)
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__TIME_INFORMATION" + " " + DanaRS_Packet.toHexString(bytes))
|
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__TIME_INFORMATION" + " " + DanaRSPacket.toHexString(bytes))
|
||||||
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,7 +659,7 @@ class BLEComm @Inject internal constructor(
|
||||||
// On pump pairing request is displayed and is waiting for conformation
|
// On pump pairing request is displayed and is waiting for conformation
|
||||||
context.startActivity(Intent(context, PairingHelperActivity::class.java).also { it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) })
|
context.startActivity(Intent(context, PairingHelperActivity::class.java).also { it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) })
|
||||||
val bytes = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__PASSKEY_REQUEST, null, null)
|
val bytes = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__PASSKEY_REQUEST, null, null)
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__PASSKEY_REQUEST" + " " + DanaRS_Packet.toHexString(bytes))
|
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__PASSKEY_REQUEST" + " " + DanaRSPacket.toHexString(bytes))
|
||||||
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,7 +678,7 @@ class BLEComm @Inject internal constructor(
|
||||||
|
|
||||||
// 2nd or 3rd packet v1 response
|
// 2nd or 3rd packet v1 response
|
||||||
private fun processPairingRequest(decryptedBuffer: ByteArray) {
|
private fun processPairingRequest(decryptedBuffer: ByteArray) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PASSKEY_REQUEST " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PASSKEY_REQUEST " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
if (decryptedBuffer[2] != 0x00.toByte()) {
|
if (decryptedBuffer[2] != 0x00.toByte()) {
|
||||||
disconnect("passkey request failed")
|
disconnect("passkey request failed")
|
||||||
}
|
}
|
||||||
|
@ -688,14 +686,14 @@ class BLEComm @Inject internal constructor(
|
||||||
|
|
||||||
// 2nd or 3rd packet v1 response
|
// 2nd or 3rd packet v1 response
|
||||||
private fun processPairingRequest2(decryptedBuffer: ByteArray) {
|
private fun processPairingRequest2(decryptedBuffer: ByteArray) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PASSKEY_RETURN " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PASSKEY_RETURN " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
// Paring is successful, sending time info
|
// Paring is successful, sending time info
|
||||||
rxBus.send(EventDanaRSPairingSuccess())
|
rxBus.send(EventDanaRSPairingSuccess())
|
||||||
sendTimeInfo()
|
sendTimeInfo()
|
||||||
val pairingKey = byteArrayOf(decryptedBuffer[2], decryptedBuffer[3])
|
val pairingKey = byteArrayOf(decryptedBuffer[2], decryptedBuffer[3])
|
||||||
// store pairing key to preferences
|
// store pairing key to preferences
|
||||||
sp.putString(resourceHelper.gs(R.string.key_danars_pairingkey) + danaRSPlugin.mDeviceName, DanaRS_Packet.bytesToHex(pairingKey))
|
sp.putString(resourceHelper.gs(R.string.key_danars_pairingkey) + danaRSPlugin.mDeviceName, DanaRSPacket.bytesToHex(pairingKey))
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Got pairing key: " + DanaRS_Packet.bytesToHex(pairingKey))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Got pairing key: " + DanaRSPacket.bytesToHex(pairingKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3rd packet Easy menu pump
|
// 3rd packet Easy menu pump
|
||||||
|
@ -715,12 +713,12 @@ class BLEComm @Inject internal constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
// the rest of packets
|
// the rest of packets
|
||||||
fun sendMessage(message: DanaRS_Packet) {
|
fun sendMessage(message: DanaRSPacket) {
|
||||||
encryptedCommandSent = true
|
encryptedCommandSent = true
|
||||||
processedMessage = message
|
processedMessage = message
|
||||||
val command = byteArrayOf(message.type.toByte(), message.opCode.toByte())
|
val command = byteArrayOf(message.type.toByte(), message.opCode.toByte())
|
||||||
val params = message.getRequestParams()
|
val params = message.getRequestParams()
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + message.getFriendlyName() + " " + DanaRS_Packet.toHexString(command) + " " + DanaRS_Packet.toHexString(params))
|
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + message.friendlyName + " " + DanaRSPacket.toHexString(command) + " " + DanaRSPacket.toHexString(params))
|
||||||
var bytes = bleEncryption.getEncryptedPacket(message.opCode, params, null)
|
var bytes = bleEncryption.getEncryptedPacket(message.opCode, params, null)
|
||||||
// aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + DanaRS_Packet.toHexString(bytes))
|
// aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + DanaRS_Packet.toHexString(bytes))
|
||||||
if (encryption != EncryptionType.ENCRYPTION_DEFAULT)
|
if (encryption != EncryptionType.ENCRYPTION_DEFAULT)
|
||||||
|
@ -780,19 +778,19 @@ class BLEComm @Inject internal constructor(
|
||||||
|
|
||||||
//SystemClock.sleep(200);
|
//SystemClock.sleep(200);
|
||||||
if (!message.isReceived) {
|
if (!message.isReceived) {
|
||||||
aapsLogger.warn(LTag.PUMPBTCOMM, "Reply not received " + message.getFriendlyName())
|
aapsLogger.warn(LTag.PUMPBTCOMM, "Reply not received " + message.friendlyName)
|
||||||
message.handleMessageNotReceived()
|
message.handleMessageNotReceived()
|
||||||
}
|
}
|
||||||
// verify encryption for v3
|
// verify encryption for v3
|
||||||
if (message is DanaRS_Packet_Etc_Keep_Connection)
|
if (message is DanaRSPacketEtcKeepConnection)
|
||||||
if (!message.isReceived) disconnect("KeepAlive not received")
|
if (!message.isReceived) disconnect("KeepAlive not received")
|
||||||
}
|
}
|
||||||
|
|
||||||
// process common packet response
|
// process common packet response
|
||||||
private fun processMessage(decryptedBuffer: ByteArray) {
|
private fun processMessage(decryptedBuffer: ByteArray) {
|
||||||
val originalCommand = processedMessage?.command ?: 0xFFFF
|
val originalCommand = processedMessage?.command ?: 0xFFFF
|
||||||
val receivedCommand = DanaRS_Packet(injector).getCommand(decryptedBuffer)
|
val receivedCommand = DanaRSPacket(injector).getCommand(decryptedBuffer)
|
||||||
val message: DanaRS_Packet? = if (originalCommand == receivedCommand) {
|
val message: DanaRSPacket? = if (originalCommand == receivedCommand) {
|
||||||
// it's response to last message
|
// it's response to last message
|
||||||
processedMessage
|
processedMessage
|
||||||
} else {
|
} else {
|
||||||
|
@ -800,7 +798,7 @@ class BLEComm @Inject internal constructor(
|
||||||
danaRSMessageHashTable.findMessage(receivedCommand)
|
danaRSMessageHashTable.findMessage(receivedCommand)
|
||||||
}
|
}
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + message.getFriendlyName() + " " + DanaRS_Packet.toHexString(decryptedBuffer))
|
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + message.friendlyName + " " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
// process received data
|
// process received data
|
||||||
message.handleMessage(decryptedBuffer)
|
message.handleMessage(decryptedBuffer)
|
||||||
message.setReceived()
|
message.setReceived()
|
||||||
|
@ -808,7 +806,7 @@ class BLEComm @Inject internal constructor(
|
||||||
// notify to sendMessage
|
// notify to sendMessage
|
||||||
message.notify()
|
message.notify()
|
||||||
}
|
}
|
||||||
} else aapsLogger.error("Unknown message received " + DanaRS_Packet.toHexString(decryptedBuffer))
|
} else aapsLogger.error("Unknown message received " + DanaRSPacket.toHexString(decryptedBuffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -110,7 +110,7 @@ class DanaRSService : DaggerService() {
|
||||||
bleComm.disconnect(from)
|
bleComm.disconnect(from)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendMessage(message: DanaRS_Packet) {
|
fun sendMessage(message: DanaRSPacket) {
|
||||||
bleComm.sendMessage(message)
|
bleComm.sendMessage(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,20 +118,20 @@ class DanaRSService : DaggerService() {
|
||||||
try {
|
try {
|
||||||
val pump = activePlugin.activePump
|
val pump = activePlugin.activePump
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)))
|
||||||
sendMessage(DanaRS_Packet_Etc_Keep_Connection(injector)) // test encryption for v3
|
sendMessage(DanaRSPacketEtcKeepConnection(injector)) // test encryption for v3
|
||||||
sendMessage(DanaRS_Packet_General_Get_Shipping_Information(injector)) // serial no
|
sendMessage(DanaRSPacketGeneralGetShippingInformation(injector)) // serial no
|
||||||
sendMessage(DanaRS_Packet_General_Get_Pump_Check(injector)) // firmware
|
sendMessage(DanaRSPacketGeneralGetPumpCheck(injector)) // firmware
|
||||||
sendMessage(DanaRS_Packet_Basal_Get_Profile_Number(injector))
|
sendMessage(DanaRSPacketBasalGetProfileNumber(injector))
|
||||||
sendMessage(DanaRS_Packet_Bolus_Get_Bolus_Option(injector)) // isExtendedEnabled
|
sendMessage(DanaRSPacketBolusGetBolusOption(injector)) // isExtendedEnabled
|
||||||
sendMessage(DanaRS_Packet_Basal_Get_Basal_Rate(injector)) // basal profile, basalStep, maxBasal
|
sendMessage(DanaRSPacketBasalGetBasalRate(injector)) // basal profile, basalStep, maxBasal
|
||||||
sendMessage(DanaRS_Packet_Bolus_Get_Calculation_Information(injector)) // target
|
sendMessage(DanaRSPacketBolusGetCalculationInformation(injector)) // target
|
||||||
if (danaPump.profile24) sendMessage(DanaRS_Packet_Bolus_Get_24_CIR_CF_Array(injector))
|
if (danaPump.profile24) sendMessage(DanaRSPacketBolusGet24CIRCFArray(injector))
|
||||||
else sendMessage(DanaRS_Packet_Bolus_Get_CIR_CF_Array(injector))
|
else sendMessage(DanaRSPacketBolusGetCIRCFArray(injector))
|
||||||
sendMessage(DanaRS_Packet_Option_Get_User_Option(injector)) // Getting user options
|
sendMessage(DanaRSPacketOptionGetUserOption(injector)) // Getting user options
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpstatus)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpstatus)))
|
||||||
sendMessage(DanaRS_Packet_General_Initial_Screen_Information(injector))
|
sendMessage(DanaRSPacketGeneralInitialScreenInformation(injector))
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)))
|
||||||
sendMessage(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(injector)) // last bolus, bolusStep, maxBolus
|
sendMessage(DanaRSPacketBolusGetStepBolusInformation(injector)) // last bolus, bolusStep, maxBolus
|
||||||
danaPump.lastConnection = System.currentTimeMillis()
|
danaPump.lastConnection = System.currentTimeMillis()
|
||||||
val profile = profileFunction.getProfile()
|
val profile = profileFunction.getProfile()
|
||||||
if (profile != null && abs(danaPump.currentBasal - profile.getBasal()) >= pump.pumpDescription.basalStep) {
|
if (profile != null && abs(danaPump.currentBasal - profile.getBasal()) >= pump.pumpDescription.basalStep) {
|
||||||
|
@ -141,8 +141,8 @@ class DanaRSService : DaggerService() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)))
|
||||||
if (danaPump.usingUTC) sendMessage(DanaRS_Packet_Option_Get_Pump_UTC_And_TimeZone(injector))
|
if (danaPump.usingUTC) sendMessage(DanaRSPacketOptionGetPumpUTCAndTimeZone(injector))
|
||||||
else sendMessage(DanaRS_Packet_Option_Get_Pump_Time(injector))
|
else sendMessage(DanaRSPacketOptionGetPumpTime(injector))
|
||||||
var timeDiff = (danaPump.getPumpTime() - System.currentTimeMillis()) / 1000L
|
var timeDiff = (danaPump.getPumpTime() - System.currentTimeMillis()) / 1000L
|
||||||
if (danaPump.getPumpTime() == 0L) {
|
if (danaPump.getPumpTime() == 0L) {
|
||||||
// initial handshake was not successful
|
// initial handshake was not successful
|
||||||
|
@ -172,21 +172,21 @@ class DanaRSService : DaggerService() {
|
||||||
} else {
|
} else {
|
||||||
when {
|
when {
|
||||||
danaPump.usingUTC -> {
|
danaPump.usingUTC -> {
|
||||||
sendMessage(DanaRS_Packet_Option_Set_Pump_UTC_And_TimeZone(injector, dateUtil.now(), offset))
|
sendMessage(DanaRSPacketOptionSetPumpUTCAndTimeZone(injector, dateUtil.now(), offset))
|
||||||
}
|
}
|
||||||
|
|
||||||
danaPump.protocol >= 6 -> { // can set seconds
|
danaPump.protocol >= 6 -> { // can set seconds
|
||||||
sendMessage(DanaRS_Packet_Option_Set_Pump_Time(injector, dateUtil.now()))
|
sendMessage(DanaRSPacketOptionSetPumpTime(injector, dateUtil.now()))
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
waitForWholeMinute() // Dana can set only whole minute
|
waitForWholeMinute() // Dana can set only whole minute
|
||||||
// add 10sec to be sure we are over minute (will be cut off anyway)
|
// add 10sec to be sure we are over minute (will be cut off anyway)
|
||||||
sendMessage(DanaRS_Packet_Option_Set_Pump_Time(injector, dateUtil.now() + T.secs(10).msecs()))
|
sendMessage(DanaRSPacketOptionSetPumpTime(injector, dateUtil.now() + T.secs(10).msecs()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (danaPump.usingUTC) sendMessage(DanaRS_Packet_Option_Get_Pump_UTC_And_TimeZone(injector))
|
if (danaPump.usingUTC) sendMessage(DanaRSPacketOptionGetPumpUTCAndTimeZone(injector))
|
||||||
else sendMessage(DanaRS_Packet_Option_Get_Pump_Time(injector))
|
else sendMessage(DanaRSPacketOptionGetPumpTime(injector))
|
||||||
timeDiff = (danaPump.getPumpTime() - System.currentTimeMillis()) / 1000L
|
timeDiff = (danaPump.getPumpTime() - System.currentTimeMillis()) / 1000L
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds")
|
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds")
|
||||||
}
|
}
|
||||||
|
@ -221,12 +221,12 @@ class DanaRSService : DaggerService() {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
SystemClock.sleep(1000)
|
SystemClock.sleep(1000)
|
||||||
val msg: DanaRS_Packet_APS_History_Events
|
val msg: DanaRSPacketAPSHistoryEvents
|
||||||
if (danaPump.lastHistoryFetched == 0L) {
|
if (danaPump.lastHistoryFetched == 0L) {
|
||||||
msg = DanaRS_Packet_APS_History_Events(injector, 0)
|
msg = DanaRSPacketAPSHistoryEvents(injector, 0)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Loading complete event history")
|
aapsLogger.debug(LTag.PUMPCOMM, "Loading complete event history")
|
||||||
} else {
|
} else {
|
||||||
msg = DanaRS_Packet_APS_History_Events(injector, danaPump.lastHistoryFetched)
|
msg = DanaRSPacketAPSHistoryEvents(injector, danaPump.lastHistoryFetched)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + dateUtil.dateAndTimeString(danaPump.lastHistoryFetched))
|
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + dateUtil.dateAndTimeString(danaPump.lastHistoryFetched))
|
||||||
}
|
}
|
||||||
sendMessage(msg)
|
sendMessage(msg)
|
||||||
|
@ -240,7 +240,7 @@ class DanaRSService : DaggerService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setUserSettings(): PumpEnactResult {
|
fun setUserSettings(): PumpEnactResult {
|
||||||
val message = DanaRS_Packet_Option_Set_User_Option(injector)
|
val message = DanaRSPacketOptionSetUserOption(injector)
|
||||||
sendMessage(message)
|
sendMessage(message)
|
||||||
return PumpEnactResult(injector).success(message.success())
|
return PumpEnactResult(injector).success(message.success())
|
||||||
}
|
}
|
||||||
|
@ -256,11 +256,11 @@ class DanaRSService : DaggerService() {
|
||||||
danaPump.bolusStopped = false
|
danaPump.bolusStopped = false
|
||||||
danaPump.bolusStopForced = false
|
danaPump.bolusStopForced = false
|
||||||
danaPump.bolusProgressLastTimeStamp = dateUtil.now()
|
danaPump.bolusProgressLastTimeStamp = dateUtil.now()
|
||||||
val start = DanaRS_Packet_Bolus_Set_Step_Bolus_Start(injector, insulin, preferencesSpeed)
|
val start = DanaRSPacketBolusSetStepBolusStart(injector, insulin, preferencesSpeed)
|
||||||
if (carbs > 0) {
|
if (carbs > 0) {
|
||||||
// MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbTime, carbs); ####
|
// MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbTime, carbs); ####
|
||||||
// sendMessage(msg);
|
// sendMessage(msg);
|
||||||
val msgSetHistoryEntryV2 = DanaRS_Packet_APS_Set_Event_History(injector, DanaPump.CARBS, carbTime, carbs, 0)
|
val msgSetHistoryEntryV2 = DanaRSPacketAPSSetEventHistory(injector, DanaPump.CARBS, carbTime, carbs, 0)
|
||||||
sendMessage(msgSetHistoryEntryV2)
|
sendMessage(msgSetHistoryEntryV2)
|
||||||
danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs())
|
danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs())
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ class DanaRSService : DaggerService() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
// reread bolus status
|
// reread bolus status
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)))
|
||||||
sendMessage(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(injector)) // last bolus
|
sendMessage(DanaRSPacketBolusGetStepBolusInformation(injector)) // last bolus
|
||||||
bolusingEvent.percent = 100
|
bolusingEvent.percent = 100
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.disconnecting)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.disconnecting)))
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ class DanaRSService : DaggerService() {
|
||||||
|
|
||||||
fun bolusStop() {
|
fun bolusStop() {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "bolusStop >>>>> @ " + if (danaPump.bolusingTreatment == null) "" else danaPump.bolusingTreatment?.insulin)
|
aapsLogger.debug(LTag.PUMPCOMM, "bolusStop >>>>> @ " + if (danaPump.bolusingTreatment == null) "" else danaPump.bolusingTreatment?.insulin)
|
||||||
val stop = DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(injector)
|
val stop = DanaRSPacketBolusSetStepBolusStop(injector)
|
||||||
danaPump.bolusStopForced = true
|
danaPump.bolusStopForced = true
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
sendMessage(stop)
|
sendMessage(stop)
|
||||||
|
@ -332,11 +332,11 @@ class DanaRSService : DaggerService() {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
if (danaPump.isTempBasalInProgress) {
|
if (danaPump.isTempBasalInProgress) {
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
||||||
sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
|
sendMessage(DanaRSPacketBasalSetCancelTemporaryBasal(injector))
|
||||||
SystemClock.sleep(500)
|
SystemClock.sleep(500)
|
||||||
}
|
}
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
||||||
val msgTBR = DanaRS_Packet_Basal_Set_Temporary_Basal(injector, percent, durationInHours)
|
val msgTBR = DanaRSPacketBasalSetTemporaryBasal(injector, percent, durationInHours)
|
||||||
sendMessage(msgTBR)
|
sendMessage(msgTBR)
|
||||||
SystemClock.sleep(200)
|
SystemClock.sleep(200)
|
||||||
loadEvents()
|
loadEvents()
|
||||||
|
@ -349,11 +349,11 @@ class DanaRSService : DaggerService() {
|
||||||
fun highTempBasal(percent: Int): Boolean {
|
fun highTempBasal(percent: Int): Boolean {
|
||||||
if (danaPump.isTempBasalInProgress) {
|
if (danaPump.isTempBasalInProgress) {
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
||||||
sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
|
sendMessage(DanaRSPacketBasalSetCancelTemporaryBasal(injector))
|
||||||
SystemClock.sleep(500)
|
SystemClock.sleep(500)
|
||||||
}
|
}
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
||||||
val msgTBR = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(injector, percent)
|
val msgTBR = DanaRSPacketAPSBasalSetTemporaryBasal(injector, percent)
|
||||||
sendMessage(msgTBR)
|
sendMessage(msgTBR)
|
||||||
loadEvents()
|
loadEvents()
|
||||||
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
||||||
|
@ -369,11 +369,11 @@ class DanaRSService : DaggerService() {
|
||||||
}
|
}
|
||||||
if (danaPump.isTempBasalInProgress) {
|
if (danaPump.isTempBasalInProgress) {
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
||||||
sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
|
sendMessage(DanaRSPacketBasalSetCancelTemporaryBasal(injector))
|
||||||
SystemClock.sleep(500)
|
SystemClock.sleep(500)
|
||||||
}
|
}
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
||||||
val msgTBR = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(injector, percent)
|
val msgTBR = DanaRSPacketAPSBasalSetTemporaryBasal(injector, percent)
|
||||||
sendMessage(msgTBR)
|
sendMessage(msgTBR)
|
||||||
loadEvents()
|
loadEvents()
|
||||||
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
||||||
|
@ -385,7 +385,7 @@ class DanaRSService : DaggerService() {
|
||||||
fun tempBasalStop(): Boolean {
|
fun tempBasalStop(): Boolean {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
||||||
val msgCancel = DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector)
|
val msgCancel = DanaRSPacketBasalSetCancelTemporaryBasal(injector)
|
||||||
sendMessage(msgCancel)
|
sendMessage(msgCancel)
|
||||||
loadEvents()
|
loadEvents()
|
||||||
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
||||||
|
@ -397,7 +397,7 @@ class DanaRSService : DaggerService() {
|
||||||
fun extendedBolus(insulin: Double, durationInHalfHours: Int): Boolean {
|
fun extendedBolus(insulin: Double, durationInHalfHours: Int): Boolean {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingextendedbolus)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingextendedbolus)))
|
||||||
val msgExtended = DanaRS_Packet_Bolus_Set_Extended_Bolus(injector, insulin, durationInHalfHours)
|
val msgExtended = DanaRSPacketBolusSetExtendedBolus(injector, insulin, durationInHalfHours)
|
||||||
sendMessage(msgExtended)
|
sendMessage(msgExtended)
|
||||||
SystemClock.sleep(200)
|
SystemClock.sleep(200)
|
||||||
loadEvents()
|
loadEvents()
|
||||||
|
@ -410,7 +410,7 @@ class DanaRSService : DaggerService() {
|
||||||
fun extendedBolusStop(): Boolean {
|
fun extendedBolusStop(): Boolean {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)))
|
||||||
val msgStop = DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(injector)
|
val msgStop = DanaRSPacketBolusSetExtendedBolusCancel(injector)
|
||||||
sendMessage(msgStop)
|
sendMessage(msgStop)
|
||||||
loadEvents()
|
loadEvents()
|
||||||
val eb = pumpSync.expectedPumpState().extendedBolus
|
val eb = pumpSync.expectedPumpState().extendedBolus
|
||||||
|
@ -423,12 +423,12 @@ class DanaRSService : DaggerService() {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.updatingbasalrates)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.updatingbasalrates)))
|
||||||
val basal = danaPump.buildDanaRProfileRecord(profile)
|
val basal = danaPump.buildDanaRProfileRecord(profile)
|
||||||
val msgSet = DanaRS_Packet_Basal_Set_Profile_Basal_Rate(injector, 0, basal)
|
val msgSet = DanaRSPacketBasalSetProfileBasalRate(injector, 0, basal)
|
||||||
sendMessage(msgSet)
|
sendMessage(msgSet)
|
||||||
val msgActivate = DanaRS_Packet_Basal_Set_Profile_Number(injector, 0)
|
val msgActivate = DanaRSPacketBasalSetProfileNumber(injector, 0)
|
||||||
sendMessage(msgActivate)
|
sendMessage(msgActivate)
|
||||||
if (danaPump.profile24) {
|
if (danaPump.profile24) {
|
||||||
val msgProfile = DanaRS_Packet_Bolus_Set_24_CIR_CF_Array(injector, profile)
|
val msgProfile = DanaRSPacketBolusSet24CIRCFArray(injector, profile)
|
||||||
sendMessage(msgProfile)
|
sendMessage(msgProfile)
|
||||||
}
|
}
|
||||||
readPumpStatus()
|
readPumpStatus()
|
||||||
|
@ -439,27 +439,27 @@ class DanaRSService : DaggerService() {
|
||||||
fun loadHistory(type: Byte): PumpEnactResult {
|
fun loadHistory(type: Byte): PumpEnactResult {
|
||||||
val result = PumpEnactResult(injector)
|
val result = PumpEnactResult(injector)
|
||||||
if (!isConnected) return result
|
if (!isConnected) return result
|
||||||
var msg: DanaRS_Packet_History_? = null
|
var msg: DanaRSPacketHistory? = null
|
||||||
when (type) {
|
when (type) {
|
||||||
RecordTypes.RECORD_TYPE_ALARM -> msg = DanaRS_Packet_History_Alarm(injector)
|
RecordTypes.RECORD_TYPE_ALARM -> msg = DanaRSPacketHistoryAlarm(injector)
|
||||||
RecordTypes.RECORD_TYPE_PRIME -> msg = DanaRS_Packet_History_Prime(injector)
|
RecordTypes.RECORD_TYPE_PRIME -> msg = DanaRSPacketHistoryPrime(injector)
|
||||||
RecordTypes.RECORD_TYPE_BASALHOUR -> msg = DanaRS_Packet_History_Basal(injector)
|
RecordTypes.RECORD_TYPE_BASALHOUR -> msg = DanaRSPacketHistoryBasal(injector)
|
||||||
RecordTypes.RECORD_TYPE_BOLUS -> msg = DanaRS_Packet_History_Bolus(injector)
|
RecordTypes.RECORD_TYPE_BOLUS -> msg = DanaRSPacketHistoryBolus(injector)
|
||||||
RecordTypes.RECORD_TYPE_CARBO -> msg = DanaRS_Packet_History_Carbohydrate(injector)
|
RecordTypes.RECORD_TYPE_CARBO -> msg = DanaRSPacketHistoryCarbohydrate(injector)
|
||||||
RecordTypes.RECORD_TYPE_DAILY -> msg = DanaRS_Packet_History_Daily(injector)
|
RecordTypes.RECORD_TYPE_DAILY -> msg = DanaRSPacketHistoryDaily(injector)
|
||||||
RecordTypes.RECORD_TYPE_GLUCOSE -> msg = DanaRS_Packet_History_Blood_Glucose(injector)
|
RecordTypes.RECORD_TYPE_GLUCOSE -> msg = DanaRSPacketHistoryBloodGlucose(injector)
|
||||||
RecordTypes.RECORD_TYPE_REFILL -> msg = DanaRS_Packet_History_Refill(injector)
|
RecordTypes.RECORD_TYPE_REFILL -> msg = DanaRSPacketHistoryRefill(injector)
|
||||||
RecordTypes.RECORD_TYPE_SUSPEND -> msg = DanaRS_Packet_History_Suspend(injector)
|
RecordTypes.RECORD_TYPE_SUSPEND -> msg = DanaRSPacketHistorySuspend(injector)
|
||||||
}
|
}
|
||||||
if (msg != null) {
|
if (msg != null) {
|
||||||
sendMessage(DanaRS_Packet_General_Set_History_Upload_Mode(injector, 1))
|
sendMessage(DanaRSPacketGeneralSetHistoryUploadMode(injector, 1))
|
||||||
SystemClock.sleep(200)
|
SystemClock.sleep(200)
|
||||||
sendMessage(msg)
|
sendMessage(msg)
|
||||||
while (!msg.done && isConnected) {
|
while (!msg.done && isConnected) {
|
||||||
SystemClock.sleep(100)
|
SystemClock.sleep(100)
|
||||||
}
|
}
|
||||||
SystemClock.sleep(200)
|
SystemClock.sleep(200)
|
||||||
sendMessage(DanaRS_Packet_General_Set_History_Upload_Mode(injector, 0))
|
sendMessage(DanaRSPacketGeneralSetHistoryUploadMode(injector, 0))
|
||||||
}
|
}
|
||||||
result.success = msg?.success() ?: false
|
result.success = msg?.success() ?: false
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -4,7 +4,7 @@ import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.TestBaseWithProfile
|
import info.nightscout.androidaps.TestBaseWithProfile
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.comm.DanaRS_Packet
|
import info.nightscout.androidaps.danars.comm.DanaRSPacket
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
|
@ -42,13 +42,13 @@ open class DanaRSTestBase : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
fun putIntToArray(array: ByteArray, position: Int, value: Int): ByteArray {
|
fun putIntToArray(array: ByteArray, position: Int, value: Int): ByteArray {
|
||||||
array[DanaRS_Packet.DATA_START + position] = (value and 0xFF).toByte()
|
array[DanaRSPacket.DATA_START + position] = (value and 0xFF).toByte()
|
||||||
array[DanaRS_Packet.DATA_START + position + 1] = ((value and 0xFF00) shr 8).toByte()
|
array[DanaRSPacket.DATA_START + position + 1] = ((value and 0xFF00) shr 8).toByte()
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|
||||||
fun putByteToArray(array: ByteArray, position: Int, value: Byte): ByteArray {
|
fun putByteToArray(array: ByteArray, position: Int, value: Byte): ByteArray {
|
||||||
array[DanaRS_Packet.DATA_START + position] = value
|
array[DanaRSPacket.DATA_START + position] = value
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,16 +13,16 @@ class DanaRSPacketBasalSetTemporaryBasalTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_Basal_Set_Temporary_Basal) {
|
if (it is DanaRSPacketBasalSetTemporaryBasal) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
val testPacket = DanaRS_Packet_Basal_Set_Temporary_Basal(packetInjector, 50, 20)
|
val testPacket = DanaRSPacketBasalSetTemporaryBasal(packetInjector, 50, 20)
|
||||||
// params
|
// params
|
||||||
val params = testPacket.requestParams
|
val params = testPacket.getRequestParams()
|
||||||
// is ratio 50
|
// is ratio 50
|
||||||
Assert.assertEquals(50.toByte(), params[0])
|
Assert.assertEquals(50.toByte(), params[0])
|
||||||
// is duration 20
|
// is duration 20
|
||||||
|
|
|
@ -19,11 +19,11 @@ class DanaRSPacketHistoryAlarmTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet) {
|
if (it is DanaRSPacket) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
it.dateUtil = dateUtil
|
it.dateUtil = dateUtil
|
||||||
}
|
}
|
||||||
if (it is DanaRS_Packet_History_Alarm) {
|
if (it is DanaRSPacketHistoryAlarm) {
|
||||||
it.rxBus = rxBus
|
it.rxBus = rxBus
|
||||||
it.danaHistoryRecordDao = danaHistoryRecordDao
|
it.danaHistoryRecordDao = danaHistoryRecordDao
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class DanaRSPacketHistoryAlarmTest : DanaRSTestBase() {
|
||||||
@Test
|
@Test
|
||||||
@kotlin.ExperimentalStdlibApi
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun runTest() {
|
fun runTest() {
|
||||||
val packet = DanaRS_Packet_History_Alarm(packetInjector, 0)
|
val packet = DanaRSPacketHistoryAlarm(packetInjector, 0)
|
||||||
|
|
||||||
val array = createArray(12, 0.toByte()) // 10 + 2
|
val array = createArray(12, 0.toByte()) // 10 + 2
|
||||||
putByteToArray(array, 0, 0x0A) // record code alarm
|
putByteToArray(array, 0, 0x0A) // record code alarm
|
||||||
|
|
|
@ -25,7 +25,7 @@ class DanaRSPacketNotifyDeliveryCompleteTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_Notify_Delivery_Complete) {
|
if (it is DanaRSPacketNotifyDeliveryComplete) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
it.rxBus = rxBus
|
it.rxBus = rxBus
|
||||||
it.resourceHelper = resourceHelper
|
it.resourceHelper = resourceHelper
|
||||||
|
@ -38,9 +38,9 @@ class DanaRSPacketNotifyDeliveryCompleteTest : DanaRSTestBase() {
|
||||||
`when`(resourceHelper.gs(anyInt(), anyDouble())).thenReturn("SomeString")
|
`when`(resourceHelper.gs(anyInt(), anyDouble())).thenReturn("SomeString")
|
||||||
|
|
||||||
danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true)
|
danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true)
|
||||||
val packet = DanaRS_Packet_Notify_Delivery_Complete(packetInjector)
|
val packet = DanaRSPacketNotifyDeliveryComplete(packetInjector)
|
||||||
// test params
|
// test params
|
||||||
Assert.assertEquals(null, packet.requestParams)
|
Assert.assertEquals(0, packet.getRequestParams().size)
|
||||||
// test message decoding
|
// test message decoding
|
||||||
packet.handleMessage(createArray(17, 0.toByte()))
|
packet.handleMessage(createArray(17, 0.toByte()))
|
||||||
Assert.assertEquals(true, danaPump.bolusDone)
|
Assert.assertEquals(true, danaPump.bolusDone)
|
||||||
|
|
|
@ -13,7 +13,7 @@ class DanaRSPacketOptionSetUserOptionTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_Option_Set_User_Option) {
|
if (it is DanaRSPacketOptionSetUserOption) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
it.danaPump = danaPump
|
it.danaPump = danaPump
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ class DanaRSPacketOptionSetUserOptionTest : DanaRSTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
val packet = DanaRS_Packet_Option_Set_User_Option(packetInjector)
|
val packet = DanaRSPacketOptionSetUserOption(packetInjector)
|
||||||
// test params
|
// test params
|
||||||
val params = packet.requestParams
|
val params = packet.getRequestParams()
|
||||||
Assert.assertEquals((danaPump.lcdOnTimeSec and 0xff).toByte(), params[3])
|
Assert.assertEquals((danaPump.lcdOnTimeSec and 0xff).toByte(), params[3])
|
||||||
// test message decoding
|
// test message decoding
|
||||||
packet.handleMessage(createArray(3, 0.toByte()))
|
packet.handleMessage(createArray(3, 0.toByte()))
|
||||||
|
|
|
@ -26,17 +26,17 @@ class DanaRsMessageHashTableTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet) {
|
if (it is DanaRSPacket) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
it.dateUtil = dateUtil
|
it.dateUtil = dateUtil
|
||||||
}
|
}
|
||||||
if (it is DanaRS_Packet_Bolus_Set_Step_Bolus_Start) {
|
if (it is DanaRSPacketBolusSetStepBolusStart) {
|
||||||
it.constraintChecker = constraintChecker
|
it.constraintChecker = constraintChecker
|
||||||
}
|
}
|
||||||
if (it is DanaRS_Packet_Bolus_Set_Step_Bolus_Start) {
|
if (it is DanaRSPacketBolusSetStepBolusStart) {
|
||||||
it.danaPump = danaPump
|
it.danaPump = danaPump
|
||||||
}
|
}
|
||||||
if (it is DanaRS_Packet_APS_History_Events) {
|
if (it is DanaRSPacketAPSHistoryEvents) {
|
||||||
it.danaPump = danaPump
|
it.danaPump = danaPump
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ class DanaRsMessageHashTableTest : DanaRSTestBase() {
|
||||||
`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
|
`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
|
||||||
|
|
||||||
val danaRSMessageHashTable = DanaRSMessageHashTable(packetInjector)
|
val danaRSMessageHashTable = DanaRSMessageHashTable(packetInjector)
|
||||||
val forTesting: DanaRS_Packet = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, 0, 0, 0)
|
val forTesting: DanaRSPacket = DanaRSPacketAPSSetEventHistory(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, 0, 0, 0)
|
||||||
val testPacket: DanaRS_Packet = danaRSMessageHashTable.findMessage(forTesting.command)
|
val testPacket: DanaRSPacket = danaRSMessageHashTable.findMessage(forTesting.command)
|
||||||
Assert.assertEquals(BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY.toLong(), testPacket.opCode.toLong())
|
Assert.assertEquals(BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY.toLong(), testPacket.opCode.toLong())
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ class DanaRsPacketApsBasalSetTemporaryBasalTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_APS_Basal_Set_Temporary_Basal) {
|
if (it is DanaRSPacketAPSBasalSetTemporaryBasal) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,32 +23,32 @@ class DanaRsPacketApsBasalSetTemporaryBasalTest : DanaRSTestBase() {
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
|
|
||||||
// under 100% should last 30 min
|
// under 100% should last 30 min
|
||||||
var packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 0)
|
var packet = DanaRSPacketAPSBasalSetTemporaryBasal(packetInjector, 0)
|
||||||
Assert.assertEquals(0, packet.temporaryBasalRatio)
|
Assert.assertEquals(0, packet.temporaryBasalRatio)
|
||||||
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration)
|
Assert.assertEquals(DanaRSPacketAPSBasalSetTemporaryBasal.PARAM30MIN, packet.temporaryBasalDuration)
|
||||||
//constructor with param
|
//constructor with param
|
||||||
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 10)
|
packet = DanaRSPacketAPSBasalSetTemporaryBasal(packetInjector, 10)
|
||||||
Assert.assertEquals(10, packet.temporaryBasalRatio)
|
Assert.assertEquals(10, packet.temporaryBasalRatio)
|
||||||
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration)
|
Assert.assertEquals(DanaRSPacketAPSBasalSetTemporaryBasal.PARAM30MIN, packet.temporaryBasalDuration)
|
||||||
// over 100% should last 15 min
|
// over 100% should last 15 min
|
||||||
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 150)
|
packet = DanaRSPacketAPSBasalSetTemporaryBasal(packetInjector, 150)
|
||||||
Assert.assertEquals(150, packet.temporaryBasalRatio)
|
Assert.assertEquals(150, packet.temporaryBasalRatio)
|
||||||
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM15MIN, packet.temporaryBasalDuration)
|
Assert.assertEquals(DanaRSPacketAPSBasalSetTemporaryBasal.PARAM15MIN, packet.temporaryBasalDuration)
|
||||||
// test low hard limit
|
// test low hard limit
|
||||||
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, -1)
|
packet = DanaRSPacketAPSBasalSetTemporaryBasal(packetInjector, -1)
|
||||||
Assert.assertEquals(0, packet.temporaryBasalRatio)
|
Assert.assertEquals(0, packet.temporaryBasalRatio)
|
||||||
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration)
|
Assert.assertEquals(DanaRSPacketAPSBasalSetTemporaryBasal.PARAM30MIN, packet.temporaryBasalDuration)
|
||||||
// test high hard limit
|
// test high hard limit
|
||||||
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 550)
|
packet = DanaRSPacketAPSBasalSetTemporaryBasal(packetInjector, 550)
|
||||||
Assert.assertEquals(500, packet.temporaryBasalRatio)
|
Assert.assertEquals(500, packet.temporaryBasalRatio)
|
||||||
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM15MIN, packet.temporaryBasalDuration)
|
Assert.assertEquals(DanaRSPacketAPSBasalSetTemporaryBasal.PARAM15MIN, packet.temporaryBasalDuration)
|
||||||
// test message generation
|
// test message generation
|
||||||
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 260)
|
packet = DanaRSPacketAPSBasalSetTemporaryBasal(packetInjector, 260)
|
||||||
val generatedCode = packet.requestParams
|
val generatedCode = packet.getRequestParams()
|
||||||
Assert.assertEquals(3, generatedCode.size.toLong())
|
Assert.assertEquals(3, generatedCode.size.toLong())
|
||||||
Assert.assertEquals(4.toByte(), generatedCode[0])
|
Assert.assertEquals(4.toByte(), generatedCode[0])
|
||||||
Assert.assertEquals(1.toByte(), generatedCode[1])
|
Assert.assertEquals(1.toByte(), generatedCode[1])
|
||||||
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM15MIN.toUByte(), generatedCode[2].toUByte())
|
Assert.assertEquals(DanaRSPacketAPSBasalSetTemporaryBasal.PARAM15MIN.toUByte(), generatedCode[2].toUByte())
|
||||||
// test message decoding
|
// test message decoding
|
||||||
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
|
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
|
||||||
Assert.assertEquals(false, packet.failed)
|
Assert.assertEquals(false, packet.failed)
|
||||||
|
|
|
@ -30,11 +30,11 @@ class DanaRsPacketApsHistoryEventsTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet) {
|
if (it is DanaRSPacket) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
it.dateUtil = dateUtil
|
it.dateUtil = dateUtil
|
||||||
}
|
}
|
||||||
if (it is DanaRS_Packet_APS_History_Events) {
|
if (it is DanaRSPacketAPSHistoryEvents) {
|
||||||
it.rxBus = rxBus
|
it.rxBus = rxBus
|
||||||
it.resourceHelper = resourceHelper
|
it.resourceHelper = resourceHelper
|
||||||
it.pumpSync = pumpSync
|
it.pumpSync = pumpSync
|
||||||
|
@ -49,9 +49,9 @@ class DanaRsPacketApsHistoryEventsTest : DanaRSTestBase() {
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
val now = dateUtil.now()
|
val now = dateUtil.now()
|
||||||
|
|
||||||
val testPacket = DanaRS_Packet_APS_History_Events(packetInjector, now)
|
val testPacket = DanaRSPacketAPSHistoryEvents(packetInjector, now)
|
||||||
// test getRequestedParams
|
// test getRequestedParams
|
||||||
val returnedValues = testPacket.requestParams
|
val returnedValues = testPacket.getRequestParams()
|
||||||
val expectedValues = getCalender(now)
|
val expectedValues = getCalender(now)
|
||||||
//year
|
//year
|
||||||
Assert.assertEquals(expectedValues[0], returnedValues[0])
|
Assert.assertEquals(expectedValues[0], returnedValues[0])
|
||||||
|
|
|
@ -13,11 +13,11 @@ class DanaRsPacketApsSetEventHistoryTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet) {
|
if (it is DanaRSPacket) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
it.dateUtil = dateUtil
|
it.dateUtil = dateUtil
|
||||||
}
|
}
|
||||||
if (it is DanaRS_Packet_APS_Set_Event_History) {
|
if (it is DanaRSPacketAPSSetEventHistory) {
|
||||||
it.danaPump = danaPump
|
it.danaPump = danaPump
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,20 +25,20 @@ class DanaRsPacketApsSetEventHistoryTest : DanaRSTestBase() {
|
||||||
|
|
||||||
@Test fun runTest() { // test for negative carbs
|
@Test fun runTest() { // test for negative carbs
|
||||||
val now = dateUtil.now()
|
val now = dateUtil.now()
|
||||||
var historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, -1, 0)
|
var historyTest = DanaRSPacketAPSSetEventHistory(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, -1, 0)
|
||||||
var testParams = historyTest.requestParams
|
var testParams = historyTest.getRequestParams()
|
||||||
Assert.assertEquals(0.toByte(), testParams[8])
|
Assert.assertEquals(0.toByte(), testParams[8])
|
||||||
// 5g carbs
|
// 5g carbs
|
||||||
historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 5, 0)
|
historyTest = DanaRSPacketAPSSetEventHistory(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 5, 0)
|
||||||
testParams = historyTest.requestParams
|
testParams = historyTest.getRequestParams()
|
||||||
Assert.assertEquals(5.toByte(), testParams[8])
|
Assert.assertEquals(5.toByte(), testParams[8])
|
||||||
// 150g carbs
|
// 150g carbs
|
||||||
historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 150, 0)
|
historyTest = DanaRSPacketAPSSetEventHistory(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 150, 0)
|
||||||
testParams = historyTest.requestParams
|
testParams = historyTest.getRequestParams()
|
||||||
Assert.assertEquals(150.toByte(), testParams[8])
|
Assert.assertEquals(150.toByte(), testParams[8])
|
||||||
// test message generation
|
// test message generation
|
||||||
historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 5, 0)
|
historyTest = DanaRSPacketAPSSetEventHistory(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 5, 0)
|
||||||
testParams = historyTest.requestParams
|
testParams = historyTest.getRequestParams()
|
||||||
Assert.assertEquals(5.toByte(), testParams[8])
|
Assert.assertEquals(5.toByte(), testParams[8])
|
||||||
Assert.assertEquals(11, testParams.size)
|
Assert.assertEquals(11, testParams.size)
|
||||||
Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.CARBS.toByte(), testParams[0])
|
Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.CARBS.toByte(), testParams[0])
|
||||||
|
|
|
@ -16,7 +16,7 @@ class DanaRsPacketBasalGetBasalRateTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_Basal_Get_Basal_Rate) {
|
if (it is DanaRSPacketBasalGetBasalRate) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
it.rxBus = rxBus
|
it.rxBus = rxBus
|
||||||
it.resourceHelper = resourceHelper
|
it.resourceHelper = resourceHelper
|
||||||
|
@ -26,7 +26,7 @@ class DanaRsPacketBasalGetBasalRateTest : DanaRSTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
val packet = DanaRS_Packet_Basal_Get_Basal_Rate(packetInjector)
|
val packet = DanaRSPacketBasalGetBasalRate(packetInjector)
|
||||||
// test message decoding
|
// test message decoding
|
||||||
// rate is 0.01
|
// rate is 0.01
|
||||||
val array = ByteArray(100)
|
val array = ByteArray(100)
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.AndroidInjector
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.danars.DanaRSTestBase
|
|
||||||
import org.junit.Assert.assertEquals
|
|
||||||
import org.junit.Test
|
|
||||||
import org.junit.runner.RunWith
|
|
||||||
import org.powermock.modules.junit4.PowerMockRunner
|
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
|
||||||
class DanaRsPacketBasalGetProfileBasalRateTest : DanaRSTestBase() {
|
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
|
||||||
AndroidInjector {
|
|
||||||
if (it is DanaRS_Packet_Basal_Get_Profile_Basal_Rate) {
|
|
||||||
it.aapsLogger = aapsLogger
|
|
||||||
it.danaPump = danaPump
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test fun runTest() {
|
|
||||||
val testPacket = DanaRS_Packet_Basal_Get_Profile_Basal_Rate(packetInjector, 1)
|
|
||||||
// test if pumpProfile array is set right
|
|
||||||
val basal01 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet(packetInjector).getBytes(createArray(50, 1.toByte()), 2, 2)) / 100.0
|
|
||||||
val basal05 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet(packetInjector).getBytes(createArray(50, 5.toByte()), 2, 2)) / 100.0
|
|
||||||
val basal12 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet(packetInjector).getBytes(createArray(50, 12.toByte()), 2, 2)) / 100.0
|
|
||||||
// basal rate > 1U/hr
|
|
||||||
val basal120 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet(packetInjector).getBytes(createArray(50, 120.toByte()), 2, 2)) / 100.0
|
|
||||||
val params = testPacket.requestParams
|
|
||||||
assertEquals(1.toByte(), params[0])
|
|
||||||
testPacket.handleMessage(createArray(50, 0.toByte()))
|
|
||||||
assertEquals(0.0, danaPump.pumpProfiles!![1][1], 0.0)
|
|
||||||
testPacket.handleMessage(createArray(50, 1.toByte()))
|
|
||||||
assertEquals(basal01, danaPump.pumpProfiles!![1][2], 0.0)
|
|
||||||
testPacket.handleMessage(createArray(50, 5.toByte()))
|
|
||||||
assertEquals(basal05, danaPump.pumpProfiles!![1][1], 0.0)
|
|
||||||
testPacket.handleMessage(createArray(50, 12.toByte()))
|
|
||||||
assertEquals(basal12, danaPump.pumpProfiles!![1][1], 0.0)
|
|
||||||
testPacket.handleMessage(createArray(50, 120.toByte()))
|
|
||||||
assertEquals(basal120, danaPump.pumpProfiles!![1][1], 0.0)
|
|
||||||
assertEquals("BASAL__GET_PROFILE_BASAL_RATE", testPacket.friendlyName)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,7 +13,7 @@ class DanaRsPacketBasalGetProfileNumberTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_Basal_Get_Profile_Number) {
|
if (it is DanaRSPacketBasalGetProfileNumber) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
it.danaPump = danaPump
|
it.danaPump = danaPump
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class DanaRsPacketBasalGetProfileNumberTest : DanaRSTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
val packet = DanaRS_Packet_Basal_Get_Profile_Number(packetInjector)
|
val packet = DanaRSPacketBasalGetProfileNumber(packetInjector)
|
||||||
|
|
||||||
val array = ByteArray(100)
|
val array = ByteArray(100)
|
||||||
putByteToArray(array, 0, 1.toByte())
|
putByteToArray(array, 0, 1.toByte())
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.AndroidInjector
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.danars.DanaRSTestBase
|
|
||||||
import org.junit.Assert
|
|
||||||
import org.junit.Test
|
|
||||||
import org.junit.runner.RunWith
|
|
||||||
import org.powermock.modules.junit4.PowerMockRunner
|
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
|
||||||
class DanaRsPacketBasalGetTemporaryBasalStateTest : DanaRSTestBase() {
|
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
|
||||||
AndroidInjector {
|
|
||||||
if (it is DanaRS_Packet) {
|
|
||||||
it.aapsLogger = aapsLogger
|
|
||||||
it.dateUtil = dateUtil
|
|
||||||
}
|
|
||||||
if (it is DanaRS_Packet_Basal_Get_Temporary_Basal_State) {
|
|
||||||
it.danaPump = danaPump
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test fun runTest() {
|
|
||||||
val packet = DanaRS_Packet_Basal_Get_Temporary_Basal_State(packetInjector)
|
|
||||||
// test message decoding
|
|
||||||
val array = ByteArray(100)
|
|
||||||
putByteToArray(array, 0, 1.toByte())
|
|
||||||
putByteToArray(array, 1, 1.toByte())
|
|
||||||
putByteToArray(array, 2, 230.toByte())
|
|
||||||
putByteToArray(array, 3, 150.toByte())
|
|
||||||
putIntToArray(array, 4, 1)
|
|
||||||
packet.handleMessage(array)
|
|
||||||
Assert.assertTrue(packet.failed)
|
|
||||||
Assert.assertTrue(packet.isTempBasalInProgress)
|
|
||||||
Assert.assertEquals(300, packet.tempBasalPercent)
|
|
||||||
Assert.assertEquals(15 * 60, packet.tempBasalTotalSec)
|
|
||||||
Assert.assertEquals("BASAL__TEMPORARY_BASAL_STATE", packet.friendlyName)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
package info.nightscout.androidaps.danars.comm
|
|
||||||
|
|
||||||
import dagger.android.AndroidInjector
|
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.danars.DanaRSTestBase
|
|
||||||
import org.junit.Assert
|
|
||||||
import org.junit.Test
|
|
||||||
import org.junit.runner.RunWith
|
|
||||||
import org.powermock.modules.junit4.PowerMockRunner
|
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
|
||||||
class DanaRsPacketBasalSetBasalRateTest : DanaRSTestBase() {
|
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
|
||||||
AndroidInjector {
|
|
||||||
if (it is DanaRS_Packet_Basal_Set_Basal_Rate) {
|
|
||||||
it.aapsLogger = aapsLogger
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test fun runTest() {
|
|
||||||
// test message decoding
|
|
||||||
val packet = DanaRS_Packet_Basal_Set_Basal_Rate(packetInjector, createArray(24, 5.0))
|
|
||||||
val requested = packet.requestParams
|
|
||||||
var lookingFor = (5 * 100 and 0xff).toByte()
|
|
||||||
Assert.assertEquals(lookingFor, requested[24])
|
|
||||||
lookingFor = (500 ushr 8 and 0xff).toByte()
|
|
||||||
Assert.assertEquals(lookingFor, requested[25])
|
|
||||||
packet.handleMessage(createArray(3, 0.toByte()))
|
|
||||||
Assert.assertEquals(false, packet.failed)
|
|
||||||
packet.handleMessage(createArray(3, 1.toByte()))
|
|
||||||
Assert.assertEquals(true, packet.failed)
|
|
||||||
Assert.assertEquals("BASAL__SET_BASAL_RATE", packet.friendlyName)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,14 +13,14 @@ class DanaRsPacketBasalSetCancelTemporaryBasalTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal) {
|
if (it is DanaRSPacketBasalSetCancelTemporaryBasal) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
val packet = DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(packetInjector)
|
val packet = DanaRSPacketBasalSetCancelTemporaryBasal(packetInjector)
|
||||||
// test message decoding
|
// test message decoding
|
||||||
packet.handleMessage(createArray(3, 0.toByte()))
|
packet.handleMessage(createArray(3, 0.toByte()))
|
||||||
Assert.assertEquals(false, packet.failed)
|
Assert.assertEquals(false, packet.failed)
|
||||||
|
|
|
@ -13,16 +13,16 @@ class DanaRsPacketBasalSetProfileBasalRateTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_Basal_Set_Profile_Basal_Rate) {
|
if (it is DanaRSPacketBasalSetProfileBasalRate) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
val packet = DanaRS_Packet_Basal_Set_Profile_Basal_Rate(packetInjector, 1, createArray(24, 1.0))
|
val packet = DanaRSPacketBasalSetProfileBasalRate(packetInjector, 1, createArray(24, 1.0))
|
||||||
// test params
|
// test params
|
||||||
val testParams = packet.requestParams
|
val testParams = packet.getRequestParams()
|
||||||
// is profile 1
|
// is profile 1
|
||||||
Assert.assertEquals(1.toByte(), testParams[0])
|
Assert.assertEquals(1.toByte(), testParams[0])
|
||||||
// is value 100
|
// is value 100
|
||||||
|
|
|
@ -13,16 +13,16 @@ class DanaRsPacketBasalSetProfileNumberTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_Basal_Set_Profile_Number) {
|
if (it is DanaRSPacketBasalSetProfileNumber) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
val packet = DanaRS_Packet_Basal_Set_Profile_Number(packetInjector, 1)
|
val packet = DanaRSPacketBasalSetProfileNumber(packetInjector, 1)
|
||||||
// test params
|
// test params
|
||||||
val testParams = packet.requestParams
|
val testParams = packet.getRequestParams()
|
||||||
// is profile 1
|
// is profile 1
|
||||||
Assert.assertEquals(1.toByte(), testParams[0])
|
Assert.assertEquals(1.toByte(), testParams[0])
|
||||||
// test message decoding
|
// test message decoding
|
||||||
|
|
|
@ -13,14 +13,14 @@ class DanaRsPacketBasalSetSuspendOffTest : DanaRSTestBase() {
|
||||||
|
|
||||||
private val packetInjector = HasAndroidInjector {
|
private val packetInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
if (it is DanaRS_Packet_Basal_Set_Suspend_Off) {
|
if (it is DanaRSPacketBasalSetSuspendOff) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
@Test fun runTest() {
|
||||||
val packet = DanaRS_Packet_Basal_Set_Suspend_Off(packetInjector)
|
val packet = DanaRSPacketBasalSetSuspendOff(packetInjector)
|
||||||
// test message decoding
|
// test message decoding
|
||||||
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
|
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
|
||||||
Assert.assertEquals(false, packet.failed)
|
Assert.assertEquals(false, packet.failed)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue