-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3242 from nightscout/dev32
3.2.0.4
- Loading branch information
Showing
23 changed files
with
67 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/enums/ModelType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package info.nightscout.pump.medtrum.comm.enums | ||
|
||
enum class ModelType(val value: Int) { | ||
INVALID(-1), | ||
MD0201(80), | ||
MD5201(81), | ||
MD0202(82), | ||
MD5202(83), | ||
MD8201(88), | ||
MD8301(98); | ||
|
||
companion object { | ||
fun fromValue(value: Int): ModelType { | ||
return values().find { it.value == value } ?: INVALID | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 10 additions & 20 deletions
30
pump/medtrum/src/main/java/info/nightscout/pump/medtrum/util/MedtrumSnUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,23 @@ | ||
package info.nightscout.pump.medtrum.util | ||
|
||
import info.nightscout.pump.medtrum.comm.enums.ModelType | ||
import info.nightscout.pump.medtrum.encryption.Crypt | ||
|
||
class MedtrumSnUtil { | ||
|
||
companion object { | ||
|
||
const val INVALID = -1 | ||
const val MD_0201 = 80 | ||
const val MD_5201 = 81 | ||
const val MD_0202 = 82 | ||
const val MD_5202 = 83 | ||
const val MD_8201 = 88 | ||
const val MD_8301 = 98 | ||
} | ||
|
||
fun getDeviceTypeFromSerial(serial: Long): Int { | ||
fun getDeviceTypeFromSerial(serial: Long): ModelType { | ||
if (serial in 106000000..106999999) { | ||
return INVALID | ||
return ModelType.INVALID | ||
} | ||
|
||
return when (Crypt().simpleDecrypt(serial)) { | ||
in 126000000..126999999 -> MD_0201 | ||
in 127000000..127999999 -> MD_5201 | ||
in 128000000..128999999 -> MD_8201 | ||
in 130000000..130999999 -> MD_0202 | ||
in 131000000..131999999 -> MD_5202 | ||
in 148000000..148999999 -> MD_8301 | ||
else -> INVALID | ||
in 126000000..126999999 -> ModelType.MD0201 | ||
in 127000000..127999999 -> ModelType.MD5201 | ||
in 128000000..128999999 -> ModelType.MD8201 | ||
in 130000000..130999999 -> ModelType.MD0202 | ||
in 131000000..131999999 -> ModelType.MD5202 | ||
in 148000000..148999999 -> ModelType.MD8301 | ||
else -> ModelType.INVALID | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.