commit
420fe12ef3
|
@ -10,6 +10,9 @@ buildscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apply plugin: "com.android.application"
|
apply plugin: "com.android.application"
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
apply plugin: "io.fabric"
|
apply plugin: "io.fabric"
|
||||||
apply plugin: "jacoco-android"
|
apply plugin: "jacoco-android"
|
||||||
apply plugin: 'com.jakewharton.butterknife'
|
apply plugin: 'com.jakewharton.butterknife'
|
||||||
|
@ -26,6 +29,7 @@ ext {
|
||||||
repositories {
|
repositories {
|
||||||
maven { url 'https://maven.fabric.io/public' }
|
maven { url 'https://maven.fabric.io/public' }
|
||||||
jcenter { url "https://jcenter.bintray.com/" }
|
jcenter { url "https://jcenter.bintray.com/" }
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
def generateGitBuild = { ->
|
def generateGitBuild = { ->
|
||||||
|
@ -44,6 +48,22 @@ def generateGitBuild = { ->
|
||||||
return stringBuilder.toString()
|
return stringBuilder.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def generateGitRemote = { ->
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
try {
|
||||||
|
def stdout = new ByteArrayOutputStream()
|
||||||
|
exec {
|
||||||
|
commandLine 'git', 'remote', 'get-url', 'origin'
|
||||||
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
String commitObject = stdout.toString().trim()
|
||||||
|
stringBuilder.append(commitObject)
|
||||||
|
} catch (ignored) {
|
||||||
|
stringBuilder.append('NoGitSystemAvailable')
|
||||||
|
}
|
||||||
|
return stringBuilder.toString()
|
||||||
|
}
|
||||||
|
|
||||||
def generateDate = { ->
|
def generateDate = { ->
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
stringBuilder.append((new Date()).format('yyyy.MM.dd-HH:mm'))
|
stringBuilder.append((new Date()).format('yyyy.MM.dd-HH:mm'))
|
||||||
|
@ -63,9 +83,10 @@ android {
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
versionCode 1500
|
versionCode 1500
|
||||||
version "2.2.2"
|
version "2.3"
|
||||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||||
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
||||||
|
buildConfigField "String", "REMOTE", '"' + generateGitRemote()+ '"'
|
||||||
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
|
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
// if you change minSdkVersion to less than 11, you need to change executeTask for wear
|
// if you change minSdkVersion to less than 11, you need to change executeTask for wear
|
||||||
|
@ -74,6 +95,9 @@ android {
|
||||||
moduleName "BleCommandUtil"
|
moduleName "BleCommandUtil"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '1.8'
|
||||||
|
}
|
||||||
lintOptions {
|
lintOptions {
|
||||||
// TODO remove once wear dependency com.google.android.gms:play-services-wearable:7.3.0
|
// TODO remove once wear dependency com.google.android.gms:play-services-wearable:7.3.0
|
||||||
// has been upgraded (requiring significant code changes), which currently fails release
|
// has been upgraded (requiring significant code changes), which currently fails release
|
||||||
|
@ -167,12 +191,11 @@ dependencies {
|
||||||
wearApp project(':wear')
|
wearApp project(':wear')
|
||||||
|
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
implementation 'com.google.android.gms:play-services-wearable:16.0.1'
|
||||||
|
implementation 'com.google.firebase:firebase-core:16.0.8'
|
||||||
implementation("com.crashlytics.sdk.android:crashlytics:2.9.9@aar") {
|
implementation("com.crashlytics.sdk.android:crashlytics:2.9.9@aar") {
|
||||||
transitive = true;
|
transitive = true;
|
||||||
}
|
}
|
||||||
implementation("com.crashlytics.sdk.android:answers:1.4.7@aar") {
|
|
||||||
transitive = true;
|
|
||||||
}
|
|
||||||
libs "MilosKozak:danars-support-lib:master@zip"
|
libs "MilosKozak:danars-support-lib:master@zip"
|
||||||
|
|
||||||
implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
|
implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
|
||||||
|
@ -192,11 +215,11 @@ dependencies {
|
||||||
}
|
}
|
||||||
implementation "org.apache.commons:commons-lang3:3.7"
|
implementation "org.apache.commons:commons-lang3:3.7"
|
||||||
implementation "org.slf4j:slf4j-api:1.7.21"
|
implementation "org.slf4j:slf4j-api:1.7.21"
|
||||||
|
// Graphview cannot be upgraded
|
||||||
implementation "com.jjoe64:graphview:4.0.1"
|
implementation "com.jjoe64:graphview:4.0.1"
|
||||||
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
|
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
|
||||||
implementation 'com.google.android.gms:play-services-wearable:10.2.1'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||||
implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
|
implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
|
||||||
implementation(name: "sightparser-release", ext: "aar")
|
|
||||||
implementation 'com.madgag.spongycastle:core:1.58.0.0'
|
implementation 'com.madgag.spongycastle:core:1.58.0.0'
|
||||||
|
|
||||||
implementation("com.google.android:flexbox:0.3.0") {
|
implementation("com.google.android:flexbox:0.3.0") {
|
||||||
|
@ -232,6 +255,7 @@ dependencies {
|
||||||
androidTestImplementation "org.mockito:mockito-core:2.8.47"
|
androidTestImplementation "org.mockito:mockito-core:2.8.47"
|
||||||
androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}"
|
androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}"
|
||||||
androidTestImplementation "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
|
androidTestImplementation "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
task unzip(type: Copy) {
|
task unzip(type: Copy) {
|
||||||
|
|
107
app/google-services.json
Normal file
107
app/google-services.json
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "477603612366",
|
||||||
|
"firebase_url": "https://androidaps-c34f8.firebaseio.com",
|
||||||
|
"project_id": "androidaps-c34f8",
|
||||||
|
"storage_bucket": "androidaps-c34f8.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:477603612366:android:aef229914e3e5448",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "info.nightscout.aapspumpcontrol"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDcZpDRMaGjdhihXp531cVYM6LkEL8KbgM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:477603612366:android:efc956f55b281623",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "info.nightscout.androidaps"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDcZpDRMaGjdhihXp531cVYM6LkEL8KbgM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:477603612366:android:b38d6e7351f73cc0",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "info.nightscout.nsclient"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDcZpDRMaGjdhihXp531cVYM6LkEL8KbgM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:477603612366:android:2dc8cf3acd3332e7",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "info.nightscout.nsclient2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDcZpDRMaGjdhihXp531cVYM6LkEL8KbgM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
Binary file not shown.
|
@ -38,6 +38,7 @@
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.gms.car.application"
|
android:name="com.google.android.gms.car.application"
|
||||||
android:resource="@xml/automotive_app_desc" />
|
android:resource="@xml/automotive_app_desc" />
|
||||||
|
|
||||||
<activity android:name=".MainActivity">
|
<activity android:name=".MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -46,10 +47,10 @@
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".activities.PreferencesActivity" />
|
<activity android:name=".activities.PreferencesActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".plugins.general.overview.Dialogs.BolusProgressHelperActivity"
|
android:name=".plugins.general.overview.dialogs.BolusProgressHelperActivity"
|
||||||
android:theme="@style/Theme.AppCompat.Translucent" />
|
android:theme="@style/Theme.AppCompat.Translucent" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".plugins.general.overview.Dialogs.ErrorHelperActivity"
|
android:name=".plugins.general.overview.dialogs.ErrorHelperActivity"
|
||||||
android:theme="@style/Theme.AppCompat.Translucent" />
|
android:theme="@style/Theme.AppCompat.Translucent" />
|
||||||
<activity android:name=".activities.AgreementActivity" />
|
<activity android:name=".activities.AgreementActivity" />
|
||||||
<activity android:name=".plugins.pump.danaR.activities.DanaRHistoryActivity" />
|
<activity android:name=".plugins.pump.danaR.activities.DanaRHistoryActivity" />
|
||||||
|
@ -72,30 +73,40 @@
|
||||||
<activity android:name=".plugins.pump.danaRS.activities.PairingHelperActivity" />
|
<activity android:name=".plugins.pump.danaRS.activities.PairingHelperActivity" />
|
||||||
<activity android:name=".activities.HistoryBrowseActivity" />
|
<activity android:name=".activities.HistoryBrowseActivity" />
|
||||||
|
|
||||||
|
<!-- Receive new BG readings from other local apps -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".receivers.DataReceiver"
|
android:name=".receivers.DataReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|
||||||
<!-- Receive new SMS messages -->
|
|
||||||
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
|
|
||||||
<!-- Receiver from xDrip -->
|
<!-- Receiver from xDrip -->
|
||||||
<action android:name="com.eveningoutpost.dexdrip.BgEstimate" />
|
<action android:name="com.eveningoutpost.dexdrip.BgEstimate"/>
|
||||||
<!-- Receiver from 640g uploader -->
|
<!-- Receiver from 640g uploader -->
|
||||||
<action android:name="com.eveningoutpost.dexdrip.NS_EMULATOR" />
|
<action android:name="com.eveningoutpost.dexdrip.NS_EMULATOR"/>
|
||||||
<!-- Receiver from glimp -->
|
<!-- Receiver from glimp -->
|
||||||
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED" />
|
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED"/>
|
||||||
<!-- Receiver from DexcomG5 -->
|
<!-- Receiver from DexcomG5 -->
|
||||||
<action android:name="com.dexcom.cgm.DATA" />
|
<action android:name="com.dexcom.cgm.DATA"/>
|
||||||
<action android:name="com.dexcom.cgm.AndroidAPSEVGCallback.BROADCAST" />
|
<action android:name="com.dexcom.cgm.AndroidAPSEVGCallback.BROADCAST"/>
|
||||||
<action android:name="com.dexcom.cgm.g5.AndroidAPSEVGCallback.BROADCAST" />
|
<action android:name="com.dexcom.cgm.g5.AndroidAPSEVGCallback.BROADCAST"/>
|
||||||
<!-- Receiver from Poctech -->
|
<!-- Receiver from Poctech -->
|
||||||
<action android:name="com.china.poctech.data" />
|
<action android:name="com.china.poctech.data"/>
|
||||||
<!-- Receiver from Tomato -->
|
<!-- Receiver from Tomato -->
|
||||||
<action android:name="com.fanqies.tomatofn.BgEstimate" />
|
<action android:name="com.fanqies.tomatofn.BgEstimate"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
<!-- Receive new SMS messages -->
|
||||||
|
<receiver
|
||||||
|
android:name=".receivers.SmsReceiver"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true"
|
||||||
|
android:permission="android.permission.BROADCAST_SMS">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
<!-- Receiver keepalive, scheduled every 30 min -->
|
<!-- Receiver keepalive, scheduled every 30 min -->
|
||||||
<receiver android:name=".receivers.KeepAliveReceiver" />
|
<receiver android:name=".receivers.KeepAliveReceiver" />
|
||||||
|
|
||||||
|
@ -175,57 +186,57 @@
|
||||||
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
|
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
|
||||||
|
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_data" />
|
android:pathPrefix="/nightscout_watch_data"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_data_resend" />
|
android:pathPrefix="/nightscout_watch_data_resend"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_cancel_bolus" />
|
android:pathPrefix="/nightscout_watch_cancel_bolus"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_confirmactionstring" />
|
android:pathPrefix="/nightscout_watch_confirmactionstring"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_initiateactionstring" />
|
android:pathPrefix="/nightscout_watch_initiateactionstring"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/openwearsettings" />
|
android:pathPrefix="/openwearsettings"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/sendstatustowear" />
|
android:pathPrefix="/sendstatustowear"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/sendpreferencestowear" />
|
android:pathPrefix="/sendpreferencestowear"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_basal" />
|
android:pathPrefix="/nightscout_watch_basal"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_bolusprogress" />
|
android:pathPrefix="/nightscout_watch_bolusprogress"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_actionconfirmationrequest" />
|
android:pathPrefix="/nightscout_watch_actionconfirmationrequest"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_changeconfirmationrequest" />
|
android:pathPrefix="/nightscout_watch_changeconfirmationrequest"
|
||||||
|
android:scheme="wear" />
|
||||||
<data
|
<data
|
||||||
android:scheme="wear"
|
|
||||||
android:host="*"
|
android:host="*"
|
||||||
android:pathPrefix="/nightscout_watch_cancelnotificationrequest" />
|
android:pathPrefix="/nightscout_watch_cancelnotificationrequest"
|
||||||
|
android:scheme="wear" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<service
|
<service
|
||||||
|
@ -257,19 +268,19 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.SingleFragmentActivity"
|
android:name=".activities.SingleFragmentActivity"
|
||||||
android:theme="@style/AppTheme" />
|
android:theme="@style/AppTheme" />
|
||||||
<activity android:name=".plugins.general.maintenance.activities.LogSettingActivity"></activity>
|
<activity android:name=".plugins.general.maintenance.activities.LogSettingActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".plugins.pump.insight.activities.InsightPairingActivity"
|
android:name=".plugins.pump.insight.activities.InsightPairingActivity"
|
||||||
android:theme="@style/AppTheme"
|
android:label="@string/insight_pairing"
|
||||||
android:label="@string/insight_pairing" />
|
android:theme="@style/AppTheme" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".plugins.pump.insight.activities.InsightAlertActivity"
|
android:name=".plugins.pump.insight.activities.InsightAlertActivity"
|
||||||
android:label="@string/pump_alert"
|
android:label="@string/pump_alert"
|
||||||
android:theme="@style/InsightAlertDialog" />
|
android:theme="@style/InsightAlertDialog" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".plugins.pump.insight.activities.InsightPairingInformationActivity"
|
android:name=".plugins.pump.insight.activities.InsightPairingInformationActivity"
|
||||||
android:theme="@style/AppTheme"
|
android:label="@string/pairing_information"
|
||||||
android:label="@string/pairing_information" />
|
android:theme="@style/AppTheme" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -48,17 +48,20 @@ import info.nightscout.androidaps.events.EventFeatureRunning;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerUtilsKt;
|
||||||
import info.nightscout.androidaps.setupwizard.SetupWizardActivity;
|
import info.nightscout.androidaps.setupwizard.SetupWizardActivity;
|
||||||
import info.nightscout.androidaps.tabs.TabPageAdapter;
|
import info.nightscout.androidaps.tabs.TabPageAdapter;
|
||||||
import info.nightscout.androidaps.utils.AndroidPermission;
|
import info.nightscout.androidaps.utils.AndroidPermission;
|
||||||
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
import info.nightscout.androidaps.utils.LocaleHelper;
|
import info.nightscout.androidaps.utils.LocaleHelper;
|
||||||
import info.nightscout.androidaps.utils.OKDialog;
|
import info.nightscout.androidaps.utils.OKDialog;
|
||||||
import info.nightscout.androidaps.utils.PasswordProtection;
|
import info.nightscout.androidaps.utils.PasswordProtection;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
import info.nightscout.androidaps.utils.VersionChecker;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||||
|
@ -114,7 +117,12 @@ public class MainActivity extends AppCompatActivity {
|
||||||
public void onPageScrollStateChanged(int state) {
|
public void onPageScrollStateChanged(int state) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
VersionChecker.check();
|
|
||||||
|
//Check here if loop plugin is disabled. Else check via constraints
|
||||||
|
if (!LoopPlugin.getPlugin().isEnabled(PluginType.LOOP))
|
||||||
|
VersionCheckerUtilsKt.triggerCheckVersion();
|
||||||
|
|
||||||
|
FabricPrivacy.setUserStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPluginPreferences(ViewPager viewPager) {
|
private void checkPluginPreferences(ViewPager viewPager) {
|
||||||
|
@ -170,7 +178,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
boolean keepScreenOn = SP.getBoolean(R.string.key_keep_screen_on, false);
|
boolean keepScreenOn = SP.getBoolean(R.string.key_keep_screen_on, false);
|
||||||
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||||
if (keepScreenOn) {
|
if (keepScreenOn) {
|
||||||
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "AAPS");
|
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "AndroidAPS:MainActivity_onEventPreferenceChange");
|
||||||
if (!mWakeLock.isHeld())
|
if (!mWakeLock.isHeld())
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import android.support.annotation.PluralsRes;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.crashlytics.android.answers.Answers;
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||||
import com.j256.ormlite.android.apptools.OpenHelperManager;
|
import com.j256.ormlite.android.apptools.OpenHelperManager;
|
||||||
import com.squareup.otto.Bus;
|
import com.squareup.otto.Bus;
|
||||||
import com.squareup.otto.LoggingBus;
|
import com.squareup.otto.LoggingBus;
|
||||||
|
@ -50,6 +50,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.receivers.DBAccessRec
|
||||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
|
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin;
|
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin;
|
||||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin;
|
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin;
|
||||||
|
@ -88,6 +89,8 @@ import info.nightscout.androidaps.services.Intents;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
import io.fabric.sdk.android.Fabric;
|
import io.fabric.sdk.android.Fabric;
|
||||||
|
|
||||||
|
import static info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerUtilsKt.triggerCheckVersion;
|
||||||
|
|
||||||
|
|
||||||
public class MainApp extends Application {
|
public class MainApp extends Application {
|
||||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||||
|
@ -97,6 +100,8 @@ public class MainApp extends Application {
|
||||||
private static MainApp sInstance;
|
private static MainApp sInstance;
|
||||||
public static Resources sResources;
|
public static Resources sResources;
|
||||||
|
|
||||||
|
private static FirebaseAnalytics mFirebaseAnalytics;
|
||||||
|
|
||||||
private static DatabaseHelper sDatabaseHelper = null;
|
private static DatabaseHelper sDatabaseHelper = null;
|
||||||
private static ConstraintChecker sConstraintsChecker = null;
|
private static ConstraintChecker sConstraintsChecker = null;
|
||||||
|
|
||||||
|
@ -117,23 +122,24 @@ public class MainApp extends Application {
|
||||||
log.debug("onCreate");
|
log.debug("onCreate");
|
||||||
sInstance = this;
|
sInstance = this;
|
||||||
sResources = getResources();
|
sResources = getResources();
|
||||||
sConstraintsChecker = new ConstraintChecker(this);
|
sConstraintsChecker = new ConstraintChecker();
|
||||||
sDatabaseHelper = OpenHelperManager.getHelper(sInstance, DatabaseHelper.class);
|
sDatabaseHelper = OpenHelperManager.getHelper(sInstance, DatabaseHelper.class);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (FabricPrivacy.fabricEnabled()) {
|
if (FabricPrivacy.fabricEnabled()) {
|
||||||
Fabric.with(this, new Crashlytics());
|
Fabric.with(this, new Crashlytics());
|
||||||
Fabric.with(this, new Answers());
|
|
||||||
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error with Fabric init! " + e);
|
log.error("Error with Fabric init! " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||||
|
|
||||||
JodaTimeAndroid.init(this);
|
JodaTimeAndroid.init(this);
|
||||||
|
|
||||||
log.info("Version: " + BuildConfig.VERSION_NAME);
|
log.info("Version: " + BuildConfig.VERSION_NAME);
|
||||||
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
|
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
|
||||||
|
log.info("Remote: " + BuildConfig.REMOTE);
|
||||||
|
|
||||||
String extFilesDir = LoggerUtils.getLogDirectory();
|
String extFilesDir = LoggerUtils.getLogDirectory();
|
||||||
File engineeringModeSemaphore = new File(extFilesDir, "engineering_mode");
|
File engineeringModeSemaphore = new File(extFilesDir, "engineering_mode");
|
||||||
|
@ -145,6 +151,9 @@ public class MainApp extends Application {
|
||||||
|
|
||||||
registerLocalBroadcastReceiver();
|
registerLocalBroadcastReceiver();
|
||||||
|
|
||||||
|
//trigger here to see the new version on app start after an update
|
||||||
|
triggerCheckVersion();
|
||||||
|
|
||||||
if (pluginsList == null) {
|
if (pluginsList == null) {
|
||||||
pluginsList = new ArrayList<>();
|
pluginsList = new ArrayList<>();
|
||||||
// Register all tabs in app here
|
// Register all tabs in app here
|
||||||
|
@ -176,6 +185,7 @@ public class MainApp extends Application {
|
||||||
if (Config.OTHERPROFILES) pluginsList.add(LocalProfilePlugin.getPlugin());
|
if (Config.OTHERPROFILES) pluginsList.add(LocalProfilePlugin.getPlugin());
|
||||||
pluginsList.add(TreatmentsPlugin.getPlugin());
|
pluginsList.add(TreatmentsPlugin.getPlugin());
|
||||||
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
||||||
|
if (Config.SAFETY) pluginsList.add(VersionCheckerPlugin.INSTANCE);
|
||||||
if (Config.SAFETY) pluginsList.add(StorageConstraintPlugin.getPlugin());
|
if (Config.SAFETY) pluginsList.add(StorageConstraintPlugin.getPlugin());
|
||||||
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
|
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
|
||||||
pluginsList.add(SourceXdripPlugin.getPlugin());
|
pluginsList.add(SourceXdripPlugin.getPlugin());
|
||||||
|
@ -307,6 +317,10 @@ public class MainApp extends Application {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FirebaseAnalytics getFirebaseAnalytics() {
|
||||||
|
return mFirebaseAnalytics;
|
||||||
|
}
|
||||||
|
|
||||||
public static ConstraintChecker getConstraintChecker() {
|
public static ConstraintChecker getConstraintChecker() {
|
||||||
return sConstraintsChecker;
|
return sConstraintsChecker;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package info.nightscout.androidaps.data;
|
package info.nightscout.androidaps.data;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
|
@ -15,13 +19,6 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
|
|
||||||
public class ConstraintChecker implements ConstraintsInterface {
|
public class ConstraintChecker implements ConstraintsInterface {
|
||||||
|
|
||||||
private MainApp mainApp;
|
|
||||||
|
|
||||||
public ConstraintChecker(MainApp mainApp) {
|
|
||||||
this.mainApp = mainApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Constraint<Boolean> isLoopInvokationAllowed() {
|
public Constraint<Boolean> isLoopInvokationAllowed() {
|
||||||
return isLoopInvocationAllowed(new Constraint<>(true));
|
return isLoopInvocationAllowed(new Constraint<>(true));
|
||||||
}
|
}
|
||||||
|
@ -79,9 +76,9 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isLoopInvocationAllowed(Constraint<Boolean> value) {
|
public Constraint<Boolean> isLoopInvocationAllowed(@NonNull Constraint<Boolean> value) {
|
||||||
|
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -91,9 +88,9 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
public Constraint<Boolean> isClosedLoopAllowed(@NonNull Constraint<Boolean> value) {
|
||||||
|
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -103,9 +100,9 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isAutosensModeEnabled(Constraint<Boolean> value) {
|
public Constraint<Boolean> isAutosensModeEnabled(@NonNull Constraint<Boolean> value) {
|
||||||
|
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -115,9 +112,9 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isAMAModeEnabled(Constraint<Boolean> value) {
|
public Constraint<Boolean> isAMAModeEnabled(@NonNull Constraint<Boolean> value) {
|
||||||
|
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -127,9 +124,9 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isSMBModeEnabled(Constraint<Boolean> value) {
|
public Constraint<Boolean> isSMBModeEnabled(@NonNull Constraint<Boolean> value) {
|
||||||
|
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -139,9 +136,9 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isUAMEnabled(Constraint<Boolean> value) {
|
public Constraint<Boolean> isUAMEnabled(@NonNull Constraint<Boolean> value) {
|
||||||
|
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -151,8 +148,8 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
public Constraint<Boolean> isAdvancedFilteringEnabled(@NonNull Constraint<Boolean> value) {
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -162,8 +159,8 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isSuperBolusEnabled(Constraint<Boolean> value) {
|
public Constraint<Boolean> isSuperBolusEnabled(@NonNull Constraint<Boolean> value) {
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -173,8 +170,8 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
public Constraint<Double> applyBasalConstraints(@NonNull Constraint<Double> absoluteRate, Profile profile) {
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -184,8 +181,8 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Integer> applyBasalPercentConstraints(Constraint<Integer> percentRate, Profile profile) {
|
public Constraint<Integer> applyBasalPercentConstraints(@NonNull Constraint<Integer> percentRate, Profile profile) {
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -195,8 +192,8 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Double> applyBolusConstraints(Constraint<Double> insulin) {
|
public Constraint<Double> applyBolusConstraints(@NonNull Constraint<Double> insulin) {
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -206,8 +203,8 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Double> applyExtendedBolusConstraints(Constraint<Double> insulin) {
|
public Constraint<Double> applyExtendedBolusConstraints(@NonNull Constraint<Double> insulin) {
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -217,8 +214,8 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Integer> applyCarbsConstraints(Constraint<Integer> carbs) {
|
public Constraint<Integer> applyCarbsConstraints(@NonNull Constraint<Integer> carbs) {
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
@ -228,8 +225,8 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Double> applyMaxIOBConstraints(Constraint<Double> maxIob) {
|
public Constraint<Double> applyMaxIOBConstraints(@NonNull Constraint<Double> maxIob) {
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
for (PluginBase p : constraintsPlugins) {
|
for (PluginBase p : constraintsPlugins) {
|
||||||
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
ConstraintsInterface constrain = (ConstraintsInterface) p;
|
||||||
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
|
|
@ -1,166 +0,0 @@
|
||||||
package info.nightscout.androidaps.data;
|
|
||||||
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
|
||||||
import info.nightscout.androidaps.R;
|
|
||||||
import info.nightscout.androidaps.db.BgReading;
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
|
||||||
import info.nightscout.androidaps.utils.Round;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mike on 04.01.2017.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class GlucoseStatus {
|
|
||||||
private static Logger log = LoggerFactory.getLogger(GlucoseStatus.class);
|
|
||||||
public double glucose = 0d;
|
|
||||||
public double delta = 0d;
|
|
||||||
public double avgdelta = 0d;
|
|
||||||
public double short_avgdelta = 0d;
|
|
||||||
public double long_avgdelta = 0d;
|
|
||||||
public long date = 0L;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return MainApp.gs(R.string.glucose) + " " + DecimalFormatter.to0Decimal(glucose) + " mg/dl\n" +
|
|
||||||
MainApp.gs(R.string.delta) + " " + DecimalFormatter.to0Decimal(delta) + " mg/dl\n" +
|
|
||||||
MainApp.gs(R.string.short_avgdelta) + " " + DecimalFormatter.to2Decimal(short_avgdelta) + " mg/dl\n" +
|
|
||||||
MainApp.gs(R.string.long_avgdelta) + " " + DecimalFormatter.to2Decimal(long_avgdelta) + " mg/dl";
|
|
||||||
}
|
|
||||||
|
|
||||||
public GlucoseStatus() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public GlucoseStatus round() {
|
|
||||||
this.glucose = Round.roundTo(this.glucose, 0.1);
|
|
||||||
this.delta = Round.roundTo(this.delta, 0.01);
|
|
||||||
this.avgdelta = Round.roundTo(this.avgdelta, 0.01);
|
|
||||||
this.short_avgdelta = Round.roundTo(this.short_avgdelta, 0.01);
|
|
||||||
this.long_avgdelta = Round.roundTo(this.long_avgdelta, 0.01);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static GlucoseStatus getGlucoseStatusData() {
|
|
||||||
return getGlucoseStatusData(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static GlucoseStatus getGlucoseStatusData(boolean allowOldData) {
|
|
||||||
// load 45min
|
|
||||||
//long fromtime = DateUtil.now() - 60 * 1000L * 45;
|
|
||||||
//List<BgReading> data = MainApp.getDbHelper().getBgreadingsDataFromTime(fromtime, false);
|
|
||||||
|
|
||||||
List<BgReading> data = IobCobCalculatorPlugin.getPlugin().getBgReadings();
|
|
||||||
|
|
||||||
if (data == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
int sizeRecords = data.size();
|
|
||||||
if (sizeRecords == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.get(0).date < DateUtil.now() - 7 * 60 * 1000L && !allowOldData) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
BgReading now = data.get(0);
|
|
||||||
long now_date = now.date;
|
|
||||||
double change;
|
|
||||||
|
|
||||||
if (sizeRecords == 1) {
|
|
||||||
GlucoseStatus status = new GlucoseStatus();
|
|
||||||
status.glucose = now.value;
|
|
||||||
status.short_avgdelta = 0d;
|
|
||||||
status.delta = 0d;
|
|
||||||
status.long_avgdelta = 0d;
|
|
||||||
status.avgdelta = 0d; // for OpenAPS MA
|
|
||||||
status.date = now_date;
|
|
||||||
return status.round();
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<Double> now_value_list = new ArrayList<Double>();
|
|
||||||
ArrayList<Double> last_deltas = new ArrayList<Double>();
|
|
||||||
ArrayList<Double> short_deltas = new ArrayList<Double>();
|
|
||||||
ArrayList<Double> long_deltas = new ArrayList<Double>();
|
|
||||||
|
|
||||||
// Use the latest sgv value in the now calculations
|
|
||||||
now_value_list.add(now.value);
|
|
||||||
|
|
||||||
for (int i = 1; i < sizeRecords; i++) {
|
|
||||||
if (data.get(i).value > 38) {
|
|
||||||
BgReading then = data.get(i);
|
|
||||||
long then_date = then.date;
|
|
||||||
double avgdelta = 0;
|
|
||||||
long minutesago;
|
|
||||||
|
|
||||||
minutesago = Math.round((now_date - then_date) / (1000d * 60));
|
|
||||||
// multiply by 5 to get the same units as delta, i.e. mg/dL/5m
|
|
||||||
change = now.value - then.value;
|
|
||||||
avgdelta = change / minutesago * 5;
|
|
||||||
|
|
||||||
// use the average of all data points in the last 2.5m for all further "now" calculations
|
|
||||||
if (0 < minutesago && minutesago < 2.5) {
|
|
||||||
// Keep and average all values within the last 2.5 minutes
|
|
||||||
now_value_list.add(then.value);
|
|
||||||
now.value = average(now_value_list);
|
|
||||||
// short_deltas are calculated from everything ~5-15 minutes ago
|
|
||||||
} else if (2.5 < minutesago && minutesago < 17.5) {
|
|
||||||
//console.error(minutesago, avgdelta);
|
|
||||||
short_deltas.add(avgdelta);
|
|
||||||
// last_deltas are calculated from everything ~5 minutes ago
|
|
||||||
if (2.5 < minutesago && minutesago < 7.5) {
|
|
||||||
last_deltas.add(avgdelta);
|
|
||||||
}
|
|
||||||
// long_deltas are calculated from everything ~20-40 minutes ago
|
|
||||||
} else if (17.5 < minutesago && minutesago < 42.5) {
|
|
||||||
long_deltas.add(avgdelta);
|
|
||||||
} else {
|
|
||||||
// Do not process any more records after >= 42.5 minutes
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GlucoseStatus status = new GlucoseStatus();
|
|
||||||
status.glucose = now.value;
|
|
||||||
status.date = now_date;
|
|
||||||
|
|
||||||
status.short_avgdelta = average(short_deltas);
|
|
||||||
|
|
||||||
if (last_deltas.isEmpty()) {
|
|
||||||
status.delta = status.short_avgdelta;
|
|
||||||
} else {
|
|
||||||
status.delta = average(last_deltas);
|
|
||||||
}
|
|
||||||
|
|
||||||
status.long_avgdelta = average(long_deltas);
|
|
||||||
status.avgdelta = status.short_avgdelta; // for OpenAPS MA
|
|
||||||
|
|
||||||
return status.round();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double average(ArrayList<Double> array) {
|
|
||||||
double sum = 0d;
|
|
||||||
|
|
||||||
if (array.size() == 0)
|
|
||||||
return 0d;
|
|
||||||
|
|
||||||
for (Double value : array) {
|
|
||||||
sum += value;
|
|
||||||
}
|
|
||||||
return sum / array.size();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,6 +12,7 @@ import info.nightscout.androidaps.db.BgReading;
|
||||||
import info.nightscout.androidaps.db.TempTarget;
|
import info.nightscout.androidaps.db.TempTarget;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
|
|
|
@ -35,7 +35,7 @@ import info.nightscout.androidaps.data.ProfileStore;
|
||||||
import info.nightscout.androidaps.events.EventCareportalEventChange;
|
import info.nightscout.androidaps.events.EventCareportalEventChange;
|
||||||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||||
import info.nightscout.androidaps.events.EventNewBG;
|
import info.nightscout.androidaps.events.EventNewBG;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||||
import info.nightscout.androidaps.events.EventReloadProfileSwitchData;
|
import info.nightscout.androidaps.events.EventReloadProfileSwitchData;
|
||||||
import info.nightscout.androidaps.events.EventReloadTempBasalData;
|
import info.nightscout.androidaps.events.EventReloadTempBasalData;
|
||||||
|
@ -45,9 +45,9 @@ import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.activities.DanaRNSHistorySync;
|
import info.nightscout.androidaps.plugins.pump.danaR.activities.DanaRNSHistorySync;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes;
|
import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.database.InsightBolusID;
|
import info.nightscout.androidaps.plugins.pump.insight.database.InsightBolusID;
|
||||||
|
@ -83,7 +83,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
public static final String DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs";
|
public static final String DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs";
|
||||||
public static final String DATABASE_INSIGHT_PUMP_IDS = "InsightPumpIDs";
|
public static final String DATABASE_INSIGHT_PUMP_IDS = "InsightPumpIDs";
|
||||||
|
|
||||||
private static final int DATABASE_VERSION = 10;
|
private static final int DATABASE_VERSION = 11;
|
||||||
|
|
||||||
public static Long earliestDataChange = null;
|
public static Long earliestDataChange = null;
|
||||||
|
|
||||||
|
@ -131,6 +131,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
|
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
|
||||||
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
|
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
|
||||||
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
|
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
|
||||||
|
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
|
||||||
|
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")");
|
||||||
|
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " +
|
||||||
|
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\")");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Can't create database", e);
|
log.error("Can't create database", e);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -143,15 +147,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
this.oldVersion = oldVersion;
|
this.oldVersion = oldVersion;
|
||||||
this.newVersion = newVersion;
|
this.newVersion = newVersion;
|
||||||
|
|
||||||
if (oldVersion == 7 && newVersion == 8) {
|
if (oldVersion < 7) {
|
||||||
log.debug("Upgrading database from v7 to v8");
|
|
||||||
} else if (oldVersion == 8 && newVersion == 9) {
|
|
||||||
log.debug("Upgrading database from v8 to v9");
|
|
||||||
} else if (oldVersion == 9 && newVersion == 10) {
|
|
||||||
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
|
|
||||||
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
|
|
||||||
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
|
|
||||||
} else {
|
|
||||||
log.info(DatabaseHelper.class.getName(), "onUpgrade");
|
log.info(DatabaseHelper.class.getName(), "onUpgrade");
|
||||||
TableUtils.dropTable(connectionSource, TempTarget.class, true);
|
TableUtils.dropTable(connectionSource, TempTarget.class, true);
|
||||||
TableUtils.dropTable(connectionSource, BgReading.class, true);
|
TableUtils.dropTable(connectionSource, BgReading.class, true);
|
||||||
|
@ -162,6 +158,17 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
TableUtils.dropTable(connectionSource, CareportalEvent.class, true);
|
TableUtils.dropTable(connectionSource, CareportalEvent.class, true);
|
||||||
TableUtils.dropTable(connectionSource, ProfileSwitch.class, true);
|
TableUtils.dropTable(connectionSource, ProfileSwitch.class, true);
|
||||||
onCreate(database, connectionSource);
|
onCreate(database, connectionSource);
|
||||||
|
} else if (oldVersion < 10) {
|
||||||
|
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
|
||||||
|
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
|
||||||
|
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
|
||||||
|
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
|
||||||
|
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")");
|
||||||
|
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " +
|
||||||
|
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\")");
|
||||||
|
} else if (oldVersion < 11) {
|
||||||
|
database.execSQL("UPDATE sqlite_sequence SET seq = " + System.currentTimeMillis() + " WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\"");
|
||||||
|
database.execSQL("UPDATE sqlite_sequence SET seq = " + System.currentTimeMillis() + " WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\"");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Can't drop databases", e);
|
log.error("Can't drop databases", e);
|
||||||
|
@ -1574,9 +1581,9 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
class PostRunnable implements Runnable {
|
class PostRunnable implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (L.isEnabled(L.DATABASE))
|
if (L.isEnabled(L.DATABASE))
|
||||||
log.debug("Firing EventProfileSwitchChange");
|
log.debug("Firing EventProfileNeedsUpdate");
|
||||||
MainApp.bus().post(new EventReloadProfileSwitchData());
|
MainApp.bus().post(new EventReloadProfileSwitchData());
|
||||||
MainApp.bus().post(new EventProfileSwitchChange());
|
MainApp.bus().post(new EventProfileNeedsUpdate());
|
||||||
scheduledProfileSwitchEventPost = null;
|
scheduledProfileSwitchEventPost = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
|
||||||
* Created by mike on 02.06.2017.
|
* Created by mike on 02.06.2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EventProfileSwitchChange extends Event {
|
public class EventProfileNeedsUpdate extends Event {
|
||||||
}
|
}
|
|
@ -78,6 +78,7 @@ public class L {
|
||||||
public static final String CORE = "CORE";
|
public static final String CORE = "CORE";
|
||||||
public static final String AUTOSENS = "AUTOSENS";
|
public static final String AUTOSENS = "AUTOSENS";
|
||||||
public static final String EVENTS = "EVENTS";
|
public static final String EVENTS = "EVENTS";
|
||||||
|
public static final String GLUCOSE = "GLUCOSE";
|
||||||
public static final String BGSOURCE = "BGSOURCE";
|
public static final String BGSOURCE = "BGSOURCE";
|
||||||
public static final String OVERVIEW = "OVERVIEW";
|
public static final String OVERVIEW = "OVERVIEW";
|
||||||
public static final String NOTIFICATION = "NOTIFICATION";
|
public static final String NOTIFICATION = "NOTIFICATION";
|
||||||
|
@ -102,6 +103,7 @@ public class L {
|
||||||
logElements.add(new LogElement(APS, true));
|
logElements.add(new LogElement(APS, true));
|
||||||
logElements.add(new LogElement(AUTOSENS, false));
|
logElements.add(new LogElement(AUTOSENS, false));
|
||||||
logElements.add(new LogElement(BGSOURCE, true));
|
logElements.add(new LogElement(BGSOURCE, true));
|
||||||
|
logElements.add(new LogElement(GLUCOSE, false));
|
||||||
logElements.add(new LogElement(CONFIGBUILDER, false));
|
logElements.add(new LogElement(CONFIGBUILDER, false));
|
||||||
logElements.add(new LogElement(CONSTRAINTS, true));
|
logElements.add(new LogElement(CONSTRAINTS, true));
|
||||||
logElements.add(new LogElement(CORE, true));
|
logElements.add(new LogElement(CORE, true));
|
||||||
|
|
|
@ -10,7 +10,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
@ -19,9 +18,9 @@ import butterknife.OnClick;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui;
|
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui;
|
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui;
|
||||||
|
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
|
|
||||||
public class LoopFragment extends SubscriberFragment {
|
public class LoopFragment extends SubscriberFragment {
|
||||||
|
@ -62,7 +61,6 @@ public class LoopFragment extends SubscriberFragment {
|
||||||
void onRunClick() {
|
void onRunClick() {
|
||||||
lastRunView.setText(MainApp.gs(R.string.executing));
|
lastRunView.setText(MainApp.gs(R.string.executing));
|
||||||
new Thread(() -> LoopPlugin.getPlugin().invoke("Loop button", true)).start();
|
new Thread(() -> LoopPlugin.getPlugin().invoke("Loop button", true)).start();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("Loop_Run"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -75,7 +73,11 @@ public class LoopFragment extends SubscriberFragment {
|
||||||
clearGUI();
|
clearGUI();
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
if (activity != null)
|
if (activity != null)
|
||||||
activity.runOnUiThread(() -> { synchronized (LoopFragment.this) { if (lastRunView != null) lastRunView.setText(ev.text); } });
|
activity.runOnUiThread(() -> {
|
||||||
|
synchronized (LoopFragment.this) {
|
||||||
|
if (lastRunView != null) lastRunView.setText(ev.text);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import android.os.SystemClock;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -33,6 +32,7 @@ import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||||
|
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange;
|
||||||
import info.nightscout.androidaps.events.EventNewBG;
|
import info.nightscout.androidaps.events.EventNewBG;
|
||||||
import info.nightscout.androidaps.events.EventTempTargetChange;
|
import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||||
|
@ -44,18 +44,17 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui;
|
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui;
|
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification;
|
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification;
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
|
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
|
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
|
||||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
|
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
|
|
||||||
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange;
|
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.queue.commands.Command;
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
|
@ -179,11 +178,9 @@ public class LoopPlugin extends PluginBase {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventTempTargetChange ev) {
|
public void onStatusEvent(final EventTempTargetChange ev) {
|
||||||
new Thread(() -> invoke("EventTempTargetChange", true)).start();
|
new Thread(() -> invoke("EventTempTargetChange", true)).start();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("TT_Loop_Run"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void suspendTo(long endTime) {
|
public void suspendTo(long endTime) {
|
||||||
loopSuspendedTill = endTime;
|
loopSuspendedTill = endTime;
|
||||||
isSuperBolus = false;
|
isSuperBolus = false;
|
||||||
|
@ -376,7 +373,7 @@ public class LoopPlugin extends PluginBase {
|
||||||
if (resultAfterConstraints.bolusRequested)
|
if (resultAfterConstraints.bolusRequested)
|
||||||
lastRun.smbSetByPump = waiting;
|
lastRun.smbSetByPump = waiting;
|
||||||
MainApp.bus().post(new EventLoopUpdateGui());
|
MainApp.bus().post(new EventLoopUpdateGui());
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("APSRequest"));
|
FabricPrivacy.getInstance().logCustom("APSRequest");
|
||||||
applyTBRRequest(resultAfterConstraints, profile, new Callback() {
|
applyTBRRequest(resultAfterConstraints, profile, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -395,7 +392,6 @@ public class LoopPlugin extends PluginBase {
|
||||||
SystemClock.sleep(1000);
|
SystemClock.sleep(1000);
|
||||||
LoopPlugin.getPlugin().invoke("tempBasalFallback", allowNotification, true);
|
LoopPlugin.getPlugin().invoke("tempBasalFallback", allowNotification, true);
|
||||||
}).start();
|
}).start();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("Loop_Run_TempBasalFallback"));
|
|
||||||
}
|
}
|
||||||
MainApp.bus().post(new EventLoopUpdateGui());
|
MainApp.bus().post(new EventLoopUpdateGui());
|
||||||
}
|
}
|
||||||
|
@ -482,7 +478,7 @@ public class LoopPlugin extends PluginBase {
|
||||||
MainApp.bus().post(new EventAcceptOpenLoopChange());
|
MainApp.bus().post(new EventAcceptOpenLoopChange());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("AcceptTemp"));
|
FabricPrivacy.getInstance().logCustom("AcceptTemp");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.MealData;
|
import info.nightscout.androidaps.data.MealData;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
@ -19,11 +18,10 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
|
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui;
|
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||||
|
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.JSONFormatter;
|
import info.nightscout.androidaps.utils.JSONFormatter;
|
||||||
|
|
||||||
public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener {
|
public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener {
|
||||||
|
@ -68,7 +66,6 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.openapsma_run:
|
case R.id.openapsma_run:
|
||||||
OpenAPSAMAPlugin.getPlugin().invoke("OpenAPSAMA button", false);
|
OpenAPSAMAPlugin.getPlugin().invoke("OpenAPSAMA button", false);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run"));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.MealData;
|
import info.nightscout.androidaps.data.MealData;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.MealData;
|
import info.nightscout.androidaps.data.MealData;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
|
|
@ -8,13 +8,12 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
|
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui;
|
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||||
|
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
import info.nightscout.androidaps.utils.JSONFormatter;
|
import info.nightscout.androidaps.utils.JSONFormatter;
|
||||||
|
@ -61,7 +60,6 @@ public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClic
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.openapsma_run:
|
case R.id.openapsma_run:
|
||||||
OpenAPSMAPlugin.getPlugin().invoke("OpenAPSMA button", false);
|
OpenAPSMAPlugin.getPlugin().invoke("OpenAPSMA button", false);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_MA_Run"));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.MealData;
|
import info.nightscout.androidaps.data.MealData;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.MealData;
|
import info.nightscout.androidaps.data.MealData;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
@ -22,11 +21,10 @@ import butterknife.OnClick;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
|
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui;
|
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||||
|
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.JSONFormatter;
|
import info.nightscout.androidaps.utils.JSONFormatter;
|
||||||
|
|
||||||
public class OpenAPSSMBFragment extends SubscriberFragment {
|
public class OpenAPSSMBFragment extends SubscriberFragment {
|
||||||
|
@ -69,7 +67,6 @@ public class OpenAPSSMBFragment extends SubscriberFragment {
|
||||||
@OnClick(R.id.openapsma_run)
|
@OnClick(R.id.openapsma_run)
|
||||||
public void onRunClick() {
|
public void onRunClick() {
|
||||||
OpenAPSSMBPlugin.getPlugin().invoke("OpenAPSSMB button", false);
|
OpenAPSSMBPlugin.getPlugin().invoke("OpenAPSSMB button", false);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_SMB_Run"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.MealData;
|
import info.nightscout.androidaps.data.MealData;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
|
|
@ -16,8 +16,6 @@ import android.widget.RadioButton;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -26,8 +24,8 @@ import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
import butterknife.Unbinder;
|
import butterknife.Unbinder;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.activities.PreferencesActivity;
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.activities.PreferencesActivity;
|
||||||
import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
||||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||||
|
@ -42,7 +40,6 @@ import info.nightscout.androidaps.interfaces.SensitivityInterface;
|
||||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin;
|
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin;
|
||||||
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin;
|
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
|
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
|
@ -276,7 +273,6 @@ public class ConfigBuilderFragment extends SubscriberFragment {
|
||||||
MainApp.bus().post(new EventRefreshGui());
|
MainApp.bus().post(new EventRefreshGui());
|
||||||
MainApp.bus().post(new EventConfigBuilderChange());
|
MainApp.bus().post(new EventConfigBuilderChange());
|
||||||
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
ConfigBuilderPlugin.getPlugin().logPluginStatus();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ConfigurationChange"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancel(){
|
public void cancel(){
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.configBuilder;
|
package info.nightscout.androidaps.plugins.configBuilder;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -18,11 +19,11 @@ import info.nightscout.androidaps.data.ProfileStore;
|
||||||
import info.nightscout.androidaps.db.ProfileSwitch;
|
import info.nightscout.androidaps.db.ProfileSwitch;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
|
@ -47,7 +48,7 @@ public class ProfileFunctions {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onProfileSwitch(EventProfileSwitchChange ignored) {
|
public void onProfileSwitch(EventProfileNeedsUpdate ignored) {
|
||||||
if (L.isEnabled(L.PROFILE))
|
if (L.isEnabled(L.PROFILE))
|
||||||
log.debug("onProfileSwitch");
|
log.debug("onProfileSwitch");
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().setProfile(getProfile(), new Callback() {
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().setProfile(getProfile(), new Callback() {
|
||||||
|
@ -61,6 +62,7 @@ public class ProfileFunctions {
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
MainApp.instance().startActivity(i);
|
MainApp.instance().startActivity(i);
|
||||||
}
|
}
|
||||||
|
if (result.enacted)
|
||||||
MainApp.bus().post(new EventNewBasalProfile());
|
MainApp.bus().post(new EventNewBasalProfile());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -129,12 +131,12 @@ public class ProfileFunctions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (activeTreatments.getProfileSwitchesFromHistory().size() > 0) {
|
if (activeTreatments.getProfileSwitchesFromHistory().size() > 0) {
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError")
|
Bundle bundle = new Bundle();
|
||||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "CatchedError");
|
||||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, BuildConfig.BUILDVERSION);
|
||||||
.putCustomAttribute("time", time)
|
bundle.putString(FirebaseAnalytics.Param.START_DATE, String.valueOf(time));
|
||||||
.putCustomAttribute("getProfileSwitchesFromHistory", activeTreatments.getProfileSwitchesFromHistory().toString())
|
bundle.putString(FirebaseAnalytics.Param.VALUE, activeTreatments.getProfileSwitchesFromHistory().toString());
|
||||||
);
|
FabricPrivacy.getInstance().logCustom(bundle);
|
||||||
}
|
}
|
||||||
log.error("getProfile at the end: returning null");
|
log.error("getProfile at the end: returning null");
|
||||||
return null;
|
return null;
|
||||||
|
@ -157,7 +159,6 @@ public class ProfileFunctions {
|
||||||
public static void doProfileSwitch(final ProfileStore profileStore, final String profileName, final int duration, final int percentage, final int timeshift) {
|
public static void doProfileSwitch(final ProfileStore profileStore, final String profileName, final int duration, final int percentage, final int timeshift) {
|
||||||
ProfileSwitch profileSwitch = prepareProfileSwitch(profileStore, profileName, duration, percentage, timeshift, System.currentTimeMillis());
|
ProfileSwitch profileSwitch = prepareProfileSwitch(profileStore, profileName, duration, percentage, timeshift, System.currentTimeMillis());
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch);
|
TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void doProfileSwitch(final int duration, final int percentage, final int timeshift) {
|
public static void doProfileSwitch(final int duration, final int percentage, final int timeshift) {
|
||||||
|
@ -174,7 +175,6 @@ public class ProfileFunctions {
|
||||||
profileSwitch.timeshift = timeshift;
|
profileSwitch.timeshift = timeshift;
|
||||||
profileSwitch.percentage = percentage;
|
profileSwitch.percentage = percentage;
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch);
|
TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
|
|
||||||
} else {
|
} else {
|
||||||
log.error("No profile switch existing");
|
log.error("No profile switch existing");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -21,9 +20,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.activities.HistoryBrowseActivity;
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.activities.HistoryBrowseActivity;
|
||||||
import info.nightscout.androidaps.activities.TDDStatsActivity;
|
import info.nightscout.androidaps.activities.TDDStatsActivity;
|
||||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||||
|
@ -35,7 +34,6 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.dialogs.FillDialog;
|
import info.nightscout.androidaps.plugins.general.actions.dialogs.FillDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBolusDialog;
|
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBolusDialog;
|
||||||
|
@ -70,7 +68,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
SingleClickButton tddStats;
|
SingleClickButton tddStats;
|
||||||
SingleClickButton history;
|
SingleClickButton history;
|
||||||
|
|
||||||
private Map<String,CustomAction> pumpCustomActions = new HashMap<>();
|
private Map<String, CustomAction> pumpCustomActions = new HashMap<>();
|
||||||
private List<SingleClickButton> pumpCustomButtons = new ArrayList<>();
|
private List<SingleClickButton> pumpCustomButtons = new ArrayList<>();
|
||||||
|
|
||||||
public ActionsFragment() {
|
public ActionsFragment() {
|
||||||
|
@ -222,7 +220,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
|
|
||||||
View.OnClickListener pumpCustomActionsListener = v -> {
|
View.OnClickListener pumpCustomActionsListener = v -> {
|
||||||
|
|
||||||
SingleClickButton btn = (SingleClickButton)v;
|
SingleClickButton btn = (SingleClickButton) v;
|
||||||
|
|
||||||
CustomAction customAction = this.pumpCustomActions.get(btn.getText().toString());
|
CustomAction customAction = this.pumpCustomActions.get(btn.getText().toString());
|
||||||
|
|
||||||
|
@ -243,7 +241,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
|
|
||||||
List<CustomAction> customActions = activePump.getCustomActions();
|
List<CustomAction> customActions = activePump.getCustomActions();
|
||||||
|
|
||||||
if (customActions != null && customActions.size()>0) {
|
if (customActions != null && customActions.size() > 0) {
|
||||||
|
|
||||||
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
|
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
|
||||||
|
|
||||||
|
@ -275,7 +273,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
|
|
||||||
private void removePumpCustomActions() {
|
private void removePumpCustomActions() {
|
||||||
|
|
||||||
if (pumpCustomActions.size()==0)
|
if (pumpCustomActions.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
|
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
|
||||||
|
@ -314,13 +312,11 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
case R.id.actions_extendedbolus_cancel:
|
case R.id.actions_extendedbolus_cancel:
|
||||||
if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress()) {
|
if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress()) {
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelExtended(null);
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelExtended(null);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelExtended"));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.actions_canceltempbasal:
|
case R.id.actions_canceltempbasal:
|
||||||
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) {
|
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) {
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelTemp"));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.actions_settempbasal:
|
case R.id.actions_settempbasal:
|
||||||
|
|
|
@ -19,7 +19,6 @@ import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -35,11 +34,10 @@ import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
|
||||||
import info.nightscout.androidaps.utils.NumberPicker;
|
import info.nightscout.androidaps.utils.NumberPicker;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
import info.nightscout.androidaps.utils.SafeParse;
|
import info.nightscout.androidaps.utils.SafeParse;
|
||||||
|
@ -236,7 +234,6 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("Fill"));
|
|
||||||
}
|
}
|
||||||
if (pumpSiteChangeCheckbox.isChecked())
|
if (pumpSiteChangeCheckbox.isChecked())
|
||||||
NSUpload.uploadEvent(CareportalEvent.SITECHANGE, now(), notes);
|
NSUpload.uploadEvent(CareportalEvent.SITECHANGE, now(), notes);
|
||||||
|
|
|
@ -10,8 +10,6 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -21,9 +19,8 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.NumberPicker;
|
import info.nightscout.androidaps.utils.NumberPicker;
|
||||||
import info.nightscout.androidaps.utils.SafeParse;
|
import info.nightscout.androidaps.utils.SafeParse;
|
||||||
|
|
||||||
|
@ -99,7 +96,6 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ExtendedBolus"));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||||
|
|
|
@ -12,8 +12,6 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -26,9 +24,8 @@ import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.NumberPicker;
|
import info.nightscout.androidaps.utils.NumberPicker;
|
||||||
import info.nightscout.androidaps.utils.SafeParse;
|
import info.nightscout.androidaps.utils.SafeParse;
|
||||||
|
|
||||||
|
@ -167,7 +164,6 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
||||||
} else {
|
} else {
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, profile, callback);
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, profile, callback);
|
||||||
}
|
}
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("TempBasal"));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||||
|
|
|
@ -20,7 +20,6 @@ import android.widget.RadioButton;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
|
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
|
||||||
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
|
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
|
||||||
|
@ -40,7 +39,7 @@ import java.util.List;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.ProfileStore;
|
import info.nightscout.androidaps.data.ProfileStore;
|
||||||
import info.nightscout.androidaps.db.BgReading;
|
import info.nightscout.androidaps.db.BgReading;
|
||||||
|
@ -48,14 +47,13 @@ import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.db.ProfileSwitch;
|
import info.nightscout.androidaps.db.ProfileSwitch;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.db.TempTarget;
|
import info.nightscout.androidaps.db.TempTarget;
|
||||||
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
|
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DefaultValueHelper;
|
import info.nightscout.androidaps.utils.DefaultValueHelper;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.HardLimits;
|
import info.nightscout.androidaps.utils.HardLimits;
|
||||||
import info.nightscout.androidaps.utils.JsonHelper;
|
import info.nightscout.androidaps.utils.JsonHelper;
|
||||||
import info.nightscout.androidaps.utils.NumberPicker;
|
import info.nightscout.androidaps.utils.NumberPicker;
|
||||||
|
@ -742,7 +740,6 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
tempTarget.low(0).high(0);
|
tempTarget.low(0).high(0);
|
||||||
}
|
}
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
|
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("TempTarget"));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (JsonHelper.safeGetString(data, "eventType").equals(CareportalEvent.PROFILESWITCH)) {
|
if (JsonHelper.safeGetString(data, "eventType").equals(CareportalEvent.PROFILESWITCH)) {
|
||||||
|
@ -758,7 +755,6 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
} else {
|
} else {
|
||||||
NSUpload.uploadCareportalEntryToNS(data);
|
NSUpload.uploadCareportalEntryToNS(data);
|
||||||
}
|
}
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSTreatment"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -222,6 +222,7 @@ public class MaintenancePlugin extends PluginBase {
|
||||||
builder.append("NSCLIENT" + System.lineSeparator());
|
builder.append("NSCLIENT" + System.lineSeparator());
|
||||||
|
|
||||||
builder.append("Build: " + BuildConfig.BUILDVERSION + System.lineSeparator());
|
builder.append("Build: " + BuildConfig.BUILDVERSION + System.lineSeparator());
|
||||||
|
builder.append("Remote: " + BuildConfig.REMOTE + System.lineSeparator());
|
||||||
builder.append("Flavor: " + BuildConfig.FLAVOR + BuildConfig.BUILD_TYPE + System.lineSeparator());
|
builder.append("Flavor: " + BuildConfig.FLAVOR + BuildConfig.BUILD_TYPE + System.lineSeparator());
|
||||||
builder.append(MainApp.gs(R.string.configbuilder_nightscoutversion_label) + " " + NSSettingsStatus.getInstance().nightscoutVersionName + System.lineSeparator());
|
builder.append(MainApp.gs(R.string.configbuilder_nightscoutversion_label) + " " + NSSettingsStatus.getInstance().nightscoutVersionName + System.lineSeparator());
|
||||||
if (MainApp.engineeringMode)
|
if (MainApp.engineeringMode)
|
||||||
|
|
|
@ -17,7 +17,6 @@ import android.widget.CompoundButton;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -91,11 +90,11 @@ public class NSClientFragment extends SubscriberFragment implements View.OnClick
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.nsclientinternal_restart:
|
case R.id.nsclientinternal_restart:
|
||||||
MainApp.bus().post(new EventNSClientRestart());
|
MainApp.bus().post(new EventNSClientRestart());
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientRestart"));
|
FabricPrivacy.getInstance().logCustom("NSClientRestart");
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_delivernow:
|
case R.id.nsclientinternal_delivernow:
|
||||||
NSClientPlugin.getPlugin().resend("GUI");
|
NSClientPlugin.getPlugin().resend("GUI");
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientDeliverNow"));
|
FabricPrivacy.getInstance().logCustom("NSClientDeliverNow");
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_clearlog:
|
case R.id.nsclientinternal_clearlog:
|
||||||
NSClientPlugin.getPlugin().clearLog();
|
NSClientPlugin.getPlugin().clearLog();
|
||||||
|
@ -110,7 +109,7 @@ public class NSClientFragment extends SubscriberFragment implements View.OnClick
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
UploadQueue.clearQueue();
|
UploadQueue.clearQueue();
|
||||||
updateGUI();
|
updateGUI();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientClearQueue"));
|
FabricPrivacy.getInstance().logCustom("NSClientClearQueue");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||||
|
@ -118,7 +117,6 @@ public class NSClientFragment extends SubscriberFragment implements View.OnClick
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_showqueue:
|
case R.id.nsclientinternal_showqueue:
|
||||||
MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientPlugin.getPlugin().queue().textList()));
|
MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientPlugin.getPlugin().queue().textList()));
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +127,7 @@ public class NSClientFragment extends SubscriberFragment implements View.OnClick
|
||||||
case R.id.nsclientinternal_paused:
|
case R.id.nsclientinternal_paused:
|
||||||
NSClientPlugin.getPlugin().pause(isChecked);
|
NSClientPlugin.getPlugin().pause(isChecked);
|
||||||
updateGUI();
|
updateGUI();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientPause"));
|
FabricPrivacy.getInstance().logCustom("NSClientPause");
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_autoscroll:
|
case R.id.nsclientinternal_autoscroll:
|
||||||
SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked);
|
SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked);
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class NSClientService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
|
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
|
||||||
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "NSClientService");
|
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:NSClientService");
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ public class NSClientService extends Service {
|
||||||
public void run() {
|
public void run() {
|
||||||
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
|
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
|
||||||
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
|
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
|
||||||
"onDataUpdate");
|
"AndroidAPS:NSClientService_onDataUpdate");
|
||||||
wakeLock.acquire();
|
wakeLock.acquire();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.jjoe64.graphview.GraphView;
|
import com.jjoe64.graphview.GraphView;
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
|
@ -46,6 +45,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
@ -56,7 +56,7 @@ import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.QuickWizardEntry;
|
import info.nightscout.androidaps.data.QuickWizardEntry;
|
||||||
|
@ -72,7 +72,7 @@ import info.nightscout.androidaps.events.EventCareportalEventChange;
|
||||||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||||
|
@ -83,44 +83,43 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.aps.loop.APSResult;
|
||||||
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification;
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
|
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
|
||||||
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
|
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
|
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.CalibrationDialog;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.NewCarbsDialog;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.NewInsulinDialog;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.NewTreatmentDialog;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.WizardDialog;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationRecyclerViewAdapter;
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore;
|
||||||
|
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.APSResult;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification;
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus;
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.CalibrationDialog;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.NewCarbsDialog;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.NewInsulinDialog;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.NewTreatmentDialog;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.WizardDialog;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationRecyclerViewAdapter;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore;
|
|
||||||
import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin;
|
import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin;
|
||||||
import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin;
|
import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin;
|
||||||
import info.nightscout.androidaps.plugins.source.SourceXdripPlugin;
|
import info.nightscout.androidaps.plugins.source.SourceXdripPlugin;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog;
|
import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
|
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.BolusWizard;
|
import info.nightscout.androidaps.utils.BolusWizard;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.DefaultValueHelper;
|
import info.nightscout.androidaps.utils.DefaultValueHelper;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.OKDialog;
|
import info.nightscout.androidaps.utils.OKDialog;
|
||||||
import info.nightscout.androidaps.utils.Profiler;
|
import info.nightscout.androidaps.utils.Profiler;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
@ -892,7 +891,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
} else {
|
} else {
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
|
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
|
||||||
}
|
}
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("QuickWizard"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -984,8 +982,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventProfileSwitchChange ev) {
|
public void onStatusEvent(final EventProfileNeedsUpdate ev) {
|
||||||
scheduleUpdateGUI("EventProfileSwitchChange");
|
scheduleUpdateGUI("EventProfileNeedsUpdate");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -1461,7 +1459,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
if (sensitivityView != null) {
|
if (sensitivityView != null) {
|
||||||
AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("Overview");
|
AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("Overview");
|
||||||
if (autosensData != null)
|
if (autosensData != null)
|
||||||
sensitivityView.setText(String.format("%.0f%%", autosensData.autosensResult.ratio * 100));
|
sensitivityView.setText(String.format(Locale.ENGLISH, "%.0f%%", autosensData.autosensResult.ratio * 100));
|
||||||
else
|
else
|
||||||
sensitivityView.setText("");
|
sensitivityView.setText("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import com.squareup.otto.Subscribe;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.QuickWizard;
|
import info.nightscout.androidaps.data.QuickWizard;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.EditQuickWizardDialog;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventQuickWizardChange;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventQuickWizardChange;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -11,8 +11,6 @@ import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -20,10 +18,9 @@ import java.text.DecimalFormat;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.NumberPicker;
|
import info.nightscout.androidaps.utils.NumberPicker;
|
||||||
import info.nightscout.androidaps.utils.SafeParse;
|
import info.nightscout.androidaps.utils.SafeParse;
|
||||||
import info.nightscout.androidaps.utils.XdripCalibrations;
|
import info.nightscout.androidaps.utils.XdripCalibrations;
|
||||||
|
@ -88,7 +85,6 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
|
||||||
final Double bg = SafeParse.stringToDouble(bgNumber.getText());
|
final Double bg = SafeParse.stringToDouble(bgNumber.getText());
|
||||||
XdripCalibrations.confirmAndSendCalibration(bg, context);
|
XdripCalibrations.confirmAndSendCalibration(bg, context);
|
||||||
dismiss();
|
dismiss();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("Calibration"));
|
|
||||||
break;
|
break;
|
||||||
case R.id.cancel:
|
case R.id.cancel:
|
||||||
dismiss();
|
dismiss();
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -20,7 +20,6 @@ import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -46,7 +45,6 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.NumberPicker;
|
import info.nightscout.androidaps.utils.NumberPicker;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
import info.nightscout.androidaps.utils.SafeParse;
|
import info.nightscout.androidaps.utils.SafeParse;
|
||||||
|
@ -170,8 +168,8 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
|
||||||
insulinDialogState.putBoolean("recordOnlyCheckbox", recordOnlyCheckbox.isChecked());
|
insulinDialogState.putBoolean("recordOnlyCheckbox", recordOnlyCheckbox.isChecked());
|
||||||
insulinDialogState.putDouble("editTime", editTime.getValue());
|
insulinDialogState.putDouble("editTime", editTime.getValue());
|
||||||
insulinDialogState.putDouble("editInsulin", editInsulin.getValue());
|
insulinDialogState.putDouble("editInsulin", editInsulin.getValue());
|
||||||
insulinDialogState.putString("notesEdit",notesEdit.getText().toString());
|
insulinDialogState.putString("notesEdit", notesEdit.getText().toString());
|
||||||
log.debug("Instance state saved:"+insulinDialogState.toString());
|
log.debug("Instance state saved:" + insulinDialogState.toString());
|
||||||
super.onSaveInstanceState(insulinDialogState);
|
super.onSaveInstanceState(insulinDialogState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +304,6 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("Bolus"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -17,8 +17,6 @@ import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -36,7 +34,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.NumberPicker;
|
import info.nightscout.androidaps.utils.NumberPicker;
|
||||||
import info.nightscout.androidaps.utils.SafeParse;
|
import info.nightscout.androidaps.utils.SafeParse;
|
||||||
import info.nightscout.androidaps.utils.ToastUtils;
|
import info.nightscout.androidaps.utils.ToastUtils;
|
||||||
|
@ -194,7 +191,6 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
} else {
|
} else {
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
|
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
|
||||||
}
|
}
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("Bolus"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.Dialogs;
|
package info.nightscout.androidaps.plugins.general.overview.dialogs;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -26,7 +26,6 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@ -66,7 +65,6 @@ import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.BolusWizard;
|
import info.nightscout.androidaps.utils.BolusWizard;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.NumberPicker;
|
import info.nightscout.androidaps.utils.NumberPicker;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
import info.nightscout.androidaps.utils.SafeParse;
|
import info.nightscout.androidaps.utils.SafeParse;
|
||||||
|
@ -398,7 +396,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
} else {
|
} else {
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
|
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
|
||||||
}
|
}
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("Wizard"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -74,6 +74,7 @@ public class Notification {
|
||||||
public static final int DST_LOOP_DISABLED = 49;
|
public static final int DST_LOOP_DISABLED = 49;
|
||||||
public static final int DST_IN_24H = 50;
|
public static final int DST_IN_24H = 50;
|
||||||
public static final int DISKFULL = 51;
|
public static final int DISKFULL = 51;
|
||||||
|
public static final int OLDVERSION = 52;
|
||||||
|
|
||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainActivity;
|
import info.nightscout.androidaps.MainActivity;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.db.BgReading;
|
import info.nightscout.androidaps.db.BgReading;
|
||||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.ProfileStore;
|
import info.nightscout.androidaps.data.ProfileStore;
|
||||||
|
@ -118,7 +118,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isCommand(String command, String number) {
|
boolean isCommand(String command, String number) {
|
||||||
switch(command.toUpperCase()) {
|
switch (command.toUpperCase()) {
|
||||||
case "BG":
|
case "BG":
|
||||||
case "LOOP":
|
case "LOOP":
|
||||||
case "TREATMENTS":
|
case "TREATMENTS":
|
||||||
|
@ -760,11 +760,18 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
void sendSMS(Sms sms) {
|
void sendSMS(Sms sms) {
|
||||||
SmsManager smsManager = SmsManager.getDefault();
|
SmsManager smsManager = SmsManager.getDefault();
|
||||||
sms.text = stripAccents(sms.text);
|
sms.text = stripAccents(sms.text);
|
||||||
if (sms.text.length() > 140) sms.text = sms.text.substring(0, 139);
|
|
||||||
try {
|
try {
|
||||||
if (L.isEnabled(L.SMS))
|
if (L.isEnabled(L.SMS))
|
||||||
log.debug("Sending SMS to " + sms.phoneNumber + ": " + sms.text);
|
log.debug("Sending SMS to " + sms.phoneNumber + ": " + sms.text);
|
||||||
|
if (sms.text.getBytes().length <= 140)
|
||||||
smsManager.sendTextMessage(sms.phoneNumber, null, sms.text, null, null);
|
smsManager.sendTextMessage(sms.phoneNumber, null, sms.text, null, null);
|
||||||
|
else {
|
||||||
|
ArrayList<String> parts = smsManager.divideMessage(sms.text);
|
||||||
|
smsManager.sendMultipartTextMessage(sms.phoneNumber, null, parts,
|
||||||
|
null, null);
|
||||||
|
}
|
||||||
|
|
||||||
messages.add(sms);
|
messages.add(sms);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Notification notification = new Notification(Notification.INVALID_PHONE_NUMBER, MainApp.gs(R.string.smscommunicator_invalidphonennumber), Notification.NORMAL);
|
Notification notification = new Notification(Notification.INVALID_PHONE_NUMBER, MainApp.gs(R.string.smscommunicator_invalidphonennumber), Notification.NORMAL);
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package info.nightscout.androidaps.plugins.general.versionChecker
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.MainApp
|
||||||
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.interfaces.*
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Usually we would have a class here.
|
||||||
|
* Instead of having a class we can use an object directly inherited from PluginBase.
|
||||||
|
* This is a lazy loading singleton only loaded when actually used.
|
||||||
|
* */
|
||||||
|
|
||||||
|
object VersionCheckerPlugin : PluginBase(PluginDescription()
|
||||||
|
.mainType(PluginType.CONSTRAINTS)
|
||||||
|
.neverVisible(true)
|
||||||
|
.alwaysEnabled(true)
|
||||||
|
.showInList(false)
|
||||||
|
.pluginName(R.string.versionChecker)), ConstraintsInterface {
|
||||||
|
|
||||||
|
override fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||||
|
checkWarning()
|
||||||
|
triggerCheckVersion()
|
||||||
|
return if (isOldVersion(GRACE_PERIOD_VERY_OLD))
|
||||||
|
value.set(false, MainApp.gs(R.string.very_old_version), this)
|
||||||
|
else
|
||||||
|
value
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkWarning() {
|
||||||
|
val now = System.currentTimeMillis()
|
||||||
|
if (isOldVersion(GRACE_PERIOD_WARNING) && shouldWarnAgain(now)) {
|
||||||
|
// store last notification time
|
||||||
|
SP.putLong(R.string.key_last_versionchecker_plugin_warning, now)
|
||||||
|
|
||||||
|
//notify
|
||||||
|
val message = MainApp.gs(R.string.new_version_warning, Math.round((now - SP.getLong(R.string.key_last_time_this_version_detected, now)) / TimeUnit.DAYS.toMillis(1).toDouble()))
|
||||||
|
val notification = Notification(Notification.OLDVERSION, message, Notification.NORMAL)
|
||||||
|
MainApp.bus().post(EventNewNotification(notification))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun shouldWarnAgain(now: Long) =
|
||||||
|
now > SP.getLong(R.string.key_last_versionchecker_plugin_warning, 0) + WARN_EVERY
|
||||||
|
|
||||||
|
override fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> =
|
||||||
|
if (isOldVersion(GRACE_PERIOD_OLD))
|
||||||
|
maxIob.set(0.toDouble(), MainApp.gs(R.string.old_version), this)
|
||||||
|
else
|
||||||
|
maxIob
|
||||||
|
|
||||||
|
private fun isOldVersion(gracePeriod: Long): Boolean {
|
||||||
|
val now = System.currentTimeMillis()
|
||||||
|
return now > SP.getLong(R.string.key_last_time_this_version_detected, 0) + gracePeriod
|
||||||
|
}
|
||||||
|
|
||||||
|
val WARN_EVERY = TimeUnit.DAYS.toMillis(1)
|
||||||
|
val GRACE_PERIOD_WARNING = TimeUnit.DAYS.toMillis(30)
|
||||||
|
val GRACE_PERIOD_OLD = TimeUnit.DAYS.toMillis(60)
|
||||||
|
val GRACE_PERIOD_VERY_OLD = TimeUnit.DAYS.toMillis(90)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
package info.nightscout.androidaps.plugins.general.versionChecker
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.net.ConnectivityManager
|
||||||
|
import info.nightscout.androidaps.BuildConfig
|
||||||
|
import info.nightscout.androidaps.MainApp
|
||||||
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.logging.L
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||||
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
import org.apache.http.HttpResponse
|
||||||
|
import org.apache.http.client.methods.HttpGet
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import java.io.IOException
|
||||||
|
import java.io.InputStream
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
// check network connection
|
||||||
|
fun isConnected(): Boolean {
|
||||||
|
val connMgr = MainApp.instance().applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||||
|
return connMgr.activeNetworkInfo?.isConnected ?: false
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert inputstream to String
|
||||||
|
@Throws(IOException::class)
|
||||||
|
inline fun InputStream.findVersion(): String? {
|
||||||
|
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
|
||||||
|
return bufferedReader()
|
||||||
|
.readLines()
|
||||||
|
.filter { regex.matches(it) }
|
||||||
|
.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }
|
||||||
|
.firstOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
|
private val log = LoggerFactory.getLogger(L.CORE)
|
||||||
|
|
||||||
|
|
||||||
|
fun triggerCheckVersion() {
|
||||||
|
|
||||||
|
if(!SP.contains(R.string.key_last_time_this_version_detected)) {
|
||||||
|
// On a new installation, set it as 30 days old in order to warn that there is a new version.
|
||||||
|
SP.putLong(R.string.key_last_time_this_version_detected, System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30))
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are good, only check once every day.
|
||||||
|
if(System.currentTimeMillis() > SP.getLong(R.string.key_last_time_this_version_detected, 0) + CHECK_EVERY){
|
||||||
|
checkVersion()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
private fun checkVersion() = if (isConnected()) {
|
||||||
|
Thread {
|
||||||
|
try {
|
||||||
|
val request = HttpGet("https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/build.gradle")
|
||||||
|
val response: HttpResponse = DefaultHttpClient().execute(request)
|
||||||
|
val version: String? = response.entity.content?.findVersion()
|
||||||
|
compareWithCurrentVersion(version, BuildConfig.VERSION_NAME)
|
||||||
|
} catch (e: IOException) {
|
||||||
|
log.debug("Github master version check error: $e")
|
||||||
|
}
|
||||||
|
}.start()
|
||||||
|
} else
|
||||||
|
log.debug("Github master version no checked. No connectivity")
|
||||||
|
|
||||||
|
fun compareWithCurrentVersion(newVersion: String?, currentVersion: String) {
|
||||||
|
val comparison: Int? = newVersion?.versionStrip()?.compareTo(currentVersion.versionStrip())
|
||||||
|
when {
|
||||||
|
comparison == null -> onVersionNotDetectable()
|
||||||
|
comparison == 0 -> onSameVersionDetected()
|
||||||
|
comparison > 0 -> onNewVersionDetected(currentVersion = currentVersion, newVersion = newVersion)
|
||||||
|
else -> onOlderVersionDetected()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun onOlderVersionDetected() {
|
||||||
|
log.debug("Version newer than master. Are you developer?")
|
||||||
|
SP.putLong(R.string.key_last_time_this_version_detected, System.currentTimeMillis())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onSameVersionDetected() {
|
||||||
|
SP.putLong(R.string.key_last_time_this_version_detected, System.currentTimeMillis())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onVersionNotDetectable() {
|
||||||
|
log.debug("fetch failed, ignore and smartcast to non-null")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onNewVersionDetected(currentVersion: String, newVersion: String?) {
|
||||||
|
val now = System.currentTimeMillis()
|
||||||
|
if(now > SP.getLong(R.string.key_last_versionchecker_warning, 0) + WARN_EVERY) {
|
||||||
|
log.debug("Version ${currentVersion} outdated. Found $newVersion")
|
||||||
|
val notification = Notification(Notification.NEWVERSIONDETECTED, String.format(MainApp.gs(R.string.versionavailable), newVersion.toString()), Notification.LOW)
|
||||||
|
MainApp.bus().post(EventNewNotification(notification))
|
||||||
|
SP.putLong(R.string.key_last_versionchecker_warning, now)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun String.versionStrip() = this.mapNotNull {
|
||||||
|
when (it) {
|
||||||
|
in '0'..'9' -> it
|
||||||
|
'.' -> it
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
}.joinToString(separator = "")
|
||||||
|
|
||||||
|
|
||||||
|
val CHECK_EVERY = TimeUnit.DAYS.toMillis(1)
|
||||||
|
val WARN_EVERY = TimeUnit.DAYS.toMillis(1)
|
|
@ -625,10 +625,12 @@ public class ActionStringHandler {
|
||||||
}
|
}
|
||||||
generateTempTarget(duration, low, high);
|
generateTempTarget(duration, low, high);
|
||||||
} else if ("wizard2".equals(act[0])) {
|
} else if ("wizard2".equals(act[0])) {
|
||||||
|
if (lastBolusWizard != null) {
|
||||||
//use last calculation as confirmed string matches
|
//use last calculation as confirmed string matches
|
||||||
|
|
||||||
doBolus(lastBolusWizard.calculatedTotalInsulin, lastBolusWizard.carbs);
|
doBolus(lastBolusWizard.calculatedTotalInsulin, lastBolusWizard.carbs);
|
||||||
lastBolusWizard = null;
|
lastBolusWizard = null;
|
||||||
|
}
|
||||||
} else if ("bolus".equals(act[0])) {
|
} else if ("bolus".equals(act[0])) {
|
||||||
double insulin = SafeParse.stringToDouble(act[1]);
|
double insulin = SafeParse.stringToDouble(act[1]);
|
||||||
int carbs = SafeParse.stringToInt(act[2]);
|
int carbs = SafeParse.stringToInt(act[2]);
|
||||||
|
|
|
@ -32,17 +32,11 @@ import com.google.android.gms.wearable.PutDataRequest;
|
||||||
import com.google.android.gms.wearable.Wearable;
|
import com.google.android.gms.wearable.Wearable;
|
||||||
import com.google.android.gms.wearable.WearableListenerService;
|
import com.google.android.gms.wearable.WearableListenerService;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.db.BgReading;
|
import info.nightscout.androidaps.db.BgReading;
|
||||||
|
@ -55,15 +49,11 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus;
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
|
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
|
||||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.Treatment;
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
import info.nightscout.androidaps.utils.SafeParse;
|
import info.nightscout.androidaps.utils.SafeParse;
|
||||||
|
@ -482,6 +472,8 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
||||||
|
|
||||||
for (; runningTime < now; runningTime += 5 * 60 * 1000) {
|
for (; runningTime < now; runningTime += 5 * 60 * 1000) {
|
||||||
Profile profileTB = ProfileFunctions.getInstance().getProfile(runningTime);
|
Profile profileTB = ProfileFunctions.getInstance().getProfile(runningTime);
|
||||||
|
if (profileTB == null)
|
||||||
|
return;
|
||||||
//basal rate
|
//basal rate
|
||||||
endBasalValue = profile.getBasal(runningTime);
|
endBasalValue = profile.getBasal(runningTime);
|
||||||
if (endBasalValue != beginBasalValue) {
|
if (endBasalValue != beginBasalValue) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -66,7 +67,7 @@ public class AutosensData implements DataPointWithLabelInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("CarbsInPast: time: %s carbs: %.02f min5minCI: %.02f remaining: %.2f", new Date(time).toLocaleString(), carbs, min5minCarbImpact, remaining);
|
return String.format(Locale.ENGLISH, "CarbsInPast: time: %s carbs: %.02f min5minCI: %.02f remaining: %.2f", new Date(time).toLocaleString(), carbs, min5minCarbImpact, remaining);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +102,7 @@ public class AutosensData implements DataPointWithLabelInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("AutosensData: %s pastSensitivity=%s delta=%.02f avgDelta=%.02f bgi=%.02f deviation=%.02f avgDeviation=%.02f absorbed=%.02f carbsFromBolus=%.02f cob=%.02f autosensRatio=%.02f slopeFromMaxDeviation=%.02f slopeFromMinDeviation=%.02f activeCarbsList=%s",
|
return String.format(Locale.ENGLISH, "AutosensData: %s pastSensitivity=%s delta=%.02f avgDelta=%.02f bgi=%.02f deviation=%.02f avgDeviation=%.02f absorbed=%.02f carbsFromBolus=%.02f cob=%.02f autosensRatio=%.02f slopeFromMaxDeviation=%.02f slopeFromMinDeviation=%.02f activeCarbsList=%s",
|
||||||
new Date(time).toLocaleString(), pastSensitivity, delta, avgDelta, bgi, deviation, avgDeviation, absorbed, carbsFromBolus, cob, autosensResult.ratio, slopeFromMaxDeviation, slopeFromMinDeviation, activeCarbsList.toString());
|
new Date(time).toLocaleString(), pastSensitivity, delta, avgDelta, bgi, deviation, avgDeviation, absorbed, carbsFromBolus, cob, autosensResult.ratio, slopeFromMaxDeviation, slopeFromMinDeviation, activeCarbsList.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,180 @@
|
||||||
|
package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
|
||||||
|
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.db.BgReading;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
|
import info.nightscout.androidaps.utils.Round;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mike on 04.01.2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GlucoseStatus {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(GlucoseStatus.class);
|
||||||
|
public double glucose = 0d;
|
||||||
|
public double delta = 0d;
|
||||||
|
public double avgdelta = 0d;
|
||||||
|
public double short_avgdelta = 0d;
|
||||||
|
public double long_avgdelta = 0d;
|
||||||
|
public long date = 0L;
|
||||||
|
|
||||||
|
|
||||||
|
public String log() {
|
||||||
|
return "Glucose: " + DecimalFormatter.to0Decimal(glucose) + " mg/dl " +
|
||||||
|
"Delta: " + DecimalFormatter.to0Decimal(delta) + " mg/dl" +
|
||||||
|
"Short avg. delta: " + " " + DecimalFormatter.to2Decimal(short_avgdelta) + " mg/dl " +
|
||||||
|
"Long avg. delta: " + DecimalFormatter.to2Decimal(long_avgdelta) + " mg/dl";
|
||||||
|
}
|
||||||
|
|
||||||
|
public GlucoseStatus() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public GlucoseStatus round() {
|
||||||
|
this.glucose = Round.roundTo(this.glucose, 0.1);
|
||||||
|
this.delta = Round.roundTo(this.delta, 0.01);
|
||||||
|
this.avgdelta = Round.roundTo(this.avgdelta, 0.01);
|
||||||
|
this.short_avgdelta = Round.roundTo(this.short_avgdelta, 0.01);
|
||||||
|
this.long_avgdelta = Round.roundTo(this.long_avgdelta, 0.01);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static GlucoseStatus getGlucoseStatusData() {
|
||||||
|
return getGlucoseStatusData(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static GlucoseStatus getGlucoseStatusData(boolean allowOldData) {
|
||||||
|
// load 45min
|
||||||
|
//long fromtime = DateUtil.now() - 60 * 1000L * 45;
|
||||||
|
//List<BgReading> data = MainApp.getDbHelper().getBgreadingsDataFromTime(fromtime, false);
|
||||||
|
|
||||||
|
synchronized (IobCobCalculatorPlugin.getPlugin().getDataLock()) {
|
||||||
|
|
||||||
|
List<BgReading> data = IobCobCalculatorPlugin.getPlugin().getBgReadings();
|
||||||
|
|
||||||
|
if (data == null) {
|
||||||
|
if (L.isEnabled(L.GLUCOSE))
|
||||||
|
log.debug("data=null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sizeRecords = data.size();
|
||||||
|
if (sizeRecords == 0) {
|
||||||
|
if (L.isEnabled(L.GLUCOSE))
|
||||||
|
log.debug("sizeRecords==0");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.get(0).date < DateUtil.now() - 7 * 60 * 1000L && !allowOldData) {
|
||||||
|
if (L.isEnabled(L.GLUCOSE))
|
||||||
|
log.debug("olddata");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BgReading now = data.get(0);
|
||||||
|
long now_date = now.date;
|
||||||
|
double change;
|
||||||
|
|
||||||
|
if (sizeRecords == 1) {
|
||||||
|
GlucoseStatus status = new GlucoseStatus();
|
||||||
|
status.glucose = now.value;
|
||||||
|
status.short_avgdelta = 0d;
|
||||||
|
status.delta = 0d;
|
||||||
|
status.long_avgdelta = 0d;
|
||||||
|
status.avgdelta = 0d; // for OpenAPS MA
|
||||||
|
status.date = now_date;
|
||||||
|
if (L.isEnabled(L.GLUCOSE))
|
||||||
|
log.debug("sizeRecords==1");
|
||||||
|
return status.round();
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Double> now_value_list = new ArrayList<>();
|
||||||
|
ArrayList<Double> last_deltas = new ArrayList<>();
|
||||||
|
ArrayList<Double> short_deltas = new ArrayList<>();
|
||||||
|
ArrayList<Double> long_deltas = new ArrayList<>();
|
||||||
|
|
||||||
|
// Use the latest sgv value in the now calculations
|
||||||
|
now_value_list.add(now.value);
|
||||||
|
|
||||||
|
for (int i = 1; i < sizeRecords; i++) {
|
||||||
|
if (data.get(i).value > 38) {
|
||||||
|
BgReading then = data.get(i);
|
||||||
|
long then_date = then.date;
|
||||||
|
double avgdelta;
|
||||||
|
long minutesago;
|
||||||
|
|
||||||
|
minutesago = Math.round((now_date - then_date) / (1000d * 60));
|
||||||
|
// multiply by 5 to get the same units as delta, i.e. mg/dL/5m
|
||||||
|
change = now.value - then.value;
|
||||||
|
avgdelta = change / minutesago * 5;
|
||||||
|
|
||||||
|
if (L.isEnabled(L.GLUCOSE))
|
||||||
|
log.debug(then.toString() + " minutesago=" + minutesago + " avgdelta=" + avgdelta);
|
||||||
|
|
||||||
|
// use the average of all data points in the last 2.5m for all further "now" calculations
|
||||||
|
if (0 < minutesago && minutesago < 2.5) {
|
||||||
|
// Keep and average all values within the last 2.5 minutes
|
||||||
|
now_value_list.add(then.value);
|
||||||
|
now.value = average(now_value_list);
|
||||||
|
// short_deltas are calculated from everything ~5-15 minutes ago
|
||||||
|
} else if (2.5 < minutesago && minutesago < 17.5) {
|
||||||
|
//console.error(minutesago, avgdelta);
|
||||||
|
short_deltas.add(avgdelta);
|
||||||
|
// last_deltas are calculated from everything ~5 minutes ago
|
||||||
|
if (2.5 < minutesago && minutesago < 7.5) {
|
||||||
|
last_deltas.add(avgdelta);
|
||||||
|
}
|
||||||
|
// long_deltas are calculated from everything ~20-40 minutes ago
|
||||||
|
} else if (17.5 < minutesago && minutesago < 42.5) {
|
||||||
|
long_deltas.add(avgdelta);
|
||||||
|
} else {
|
||||||
|
// Do not process any more records after >= 42.5 minutes
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GlucoseStatus status = new GlucoseStatus();
|
||||||
|
status.glucose = now.value;
|
||||||
|
status.date = now_date;
|
||||||
|
|
||||||
|
status.short_avgdelta = average(short_deltas);
|
||||||
|
|
||||||
|
if (last_deltas.isEmpty()) {
|
||||||
|
status.delta = status.short_avgdelta;
|
||||||
|
} else {
|
||||||
|
status.delta = average(last_deltas);
|
||||||
|
}
|
||||||
|
|
||||||
|
status.long_avgdelta = average(long_deltas);
|
||||||
|
status.avgdelta = status.short_avgdelta; // for OpenAPS MA
|
||||||
|
|
||||||
|
if (L.isEnabled(L.GLUCOSE))
|
||||||
|
log.debug(status.log());
|
||||||
|
return status.round();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double average(ArrayList<Double> array) {
|
||||||
|
double sum = 0d;
|
||||||
|
|
||||||
|
if (array.size() == 0)
|
||||||
|
return 0d;
|
||||||
|
|
||||||
|
for (Double value : array) {
|
||||||
|
sum += value;
|
||||||
|
}
|
||||||
|
return sum / array.size();
|
||||||
|
}
|
||||||
|
}
|
|
@ -65,7 +65,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
private volatile List<BgReading> bgReadings = null; // newest at index 0
|
private volatile List<BgReading> bgReadings = null; // newest at index 0
|
||||||
private volatile List<BgReading> bucketed_data = null;
|
private volatile List<BgReading> bucketed_data = null;
|
||||||
|
|
||||||
final Object dataLock = new Object();
|
private final Object dataLock = new Object();
|
||||||
|
|
||||||
boolean stopCalculationTrigger = false;
|
boolean stopCalculationTrigger = false;
|
||||||
private Thread thread = null;
|
private Thread thread = null;
|
||||||
|
@ -108,6 +108,10 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
return bucketed_data;
|
return bucketed_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object getDataLock() {
|
||||||
|
return dataLock;
|
||||||
|
}
|
||||||
|
|
||||||
// roundup to whole minute
|
// roundup to whole minute
|
||||||
public static long roundUpTime(long time) {
|
public static long roundUpTime(long time) {
|
||||||
if (time % 60000 == 0)
|
if (time % 60000 == 0)
|
||||||
|
@ -496,6 +500,10 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
log.debug("AUTOSENSDATA null: Exception catched (" + reason + ")");
|
log.debug("AUTOSENSDATA null: Exception catched (" + reason + ")");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (data == null) {
|
||||||
|
log.debug("AUTOSENSDATA null: data==null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) {
|
if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) {
|
||||||
if (L.isEnabled(L.AUTOSENS))
|
if (L.isEnabled(L.AUTOSENS))
|
||||||
log.debug("AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastdata=" + DateUtil.dateAndTimeString(data.time));
|
log.debug("AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastdata=" + DateUtil.dateAndTimeString(data.time));
|
||||||
|
@ -626,6 +634,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
log.debug("Invalidating cached data because of new profile. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
|
log.debug("Invalidating cached data because of new profile. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
|
||||||
iobTable = new LongSparseArray<>();
|
iobTable = new LongSparseArray<>();
|
||||||
autosensDataTable = new LongSparseArray<>();
|
autosensDataTable = new LongSparseArray<>();
|
||||||
|
basalDataTable = new LongSparseArray<>();
|
||||||
}
|
}
|
||||||
runCalculation("onNewProfile", System.currentTimeMillis(), false, true, ev);
|
runCalculation("onNewProfile", System.currentTimeMillis(), false, true, ev);
|
||||||
}
|
}
|
||||||
|
@ -648,9 +657,10 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
stopCalculation("onEventPreferenceChange");
|
stopCalculation("onEventPreferenceChange");
|
||||||
synchronized (dataLock) {
|
synchronized (dataLock) {
|
||||||
if (L.isEnabled(L.AUTOSENS))
|
if (L.isEnabled(L.AUTOSENS))
|
||||||
log.debug("Invalidating cached data because of preference change. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
|
log.debug("Invalidating cached data because of preference change. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records" + " BasalData: " + basalDataTable.size() + " records");
|
||||||
iobTable = new LongSparseArray<>();
|
iobTable = new LongSparseArray<>();
|
||||||
autosensDataTable = new LongSparseArray<>();
|
autosensDataTable = new LongSparseArray<>();
|
||||||
|
basalDataTable = new LongSparseArray<>();
|
||||||
}
|
}
|
||||||
runCalculation("onEventPreferenceChange", System.currentTimeMillis(), false, true, ev);
|
runCalculation("onEventPreferenceChange", System.currentTimeMillis(), false, true, ev);
|
||||||
}
|
}
|
||||||
|
@ -726,6 +736,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
log.debug("Clearing cached data.");
|
log.debug("Clearing cached data.");
|
||||||
iobTable = new LongSparseArray<>();
|
iobTable = new LongSparseArray<>();
|
||||||
autosensDataTable = new LongSparseArray<>();
|
autosensDataTable = new LongSparseArray<>();
|
||||||
|
basalDataTable = new LongSparseArray<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.support.v4.util.LongSparseArray;
|
import android.support.v4.util.LongSparseArray;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -16,7 +14,6 @@ import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
@ -26,13 +23,13 @@ import info.nightscout.androidaps.db.BgReading;
|
||||||
import info.nightscout.androidaps.db.TempTarget;
|
import info.nightscout.androidaps.db.TempTarget;
|
||||||
import info.nightscout.androidaps.events.Event;
|
import info.nightscout.androidaps.events.Event;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
|
||||||
import info.nightscout.androidaps.plugins.treatments.Treatment;
|
import info.nightscout.androidaps.plugins.treatments.Treatment;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
|
@ -99,7 +96,7 @@ public class IobCobOref1Thread extends Thread {
|
||||||
|
|
||||||
long oldestTimeWithData = iobCobCalculatorPlugin.calculateDetectionStart(end, limitDataToOldestAvailable);
|
long oldestTimeWithData = iobCobCalculatorPlugin.calculateDetectionStart(end, limitDataToOldestAvailable);
|
||||||
|
|
||||||
synchronized (iobCobCalculatorPlugin.dataLock) {
|
synchronized (iobCobCalculatorPlugin.getDataLock()) {
|
||||||
if (bgDataReload) {
|
if (bgDataReload) {
|
||||||
iobCobCalculatorPlugin.loadBgData(end);
|
iobCobCalculatorPlugin.loadBgData(end);
|
||||||
iobCobCalculatorPlugin.createBucketedData();
|
iobCobCalculatorPlugin.createBucketedData();
|
||||||
|
@ -224,13 +221,6 @@ public class IobCobOref1Thread extends Thread {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
FabricPrivacy.logException(e);
|
FabricPrivacy.logException(e);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError")
|
|
||||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
|
||||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
|
||||||
.putCustomAttribute("autosensDataTable", iobCobCalculatorPlugin.getAutosensDataTable().toString())
|
|
||||||
.putCustomAttribute("for_data", ">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString())
|
|
||||||
.putCustomAttribute("past", past)
|
|
||||||
);
|
|
||||||
log.debug(autosensDataTable.toString());
|
log.debug(autosensDataTable.toString());
|
||||||
log.debug(bucketed_data.toString());
|
log.debug(bucketed_data.toString());
|
||||||
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
||||||
|
|
|
@ -5,8 +5,6 @@ import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.support.v4.util.LongSparseArray;
|
import android.support.v4.util.LongSparseArray;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -14,7 +12,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
@ -24,13 +21,13 @@ import info.nightscout.androidaps.db.BgReading;
|
||||||
import info.nightscout.androidaps.events.Event;
|
import info.nightscout.androidaps.events.Event;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
|
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
|
||||||
import info.nightscout.androidaps.plugins.treatments.Treatment;
|
import info.nightscout.androidaps.plugins.treatments.Treatment;
|
||||||
|
@ -98,7 +95,7 @@ public class IobCobThread extends Thread {
|
||||||
|
|
||||||
long oldestTimeWithData = iobCobCalculatorPlugin.calculateDetectionStart(end, limitDataToOldestAvailable);
|
long oldestTimeWithData = iobCobCalculatorPlugin.calculateDetectionStart(end, limitDataToOldestAvailable);
|
||||||
|
|
||||||
synchronized (iobCobCalculatorPlugin.dataLock) {
|
synchronized (iobCobCalculatorPlugin.getDataLock()) {
|
||||||
if (bgDataReload) {
|
if (bgDataReload) {
|
||||||
iobCobCalculatorPlugin.loadBgData(end);
|
iobCobCalculatorPlugin.loadBgData(end);
|
||||||
iobCobCalculatorPlugin.createBucketedData();
|
iobCobCalculatorPlugin.createBucketedData();
|
||||||
|
@ -223,13 +220,6 @@ public class IobCobThread extends Thread {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
FabricPrivacy.logException(e);
|
FabricPrivacy.logException(e);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError")
|
|
||||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
|
||||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
|
||||||
.putCustomAttribute("autosensDataTable", iobCobCalculatorPlugin.getAutosensDataTable().toString())
|
|
||||||
.putCustomAttribute("for_data", ">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString())
|
|
||||||
.putCustomAttribute("past", past)
|
|
||||||
);
|
|
||||||
log.debug(autosensDataTable.toString());
|
log.debug(autosensDataTable.toString());
|
||||||
log.debug(bucketed_data.toString());
|
log.debug(bucketed_data.toString());
|
||||||
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
|
||||||
|
|
|
@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
||||||
|
@ -31,7 +33,7 @@ public class MsgSettingBasal extends MessageBase {
|
||||||
|
|
||||||
if (L.isEnabled(L.PUMPCOMM))
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
for (int index = 0; index < 24; index++) {
|
for (int index = 0; index < 24; index++) {
|
||||||
log.debug("Basal " + String.format("%02d", index) + "h: " + pump.pumpProfiles[pump.activeProfile][index]);
|
log.debug("Basal " + String.format(Locale.ENGLISH, "%02d", index) + "h: " + pump.pumpProfiles[pump.activeProfile][index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
||||||
|
|
||||||
|
@ -55,7 +57,7 @@ public class MsgSettingBasalProfileAll extends MessageBase {
|
||||||
for (int profile = 0; profile < 4; profile++) {
|
for (int profile = 0; profile < 4; profile++) {
|
||||||
for (int index = 0; index < 48; index++) {
|
for (int index = 0; index < 48; index++) {
|
||||||
try {
|
try {
|
||||||
log.debug("Basal profile " + profile + ": " + String.format("%02d", index) + "h: " + pump.pumpProfiles[profile][index]);
|
log.debug("Basal profile " + profile + ": " + String.format(Locale.ENGLISH, "%02d", index) + "h: " + pump.pumpProfiles[profile][index]);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
log.error("Unhandled exception" , e);
|
log.error("Unhandled exception" , e);
|
||||||
}
|
}
|
||||||
|
@ -67,8 +69,8 @@ public class MsgSettingBasalProfileAll extends MessageBase {
|
||||||
//this is absurd pump.pumpProfiles[profile][index] returns nullPointerException
|
//this is absurd pump.pumpProfiles[profile][index] returns nullPointerException
|
||||||
try {
|
try {
|
||||||
log.debug("Basal profile " + profile + ": " +
|
log.debug("Basal profile " + profile + ": " +
|
||||||
String.format("%02d", (index / 2)) +
|
String.format(Locale.ENGLISH, "%02d", (index / 2)) +
|
||||||
":" + String.format("%02d", (index % 2) * 30) + " : " +
|
":" + String.format(Locale.ENGLISH, "%02d", (index % 2) * 30) + " : " +
|
||||||
pump.pumpProfiles[profile][index]);
|
pump.pumpProfiles[profile][index]);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
log.error("Unhandled exception" , e);
|
log.error("Unhandled exception" , e);
|
||||||
|
|
|
@ -18,14 +18,14 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -166,7 +166,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
||||||
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
MainApp.bus().post(new EventProfileSwitchChange());
|
MainApp.bus().post(new EventProfileNeedsUpdate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.pump.danaRKorean.comm;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase;
|
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase;
|
||||||
|
@ -55,15 +57,15 @@ public class MsgSettingBasalProfileAll_k extends MessageBase {
|
||||||
if (pump.basal48Enable) {
|
if (pump.basal48Enable) {
|
||||||
for (int profile = 0; profile < 4; profile++) {
|
for (int profile = 0; profile < 4; profile++) {
|
||||||
for (int index = 0; index < 24; index++) {
|
for (int index = 0; index < 24; index++) {
|
||||||
log.debug("Basal profile " + profile + ": " + String.format("%02d", index) + "h: " + pump.pumpProfiles[profile][index]);
|
log.debug("Basal profile " + profile + ": " + String.format(Locale.ENGLISH, "%02d", index) + "h: " + pump.pumpProfiles[profile][index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int profile = 0; profile < 4; profile++) {
|
for (int profile = 0; profile < 4; profile++) {
|
||||||
for (int index = 0; index < 48; index++) {
|
for (int index = 0; index < 48; index++) {
|
||||||
log.debug("Basal profile " + profile + ": " +
|
log.debug("Basal profile " + profile + ": " +
|
||||||
String.format("%02d", (index / 2)) +
|
String.format(Locale.ENGLISH, "%02d", (index / 2)) +
|
||||||
":" + String.format("%02d", (index % 2) * 30) + " : " +
|
":" + String.format(Locale.ENGLISH, "%02d", (index % 2) * 30) + " : " +
|
||||||
pump.pumpProfiles[profile][index]);
|
pump.pumpProfiles[profile][index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.pump.danaRKorean.comm;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase;
|
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase;
|
||||||
|
@ -32,7 +34,7 @@ public class MsgSettingBasal_k extends MessageBase {
|
||||||
|
|
||||||
if (L.isEnabled(L.PUMPCOMM))
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
for (int index = 0; index < 24; index++) {
|
for (int index = 0; index < 24; index++) {
|
||||||
log.debug("Basal " + String.format("%02d", index) + "h: " + pump.pumpProfiles[pump.activeProfile][index]);
|
log.debug("Basal " + String.format(Locale.ENGLISH, "%02d", index) + "h: " + pump.pumpProfiles[pump.activeProfile][index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,14 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
||||||
|
@ -171,7 +171,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
||||||
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
MainApp.bus().post(new EventProfileSwitchChange());
|
MainApp.bus().post(new EventProfileNeedsUpdate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.cozmo.danar.util.BleCommandUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
@ -49,7 +51,7 @@ public class DanaRS_Packet_Basal_Get_Basal_Rate extends DanaRS_Packet {
|
||||||
log.debug("Max basal: " + pump.maxBasal + " U");
|
log.debug("Max basal: " + pump.maxBasal + " U");
|
||||||
log.debug("Basal step: " + pump.basalStep + " U");
|
log.debug("Basal step: " + pump.basalStep + " U");
|
||||||
for (int index = 0; index < 24; index++)
|
for (int index = 0; index < 24; index++)
|
||||||
log.debug("Basal " + String.format("%02d", index) + "h: " + pump.pumpProfiles[pump.activeProfile][index]);
|
log.debug("Basal " + String.format(Locale.ENGLISH, "%02d", index) + "h: " + pump.pumpProfiles[pump.activeProfile][index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pump.basalStep != 0.01d) {
|
if (pump.basalStep != 0.01d) {
|
||||||
|
|
|
@ -5,6 +5,8 @@ import com.cozmo.danar.util.BleCommandUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ public class DanaRS_Packet_Basal_Get_Profile_Basal_Rate extends DanaRS_Packet {
|
||||||
}
|
}
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
for (int index = 0; index < 24; index++)
|
for (int index = 0; index < 24; index++)
|
||||||
log.debug("Basal " + String.format("%02d", index) + "h: " + pump.pumpProfiles[profileNumber][index]);
|
log.debug("Basal " + String.format(Locale.ENGLISH, "%02d", index) + "h: " + pump.pumpProfiles[profileNumber][index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,14 @@ import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -149,7 +149,7 @@ public class DanaRSService extends Service {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
|
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
|
||||||
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
MainApp.bus().post(new EventProfileSwitchChange());
|
MainApp.bus().post(new EventProfileNeedsUpdate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,15 +19,15 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
@ -188,7 +188,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
||||||
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
MainApp.bus().post(new EventProfileSwitchChange());
|
MainApp.bus().post(new EventProfileNeedsUpdate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.androidaps.db.CareportalEvent;
|
import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.T;
|
import info.nightscout.androidaps.utils.T;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.treatments;
|
package info.nightscout.androidaps.plugins.treatments;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -37,20 +38,21 @@ import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.ErrorHelperActivity;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
import info.nightscout.androidaps.utils.T;
|
import info.nightscout.androidaps.utils.T;
|
||||||
|
|
||||||
|
@ -186,6 +188,10 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
if (insulinInterface == null)
|
if (insulinInterface == null)
|
||||||
return total;
|
return total;
|
||||||
|
|
||||||
|
PumpInterface pumpInterface = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
if (pumpInterface == null)
|
||||||
|
return total;
|
||||||
|
|
||||||
double dia = profile.getDia();
|
double dia = profile.getDia();
|
||||||
|
|
||||||
synchronized (treatments) {
|
synchronized (treatments) {
|
||||||
|
@ -209,7 +215,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ConfigBuilderPlugin.getPlugin().getActivePump().isFakingTempsByExtendedBoluses())
|
if (!pumpInterface.isFakingTempsByExtendedBoluses())
|
||||||
synchronized (extendedBoluses) {
|
synchronized (extendedBoluses) {
|
||||||
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
||||||
ExtendedBolus e = extendedBoluses.get(pos);
|
ExtendedBolus e = extendedBoluses.get(pos);
|
||||||
|
@ -259,7 +265,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
if (t > absorptionTime_ago && t <= now) {
|
if (t > absorptionTime_ago && t <= now) {
|
||||||
if (treatment.carbs >= 1) {
|
if (treatment.carbs >= 1) {
|
||||||
result.carbs += treatment.carbs;
|
result.carbs += treatment.carbs;
|
||||||
if(t > result.lastCarbTime)
|
if (t > result.lastCarbTime)
|
||||||
result.lastCarbTime = t;
|
result.lastCarbTime = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -379,7 +385,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
TemporaryBasal t = tempBasals.get(pos);
|
TemporaryBasal t = tempBasals.get(pos);
|
||||||
if (t.date > time) continue;
|
if (t.date > time) continue;
|
||||||
IobTotal calc;
|
IobTotal calc;
|
||||||
if(truncate && t.end() > truncateTime){
|
if (truncate && t.end() > truncateTime) {
|
||||||
TemporaryBasal dummyTemp = new TemporaryBasal();
|
TemporaryBasal dummyTemp = new TemporaryBasal();
|
||||||
dummyTemp.copyFrom(t);
|
dummyTemp.copyFrom(t);
|
||||||
dummyTemp.cutEndTo(truncateTime);
|
dummyTemp.cutEndTo(truncateTime);
|
||||||
|
@ -398,7 +404,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
ExtendedBolus e = extendedBoluses.get(pos);
|
ExtendedBolus e = extendedBoluses.get(pos);
|
||||||
if (e.date > time) continue;
|
if (e.date > time) continue;
|
||||||
IobTotal calc;
|
IobTotal calc;
|
||||||
if(truncate && e.end() > truncateTime){
|
if (truncate && e.end() > truncateTime) {
|
||||||
ExtendedBolus dummyExt = new ExtendedBolus();
|
ExtendedBolus dummyExt = new ExtendedBolus();
|
||||||
dummyExt.copyFrom(e);
|
dummyExt.copyFrom(e);
|
||||||
dummyExt.cutEndTo(truncateTime);
|
dummyExt.cutEndTo(truncateTime);
|
||||||
|
@ -535,9 +541,10 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
MainApp.instance().startActivity(i);
|
MainApp.instance().startActivity(i);
|
||||||
|
|
||||||
CustomEvent customEvent = new CustomEvent("TreatmentClash");
|
Bundle bundle = new Bundle();
|
||||||
customEvent.putCustomAttribute("status", status);
|
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "TreatmentClash");
|
||||||
FabricPrivacy.getInstance().logCustom(customEvent);
|
bundle.putString(FirebaseAnalytics.Param.VALUE, status);
|
||||||
|
FabricPrivacy.getInstance().logCustom(bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newRecordCreated;
|
return newRecordCreated;
|
||||||
|
|
|
@ -18,7 +18,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -40,7 +39,6 @@ import info.nightscout.androidaps.plugins.treatments.dialogs.WizardInfoDialog;
|
||||||
import info.nightscout.androidaps.services.Intents;
|
import info.nightscout.androidaps.services.Intents;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
|
||||||
import static info.nightscout.androidaps.utils.DateUtil.now;
|
import static info.nightscout.androidaps.utils.DateUtil.now;
|
||||||
|
@ -165,7 +163,6 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View.
|
||||||
TreatmentsPlugin.getPlugin().getService().delete(treatment);
|
TreatmentsPlugin.getPlugin().getService().delete(treatment);
|
||||||
}
|
}
|
||||||
updateGUI();
|
updateGUI();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTreatment"));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||||
|
|
|
@ -15,7 +15,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -32,7 +31,6 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutos
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
|
|
||||||
|
|
||||||
public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
|
public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
|
||||||
|
@ -150,7 +148,6 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
|
||||||
UploadQueue.removeID("dbAdd", _id);
|
UploadQueue.removeID("dbAdd", _id);
|
||||||
}
|
}
|
||||||
MainApp.getDbHelper().delete(extendedBolus);
|
MainApp.getDbHelper().delete(extendedBolus);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveExtendedBolus"));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||||
|
|
|
@ -27,13 +27,13 @@ import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.services.Intents;
|
import info.nightscout.androidaps.services.Intents;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.db.ProfileSwitch;
|
import info.nightscout.androidaps.db.ProfileSwitch;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
|
||||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
|
@ -216,7 +216,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventProfileSwitchChange ev) {
|
public void onStatusEvent(final EventProfileNeedsUpdate ev) {
|
||||||
updateGUI();
|
updateGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -34,7 +33,6 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutos
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
|
|
||||||
|
|
||||||
public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
|
public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
|
||||||
|
@ -175,7 +173,6 @@ public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
|
||||||
UploadQueue.removeID("dbAdd", _id);
|
UploadQueue.removeID("dbAdd", _id);
|
||||||
}
|
}
|
||||||
MainApp.getDbHelper().delete(tempBasal);
|
MainApp.getDbHelper().delete(tempBasal);
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTempBasal"));
|
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||||
builder.show();
|
builder.show();
|
||||||
|
|
|
@ -23,8 +23,8 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.BolusProgressHelperActivity;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressHelperActivity;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
|
@ -381,7 +381,7 @@ public class CommandQueue {
|
||||||
Notification notification = new Notification(Notification.NOT_ENG_MODE_OR_RELEASE, MainApp.gs(R.string.not_eng_mode_or_release), Notification.URGENT);
|
Notification notification = new Notification(Notification.NOT_ENG_MODE_OR_RELEASE, MainApp.gs(R.string.not_eng_mode_or_release), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
callback.result(new PumpEnactResult().success(false).comment(MainApp.gs(R.string.not_eng_mode_or_release))).run();
|
callback.result(new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.not_eng_mode_or_release))).run();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ public class CommandQueue {
|
||||||
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.gs(R.string.basalvaluebelowminimum), Notification.URGENT);
|
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.gs(R.string.basalvaluebelowminimum), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
callback.result(new PumpEnactResult().success(false).comment(MainApp.gs(R.string.basalvaluebelowminimum))).run();
|
callback.result(new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.basalvaluebelowminimum))).run();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
|
||||||
import info.nightscout.androidaps.queue.events.EventQueueChanged;
|
import info.nightscout.androidaps.queue.events.EventQueueChanged;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
import info.nightscout.androidaps.utils.T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 09.11.2017.
|
* Created by mike on 09.11.2017.
|
||||||
|
@ -28,9 +29,8 @@ public class QueueThread extends Thread {
|
||||||
|
|
||||||
private CommandQueue queue;
|
private CommandQueue queue;
|
||||||
|
|
||||||
private long lastCommandTime = 0;
|
|
||||||
private boolean connectLogged = false;
|
private boolean connectLogged = false;
|
||||||
public boolean waitingForDisconnect = false;
|
boolean waitingForDisconnect = false;
|
||||||
|
|
||||||
private PowerManager.WakeLock mWakeLock;
|
private PowerManager.WakeLock mWakeLock;
|
||||||
|
|
||||||
|
@ -41,14 +41,17 @@ public class QueueThread extends Thread {
|
||||||
Context context = MainApp.instance().getApplicationContext();
|
Context context = MainApp.instance().getApplicationContext();
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "QueueThread");
|
if (powerManager != null)
|
||||||
|
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:QueueThread");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void run() {
|
public final void run() {
|
||||||
mWakeLock.acquire();
|
if (mWakeLock != null)
|
||||||
|
mWakeLock.acquire(T.mins(10).msecs());
|
||||||
MainApp.bus().post(new EventQueueChanged());
|
MainApp.bus().post(new EventQueueChanged());
|
||||||
|
long lastCommandTime;
|
||||||
long connectionStartTime = lastCommandTime = System.currentTimeMillis();
|
long connectionStartTime = lastCommandTime = System.currentTimeMillis();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -72,7 +75,7 @@ public class QueueThread extends Thread {
|
||||||
|
|
||||||
//BLUETOOTH-WATCHDOG
|
//BLUETOOTH-WATCHDOG
|
||||||
boolean watchdog = SP.getBoolean(R.string.key_btwatchdog, false);
|
boolean watchdog = SP.getBoolean(R.string.key_btwatchdog, false);
|
||||||
long last_watchdog = SP.getLong(R.string.key_btwatchdog_lastbark, 0l);
|
long last_watchdog = SP.getLong(R.string.key_btwatchdog_lastbark, 0L);
|
||||||
watchdog = watchdog && System.currentTimeMillis() - last_watchdog > (Constants.MIN_WATCHDOG_INTERVAL_IN_SECONDS * 1000);
|
watchdog = watchdog && System.currentTimeMillis() - last_watchdog > (Constants.MIN_WATCHDOG_INTERVAL_IN_SECONDS * 1000);
|
||||||
if (watchdog) {
|
if (watchdog) {
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
|
@ -170,6 +173,7 @@ public class QueueThread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
if (mWakeLock != null)
|
||||||
mWakeLock.release();
|
mWakeLock.release();
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("thread end");
|
log.debug("thread end");
|
||||||
|
|
|
@ -8,7 +8,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
|
|
|
@ -7,15 +7,13 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
|
@ -46,13 +44,12 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent rIntent) {
|
public void onReceive(Context context, Intent rIntent) {
|
||||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "");
|
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:KeepAliveReciever");
|
||||||
wl.acquire();
|
wl.acquire();
|
||||||
|
|
||||||
LocalAlertUtils.shortenSnoozeInterval();
|
LocalAlertUtils.shortenSnoozeInterval();
|
||||||
LocalAlertUtils.checkStaleBGAlert();
|
LocalAlertUtils.checkStaleBGAlert();
|
||||||
checkPump();
|
checkPump();
|
||||||
FabricPrivacy.uploadDailyStats();
|
|
||||||
|
|
||||||
if (L.isEnabled(L.CORE))
|
if (L.isEnabled(L.CORE))
|
||||||
log.debug("KeepAlive received");
|
log.debug("KeepAlive received");
|
||||||
|
@ -76,7 +73,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
MainApp.bus().post(new EventProfileSwitchChange());
|
MainApp.bus().post(new EventProfileNeedsUpdate());
|
||||||
} else if (isStatusOutdated && !pump.isBusy()) {
|
} else if (isStatusOutdated && !pump.isBusy()) {
|
||||||
lastReadStatus = System.currentTimeMillis();
|
lastReadStatus = System.currentTimeMillis();
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("KeepAlive. Status outdated.", null);
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("KeepAlive. Status outdated.", null);
|
||||||
|
@ -87,7 +84,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
if (lastRun != 0 && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {
|
if (lastRun != 0 && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {
|
||||||
log.error("KeepAlive fail");
|
log.error("KeepAlive fail");
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("KeepAliveFail"));
|
FabricPrivacy.getInstance().logCustom("KeepAliveFail");
|
||||||
}
|
}
|
||||||
lastRun = System.currentTimeMillis();
|
lastRun = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package info.nightscout.androidaps.receivers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forward received SMS intents. This is a separate class, because unlike local broadcasts handled by DataReceiver,
|
||||||
|
* receiving SMS requires a special permission in the manifest, which necessitates a separate receiver.
|
||||||
|
*/
|
||||||
|
public class SmsReceiver extends DataReceiver {}
|
|
@ -75,8 +75,11 @@ public class AlarmSoundService extends Service {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
if (player != null) {
|
||||||
player.stop();
|
player.stop();
|
||||||
player.release();
|
player.release();
|
||||||
|
}
|
||||||
|
|
||||||
if (L.isEnabled(L.CORE))
|
if (L.isEnabled(L.CORE))
|
||||||
log.debug("onDestroy");
|
log.debug("onDestroy");
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import info.nightscout.androidaps.MainActivity;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.events.EventProfileStoreChanged;
|
import info.nightscout.androidaps.events.EventProfileStoreChanged;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.plugins.constraints.objectives.events.EventObjectivesSaved;
|
import info.nightscout.androidaps.plugins.constraints.objectives.events.EventObjectivesSaved;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientStatus;
|
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientStatus;
|
||||||
|
@ -115,7 +115,7 @@ public class SetupWizardActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onEventProfileSwitchChange(EventProfileSwitchChange ignored) {
|
public void onEventProfileSwitchChange(EventProfileNeedsUpdate ignored) {
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.utils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.db.TempTarget;
|
import info.nightscout.androidaps.db.TempTarget;
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
package info.nightscout.androidaps.utils;
|
package info.nightscout.androidaps.utils;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.crashlytics.android.answers.Answers;
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
import info.nightscout.androidaps.BuildConfig;
|
||||||
import info.nightscout.androidaps.Config;
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by jamorham on 21/02/2018.
|
* Created by jamorham on 21/02/2018.
|
||||||
|
@ -21,8 +22,8 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class FabricPrivacy {
|
public class FabricPrivacy {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||||
|
|
||||||
private static final String TAG = "FabricPrivacy";
|
|
||||||
private static volatile FabricPrivacy instance;
|
private static volatile FabricPrivacy instance;
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +46,8 @@ public class FabricPrivacy {
|
||||||
final Crashlytics crashlytics = Crashlytics.getInstance();
|
final Crashlytics crashlytics = Crashlytics.getInstance();
|
||||||
crashlytics.core.logException(throwable);
|
crashlytics.core.logException(throwable);
|
||||||
} catch (NullPointerException | IllegalStateException e) {
|
} catch (NullPointerException | IllegalStateException e) {
|
||||||
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + throwable);
|
if (L.isEnabled(L.CORE))
|
||||||
|
log.debug("Ignoring opted out non-initialized log: " + throwable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +57,8 @@ public class FabricPrivacy {
|
||||||
final Crashlytics crashlytics = Crashlytics.getInstance();
|
final Crashlytics crashlytics = Crashlytics.getInstance();
|
||||||
crashlytics.core.log(msg);
|
crashlytics.core.log(msg);
|
||||||
} catch (NullPointerException | IllegalStateException e) {
|
} catch (NullPointerException | IllegalStateException e) {
|
||||||
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + msg);
|
if (L.isEnabled(L.CORE))
|
||||||
|
log.debug("Ignoring opted out non-initialized log: " + msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +68,8 @@ public class FabricPrivacy {
|
||||||
final Crashlytics crashlytics = Crashlytics.getInstance();
|
final Crashlytics crashlytics = Crashlytics.getInstance();
|
||||||
crashlytics.core.log(priority, tag, msg);
|
crashlytics.core.log(priority, tag, msg);
|
||||||
} catch (NullPointerException | IllegalStateException e) {
|
} catch (NullPointerException | IllegalStateException e) {
|
||||||
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + msg);
|
if (L.isEnabled(L.CORE))
|
||||||
|
log.debug("Ignoring opted out non-initialized log: " + msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,68 +77,67 @@ public class FabricPrivacy {
|
||||||
return SP.getBoolean("enable_fabric", true);
|
return SP.getBoolean("enable_fabric", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Answers logCustom
|
// Analytics logCustom
|
||||||
public void logCustom(CustomEvent event) {
|
public void logCustom(Bundle event) {
|
||||||
try {
|
try {
|
||||||
final Answers answers = Answers.getInstance();
|
|
||||||
if (fabricEnabled()) {
|
if (fabricEnabled()) {
|
||||||
answers.logCustom(event);
|
MainApp.getFirebaseAnalytics().logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, event);
|
||||||
} else {
|
} else {
|
||||||
android.util.Log.d(TAG, "Ignoring recently opted-out event: " + event.toString());
|
if (L.isEnabled(L.CORE))
|
||||||
|
log.debug("Ignoring recently opted-out event: " + event.toString());
|
||||||
}
|
}
|
||||||
} catch (NullPointerException | IllegalStateException e) {
|
} catch (NullPointerException | IllegalStateException e) {
|
||||||
android.util.Log.d(TAG, "Ignoring opted-out non-initialized event: " + event.toString());
|
if (L.isEnabled(L.CORE))
|
||||||
|
log.debug("Ignoring opted-out non-initialized event: " + event.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void uploadDailyStats() {
|
// Analytics logCustom
|
||||||
|
public void logCustom(String event) {
|
||||||
|
try {
|
||||||
|
if (fabricEnabled()) {
|
||||||
|
MainApp.getFirebaseAnalytics().logEvent(event, new Bundle());
|
||||||
|
} else {
|
||||||
|
if (L.isEnabled(L.CORE))
|
||||||
|
log.debug("Ignoring recently opted-out event: " + event);
|
||||||
|
}
|
||||||
|
} catch (NullPointerException | IllegalStateException e) {
|
||||||
|
if (L.isEnabled(L.CORE))
|
||||||
|
log.debug("Ignoring opted-out non-initialized event: " + event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setUserStats() {
|
||||||
if (!fabricEnabled()) return;
|
if (!fabricEnabled()) return;
|
||||||
|
|
||||||
long lastUploadDay = SP.getLong(MainApp.gs(R.string.key_plugin_stats_report_timestamp), 0L);
|
String closedLoopEnabled = MainApp.getConstraintChecker().isClosedLoopAllowed().value() ? "CLOSED_LOOP_ENABLED" : "CLOSED_LOOP_DISABLED";
|
||||||
|
// Size is limited to 36 chars
|
||||||
|
String remote = BuildConfig.REMOTE
|
||||||
|
.replace("https://","")
|
||||||
|
.replace("http://","")
|
||||||
|
.replace(".git", "")
|
||||||
|
.replace(".com/", ":")
|
||||||
|
.replace(".org/", ":")
|
||||||
|
.replace(".net/", ":");
|
||||||
|
|
||||||
Date date = new Date();
|
MainApp.getFirebaseAnalytics().setUserProperty("Mode", BuildConfig.APPLICATION_ID + "-" + closedLoopEnabled);
|
||||||
date.setHours(0);
|
MainApp.getFirebaseAnalytics().setUserProperty("Language", LocaleHelper.getLanguage(MainApp.instance()));
|
||||||
date.setMinutes(0);
|
MainApp.getFirebaseAnalytics().setUserProperty("Version", BuildConfig.VERSION);
|
||||||
date.setSeconds(0);
|
MainApp.getFirebaseAnalytics().setUserProperty("HEAD", BuildConfig.HEAD);
|
||||||
long today = date.getTime() - date.getTime() % 1000;
|
MainApp.getFirebaseAnalytics().setUserProperty("Remote", remote);
|
||||||
|
if (ConfigBuilderPlugin.getPlugin().getActivePump() != null)
|
||||||
|
MainApp.getFirebaseAnalytics().setUserProperty("Pump", ConfigBuilderPlugin.getPlugin().getActivePump().getClass().getSimpleName());
|
||||||
|
if (ConfigBuilderPlugin.getPlugin().getActiveAPS() != null)
|
||||||
|
MainApp.getFirebaseAnalytics().setUserProperty("Aps", ConfigBuilderPlugin.getPlugin().getActiveAPS().getClass().getSimpleName());
|
||||||
|
if (ConfigBuilderPlugin.getPlugin().getActiveBgSource() != null)
|
||||||
|
MainApp.getFirebaseAnalytics().setUserProperty("BgSource", ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().getSimpleName());
|
||||||
|
if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() != null)
|
||||||
|
MainApp.getFirebaseAnalytics().setUserProperty("Profile", ConfigBuilderPlugin.getPlugin().getActiveProfileInterface().getClass().getSimpleName());
|
||||||
|
if (ConfigBuilderPlugin.getPlugin().getActiveSensitivity() != null)
|
||||||
|
MainApp.getFirebaseAnalytics().setUserProperty("Sensitivity", ConfigBuilderPlugin.getPlugin().getActiveSensitivity().getClass().getSimpleName());
|
||||||
|
if (ConfigBuilderPlugin.getPlugin().getActiveInsulin() != null)
|
||||||
|
MainApp.getFirebaseAnalytics().setUserProperty("Insulin", ConfigBuilderPlugin.getPlugin().getActiveInsulin().getClass().getSimpleName());
|
||||||
|
|
||||||
if (today > lastUploadDay) {
|
|
||||||
uploadAppUsageType();
|
|
||||||
uploadPluginStats();
|
|
||||||
|
|
||||||
SP.putLong(MainApp.gs(R.string.key_plugin_stats_report_timestamp), today);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void uploadPluginStats() {
|
|
||||||
CustomEvent pluginStats = new CustomEvent("PluginStats");
|
|
||||||
pluginStats.putCustomAttribute("version", BuildConfig.VERSION);
|
|
||||||
pluginStats.putCustomAttribute("HEAD", BuildConfig.HEAD);
|
|
||||||
pluginStats.putCustomAttribute("language", SP.getString(R.string.key_language,"default"));
|
|
||||||
for (PluginBase plugin : MainApp.getPluginsList()) {
|
|
||||||
if (plugin.isEnabled(plugin.getType()) && !plugin.pluginDescription.alwaysEnabled) {
|
|
||||||
// Fabric allows no more than 20 attributes attached to an event. By reporting disabled plugins as
|
|
||||||
// well, we would exceed that threshold, so only report what is enabled
|
|
||||||
// TODO >2.0: consider reworking this to upload an event per enabled plugin instead.
|
|
||||||
pluginStats.putCustomAttribute(plugin.getClass().getSimpleName(), "enabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getInstance().logCustom(pluginStats);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void uploadAppUsageType() {
|
|
||||||
CustomEvent type = new CustomEvent("AppUsageType");
|
|
||||||
if (Config.NSCLIENT)
|
|
||||||
type.putCustomAttribute("type", "NSClient");
|
|
||||||
else if (Config.PUMPCONTROL)
|
|
||||||
type.putCustomAttribute("type", "PumpControl");
|
|
||||||
else if (MainApp.getConstraintChecker().isClosedLoopAllowed().value())
|
|
||||||
type.putCustomAttribute("type", "ClosedLoop");
|
|
||||||
else
|
|
||||||
type.putCustomAttribute("type", "OpenLoop");
|
|
||||||
|
|
||||||
getInstance().logCustom(type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,13 @@ import android.util.LongSparseArray;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
public class MidnightTime {
|
public class MidnightTime {
|
||||||
private static final LongSparseArray<Long> times = new LongSparseArray<>();
|
static final LongSparseArray<Long> times = new LongSparseArray<>();
|
||||||
|
|
||||||
private static long hits = 0;
|
private static long hits = 0;
|
||||||
private static long misses = 0;
|
private static long misses = 0;
|
||||||
|
|
||||||
|
private static final int THRESHOLD = 100000;
|
||||||
|
|
||||||
public static long calc() {
|
public static long calc() {
|
||||||
Calendar c = Calendar.getInstance();
|
Calendar c = Calendar.getInstance();
|
||||||
c.set(Calendar.HOUR_OF_DAY, 0);
|
c.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
@ -36,10 +38,17 @@ public class MidnightTime {
|
||||||
m = c.getTimeInMillis();
|
m = c.getTimeInMillis();
|
||||||
times.append(time, m);
|
times.append(time, m);
|
||||||
++misses;
|
++misses;
|
||||||
|
if (times.size() > THRESHOLD) resetCache();
|
||||||
}
|
}
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void resetCache() {
|
||||||
|
hits = 0;
|
||||||
|
misses = 0;
|
||||||
|
times.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public static String log() {
|
public static String log() {
|
||||||
return "Hits: " + hits + " misses: " + misses + " stored: " + times.size();
|
return "Hits: " + hits + " misses: " + misses + " stored: " + times.size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,100 +0,0 @@
|
||||||
package info.nightscout.androidaps.utils;
|
|
||||||
|
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
|
|
||||||
import org.apache.http.HttpResponse;
|
|
||||||
import org.apache.http.client.HttpClient;
|
|
||||||
import org.apache.http.client.methods.HttpGet;
|
|
||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
|
||||||
import info.nightscout.androidaps.R;
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
|
||||||
|
|
||||||
import static android.content.Context.CONNECTIVITY_SERVICE;
|
|
||||||
|
|
||||||
public class VersionChecker {
|
|
||||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
|
||||||
|
|
||||||
public static void check() {
|
|
||||||
if (isConnected())
|
|
||||||
new Thread(() -> {
|
|
||||||
HttpClient client = new DefaultHttpClient();
|
|
||||||
HttpGet request = new HttpGet("https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/build.gradle");
|
|
||||||
HttpResponse response;
|
|
||||||
|
|
||||||
try {
|
|
||||||
response = client.execute(request);
|
|
||||||
InputStream inputStream = response.getEntity().getContent();
|
|
||||||
|
|
||||||
if (inputStream != null) {
|
|
||||||
String result = findLine(inputStream);
|
|
||||||
if (result != null) {
|
|
||||||
int compare = result.compareTo(BuildConfig.VERSION_NAME.replace("\"", ""));
|
|
||||||
if (compare == 0) {
|
|
||||||
log.debug("Version equal to master");
|
|
||||||
return;
|
|
||||||
} else if (compare > 0) {
|
|
||||||
log.debug("Version outdated. Found " + result);
|
|
||||||
Notification notification = new Notification(Notification.NEWVERSIONDETECTED, String.format(MainApp.gs(R.string.versionavailable), result), Notification.LOW);
|
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
log.debug("Version newer than master. Are you developer?");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug("Github master version not found");
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
log.debug("Github master version check error");
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
else
|
|
||||||
log.debug("Github master version no checked. No connectivity");
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert inputstream to String
|
|
||||||
private static String findLine(InputStream inputStream) throws IOException {
|
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
|
||||||
String line;
|
|
||||||
String regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)";
|
|
||||||
Pattern p = Pattern.compile(regex);
|
|
||||||
|
|
||||||
while ((line = bufferedReader.readLine()) != null) {
|
|
||||||
Matcher m = p.matcher(line);
|
|
||||||
if (m.matches()) {
|
|
||||||
log.debug("+++ " + line);
|
|
||||||
return m.group(3);
|
|
||||||
} else {
|
|
||||||
log.debug("--- " + line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inputStream.close();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check network connection
|
|
||||||
public static boolean isConnected() {
|
|
||||||
ConnectivityManager connMgr = (ConnectivityManager) MainApp.instance().getApplicationContext().getSystemService(CONNECTIVITY_SERVICE);
|
|
||||||
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
|
|
||||||
return networkInfo != null && networkInfo.isConnected();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.monkey.d.ruffy.ruffy.driver.display.menu;
|
package org.monkey.d.ruffy.ruffy.driver.display.menu;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by fishermen21 on 24.05.17.
|
* Created by fishermen21 on 24.05.17.
|
||||||
*/
|
*/
|
||||||
|
@ -30,6 +32,6 @@ public class MenuDate {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return day+"."+String.format("%02d",month)+".";
|
return day+"."+String.format(Locale.ENGLISH, "%02d",month)+".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.monkey.d.ruffy.ruffy.driver.display.menu;
|
package org.monkey.d.ruffy.ruffy.driver.display.menu;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by fishermen21 on 22.05.17.
|
* Created by fishermen21 on 22.05.17.
|
||||||
*/
|
*/
|
||||||
|
@ -31,6 +33,6 @@ public class MenuTime {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return hour+":"+String.format("%02d",minute);
|
return hour+":"+String.format(Locale.ENGLISH, "%02d",minute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
android:id="@+id/logsettings_placeholder"
|
android:id="@+id/logsettings_placeholder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"></LinearLayout>
|
android:orientation="vertical" />
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:focusableInTouchMode="true"
|
android:focusableInTouchMode="true"
|
||||||
|
@ -529,7 +528,8 @@
|
||||||
android:id="@+id/careportal_newnstreatment_notes"
|
android:id="@+id/careportal_newnstreatment_notes"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:width="180dp" />
|
android:width="180dp"
|
||||||
|
android:inputType="text" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="info.nightscout.androidaps.plugins.PumpInsight.InsightFragment">
|
tools:context="info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment">
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".plugins.general.overview.Dialogs.BolusProgressDialog"
|
tools:context=".plugins.general.overview.dialogs.BolusProgressDialog"
|
||||||
android:paddingTop="15dp"
|
android:paddingTop="15dp"
|
||||||
android:paddingBottom="15dp">
|
android:paddingBottom="15dp">
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".plugins.general.overview.Dialogs.CalibrationDialog">
|
tools:context=".plugins.general.overview.dialogs.CalibrationDialog">
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue