commit
6552e7de30
101 changed files with 843 additions and 224 deletions
|
@ -3,9 +3,11 @@
|
||||||
<words>
|
<words>
|
||||||
<w>aaps</w>
|
<w>aaps</w>
|
||||||
<w>abcdef</w>
|
<w>abcdef</w>
|
||||||
|
<w>accu</w>
|
||||||
<w>acked</w>
|
<w>acked</w>
|
||||||
<w>actionstring</w>
|
<w>actionstring</w>
|
||||||
<w>aidex</w>
|
<w>aidex</w>
|
||||||
|
<w>alarmack</w>
|
||||||
<w>allowednumbers</w>
|
<w>allowednumbers</w>
|
||||||
<w>androidaps</w>
|
<w>androidaps</w>
|
||||||
<w>autosens</w>
|
<w>autosens</w>
|
||||||
|
@ -26,11 +28,15 @@
|
||||||
<w>carbsreq</w>
|
<w>carbsreq</w>
|
||||||
<w>careportal</w>
|
<w>careportal</w>
|
||||||
<w>cellnovo</w>
|
<w>cellnovo</w>
|
||||||
|
<w>chek</w>
|
||||||
|
<w>clearalarm</w>
|
||||||
<w>crashlytics</w>
|
<w>crashlytics</w>
|
||||||
<w>danar</w>
|
<w>danar</w>
|
||||||
<w>danars</w>
|
<w>danars</w>
|
||||||
<w>dataset</w>
|
<w>dataset</w>
|
||||||
<w>datasets</w>
|
<w>datasets</w>
|
||||||
|
<w>dbadd</w>
|
||||||
|
<w>dbupdate</w>
|
||||||
<w>devicestatus</w>
|
<w>devicestatus</w>
|
||||||
<w>devicestatuses</w>
|
<w>devicestatuses</w>
|
||||||
<w>devslope</w>
|
<w>devslope</w>
|
||||||
|
@ -39,12 +45,14 @@
|
||||||
<w>diaconn</w>
|
<w>diaconn</w>
|
||||||
<w>enteredby</w>
|
<w>enteredby</w>
|
||||||
<w>enteredinsulin</w>
|
<w>enteredinsulin</w>
|
||||||
|
<w>eopatch</w>
|
||||||
<w>eveningoutpost</w>
|
<w>eveningoutpost</w>
|
||||||
<w>eversense</w>
|
<w>eversense</w>
|
||||||
<w>extendedbolus</w>
|
<w>extendedbolus</w>
|
||||||
<w>fileprovider</w>
|
<w>fileprovider</w>
|
||||||
<w>firebase</w>
|
<w>firebase</w>
|
||||||
<w>glimp</w>
|
<w>glimp</w>
|
||||||
|
<w>glunovo</w>
|
||||||
<w>gson</w>
|
<w>gson</w>
|
||||||
<w>hmac</w>
|
<w>hmac</w>
|
||||||
<w>iage</w>
|
<w>iage</w>
|
||||||
|
@ -79,12 +87,14 @@
|
||||||
<w>pred</w>
|
<w>pred</w>
|
||||||
<w>profileswitch</w>
|
<w>profileswitch</w>
|
||||||
<w>pumpbtcomm</w>
|
<w>pumpbtcomm</w>
|
||||||
|
<w>pumpcontrol</w>
|
||||||
<w>quickwizard</w>
|
<w>quickwizard</w>
|
||||||
<w>readstatus</w>
|
<w>readstatus</w>
|
||||||
<w>realduration</w>
|
<w>realduration</w>
|
||||||
<w>refresheventsfromnightscout</w>
|
<w>refresheventsfromnightscout</w>
|
||||||
<w>rileylink</w>
|
<w>rileylink</w>
|
||||||
<w>roboelectric</w>
|
<w>roboelectric</w>
|
||||||
|
<w>rozman</w>
|
||||||
<w>sgvs</w>
|
<w>sgvs</w>
|
||||||
<w>shortgramm</w>
|
<w>shortgramm</w>
|
||||||
<w>sitechange</w>
|
<w>sitechange</w>
|
||||||
|
@ -108,7 +118,8 @@
|
||||||
<w>tirs</w>
|
<w>tirs</w>
|
||||||
<w>totp</w>
|
<w>totp</w>
|
||||||
<w>tunedays</w>
|
<w>tunedays</w>
|
||||||
<w>uart</w>
|
<w>uart</w>
|
||||||
|
<w>urgentalarm</w>
|
||||||
<w>wizzardpage</w>
|
<w>wizzardpage</w>
|
||||||
<w>xdrip</w>
|
<w>xdrip</w>
|
||||||
<w>xstream</w>
|
<w>xstream</w>
|
||||||
|
|
|
@ -105,7 +105,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
versionCode 1500
|
versionCode 1500
|
||||||
version "3.1.0"
|
version "3.1.0.1"
|
||||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||||
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
||||||
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
|
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
|
||||||
|
|
|
@ -68,6 +68,7 @@ class OpenAPSSMBDynamicISFPlugin @Inject constructor(
|
||||||
.shortName(R.string.dynisf_shortname)
|
.shortName(R.string.dynisf_shortname)
|
||||||
.preferencesId(R.xml.pref_openapssmbdynamicisf)
|
.preferencesId(R.xml.pref_openapssmbdynamicisf)
|
||||||
.setDefault(false)
|
.setDefault(false)
|
||||||
|
.showInList(buildHelper.isEngineeringMode() && buildHelper.isDev())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun specialEnableCondition(): Boolean = buildHelper.isEngineeringMode() && buildHelper.isDev()
|
override fun specialEnableCondition(): Boolean = buildHelper.isEngineeringMode() && buildHelper.isDev()
|
||||||
|
|
|
@ -61,6 +61,7 @@ class AutotunePlugin @Inject constructor(
|
||||||
.pluginName(R.string.autotune)
|
.pluginName(R.string.autotune)
|
||||||
.shortName(R.string.autotune_shortname)
|
.shortName(R.string.autotune_shortname)
|
||||||
.preferencesId(R.xml.pref_autotune)
|
.preferencesId(R.xml.pref_autotune)
|
||||||
|
.showInList(buildHelper.isEngineeringMode() && buildHelper.isDev())
|
||||||
.description(R.string.autotune_description),
|
.description(R.string.autotune_description),
|
||||||
aapsLogger, resourceHelper, injector
|
aapsLogger, resourceHelper, injector
|
||||||
), Autotune {
|
), Autotune {
|
||||||
|
|
|
@ -134,8 +134,8 @@ class OverviewMenus @Inject constructor(
|
||||||
val item = popup.menu.add(Menu.NONE, m.ordinal + 100 * (g + 1), Menu.NONE, rh.gs(m.nameId))
|
val item = popup.menu.add(Menu.NONE, m.ordinal + 100 * (g + 1), Menu.NONE, rh.gs(m.nameId))
|
||||||
val title = item.title
|
val title = item.title
|
||||||
val s = SpannableString(" $title ")
|
val s = SpannableString(" $title ")
|
||||||
s.setSpan(ForegroundColorSpan(rh.gac(context, m.attrTextId)), 0, s.length, 0)
|
s.setSpan(ForegroundColorSpan(rh.gac(m.attrTextId)), 0, s.length, 0)
|
||||||
s.setSpan(BackgroundColorSpan(rh.gac(context, m.attrId)), 0, s.length, 0)
|
s.setSpan(BackgroundColorSpan(rh.gac(m.attrId)), 0, s.length, 0)
|
||||||
item.title = s
|
item.title = s
|
||||||
item.isCheckable = true
|
item.isCheckable = true
|
||||||
item.isChecked = settingsCopy[g][m.ordinal]
|
item.isChecked = settingsCopy[g][m.ordinal]
|
||||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.utils
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.annotation.TargetApi
|
|
||||||
import android.bluetooth.BluetoothAdapter
|
import android.bluetooth.BluetoothAdapter
|
||||||
import android.content.ActivityNotFoundException
|
import android.content.ActivityNotFoundException
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
@ -95,13 +94,14 @@ class AndroidPermission @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun notifyForBtConnectPermission(activity: FragmentActivity) {
|
fun notifyForBtConnectPermission(activity: FragmentActivity) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
// Manifest.permission.BLUETOOTH_CONNECT
|
// Manifest.permission.BLUETOOTH_CONNECT
|
||||||
if (permissionNotGranted(activity, "android.permission.BLUETOOTH_CONNECT") || permissionNotGranted(activity, "android.permission.BLUETOOTH_SCAN")) {
|
if (permissionNotGranted(activity, Manifest.permission.BLUETOOTH_CONNECT) || permissionNotGranted(activity, Manifest.permission.BLUETOOTH_SCAN)) {
|
||||||
val notification = NotificationWithAction(injector, Notification.PERMISSION_BT, rh.gs(R.string.needconnectpermission), Notification.URGENT)
|
val notification = NotificationWithAction(injector, Notification.PERMISSION_BT, rh.gs(R.string.needconnectpermission), Notification.URGENT)
|
||||||
notification.action(R.string.request) { askForPermission(activity, arrayOf("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT")) }
|
notification.action(R.string.request) { askForPermission(activity, arrayOf(Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT)) }
|
||||||
rxBus.send(EventNewNotification(notification))
|
rxBus.send(EventNewNotification(notification))
|
||||||
} else {
|
} else {
|
||||||
activity.startActivity(Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE))
|
activity.startActivity(Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE))
|
||||||
|
|
|
@ -645,7 +645,6 @@
|
||||||
<string name="needsystemwindowpermission">Pro oznámení vyžaduje aplikace oprávnění systémového okna</string>
|
<string name="needsystemwindowpermission">Pro oznámení vyžaduje aplikace oprávnění systémového okna</string>
|
||||||
<string name="needlocationpermission">Aplikace potřebuje oprávnění k přístupu k poloze kvůli skenování BT a WiFi identifikaci</string>
|
<string name="needlocationpermission">Aplikace potřebuje oprávnění k přístupu k poloze kvůli skenování BT a WiFi identifikaci</string>
|
||||||
<string name="needstoragepermission">Aby bylo možné nahrávat logy a exportovat nastavení, je nutné pro aplikaci povolit oprávnění přístupu k úložišti</string>
|
<string name="needstoragepermission">Aby bylo možné nahrávat logy a exportovat nastavení, je nutné pro aplikaci povolit oprávnění přístupu k úložišti</string>
|
||||||
<string name="needconnectpermission">Aplikace potřebuje oprávnění bluetooth</string>
|
|
||||||
<string name="request">Požadavek</string>
|
<string name="request">Požadavek</string>
|
||||||
<string name="open_navigation">Otevřít menu</string>
|
<string name="open_navigation">Otevřít menu</string>
|
||||||
<string name="close_navigation">Zavřít menu</string>
|
<string name="close_navigation">Zavřít menu</string>
|
||||||
|
|
|
@ -636,7 +636,6 @@
|
||||||
<string name="needsystemwindowpermission">Applikationen mangler system vindues tilladelse til notifikationer</string>
|
<string name="needsystemwindowpermission">Applikationen mangler system vindues tilladelse til notifikationer</string>
|
||||||
<string name="needlocationpermission">Applikationen mangler lokations tilladelse til BT scanning og WIFI identifikation</string>
|
<string name="needlocationpermission">Applikationen mangler lokations tilladelse til BT scanning og WIFI identifikation</string>
|
||||||
<string name="needstoragepermission">Applikationen mangler lagerstyrings tilladelse for at gemme logfiler og exporteringsindstillinger</string>
|
<string name="needstoragepermission">Applikationen mangler lagerstyrings tilladelse for at gemme logfiler og exporteringsindstillinger</string>
|
||||||
<string name="needconnectpermission">Applikationen kræver tilladelse til bluetooth</string>
|
|
||||||
<string name="request">Anmod</string>
|
<string name="request">Anmod</string>
|
||||||
<string name="open_navigation">Åbn navigation</string>
|
<string name="open_navigation">Åbn navigation</string>
|
||||||
<string name="close_navigation">Luk navigation</string>
|
<string name="close_navigation">Luk navigation</string>
|
||||||
|
|
|
@ -633,7 +633,6 @@
|
||||||
<string name="needsystemwindowpermission">Die App benötigt die Systemberechtigung für App-Benachrichtigungen</string>
|
<string name="needsystemwindowpermission">Die App benötigt die Systemberechtigung für App-Benachrichtigungen</string>
|
||||||
<string name="needlocationpermission">Die App benötigt die Berechtigung für den Standort, um Bluetooth und WLAN nutzen zu können</string>
|
<string name="needlocationpermission">Die App benötigt die Berechtigung für den Standort, um Bluetooth und WLAN nutzen zu können</string>
|
||||||
<string name="needstoragepermission">Die App benötigt Zugriffsrechte für den Speicher um Log-Dateien zu sichern und die Einstellungen zu exportieren.</string>
|
<string name="needstoragepermission">Die App benötigt Zugriffsrechte für den Speicher um Log-Dateien zu sichern und die Einstellungen zu exportieren.</string>
|
||||||
<string name="needconnectpermission">App benötigt Bluetooth-Berechtigung</string>
|
|
||||||
<string name="request">Anfordern</string>
|
<string name="request">Anfordern</string>
|
||||||
<string name="open_navigation">Menü öffnen</string>
|
<string name="open_navigation">Menü öffnen</string>
|
||||||
<string name="close_navigation">Menü schließen</string>
|
<string name="close_navigation">Menü schließen</string>
|
||||||
|
|
|
@ -645,7 +645,6 @@
|
||||||
<string name="needsystemwindowpermission">La aplicación necesita permisos del sistema para poder mostrarse sobre otras aplicaciones, para las notificaciones</string>
|
<string name="needsystemwindowpermission">La aplicación necesita permisos del sistema para poder mostrarse sobre otras aplicaciones, para las notificaciones</string>
|
||||||
<string name="needlocationpermission">La aplicación necesita permiso de ubicación para poder buscar dispositivos Bluetooth y redes WiFi</string>
|
<string name="needlocationpermission">La aplicación necesita permiso de ubicación para poder buscar dispositivos Bluetooth y redes WiFi</string>
|
||||||
<string name="needstoragepermission">La aplicación necesita permiso de almacenamiento para poder almacenar archivos de registro y valores de exportación</string>
|
<string name="needstoragepermission">La aplicación necesita permiso de almacenamiento para poder almacenar archivos de registro y valores de exportación</string>
|
||||||
<string name="needconnectpermission">La aplicación necesita permiso de bluetooth</string>
|
|
||||||
<string name="request">Solicitar</string>
|
<string name="request">Solicitar</string>
|
||||||
<string name="open_navigation">Abrir navegación</string>
|
<string name="open_navigation">Abrir navegación</string>
|
||||||
<string name="close_navigation">Cerrar navegación</string>
|
<string name="close_navigation">Cerrar navegación</string>
|
||||||
|
|
|
@ -646,7 +646,6 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
|
||||||
<string name="needsystemwindowpermission">L\'application a besoin de l\'autorisation d\'accès à la fenêtre système pour les notifications</string>
|
<string name="needsystemwindowpermission">L\'application a besoin de l\'autorisation d\'accès à la fenêtre système pour les notifications</string>
|
||||||
<string name="needlocationpermission">L\'application a besoin de l\'autorisation de localisation pour l\'analyse BT et l\'identification WiFi</string>
|
<string name="needlocationpermission">L\'application a besoin de l\'autorisation de localisation pour l\'analyse BT et l\'identification WiFi</string>
|
||||||
<string name="needstoragepermission">L\'application a besoin d\'une autorisation de stockage pour pouvoir stocker les fichiers journaux et les paramètres d\'exportation</string>
|
<string name="needstoragepermission">L\'application a besoin d\'une autorisation de stockage pour pouvoir stocker les fichiers journaux et les paramètres d\'exportation</string>
|
||||||
<string name="needconnectpermission">L\'application a besoin de l\'autorisation Bluetooth</string>
|
|
||||||
<string name="request">Demande</string>
|
<string name="request">Demande</string>
|
||||||
<string name="open_navigation">Ouvrir navigation</string>
|
<string name="open_navigation">Ouvrir navigation</string>
|
||||||
<string name="close_navigation">Fermer navigation</string>
|
<string name="close_navigation">Fermer navigation</string>
|
||||||
|
|
|
@ -645,7 +645,6 @@
|
||||||
<string name="needsystemwindowpermission">L\'applicazione richiede l\'autorizzazione \"finestra di sistema\" per le notifiche</string>
|
<string name="needsystemwindowpermission">L\'applicazione richiede l\'autorizzazione \"finestra di sistema\" per le notifiche</string>
|
||||||
<string name="needlocationpermission">L\'applicazione richiede l\'accesso alla posizione per la scansione bluetooth e l\'identificazione WiFi</string>
|
<string name="needlocationpermission">L\'applicazione richiede l\'accesso alla posizione per la scansione bluetooth e l\'identificazione WiFi</string>
|
||||||
<string name="needstoragepermission">L\'applicazione richiede l\'accesso alla memoria per memorizzare i file di log ed esportare le impostazioni</string>
|
<string name="needstoragepermission">L\'applicazione richiede l\'accesso alla memoria per memorizzare i file di log ed esportare le impostazioni</string>
|
||||||
<string name="needconnectpermission">L\'applicazione richiede l\'autorizzazione bluetooth</string>
|
|
||||||
<string name="request">Richiesta</string>
|
<string name="request">Richiesta</string>
|
||||||
<string name="open_navigation">Apri navigazione</string>
|
<string name="open_navigation">Apri navigazione</string>
|
||||||
<string name="close_navigation">Chiudi navigazione</string>
|
<string name="close_navigation">Chiudi navigazione</string>
|
||||||
|
|
|
@ -645,7 +645,6 @@
|
||||||
<string name="needsystemwindowpermission">האפליקציה צריכה הרשאת מערכת של חלונות לצורך התראות</string>
|
<string name="needsystemwindowpermission">האפליקציה צריכה הרשאת מערכת של חלונות לצורך התראות</string>
|
||||||
<string name="needlocationpermission">דרושה הרשאת מיקום עבור סריקת בלוטות\' וזיהוי WiFi</string>
|
<string name="needlocationpermission">דרושה הרשאת מיקום עבור סריקת בלוטות\' וזיהוי WiFi</string>
|
||||||
<string name="needstoragepermission">דרושה הרשאת אחסון כדי שתוכלו לאחסן קובצי יומן והגדרות יצוא.</string>
|
<string name="needstoragepermission">דרושה הרשאת אחסון כדי שתוכלו לאחסן קובצי יומן והגדרות יצוא.</string>
|
||||||
<string name="needconnectpermission">האפליקציה צריכה הרשאה לבלוטות\'</string>
|
|
||||||
<string name="request">בקשה</string>
|
<string name="request">בקשה</string>
|
||||||
<string name="open_navigation">פתח ניווט</string>
|
<string name="open_navigation">פתח ניווט</string>
|
||||||
<string name="close_navigation">סגור ניווט</string>
|
<string name="close_navigation">סגור ניווט</string>
|
||||||
|
|
|
@ -631,7 +631,6 @@
|
||||||
<string name="needsystemwindowpermission">Norint gauti pranešimus, programai reikalingas sisteminio lango leidimas</string>
|
<string name="needsystemwindowpermission">Norint gauti pranešimus, programai reikalingas sisteminio lango leidimas</string>
|
||||||
<string name="needlocationpermission">Programai reikia vietos nustatymo leidimo, kad būtų galima naudoti Bluetooth ir WiFi</string>
|
<string name="needlocationpermission">Programai reikia vietos nustatymo leidimo, kad būtų galima naudoti Bluetooth ir WiFi</string>
|
||||||
<string name="needstoragepermission">Aplikacijai reikia leidimo prieigai prie saugyklos, kad galėtų išsaugoti žurnalo įrašus ir eksportavimo nustatymus</string>
|
<string name="needstoragepermission">Aplikacijai reikia leidimo prieigai prie saugyklos, kad galėtų išsaugoti žurnalo įrašus ir eksportavimo nustatymus</string>
|
||||||
<string name="needconnectpermission">Programai reikalinga Bluetooth prieigos teisė</string>
|
|
||||||
<string name="request">Užklausa</string>
|
<string name="request">Užklausa</string>
|
||||||
<string name="open_navigation">Atidaryti meniu</string>
|
<string name="open_navigation">Atidaryti meniu</string>
|
||||||
<string name="close_navigation">Uždaryti meniu</string>
|
<string name="close_navigation">Uždaryti meniu</string>
|
||||||
|
@ -894,6 +893,7 @@
|
||||||
<string name="not_available_full">Negalimas</string>
|
<string name="not_available_full">Negalimas</string>
|
||||||
<!-- Theme switcher dark and light mode-->
|
<!-- Theme switcher dark and light mode-->
|
||||||
<!-- WEAR OS-->
|
<!-- WEAR OS-->
|
||||||
|
<string name="sort_label">Rūšiuoti</string>
|
||||||
<string name="login">Prisijungti</string>
|
<string name="login">Prisijungti</string>
|
||||||
<!-- Aidex Cgms -->
|
<!-- Aidex Cgms -->
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -645,7 +645,6 @@
|
||||||
<string name="needsystemwindowpermission">Toepassing vereist systeemvenstermachtiging voor meldingen</string>
|
<string name="needsystemwindowpermission">Toepassing vereist systeemvenstermachtiging voor meldingen</string>
|
||||||
<string name="needlocationpermission">App heeft locatie toestemming nodig voor Bluetooth scan en WiFi identificatie</string>
|
<string name="needlocationpermission">App heeft locatie toestemming nodig voor Bluetooth scan en WiFi identificatie</string>
|
||||||
<string name="needstoragepermission">Applicatie heeft toestemming nodig om log bestanden op te slaan en instellingen te exporteren</string>
|
<string name="needstoragepermission">Applicatie heeft toestemming nodig om log bestanden op te slaan en instellingen te exporteren</string>
|
||||||
<string name="needconnectpermission">Applicatie heeft Bluetooth toestemming nodig</string>
|
|
||||||
<string name="request">Verzoek</string>
|
<string name="request">Verzoek</string>
|
||||||
<string name="open_navigation">Open navigatie</string>
|
<string name="open_navigation">Open navigatie</string>
|
||||||
<string name="close_navigation">Sluit navigatie</string>
|
<string name="close_navigation">Sluit navigatie</string>
|
||||||
|
|
|
@ -645,7 +645,6 @@
|
||||||
<string name="needsystemwindowpermission">App trenger tillatelse til å bruke Varslinger for å vise meldinger</string>
|
<string name="needsystemwindowpermission">App trenger tillatelse til å bruke Varslinger for å vise meldinger</string>
|
||||||
<string name="needlocationpermission">App trenger tilgang til Posisjon for å søke etter Bluetooth og Wifi enheter</string>
|
<string name="needlocationpermission">App trenger tilgang til Posisjon for å søke etter Bluetooth og Wifi enheter</string>
|
||||||
<string name="needstoragepermission">App trenger tilgang til Lagring for lagre logg filer og eksportere innstillinger</string>
|
<string name="needstoragepermission">App trenger tilgang til Lagring for lagre logg filer og eksportere innstillinger</string>
|
||||||
<string name="needconnectpermission">Appen trenger bluetooth tillatelse</string>
|
|
||||||
<string name="request">Forespørsel</string>
|
<string name="request">Forespørsel</string>
|
||||||
<string name="open_navigation">Åpne meny</string>
|
<string name="open_navigation">Åpne meny</string>
|
||||||
<string name="close_navigation">Lukk meny</string>
|
<string name="close_navigation">Lukk meny</string>
|
||||||
|
|
|
@ -244,6 +244,7 @@
|
||||||
<string name="wear">Oprogramowanie Wear (Smartwatch)</string>
|
<string name="wear">Oprogramowanie Wear (Smartwatch)</string>
|
||||||
<string name="resend_all_data">Prześlij ponownie wszystkie dane</string>
|
<string name="resend_all_data">Prześlij ponownie wszystkie dane</string>
|
||||||
<string name="open_settings_on_wear">Otwórz ustawienia dla Wear</string>
|
<string name="open_settings_on_wear">Otwórz ustawienia dla Wear</string>
|
||||||
|
<string name="basal_rate">Dawka bazowa</string>
|
||||||
<string name="basalvaluebelowminimum">Wartość bazy poniżej minimum. Nie ustawiono profilu!</string>
|
<string name="basalvaluebelowminimum">Wartość bazy poniżej minimum. Nie ustawiono profilu!</string>
|
||||||
<string name="sms_actualbg">BG:</string>
|
<string name="sms_actualbg">BG:</string>
|
||||||
<string name="sms_lastbg">Ostatnia BG:</string>
|
<string name="sms_lastbg">Ostatnia BG:</string>
|
||||||
|
@ -631,7 +632,6 @@
|
||||||
<string name="needsystemwindowpermission">Aplikacja wymaga uprawnienia systemowego okna dla powiadomień</string>
|
<string name="needsystemwindowpermission">Aplikacja wymaga uprawnienia systemowego okna dla powiadomień</string>
|
||||||
<string name="needlocationpermission">Aplikacja wymaga dostępu do lokalizacji dla zarządzania bluetoothem i identyfikacją Wi-Fi</string>
|
<string name="needlocationpermission">Aplikacja wymaga dostępu do lokalizacji dla zarządzania bluetoothem i identyfikacją Wi-Fi</string>
|
||||||
<string name="needstoragepermission">Aplikacja wymaga zgody na zapis do pamięci, aby móc przechować pliki logów i eksportować ustawienia</string>
|
<string name="needstoragepermission">Aplikacja wymaga zgody na zapis do pamięci, aby móc przechować pliki logów i eksportować ustawienia</string>
|
||||||
<string name="needconnectpermission">Aplikacja wymaga uprawnienia Bluetooth</string>
|
|
||||||
<string name="request">Żądanie</string>
|
<string name="request">Żądanie</string>
|
||||||
<string name="open_navigation">Otwórz menu</string>
|
<string name="open_navigation">Otwórz menu</string>
|
||||||
<string name="close_navigation">Zamknij menu</string>
|
<string name="close_navigation">Zamknij menu</string>
|
||||||
|
@ -667,6 +667,7 @@
|
||||||
<string name="error_adding_treatment_message">Leczenie (insulina: %1$.2f, węglowodany: %2$d, czas:%3$s) nie mogą być dodane. Sprawdź i dodaj ręcznie rekord w razie potrzeby.</string>
|
<string name="error_adding_treatment_message">Leczenie (insulina: %1$.2f, węglowodany: %2$d, czas:%3$s) nie mogą być dodane. Sprawdź i dodaj ręcznie rekord w razie potrzeby.</string>
|
||||||
<string name="generated_ecarbs_note">eWęgle: %1$d g (%2$d h), Opóźnienie: %3$d m</string>
|
<string name="generated_ecarbs_note">eWęgle: %1$d g (%2$d h), Opóźnienie: %3$d m</string>
|
||||||
<string name="openaps_noasdata">Brak dostępnych danych autosens</string>
|
<string name="openaps_noasdata">Brak dostępnych danych autosens</string>
|
||||||
|
<string name="log_files">Log files</string>
|
||||||
<string name="nav_logsettings">Ustawienia logów</string>
|
<string name="nav_logsettings">Ustawienia logów</string>
|
||||||
<string name="resettodefaults">Przywróć ustawienia domyślne</string>
|
<string name="resettodefaults">Przywróć ustawienia domyślne</string>
|
||||||
<string name="nsmalfunction">Usterka NSClient. Spróbuj zrestartować NS i NSClient.</string>
|
<string name="nsmalfunction">Usterka NSClient. Spróbuj zrestartować NS i NSClient.</string>
|
||||||
|
@ -748,6 +749,8 @@
|
||||||
<string name="profilenamecontainsdot">Nazwa profilu zawiera kropki.\nTo nie jest obsługiwane przez NS.\nProfil nie zostanie przesyłany do NS.</string>
|
<string name="profilenamecontainsdot">Nazwa profilu zawiera kropki.\nTo nie jest obsługiwane przez NS.\nProfil nie zostanie przesyłany do NS.</string>
|
||||||
<string name="low_mark_comment">Dolna wartość zakresu docelowego (tylko do wyświetlania)</string>
|
<string name="low_mark_comment">Dolna wartość zakresu docelowego (tylko do wyświetlania)</string>
|
||||||
<string name="high_mark_comment">Górna wartość zakresu docelowego (tylko do wyświetlania)</string>
|
<string name="high_mark_comment">Górna wartość zakresu docelowego (tylko do wyświetlania)</string>
|
||||||
|
<string name="age">Czas</string>
|
||||||
|
<string name="weight_label">Waga</string>
|
||||||
<string name="id">ID:</string>
|
<string name="id">ID:</string>
|
||||||
<string name="submit">Wyślij</string>
|
<string name="submit">Wyślij</string>
|
||||||
<string name="mostcommonprofile">Najczęściej używany profil:</string>
|
<string name="mostcommonprofile">Najczęściej używany profil:</string>
|
||||||
|
@ -797,6 +800,7 @@
|
||||||
<string name="smscommunicator_otp_install_info">Na każdym telefonie śledzącym zainstalować aplikację uwierzytelniania obsługującą tokeny TOTP RFC 6238 Popularne darmowe aplikacje:\n • Authy\n • Google Authenticator\n • LastPass Authenticator\n • FreeOTP Authenticator</string>
|
<string name="smscommunicator_otp_install_info">Na każdym telefonie śledzącym zainstalować aplikację uwierzytelniania obsługującą tokeny TOTP RFC 6238 Popularne darmowe aplikacje:\n • Authy\n • Google Authenticator\n • LastPass Authenticator\n • FreeOTP Authenticator</string>
|
||||||
<string name="smscommunicator_otp_reset_warning">Resetowanie uwierzytelniania powoduje, że wszystkie już ustawione uwierzytelnienia stają się niepoprawne (przestają działać). Trzeba będzie je jeszcze raz skonfigurować!</string>
|
<string name="smscommunicator_otp_reset_warning">Resetowanie uwierzytelniania powoduje, że wszystkie już ustawione uwierzytelnienia stają się niepoprawne (przestają działać). Trzeba będzie je jeszcze raz skonfigurować!</string>
|
||||||
<string name="overview_show_predictions">Prognozy poziomu</string>
|
<string name="overview_show_predictions">Prognozy poziomu</string>
|
||||||
|
<string name="overview_show_treatments">Zabiegi</string>
|
||||||
<string name="overview_show_deviationslope">Krzywa odchylenie</string>
|
<string name="overview_show_deviationslope">Krzywa odchylenie</string>
|
||||||
<string name="authorizationfailed">Autoryzacja nie powiodła się</string>
|
<string name="authorizationfailed">Autoryzacja nie powiodła się</string>
|
||||||
<string name="overview_show_absinsulin">Cała insulina</string>
|
<string name="overview_show_absinsulin">Cała insulina</string>
|
||||||
|
@ -896,6 +900,7 @@
|
||||||
<!-- WEAR OS-->
|
<!-- WEAR OS-->
|
||||||
<string name="remove_selected_items">Usuń wybrane pozycje</string>
|
<string name="remove_selected_items">Usuń wybrane pozycje</string>
|
||||||
<string name="confirm_remove_multiple_items">Czy na pewno chcesz usunąć %1$d pozycji</string>
|
<string name="confirm_remove_multiple_items">Czy na pewno chcesz usunąć %1$d pozycji</string>
|
||||||
|
<string name="no_records_available">Brak wpisów</string>
|
||||||
<string name="count_selected">Wybrany %1$d</string>
|
<string name="count_selected">Wybrany %1$d</string>
|
||||||
<string name="sort_label">Sortuj</string>
|
<string name="sort_label">Sortuj</string>
|
||||||
<string name="login">Zaloguj się</string>
|
<string name="login">Zaloguj się</string>
|
||||||
|
|
|
@ -631,7 +631,6 @@
|
||||||
<string name="needsystemwindowpermission">Aplicação precisa de permissão de janela do sistema para notificações</string>
|
<string name="needsystemwindowpermission">Aplicação precisa de permissão de janela do sistema para notificações</string>
|
||||||
<string name="needlocationpermission">Aplicação necessita de permissão de localização para pesquisa Bluetooth e identificação Wi-Fi</string>
|
<string name="needlocationpermission">Aplicação necessita de permissão de localização para pesquisa Bluetooth e identificação Wi-Fi</string>
|
||||||
<string name="needstoragepermission">A aplicação precisa da permissão de armazenamento para poder armazenar ficheiros de registo e exportar definições</string>
|
<string name="needstoragepermission">A aplicação precisa da permissão de armazenamento para poder armazenar ficheiros de registo e exportar definições</string>
|
||||||
<string name="needconnectpermission">Aplicação precisa de permissão Bluetooth</string>
|
|
||||||
<string name="request">Pedido</string>
|
<string name="request">Pedido</string>
|
||||||
<string name="open_navigation">Abrir a navegação</string>
|
<string name="open_navigation">Abrir a navegação</string>
|
||||||
<string name="close_navigation">Fechar a navegação</string>
|
<string name="close_navigation">Fechar a navegação</string>
|
||||||
|
|
|
@ -631,7 +631,6 @@
|
||||||
<string name="needsystemwindowpermission">Aplicația are nevoie de permisiune la fereastra sistemului pentru a afișa notificări</string>
|
<string name="needsystemwindowpermission">Aplicația are nevoie de permisiune la fereastra sistemului pentru a afișa notificări</string>
|
||||||
<string name="needlocationpermission">Aplicația are nevoie sa acceseze locația pentru scanare Bluetooth și identificare WiFi</string>
|
<string name="needlocationpermission">Aplicația are nevoie sa acceseze locația pentru scanare Bluetooth și identificare WiFi</string>
|
||||||
<string name="needstoragepermission">Aplicația are nevoie de permisiunea de a accesa unitatea de stocare pentru a scrie fișierele registru și pentru a exporta setările</string>
|
<string name="needstoragepermission">Aplicația are nevoie de permisiunea de a accesa unitatea de stocare pentru a scrie fișierele registru și pentru a exporta setările</string>
|
||||||
<string name="needconnectpermission">Aplicația are nevoie de permisiune Bluetooth</string>
|
|
||||||
<string name="request">Cerință</string>
|
<string name="request">Cerință</string>
|
||||||
<string name="open_navigation">Afișare navigație</string>
|
<string name="open_navigation">Afișare navigație</string>
|
||||||
<string name="close_navigation">Închidere navigație</string>
|
<string name="close_navigation">Închidere navigație</string>
|
||||||
|
|
|
@ -645,7 +645,6 @@
|
||||||
<string name="needsystemwindowpermission">Приложению требуется разрешение системного окна для уведомлений</string>
|
<string name="needsystemwindowpermission">Приложению требуется разрешение системного окна для уведомлений</string>
|
||||||
<string name="needlocationpermission">Приложению требуется разрешение на доступ к местоположению для сканирования BT и идентификации WiFi</string>
|
<string name="needlocationpermission">Приложению требуется разрешение на доступ к местоположению для сканирования BT и идентификации WiFi</string>
|
||||||
<string name="needstoragepermission">Приложение требует разрешения на доступ к записи в память, чтобы хранить файлы журналов и настройки экспорта</string>
|
<string name="needstoragepermission">Приложение требует разрешения на доступ к записи в память, чтобы хранить файлы журналов и настройки экспорта</string>
|
||||||
<string name="needconnectpermission">Приложению требуется разрешение Bluetooth</string>
|
|
||||||
<string name="request">Запрос</string>
|
<string name="request">Запрос</string>
|
||||||
<string name="open_navigation">Показать панель навигации</string>
|
<string name="open_navigation">Показать панель навигации</string>
|
||||||
<string name="close_navigation">Cкрыть панель навигации</string>
|
<string name="close_navigation">Cкрыть панель навигации</string>
|
||||||
|
|
|
@ -645,7 +645,6 @@
|
||||||
<string name="needsystemwindowpermission">Aplikácia vyžaduje pre oznámenia systémové oprávnenie</string>
|
<string name="needsystemwindowpermission">Aplikácia vyžaduje pre oznámenia systémové oprávnenie</string>
|
||||||
<string name="needlocationpermission">Aplikácia vyžaduje oprávnenie polohy, pre vyhľadávanie BT a identifikáciu WiFi</string>
|
<string name="needlocationpermission">Aplikácia vyžaduje oprávnenie polohy, pre vyhľadávanie BT a identifikáciu WiFi</string>
|
||||||
<string name="needstoragepermission">Aby bolo možné nahrávať logy a exportovať nastavenia, je nutné pre aplikáciu povoliť oprávnenie prístupu k úložisku</string>
|
<string name="needstoragepermission">Aby bolo možné nahrávať logy a exportovať nastavenia, je nutné pre aplikáciu povoliť oprávnenie prístupu k úložisku</string>
|
||||||
<string name="needconnectpermission">Aplikácia vyžaduje povolenie bluetooth</string>
|
|
||||||
<string name="request">Požiadavka</string>
|
<string name="request">Požiadavka</string>
|
||||||
<string name="open_navigation">Otvoriť Menu</string>
|
<string name="open_navigation">Otvoriť Menu</string>
|
||||||
<string name="close_navigation">Zavrieť Menu</string>
|
<string name="close_navigation">Zavrieť Menu</string>
|
||||||
|
|
|
@ -636,7 +636,6 @@ Eversense-appen.</string>
|
||||||
<string name="needsystemwindowpermission">Applikationen behöver förhöjd behörighet för aviseringar</string>
|
<string name="needsystemwindowpermission">Applikationen behöver förhöjd behörighet för aviseringar</string>
|
||||||
<string name="needlocationpermission">Appen behöver platsåtkomst för bluetooth- och WiFi-identifiering</string>
|
<string name="needlocationpermission">Appen behöver platsåtkomst för bluetooth- och WiFi-identifiering</string>
|
||||||
<string name="needstoragepermission">Applikationen behöver lagringsbehörighet för att kunna lagra loggfiler och exportinställningar</string>
|
<string name="needstoragepermission">Applikationen behöver lagringsbehörighet för att kunna lagra loggfiler och exportinställningar</string>
|
||||||
<string name="needconnectpermission">Applikationen behöver bluetooth-behörighet</string>
|
|
||||||
<string name="request">Begäran</string>
|
<string name="request">Begäran</string>
|
||||||
<string name="open_navigation">Öppna menyn</string>
|
<string name="open_navigation">Öppna menyn</string>
|
||||||
<string name="close_navigation">Stäng menyn</string>
|
<string name="close_navigation">Stäng menyn</string>
|
||||||
|
|
|
@ -646,7 +646,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
|
||||||
<string name="needsystemwindowpermission">Uygulama, bildirimler için sistem iznine ihtiyaç duyuyor</string>
|
<string name="needsystemwindowpermission">Uygulama, bildirimler için sistem iznine ihtiyaç duyuyor</string>
|
||||||
<string name="needlocationpermission">Uygulamanın BT taraması ve WiFi tanımlaması için konum iznine ihtiyacı var</string>
|
<string name="needlocationpermission">Uygulamanın BT taraması ve WiFi tanımlaması için konum iznine ihtiyacı var</string>
|
||||||
<string name="needstoragepermission">Uygulamanın, günlük dosyalarını saklayabilmesi ve ayarları dışa aktarabilmesi için depolama iznine ihtiyacı var</string>
|
<string name="needstoragepermission">Uygulamanın, günlük dosyalarını saklayabilmesi ve ayarları dışa aktarabilmesi için depolama iznine ihtiyacı var</string>
|
||||||
<string name="needconnectpermission">Uygulama bluetooth iznine ihtiyac duyuyor</string>
|
|
||||||
<string name="request">İstek</string>
|
<string name="request">İstek</string>
|
||||||
<string name="open_navigation">Navigasyonu aç</string>
|
<string name="open_navigation">Navigasyonu aç</string>
|
||||||
<string name="close_navigation">Navigasyonu kapat</string>
|
<string name="close_navigation">Navigasyonu kapat</string>
|
||||||
|
|
|
@ -432,6 +432,7 @@
|
||||||
<string name="ns_localbroadcasts_title">启用本地广播。</string>
|
<string name="ns_localbroadcasts_title">启用本地广播。</string>
|
||||||
<string name="openapssmb">OpenAPS SMB</string>
|
<string name="openapssmb">OpenAPS SMB</string>
|
||||||
<string name="openaps_smb_dynamic_isf">动态ISF(胰岛素敏感系数)</string>
|
<string name="openaps_smb_dynamic_isf">动态ISF(胰岛素敏感系数)</string>
|
||||||
|
<string name="DynISFAdjust_summary" formatted="false">动态ISF的调整因子。设置100%以上用于更积极的校正,100%以下则不那么积极校正。</string>
|
||||||
<string name="enableuam">启用 UAM</string>
|
<string name="enableuam">启用 UAM</string>
|
||||||
<string name="enablesmb">启用微型大剂量</string>
|
<string name="enablesmb">启用微型大剂量</string>
|
||||||
<string name="enablesmb_summary">使用微型大剂量代替使用临时基础率,更快的干预</string>
|
<string name="enablesmb_summary">使用微型大剂量代替使用临时基础率,更快的干预</string>
|
||||||
|
@ -636,7 +637,6 @@
|
||||||
<string name="needsystemwindowpermission">应用程序需要悬浮窗权限用于发送通知。</string>
|
<string name="needsystemwindowpermission">应用程序需要悬浮窗权限用于发送通知。</string>
|
||||||
<string name="needlocationpermission">应用程序需要定位权限,才能进行蓝牙扫描及WIFI识别。</string>
|
<string name="needlocationpermission">应用程序需要定位权限,才能进行蓝牙扫描及WIFI识别。</string>
|
||||||
<string name="needstoragepermission">应用程序需要文件存储权限,才能存储日志文件及导出设置。</string>
|
<string name="needstoragepermission">应用程序需要文件存储权限,才能存储日志文件及导出设置。</string>
|
||||||
<string name="needconnectpermission">应用程序需要蓝牙权限。</string>
|
|
||||||
<string name="request">请求</string>
|
<string name="request">请求</string>
|
||||||
<string name="open_navigation">打开导航栏</string>
|
<string name="open_navigation">打开导航栏</string>
|
||||||
<string name="close_navigation">关闭导航栏</string>
|
<string name="close_navigation">关闭导航栏</string>
|
||||||
|
|
|
@ -789,7 +789,6 @@
|
||||||
<string name="needsystemwindowpermission">Application needs system window permission for notifications</string>
|
<string name="needsystemwindowpermission">Application needs system window permission for notifications</string>
|
||||||
<string name="needlocationpermission">Application needs location permission for BT scan and WiFi identification</string>
|
<string name="needlocationpermission">Application needs location permission for BT scan and WiFi identification</string>
|
||||||
<string name="needstoragepermission">Application needs storage permission to be able store log files and export settings</string>
|
<string name="needstoragepermission">Application needs storage permission to be able store log files and export settings</string>
|
||||||
<string name="needconnectpermission">Application needs bluetooth permission</string>
|
|
||||||
<string name="request">Request</string>
|
<string name="request">Request</string>
|
||||||
<string name="open_navigation">Open navigation</string>
|
<string name="open_navigation">Open navigation</string>
|
||||||
<string name="close_navigation">Close navigation</string>
|
<string name="close_navigation">Close navigation</string>
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.androidaps.plugins.general.automation.triggers
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
import android.bluetooth.BluetoothManager
|
import android.bluetooth.BluetoothManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
import info.nightscout.androidaps.automation.R
|
||||||
|
@ -13,9 +16,9 @@ import info.nightscout.androidaps.plugins.general.automation.elements.InputDropd
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.*
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class TriggerBTDevice(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerBTDevice(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
|
@ -74,12 +77,16 @@ class TriggerBTDevice(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
// Get the list of paired BT devices to use in dropdown menu
|
// Get the list of paired BT devices to use in dropdown menu
|
||||||
private fun devicesPaired(): ArrayList<CharSequence> {
|
private fun devicesPaired(): ArrayList<CharSequence> {
|
||||||
val s = ArrayList<CharSequence>()
|
val s = ArrayList<CharSequence>()
|
||||||
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.bondedDevices?.forEach { s.add(it.name) }
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.bondedDevices?.forEach { s.add(it.name) }
|
||||||
|
} else {
|
||||||
|
ToastUtils.errorToast(context, context.getString(R.string.needconnectpermission))
|
||||||
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun eventExists(): Boolean {
|
private fun eventExists(): Boolean {
|
||||||
automationPlugin.btConnects.forEach {
|
ArrayList(automationPlugin.btConnects).forEach {
|
||||||
if (btDevice.value == it.deviceName) {
|
if (btDevice.value == it.deviceName) {
|
||||||
if (comparator.value == ComparatorConnect.Compare.ON_CONNECT && it.state == EventBTChange.Change.CONNECT) return true
|
if (comparator.value == ComparatorConnect.Compare.ON_CONNECT && it.state == EventBTChange.Change.CONNECT) return true
|
||||||
if (comparator.value == ComparatorConnect.Compare.ON_DISCONNECT && it.state == EventBTChange.Change.DISCONNECT) return true
|
if (comparator.value == ComparatorConnect.Compare.ON_DISCONNECT && it.state == EventBTChange.Change.DISCONNECT) return true
|
||||||
|
|
|
@ -112,4 +112,5 @@
|
||||||
<string name="automation_event">Automatizuotas įvykis</string>
|
<string name="automation_event">Automatizuotas įvykis</string>
|
||||||
<string name="reorder_label">Pertvarkyti</string>
|
<string name="reorder_label">Pertvarkyti</string>
|
||||||
<string name="user_action">Vartotojo veiksmas</string>
|
<string name="user_action">Vartotojo veiksmas</string>
|
||||||
|
<string name="sort_label">Rūšiuoti</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -49,7 +49,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.2.1'
|
classpath 'com.android.tools.build:gradle:7.2.1'
|
||||||
classpath 'com.google.gms:google-services:4.3.10'
|
classpath 'com.google.gms:google-services:4.3.13'
|
||||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||||
|
|
||||||
<application android:supportsRtl="true">
|
<application android:supportsRtl="true">
|
||||||
<activity
|
<activity
|
||||||
android:name="info.nightscout.androidaps.activities.TDDStatsActivity"
|
android:name="info.nightscout.androidaps.activities.TDDStatsActivity"
|
||||||
|
|
|
@ -43,11 +43,10 @@ class BlePreCheck @Inject constructor(
|
||||||
}
|
}
|
||||||
// change after SDK = 31+
|
// change after SDK = 31+
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
if (ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_CONNECT") != PackageManager.PERMISSION_GRANTED ||
|
if (ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED ||
|
||||||
ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_SCAN") != PackageManager.PERMISSION_GRANTED
|
ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
) {
|
||||||
//ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT), PERMISSION_REQUEST_BLUETOOTH)
|
ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT), PERMISSION_REQUEST_BLUETOOTH)
|
||||||
ActivityCompat.requestPermissions(activity, arrayOf("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT"), PERMISSION_REQUEST_BLUETOOTH)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package info.nightscout.androidaps.utils.ui
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import kotlin.jvm.JvmOverloads
|
||||||
|
import android.bluetooth.BluetoothManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
|
import androidx.preference.ListPreference
|
||||||
|
import info.nightscout.androidaps.core.R
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class BluetoothDevicePreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ListPreference(context, attrs) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
val devices = Vector<CharSequence>()
|
||||||
|
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.let { bta ->
|
||||||
|
for (dev in bta.bondedDevices)
|
||||||
|
dev.name?.let { name -> devices.add(name) }
|
||||||
|
}
|
||||||
|
entries = devices.toTypedArray()
|
||||||
|
entryValues = devices.toTypedArray()
|
||||||
|
} else {
|
||||||
|
entries = emptyArray()
|
||||||
|
entryValues = emptyArray()
|
||||||
|
ToastUtils.errorToast(context, context.getString(R.string.needconnectpermission))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -289,6 +289,7 @@
|
||||||
<string name="sms" comment="26 characters max for translation">SMS</string>
|
<string name="sms" comment="26 characters max for translation">SMS</string>
|
||||||
<string name="basal">Базал</string>
|
<string name="basal">Базал</string>
|
||||||
<!-- Autotune -->
|
<!-- Autotune -->
|
||||||
|
<string name="needconnectpermission">Апликацията изисква разрешение за bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d дeн</item>
|
<item quantity="one">%1$d дeн</item>
|
||||||
<item quantity="other">%1$d дни</item>
|
<item quantity="other">%1$d дни</item>
|
||||||
|
|
|
@ -70,4 +70,5 @@
|
||||||
<!-- Command Queue + readStatus reasons -->
|
<!-- Command Queue + readStatus reasons -->
|
||||||
<string name="basal">Basal</string>
|
<string name="basal">Basal</string>
|
||||||
<!-- Autotune -->
|
<!-- Autotune -->
|
||||||
|
<string name="needconnectpermission">L\'aplicació necessita el permís del bluethoot</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -489,6 +489,7 @@
|
||||||
<string name="autotune_run_with_autoswitch">Autotune spuštěno, a profil automaticky přepnut</string>
|
<string name="autotune_run_with_autoswitch">Autotune spuštěno, a profil automaticky přepnut</string>
|
||||||
<string name="autotune_run_with_error">Chyba při posledním spuštění Autotune</string>
|
<string name="autotune_run_with_error">Chyba při posledním spuštění Autotune</string>
|
||||||
<string name="autotune_run_cancelled">Byla zjištěna jiná běžící úloha Autotune, spuštění zrušeno</string>
|
<string name="autotune_run_cancelled">Byla zjištěna jiná běžící úloha Autotune, spuštění zrušeno</string>
|
||||||
|
<string name="needconnectpermission">Aplikace potřebuje oprávnění bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d den</item>
|
<item quantity="one">%1$d den</item>
|
||||||
<item quantity="few">%1$d dnů</item>
|
<item quantity="few">%1$d dnů</item>
|
||||||
|
|
|
@ -482,6 +482,7 @@
|
||||||
<string name="autotune_run_without_autoswitch">Autotune kørt uden profilskift</string>
|
<string name="autotune_run_without_autoswitch">Autotune kørt uden profilskift</string>
|
||||||
<string name="autotune_run_with_autoswitch">Autotune kørt, profilen er automatisk skiftet</string>
|
<string name="autotune_run_with_autoswitch">Autotune kørt, profilen er automatisk skiftet</string>
|
||||||
<string name="autotune_run_with_error">Fejl under sidste Autotune kørsel</string>
|
<string name="autotune_run_with_error">Fejl under sidste Autotune kørsel</string>
|
||||||
|
<string name="needconnectpermission">Applikationen kræver tilladelse til bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d dag</item>
|
<item quantity="one">%1$d dag</item>
|
||||||
<item quantity="other">%1$d dage</item>
|
<item quantity="other">%1$d dage</item>
|
||||||
|
|
|
@ -433,6 +433,7 @@
|
||||||
<string name="count_selected">%1$d ausgewählt</string>
|
<string name="count_selected">%1$d ausgewählt</string>
|
||||||
<string name="sort_label">Sortieren</string>
|
<string name="sort_label">Sortieren</string>
|
||||||
<!-- Autotune -->
|
<!-- Autotune -->
|
||||||
|
<string name="needconnectpermission">App benötigt Bluetooth-Berechtigung</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d Tag</item>
|
<item quantity="one">%1$d Tag</item>
|
||||||
<item quantity="other">%1$d Tage</item>
|
<item quantity="other">%1$d Tage</item>
|
||||||
|
|
|
@ -489,6 +489,7 @@
|
||||||
<string name="autotune_run_with_autoswitch">Autotune ejecutado y perfil cambiado automáticamente</string>
|
<string name="autotune_run_with_autoswitch">Autotune ejecutado y perfil cambiado automáticamente</string>
|
||||||
<string name="autotune_run_with_error">Error durante la última ejecución de Autotune</string>
|
<string name="autotune_run_with_error">Error durante la última ejecución de Autotune</string>
|
||||||
<string name="autotune_run_cancelled">Se ha detectado otra ejecución de Autotune, ejecución cancelada</string>
|
<string name="autotune_run_cancelled">Se ha detectado otra ejecución de Autotune, ejecución cancelada</string>
|
||||||
|
<string name="needconnectpermission">La aplicación necesita permiso de bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d día</item>
|
<item quantity="one">%1$d día</item>
|
||||||
<item quantity="other">%1$d días</item>
|
<item quantity="other">%1$d días</item>
|
||||||
|
|
|
@ -489,6 +489,7 @@
|
||||||
<string name="autotune_run_with_autoswitch">Autotune eseguito e profilo cambiato automaticamente</string>
|
<string name="autotune_run_with_autoswitch">Autotune eseguito e profilo cambiato automaticamente</string>
|
||||||
<string name="autotune_run_with_error">Errore durante l\'ultima esecuzione di Autotune</string>
|
<string name="autotune_run_with_error">Errore durante l\'ultima esecuzione di Autotune</string>
|
||||||
<string name="autotune_run_cancelled">È stata rilevata un\'altra esecuzione di Autotune, esecuzione annullata</string>
|
<string name="autotune_run_cancelled">È stata rilevata un\'altra esecuzione di Autotune, esecuzione annullata</string>
|
||||||
|
<string name="needconnectpermission">L\'applicazione richiede l\'autorizzazione bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d giorno</item>
|
<item quantity="one">%1$d giorno</item>
|
||||||
<item quantity="other">%1$d giorni</item>
|
<item quantity="other">%1$d giorni</item>
|
||||||
|
|
|
@ -489,6 +489,7 @@
|
||||||
<string name="autotune_run_with_autoswitch">כוונון אוטומטי הופעל והפרופיל הוחלף אוטומטית</string>
|
<string name="autotune_run_with_autoswitch">כוונון אוטומטי הופעל והפרופיל הוחלף אוטומטית</string>
|
||||||
<string name="autotune_run_with_error">שגיאה במהלך הכיוונון האוטומטי האחרון</string>
|
<string name="autotune_run_with_error">שגיאה במהלך הכיוונון האוטומטי האחרון</string>
|
||||||
<string name="autotune_run_cancelled">נמצאה הפעלה נוספת של הכוונון האוטומטי ברקע, ההפעלה מבוטלת</string>
|
<string name="autotune_run_cancelled">נמצאה הפעלה נוספת של הכוונון האוטומטי ברקע, ההפעלה מבוטלת</string>
|
||||||
|
<string name="needconnectpermission">האפליקציה צריכה הרשאה לבלוטות\'</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d יום</item>
|
<item quantity="one">%1$d יום</item>
|
||||||
<item quantity="two">%1$d ימים</item>
|
<item quantity="two">%1$d ימים</item>
|
||||||
|
|
|
@ -422,6 +422,7 @@
|
||||||
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Mygtukas Naujinti</string>
|
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Mygtukas Naujinti</string>
|
||||||
<string name="basal">Valandinė bazė</string>
|
<string name="basal">Valandinė bazė</string>
|
||||||
<!-- Autotune -->
|
<!-- Autotune -->
|
||||||
|
<string name="needconnectpermission">Programai reikalinga Bluetooth prieigos teisė</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d d.</item>
|
<item quantity="one">%1$d d.</item>
|
||||||
<item quantity="few">%1$d d.</item>
|
<item quantity="few">%1$d d.</item>
|
||||||
|
|
|
@ -246,6 +246,14 @@
|
||||||
<!---Icons in Loop area -->
|
<!---Icons in Loop area -->
|
||||||
<item name="profileColor">@color/white</item>
|
<item name="profileColor">@color/white</item>
|
||||||
<item name="crossTargetColor">@color/white</item>
|
<item name="crossTargetColor">@color/white</item>
|
||||||
|
<!---Spinner style from pump common-->
|
||||||
|
<item name="android:spinnerItemStyle">@style/CommonSpinnerItemStyle</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<style name="CommonSpinnerItemStyle" parent="Widget.AppCompat.TextView.SpinnerItem">
|
||||||
|
<item name="android:textColor">@android:color/white</item>
|
||||||
|
<item name="android:textSize">15sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Aaps_ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar">
|
<style name="Aaps_ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar">
|
||||||
|
|
|
@ -489,6 +489,7 @@
|
||||||
<string name="autotune_run_with_autoswitch">Autotune utført og profil automatisk skiftet ut</string>
|
<string name="autotune_run_with_autoswitch">Autotune utført og profil automatisk skiftet ut</string>
|
||||||
<string name="autotune_run_with_error">Feil oppdaget under siste Autotune kjøring</string>
|
<string name="autotune_run_with_error">Feil oppdaget under siste Autotune kjøring</string>
|
||||||
<string name="autotune_run_cancelled">Autotune kjører allerede. Kjøring avbrutt</string>
|
<string name="autotune_run_cancelled">Autotune kjører allerede. Kjøring avbrutt</string>
|
||||||
|
<string name="needconnectpermission">Appen trenger bluetooth tillatelse</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d dag</item>
|
<item quantity="one">%1$d dag</item>
|
||||||
<item quantity="other">%1$d dager</item>
|
<item quantity="other">%1$d dager</item>
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
<string name="count_selected">Wybrany %1$d</string>
|
<string name="count_selected">Wybrany %1$d</string>
|
||||||
<string name="sort_label">Sortuj</string>
|
<string name="sort_label">Sortuj</string>
|
||||||
<!-- Autotune -->
|
<!-- Autotune -->
|
||||||
|
<string name="needconnectpermission">Aplikacja wymaga uprawnienia Bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d dzień</item>
|
<item quantity="one">%1$d dzień</item>
|
||||||
<item quantity="few">%1$d dni</item>
|
<item quantity="few">%1$d dni</item>
|
||||||
|
|
|
@ -229,6 +229,7 @@
|
||||||
<string name="autotune_tune_insulin_curve_summary">Habilitar apenas se você usar pico livre. Esta opção irá ajustar a duração do pico e da DAI</string>
|
<string name="autotune_tune_insulin_curve_summary">Habilitar apenas se você usar pico livre. Esta opção irá ajustar a duração do pico e da DAI</string>
|
||||||
<string name="autotune_default_tune_days_summary">Número padrão de dias de dados a serem processados por Autotune (até 30)</string>
|
<string name="autotune_default_tune_days_summary">Número padrão de dias de dados a serem processados por Autotune (até 30)</string>
|
||||||
<string name="autotune_error">Erro nos dados de entrada, tente executar novamente autotune ou reduza o número de dias</string>
|
<string name="autotune_error">Erro nos dados de entrada, tente executar novamente autotune ou reduza o número de dias</string>
|
||||||
|
<string name="needconnectpermission">O aplicativo precisa de permissão bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d dia</item>
|
<item quantity="one">%1$d dia</item>
|
||||||
<item quantity="other">%1$d dias</item>
|
<item quantity="other">%1$d dias</item>
|
||||||
|
|
|
@ -341,6 +341,7 @@
|
||||||
<!-- Command Queue + readStatus reasons -->
|
<!-- Command Queue + readStatus reasons -->
|
||||||
<string name="basal">Basal</string>
|
<string name="basal">Basal</string>
|
||||||
<!-- Autotune -->
|
<!-- Autotune -->
|
||||||
|
<string name="needconnectpermission">Aplicação precisa de permissão Bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d dia</item>
|
<item quantity="one">%1$d dia</item>
|
||||||
<item quantity="other">%1$d dias</item>
|
<item quantity="other">%1$d dias</item>
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
<string name="basal">Rate bazale</string>
|
<string name="basal">Rate bazale</string>
|
||||||
<string name="sort_label">Sortează</string>
|
<string name="sort_label">Sortează</string>
|
||||||
<!-- Autotune -->
|
<!-- Autotune -->
|
||||||
|
<string name="needconnectpermission">Aplicația are nevoie de permisiune Bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d zi</item>
|
<item quantity="one">%1$d zi</item>
|
||||||
<item quantity="few">%1$d zile</item>
|
<item quantity="few">%1$d zile</item>
|
||||||
|
|
|
@ -489,6 +489,7 @@
|
||||||
<string name="autotune_run_with_autoswitch">Autotune выполнен и профиль переключён автоматически</string>
|
<string name="autotune_run_with_autoswitch">Autotune выполнен и профиль переключён автоматически</string>
|
||||||
<string name="autotune_run_with_error">Ошибка во время последнего выполнения Autotune</string>
|
<string name="autotune_run_with_error">Ошибка во время последнего выполнения Autotune</string>
|
||||||
<string name="autotune_run_cancelled">Обнаружен другой запуск Autotune, выполнение отменено</string>
|
<string name="autotune_run_cancelled">Обнаружен другой запуск Autotune, выполнение отменено</string>
|
||||||
|
<string name="needconnectpermission">Приложению требуется разрешение Bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d день</item>
|
<item quantity="one">%1$d день</item>
|
||||||
<item quantity="few">%1$d дня</item>
|
<item quantity="few">%1$d дня</item>
|
||||||
|
|
|
@ -489,6 +489,7 @@
|
||||||
<string name="autotune_run_with_autoswitch">Autotune spustený a profil automaticky prepnutý</string>
|
<string name="autotune_run_with_autoswitch">Autotune spustený a profil automaticky prepnutý</string>
|
||||||
<string name="autotune_run_with_error">Chyba pri poslednom spustení Autotune</string>
|
<string name="autotune_run_with_error">Chyba pri poslednom spustení Autotune</string>
|
||||||
<string name="autotune_run_cancelled">Bola zistená iná spustená úloha Autotune, spustenie zrušené</string>
|
<string name="autotune_run_cancelled">Bola zistená iná spustená úloha Autotune, spustenie zrušené</string>
|
||||||
|
<string name="needconnectpermission">Aplikácia vyžaduje povolenie bluetooth</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d deň</item>
|
<item quantity="one">%1$d deň</item>
|
||||||
<item quantity="few">%1$d dní</item>
|
<item quantity="few">%1$d dní</item>
|
||||||
|
|
|
@ -430,6 +430,7 @@
|
||||||
<string name="a11y_plus_button_description">öka %1$s med %2$s</string>
|
<string name="a11y_plus_button_description">öka %1$s med %2$s</string>
|
||||||
<string name="basal">Basal</string>
|
<string name="basal">Basal</string>
|
||||||
<!-- Autotune -->
|
<!-- Autotune -->
|
||||||
|
<string name="needconnectpermission">Applikationen behöver bluetooth-behörighet</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d dag</item>
|
<item quantity="one">%1$d dag</item>
|
||||||
<item quantity="other">%1$d dagar</item>
|
<item quantity="other">%1$d dagar</item>
|
||||||
|
|
|
@ -489,6 +489,7 @@
|
||||||
<string name="autotune_run_with_autoswitch">OtoAyar çalıştırıldı ve profil otomatik olarak değiştirildi</string>
|
<string name="autotune_run_with_autoswitch">OtoAyar çalıştırıldı ve profil otomatik olarak değiştirildi</string>
|
||||||
<string name="autotune_run_with_error">Son OtoAyar çalışması sırasında hata oluştu</string>
|
<string name="autotune_run_with_error">Son OtoAyar çalışması sırasında hata oluştu</string>
|
||||||
<string name="autotune_run_cancelled">Başka bir OtoAyar çalıştırması tespit edildi, çalıştırma iptal edildi</string>
|
<string name="autotune_run_cancelled">Başka bir OtoAyar çalıştırması tespit edildi, çalıştırma iptal edildi</string>
|
||||||
|
<string name="needconnectpermission">Uygulama bluetooth iznine ihtiyac duyuyor</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d gün</item>
|
<item quantity="one">%1$d gün</item>
|
||||||
<item quantity="other">%1$d gün</item>
|
<item quantity="other">%1$d gün</item>
|
||||||
|
|
|
@ -442,6 +442,7 @@
|
||||||
<string name="a11y_file">文件</string>
|
<string name="a11y_file">文件</string>
|
||||||
<string name="a11y_user">用户</string>
|
<string name="a11y_user">用户</string>
|
||||||
<!-- Autotune -->
|
<!-- Autotune -->
|
||||||
|
<string name="needconnectpermission">应用程序需要蓝牙权限。</string>
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="other">%1$d 天</item>
|
<item quantity="other">%1$d 天</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
|
@ -601,6 +601,7 @@
|
||||||
<string name="autotune_run_with_autoswitch">Autotune runned and profile automatically switched</string>
|
<string name="autotune_run_with_autoswitch">Autotune runned and profile automatically switched</string>
|
||||||
<string name="autotune_run_with_error">Error during last Autotune run</string>
|
<string name="autotune_run_with_error">Error during last Autotune run</string>
|
||||||
<string name="autotune_run_cancelled">Another run of Autotune is detected, run cancelled</string>
|
<string name="autotune_run_cancelled">Another run of Autotune is detected, run cancelled</string>
|
||||||
|
<string name="needconnectpermission">Application needs bluetooth permission</string>
|
||||||
|
|
||||||
<plurals name="days">
|
<plurals name="days">
|
||||||
<item quantity="one">%1$d day</item>
|
<item quantity="one">%1$d day</item>
|
||||||
|
|
|
@ -247,8 +247,16 @@
|
||||||
<!---Icons in Loop area -->
|
<!---Icons in Loop area -->
|
||||||
<item name="profileColor">@color/black</item>
|
<item name="profileColor">@color/black</item>
|
||||||
<item name="crossTargetColor">@color/white</item>
|
<item name="crossTargetColor">@color/white</item>
|
||||||
|
<!---Spinner style from pump common-->
|
||||||
|
<item name="android:spinnerItemStyle">@style/CommonSpinnerItemStyle</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="CommonSpinnerItemStyle" parent="Widget.AppCompat.TextView.SpinnerItem">
|
||||||
|
<item name="android:textColor">@android:color/black</item>
|
||||||
|
<item name="android:textSize">15sp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<style name="Aaps_ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar">
|
<style name="Aaps_ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar">
|
||||||
<item name="android:titleTextStyle">@style/Theme.Aaps.ActionBar.TitleTextStyle</item>
|
<item name="android:titleTextStyle">@style/Theme.Aaps.ActionBar.TitleTextStyle</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
package info.nightscout.androidaps.danar
|
|
||||||
|
|
||||||
import kotlin.jvm.JvmOverloads
|
|
||||||
import android.bluetooth.BluetoothAdapter
|
|
||||||
import android.bluetooth.BluetoothDevice
|
|
||||||
import android.bluetooth.BluetoothManager
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import androidx.preference.ListPreference
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class BluetoothDevicePreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ListPreference(context, attrs) {
|
|
||||||
init {
|
|
||||||
val entries = Vector<CharSequence>()
|
|
||||||
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.let { bta ->
|
|
||||||
for (dev in bta.bondedDevices)
|
|
||||||
dev.name?.let { name -> entries.add(name) }
|
|
||||||
}
|
|
||||||
setEntries(entries.toTypedArray())
|
|
||||||
entryValues = entries.toTypedArray()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +1,18 @@
|
||||||
package info.nightscout.androidaps.danar.services;
|
package info.nightscout.androidaps.danar.services;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.bluetooth.BluetoothManager;
|
import android.bluetooth.BluetoothManager;
|
||||||
import android.bluetooth.BluetoothSocket;
|
import android.bluetooth.BluetoothSocket;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -41,8 +45,7 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||||
import info.nightscout.androidaps.interfaces.Profile;
|
import info.nightscout.androidaps.interfaces.Profile;
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync;
|
import info.nightscout.androidaps.interfaces.PumpSync;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
import info.nightscout.androidaps.interfaces.ResourceHelper;
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus;
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
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;
|
||||||
|
@ -50,8 +53,9 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
|
||||||
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.ToastUtils;
|
import info.nightscout.androidaps.utils.ToastUtils;
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper;
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
|
import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
import info.nightscout.shared.sharedPreferences.SP;
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||||
|
|
||||||
|
@ -191,30 +195,32 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
|
||||||
|
|
||||||
protected void getBTSocketForSelectedPump() {
|
protected void getBTSocketForSelectedPump() {
|
||||||
mDevName = sp.getString(R.string.key_danar_bt_name, "");
|
mDevName = sp.getString(R.string.key_danar_bt_name, "");
|
||||||
BluetoothAdapter bluetoothAdapter = ((BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
BluetoothAdapter bluetoothAdapter = ((BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
|
||||||
|
|
||||||
if (bluetoothAdapter != null) {
|
if (bluetoothAdapter != null) {
|
||||||
Set<BluetoothDevice> bondedDevices = bluetoothAdapter.getBondedDevices();
|
Set<BluetoothDevice> bondedDevices = bluetoothAdapter.getBondedDevices();
|
||||||
|
|
||||||
if (bondedDevices != null)
|
if (bondedDevices != null)
|
||||||
for (BluetoothDevice device : bondedDevices) {
|
for (BluetoothDevice device : bondedDevices) {
|
||||||
if (mDevName.equals(device.getName())) {
|
if (mDevName.equals(device.getName())) {
|
||||||
mBTDevice = device;
|
mBTDevice = device;
|
||||||
try {
|
try {
|
||||||
mRfcommSocket = mBTDevice.createRfcommSocketToServiceRecord(SPP_UUID);
|
mRfcommSocket = mBTDevice.createRfcommSocketToServiceRecord(SPP_UUID);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
aapsLogger.error("Error creating socket: ", e);
|
aapsLogger.error("Error creating socket: ", e);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
ToastUtils.INSTANCE.showToastInUiThread(context.getApplicationContext(), rh.gs(R.string.nobtadapter));
|
||||||
|
}
|
||||||
|
if (mBTDevice == null) {
|
||||||
|
ToastUtils.INSTANCE.showToastInUiThread(context.getApplicationContext(), rh.gs(R.string.devicenotfound));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.INSTANCE.showToastInUiThread(context.getApplicationContext(),
|
ToastUtils.INSTANCE.errorToast(context, context.getString(R.string.needconnectpermission));
|
||||||
rh.gs(R.string.nobtadapter));
|
|
||||||
}
|
|
||||||
if (mBTDevice == null) {
|
|
||||||
ToastUtils.INSTANCE.showToastInUiThread(context.getApplicationContext(),
|
|
||||||
rh.gs(R.string.devicenotfound));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
android:title="@string/danar_pump_settings"
|
android:title="@string/danar_pump_settings"
|
||||||
app:initialExpandedChildrenCount="0">
|
app:initialExpandedChildrenCount="0">
|
||||||
|
|
||||||
<info.nightscout.androidaps.danar.BluetoothDevicePreference
|
<info.nightscout.androidaps.utils.ui.BluetoothDevicePreference
|
||||||
android:dialogTitle="@string/danar_bt_name_title"
|
android:dialogTitle="@string/danar_bt_name_title"
|
||||||
android:key="@string/key_danar_bt_name"
|
android:key="@string/key_danar_bt_name"
|
||||||
android:title="@string/danar_bt_name_title" />
|
android:title="@string/danar_bt_name_title" />
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
android:title="@string/danar_pump_settings"
|
android:title="@string/danar_pump_settings"
|
||||||
app:initialExpandedChildrenCount="0">
|
app:initialExpandedChildrenCount="0">
|
||||||
|
|
||||||
<info.nightscout.androidaps.danar.BluetoothDevicePreference
|
<info.nightscout.androidaps.utils.ui.BluetoothDevicePreference
|
||||||
android:dialogTitle="@string/danar_bt_name_title"
|
android:dialogTitle="@string/danar_bt_name_title"
|
||||||
android:key="@string/key_danar_bt_name"
|
android:key="@string/key_danar_bt_name"
|
||||||
android:title="@string/danar_bt_name_title" />
|
android:title="@string/danar_bt_name_title" />
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
android:title="@string/danar_pump_settings"
|
android:title="@string/danar_pump_settings"
|
||||||
app:initialExpandedChildrenCount="0">
|
app:initialExpandedChildrenCount="0">
|
||||||
|
|
||||||
<info.nightscout.androidaps.danar.BluetoothDevicePreference
|
<info.nightscout.androidaps.utils.ui.BluetoothDevicePreference
|
||||||
android:dialogTitle="@string/danar_bt_name_title"
|
android:dialogTitle="@string/danar_bt_name_title"
|
||||||
android:key="@string/key_danar_bt_name"
|
android:key="@string/key_danar_bt_name"
|
||||||
android:title="@string/danar_bt_name_title" />
|
android:title="@string/danar_bt_name_title" />
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
|
||||||
|
|
||||||
<application>
|
<application>
|
||||||
<activity
|
<activity
|
||||||
android:name="info.nightscout.androidaps.danars.activities.BLEScanActivity"
|
android:name="info.nightscout.androidaps.danars.activities.BLEScanActivity"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.danars.activities
|
package info.nightscout.androidaps.danars.activities
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.bluetooth.BluetoothAdapter
|
import android.bluetooth.BluetoothAdapter
|
||||||
import android.bluetooth.BluetoothDevice
|
import android.bluetooth.BluetoothDevice
|
||||||
|
@ -9,6 +10,7 @@ import android.bluetooth.le.ScanCallback
|
||||||
import android.bluetooth.le.ScanResult
|
import android.bluetooth.le.ScanResult
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
@ -16,14 +18,14 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.BaseAdapter
|
import android.widget.BaseAdapter
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.danars.R
|
import info.nightscout.androidaps.danars.R
|
||||||
import info.nightscout.androidaps.danars.databinding.DanarsBlescannerActivityBinding
|
import info.nightscout.androidaps.danars.databinding.DanarsBlescannerActivityBinding
|
||||||
import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange
|
import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
|
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import java.util.*
|
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -58,8 +60,12 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
if (bluetoothAdapter?.isEnabled != true) bluetoothAdapter?.enable()
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
|
||||||
startScan()
|
if (bluetoothAdapter?.isEnabled != true) bluetoothAdapter?.enable()
|
||||||
|
startScan()
|
||||||
|
} else {
|
||||||
|
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
@ -68,17 +74,26 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startScan() =
|
private fun startScan() =
|
||||||
try {
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
|
||||||
bluetoothLeScanner?.startScan(mBleScanCallback)
|
try {
|
||||||
} catch (e: IllegalStateException) {
|
bluetoothLeScanner?.startScan(mBleScanCallback)
|
||||||
} // ignore BT not on
|
} catch (ignore: IllegalStateException) {
|
||||||
|
} // ignore BT not on
|
||||||
|
} else {
|
||||||
|
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
|
||||||
|
}
|
||||||
|
|
||||||
private fun stopScan() =
|
private fun stopScan() =
|
||||||
try {
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
|
||||||
bluetoothLeScanner?.stopScan(mBleScanCallback)
|
try {
|
||||||
} catch (e: IllegalStateException) {
|
bluetoothLeScanner?.stopScan(mBleScanCallback)
|
||||||
} // ignore BT not on
|
} catch (ignore: IllegalStateException) {
|
||||||
|
} // ignore BT not on
|
||||||
|
} else {
|
||||||
|
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
private fun addBleDevice(device: BluetoothDevice?) {
|
private fun addBleDevice(device: BluetoothDevice?) {
|
||||||
if (device == null || device.name == null || device.name == "") {
|
if (device == null || device.name == null || device.name == "") {
|
||||||
return
|
return
|
||||||
|
@ -132,11 +147,16 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
|
||||||
override fun onClick(v: View) {
|
override fun onClick(v: View) {
|
||||||
sp.putString(R.string.key_danars_address, item.device.address)
|
sp.putString(R.string.key_danars_address, item.device.address)
|
||||||
sp.putString(R.string.key_danars_name, name.text.toString())
|
sp.putString(R.string.key_danars_name, name.text.toString())
|
||||||
item.device.createBond()
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
|
||||||
rxBus.send(EventDanaRSDeviceChange())
|
item.device.createBond()
|
||||||
|
rxBus.send(EventDanaRSDeviceChange())
|
||||||
|
} else {
|
||||||
|
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
|
||||||
|
}
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
fun setData(data: BluetoothDeviceItem) {
|
fun setData(data: BluetoothDeviceItem) {
|
||||||
var tTitle = data.device.name
|
var tTitle = data.device.name
|
||||||
if (tTitle == null || tTitle == "") {
|
if (tTitle == null || tTitle == "") {
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package info.nightscout.androidaps.danars.services
|
package info.nightscout.androidaps.danars.services
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.bluetooth.*
|
import android.bluetooth.*
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.danars.DanaRSPlugin
|
import info.nightscout.androidaps.danars.DanaRSPlugin
|
||||||
|
@ -21,6 +25,7 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||||
import info.nightscout.androidaps.extensions.notify
|
import info.nightscout.androidaps.extensions.notify
|
||||||
import info.nightscout.androidaps.extensions.waitMillis
|
import info.nightscout.androidaps.extensions.waitMillis
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
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
|
||||||
|
@ -28,7 +33,6 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -90,6 +94,11 @@ class BLEComm @Inject internal constructor(
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun connect(from: String, address: String?): Boolean {
|
fun connect(from: String, address: String?): Boolean {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
|
||||||
|
aapsLogger.error(LTag.PUMPBTCOMM, "missing permission: $from")
|
||||||
|
return false
|
||||||
|
}
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Initializing BLEComm.")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Initializing BLEComm.")
|
||||||
if (bluetoothAdapter == null) {
|
if (bluetoothAdapter == null) {
|
||||||
aapsLogger.error("Unable to obtain a BluetoothAdapter.")
|
aapsLogger.error("Unable to obtain a BluetoothAdapter.")
|
||||||
|
@ -107,8 +116,10 @@ class BLEComm @Inject internal constructor(
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (device.bondState == BluetoothDevice.BOND_NONE) {
|
if (device.bondState == BluetoothDevice.BOND_NONE) {
|
||||||
device.createBond()
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
|
||||||
SystemClock.sleep(10000)
|
device.createBond()
|
||||||
|
SystemClock.sleep(10000)
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
isConnected = false
|
isConnected = false
|
||||||
|
@ -131,6 +142,10 @@ class BLEComm @Inject internal constructor(
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun disconnect(from: String) {
|
fun disconnect(from: String) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
aapsLogger.error(LTag.PUMPBTCOMM, "missing permission: $from")
|
||||||
|
return
|
||||||
|
}
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "disconnect from: $from")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "disconnect from: $from")
|
||||||
|
|
||||||
if (!encryptedDataRead && encryptedCommandSent && encryption == EncryptionType.ENCRYPTION_BLE5) {
|
if (!encryptedDataRead && encryptedCommandSent && encryption == EncryptionType.ENCRYPTION_BLE5) {
|
||||||
|
@ -191,6 +206,7 @@ class BLEComm @Inject internal constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
@Synchronized fun close() {
|
@Synchronized fun close() {
|
||||||
/*
|
/*
|
||||||
if (!encryptedDataRead && !encryptedCommandSent) {
|
if (!encryptedDataRead && !encryptedCommandSent) {
|
||||||
|
@ -268,6 +284,7 @@ class BLEComm @Inject internal constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun setCharacteristicNotification(characteristic: BluetoothGattCharacteristic?, enabled: Boolean) {
|
private fun setCharacteristicNotification(characteristic: BluetoothGattCharacteristic?, enabled: Boolean) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "setCharacteristicNotification")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "setCharacteristicNotification")
|
||||||
|
@ -287,6 +304,7 @@ class BLEComm @Inject internal constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun writeCharacteristicNoResponse(characteristic: BluetoothGattCharacteristic, data: ByteArray) {
|
private fun writeCharacteristicNoResponse(characteristic: BluetoothGattCharacteristic, data: ByteArray) {
|
||||||
Thread(Runnable {
|
Thread(Runnable {
|
||||||
|
@ -346,6 +364,7 @@ class BLEComm @Inject internal constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun onConnectionStateChangeSynchronized(gatt: BluetoothGatt, newState: Int) {
|
private fun onConnectionStateChangeSynchronized(gatt: BluetoothGatt, newState: Int) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "onConnectionStateChange")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "onConnectionStateChange")
|
||||||
|
@ -559,7 +578,7 @@ class BLEComm @Inject internal constructor(
|
||||||
sp.putString(rh.gs(R.string.key_dana_ble5_pairingkey) + danaRSPlugin.mDeviceName, pairingKey)
|
sp.putString(rh.gs(R.string.key_dana_ble5_pairingkey) + danaRSPlugin.mDeviceName, pairingKey)
|
||||||
|
|
||||||
val storedPairingKey = sp.getString(rh.gs(R.string.key_dana_ble5_pairingkey) + danaRSPlugin.mDeviceName, "")
|
val storedPairingKey = sp.getString(rh.gs(R.string.key_dana_ble5_pairingkey) + danaRSPlugin.mDeviceName, "")
|
||||||
if (storedPairingKey.isNullOrBlank()) {
|
if (storedPairingKey.isBlank()) {
|
||||||
removeBond()
|
removeBond()
|
||||||
disconnect("Non existing pairing key")
|
disconnect("Non existing pairing key")
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@ class DiaconnG8Pump @Inject constructor(
|
||||||
private val aapsLogger: AAPSLogger,
|
private val aapsLogger: AAPSLogger,
|
||||||
private val dateUtil: DateUtil
|
private val dateUtil: DateUtil
|
||||||
) {
|
) {
|
||||||
|
//var bleResultInfo: Pair<Int?, Boolean> = Pair(null, false)
|
||||||
|
var bolusConfirmMessage: Byte = 0
|
||||||
|
var isReadyToBolus: Boolean = false
|
||||||
var maxBolusePerDay: Double = 0.0
|
var maxBolusePerDay: Double = 0.0
|
||||||
var pumpIncarnationNum: Int = 65536
|
var pumpIncarnationNum: Int = 65536
|
||||||
var isPumpVersionGe2_63: Boolean = false // is pumpVersion higher then 2.63
|
var isPumpVersionGe2_63: Boolean = false // is pumpVersion higher then 2.63
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.diaconn.activities
|
package info.nightscout.androidaps.diaconn.activities
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.bluetooth.BluetoothAdapter
|
import android.bluetooth.BluetoothAdapter
|
||||||
import android.bluetooth.BluetoothDevice
|
import android.bluetooth.BluetoothDevice
|
||||||
|
@ -11,6 +12,7 @@ import android.bluetooth.le.ScanResult
|
||||||
import android.bluetooth.le.ScanSettings
|
import android.bluetooth.le.ScanSettings
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
@ -19,12 +21,13 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.BaseAdapter
|
import android.widget.BaseAdapter
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8DeviceChange
|
|
||||||
import info.nightscout.androidaps.diaconn.R
|
import info.nightscout.androidaps.diaconn.R
|
||||||
import info.nightscout.androidaps.diaconn.databinding.DiaconnG8BlescannerActivityBinding
|
import info.nightscout.androidaps.diaconn.databinding.DiaconnG8BlescannerActivityBinding
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8DeviceChange
|
||||||
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
|
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -61,18 +64,25 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
bluetoothAdapter?.let { bluetoothAdapter ->
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
|
||||||
if (!bluetoothAdapter.isEnabled) bluetoothAdapter.enable()
|
bluetoothAdapter?.let { bluetoothAdapter ->
|
||||||
bluetoothLeScanner = bluetoothAdapter.bluetoothLeScanner
|
if (!bluetoothAdapter.isEnabled) bluetoothAdapter.enable()
|
||||||
startScan()
|
bluetoothLeScanner = bluetoothAdapter.bluetoothLeScanner
|
||||||
|
startScan()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
stopScan()
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
stopScan()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
private fun startScan() =
|
private fun startScan() =
|
||||||
try {
|
try {
|
||||||
val filters: MutableList<ScanFilter> = ArrayList()
|
val filters: MutableList<ScanFilter> = ArrayList()
|
||||||
|
@ -86,16 +96,21 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
bluetoothLeScanner?.startScan(filters, settings, mBleScanCallback)
|
bluetoothLeScanner?.startScan(filters, settings, mBleScanCallback)
|
||||||
} catch (e: IllegalStateException) {
|
} catch (ignored: IllegalStateException) {
|
||||||
} // ignore BT not on
|
} // ignore BT not on
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
private fun stopScan() =
|
private fun stopScan() =
|
||||||
try {
|
try {
|
||||||
bluetoothLeScanner?.stopScan(mBleScanCallback)
|
bluetoothLeScanner?.stopScan(mBleScanCallback)
|
||||||
} catch (e: IllegalStateException) {
|
} catch (ignored: IllegalStateException) {
|
||||||
} // ignore BT not on
|
} // ignore BT not on
|
||||||
|
|
||||||
private fun addBleDevice(device: BluetoothDevice?) {
|
private fun addBleDevice(device: BluetoothDevice?) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
|
||||||
|
return
|
||||||
|
}
|
||||||
if (device == null || device.name == null || device.name == "") {
|
if (device == null || device.name == null || device.name == "") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -145,6 +160,7 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
|
||||||
v.setOnClickListener(this@ViewHolder)
|
v.setOnClickListener(this@ViewHolder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
override fun onClick(v: View) {
|
override fun onClick(v: View) {
|
||||||
sp.putString(R.string.key_diaconn_g8_address, item.device.address)
|
sp.putString(R.string.key_diaconn_g8_address, item.device.address)
|
||||||
sp.putString(R.string.key_diaconn_g8_name, name.text.toString())
|
sp.putString(R.string.key_diaconn_g8_name, name.text.toString())
|
||||||
|
@ -153,6 +169,7 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
fun setData(data: BluetoothDeviceItem) {
|
fun setData(data: BluetoothDeviceItem) {
|
||||||
var tTitle = data.device.name
|
var tTitle = data.device.name
|
||||||
if (tTitle == null || tTitle == "") {
|
if (tTitle == null || tTitle == "") {
|
||||||
|
@ -168,6 +185,7 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
//
|
//
|
||||||
inner class BluetoothDeviceItem internal constructor(val device: BluetoothDevice) {
|
inner class BluetoothDeviceItem internal constructor(val device: BluetoothDevice) {
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (other !is BluetoothDeviceItem) {
|
if (other !is BluetoothDeviceItem) {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -77,6 +77,8 @@ abstract class DiaconnG8PacketModule {
|
||||||
@ContributesAndroidInjector abstract fun contributesLanguageInquireResponsePacket(): LanguageInquireResponsePacket
|
@ContributesAndroidInjector abstract fun contributesLanguageInquireResponsePacket(): LanguageInquireResponsePacket
|
||||||
@ContributesAndroidInjector abstract fun contributesBigAPSMainInfoInquirePacket(): BigAPSMainInfoInquirePacket
|
@ContributesAndroidInjector abstract fun contributesBigAPSMainInfoInquirePacket(): BigAPSMainInfoInquirePacket
|
||||||
@ContributesAndroidInjector abstract fun contributesBigAPSMainInfoInquireResponsePacket(): BigAPSMainInfoInquireResponsePacket
|
@ContributesAndroidInjector abstract fun contributesBigAPSMainInfoInquireResponsePacket(): BigAPSMainInfoInquireResponsePacket
|
||||||
|
@ContributesAndroidInjector abstract fun contributesSerialNumInquirePacket(): SerialNumInquirePacket
|
||||||
|
@ContributesAndroidInjector abstract fun contributesSerialNumInquireResponsePacket(): SerialNumInquireResponsePacket
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,10 @@ class AppConfirmSettingResponsePacket(
|
||||||
failed = true
|
failed = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// The bolus progress diallog opens only when the confirm result is successfull
|
||||||
|
if(diaconnG8Pump.bolusConfirmMessage == 0x07.toByte()) {
|
||||||
|
diaconnG8Pump.isReadyToBolus = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override fun getFriendlyName(): String {
|
||||||
|
|
|
@ -25,7 +25,6 @@ class DiaconnG8ResponseMessageHashTable @Inject constructor(val injector: HasAnd
|
||||||
put(SneckLimitInquireResponsePacket(injector))
|
put(SneckLimitInquireResponsePacket(injector))
|
||||||
put(BasalLimitInquireResponsePacket(injector))
|
put(BasalLimitInquireResponsePacket(injector))
|
||||||
put(TempBasalInquireResponsePacket(injector))
|
put(TempBasalInquireResponsePacket(injector))
|
||||||
put(TimeInquirePacket(injector))
|
|
||||||
put(TimeInquireResponsePacket(injector))
|
put(TimeInquireResponsePacket(injector))
|
||||||
put(TimeReportPacket(injector))
|
put(TimeReportPacket(injector))
|
||||||
put(LogStatusInquireResponsePacket(injector))
|
put(LogStatusInquireResponsePacket(injector))
|
||||||
|
@ -34,6 +33,8 @@ class DiaconnG8ResponseMessageHashTable @Inject constructor(val injector: HasAnd
|
||||||
put(SoundInquireResponsePacket(injector))
|
put(SoundInquireResponsePacket(injector))
|
||||||
put(DisplayTimeInquireResponsePacket(injector))
|
put(DisplayTimeInquireResponsePacket(injector))
|
||||||
put(LanguageInquireResponsePacket(injector))
|
put(LanguageInquireResponsePacket(injector))
|
||||||
|
put(SerialNumInquireResponsePacket(injector))
|
||||||
|
|
||||||
|
|
||||||
// Report Packet
|
// Report Packet
|
||||||
put(BasalPauseReportPacket(injector))
|
put(BasalPauseReportPacket(injector))
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package info.nightscout.androidaps.diaconn.packet
|
||||||
|
|
||||||
|
import dagger.android.HasAndroidInjector
|
||||||
|
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* SerialNumInquirePacket
|
||||||
|
*/
|
||||||
|
class SerialNumInquirePacket(
|
||||||
|
injector: HasAndroidInjector
|
||||||
|
) : DiaconnG8Packet(injector ) {
|
||||||
|
@Inject lateinit var diaconnG8Pump: DiaconnG8Pump
|
||||||
|
init {
|
||||||
|
msgType = 0x6E
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "SeialNumInquirePacket init")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun encode(msgSeq:Int): ByteArray {
|
||||||
|
val buffer = prefixEncode(msgType, msgSeq, MSG_CON_END)
|
||||||
|
return suffixEncode(buffer)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getFriendlyName(): String {
|
||||||
|
return "PUMP_SERIAL_NUM_INQUIRE"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package info.nightscout.androidaps.diaconn.packet
|
||||||
|
|
||||||
|
import dagger.android.HasAndroidInjector
|
||||||
|
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
||||||
|
import info.nightscout.androidaps.diaconn.R
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SerialNumInquireResponsePacket
|
||||||
|
*/
|
||||||
|
class SerialNumInquireResponsePacket(injector: HasAndroidInjector) : DiaconnG8Packet(injector ) {
|
||||||
|
|
||||||
|
@Inject lateinit var diaconnG8Pump: DiaconnG8Pump
|
||||||
|
@Inject lateinit var sp: SP
|
||||||
|
@Inject lateinit var rh: ResourceHelper
|
||||||
|
|
||||||
|
|
||||||
|
init {
|
||||||
|
msgType = 0xAE.toByte()
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "SerialNumInquireResponsePacket init")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun handleMessage(data: ByteArray?) {
|
||||||
|
val result = defect(data)
|
||||||
|
if (result != 0) {
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "SerialNumInquireResponsePacket Got some Error")
|
||||||
|
failed = true
|
||||||
|
return
|
||||||
|
} else failed = false
|
||||||
|
|
||||||
|
val bufferData = prefixDecode(data)
|
||||||
|
val result2 = getByteToInt(bufferData)
|
||||||
|
if(!isSuccInquireResponseResult(result2)) {
|
||||||
|
failed = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
diaconnG8Pump.country = getByteToInt(bufferData).toChar().toString().toInt() // ASCII
|
||||||
|
diaconnG8Pump.productType = getByteToInt(bufferData).toChar().toString().toInt() // ASCII
|
||||||
|
diaconnG8Pump.makeYear = getByteToInt(bufferData)
|
||||||
|
diaconnG8Pump.makeMonth = getByteToInt(bufferData)
|
||||||
|
diaconnG8Pump.makeDay = getByteToInt(bufferData)
|
||||||
|
diaconnG8Pump.lotNo = getByteToInt(bufferData)// LOT NO
|
||||||
|
diaconnG8Pump.serialNo = getShortToInt(bufferData)
|
||||||
|
diaconnG8Pump.majorVersion = getByteToInt(bufferData)
|
||||||
|
diaconnG8Pump.minorVersion = getByteToInt(bufferData)
|
||||||
|
|
||||||
|
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "Result --> ${diaconnG8Pump.result}")
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "country --> ${diaconnG8Pump.country}")
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "productType --> ${diaconnG8Pump.productType}")
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "makeYear --> ${diaconnG8Pump.makeYear}")
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "makeMonth --> ${diaconnG8Pump.makeMonth}")
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "makeDay --> ${diaconnG8Pump.makeDay}")
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "lotNo --> ${diaconnG8Pump.lotNo}")
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "serialNo --> ${diaconnG8Pump.serialNo}")
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "majorVersion --> ${diaconnG8Pump.majorVersion}")
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "minorVersion --> ${diaconnG8Pump.minorVersion}")
|
||||||
|
|
||||||
|
sp.putString(rh.gs(R.string.pumpversion), diaconnG8Pump.majorVersion.toString() + "." + diaconnG8Pump.minorVersion.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getFriendlyName(): String {
|
||||||
|
return "PUMP_SERIAL_NUM_INQUIRE_RESPONSE"
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,24 +15,30 @@ class TimeInquireResponsePacket(
|
||||||
@Inject lateinit var diaconnG8Pump: DiaconnG8Pump
|
@Inject lateinit var diaconnG8Pump: DiaconnG8Pump
|
||||||
|
|
||||||
init {
|
init {
|
||||||
msgType = 0x50.toByte()
|
msgType = 0x8F.toByte()
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "TimeInquireResponsePacket init")
|
aapsLogger.debug(LTag.PUMPCOMM, "TimeInquireResponsePacket init")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleMessage(data: ByteArray?) {
|
override fun handleMessage(data: ByteArray?) {
|
||||||
val result = defect(data)
|
val defectCheck = defect(data)
|
||||||
if (result != 0) {
|
if (defectCheck != 0) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "TimeInquireResponsePacket Got some Error")
|
aapsLogger.debug(LTag.PUMPCOMM, "TimeInquireResponsePacket Got some Error")
|
||||||
failed = true
|
failed = true
|
||||||
return
|
return
|
||||||
} else failed = false
|
} else failed = false
|
||||||
|
|
||||||
val bufferData = prefixDecode(data)
|
val bufferData = prefixDecode(data)
|
||||||
val result2 = getByteToInt(bufferData)
|
val result = getByteToInt(bufferData)
|
||||||
if(!isSuccInquireResponseResult(result2)) {
|
if(!isSuccInquireResponseResult(result)) {
|
||||||
failed = true
|
failed = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
diaconnG8Pump.year = getByteToInt(bufferData) + 2000 // 년 (18~99)
|
||||||
|
diaconnG8Pump.month = getByteToInt(bufferData) // 월 (1~12)
|
||||||
|
diaconnG8Pump.day = getByteToInt(bufferData) // 일 (1~31)
|
||||||
|
diaconnG8Pump.hour = getByteToInt(bufferData) // 시 (0~23)
|
||||||
|
diaconnG8Pump.minute = getByteToInt(bufferData) // 분 (0~59)
|
||||||
|
diaconnG8Pump.second = getByteToInt(bufferData) // 초 (0~59)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override fun getFriendlyName(): String {
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package info.nightscout.androidaps.diaconn.service
|
package info.nightscout.androidaps.diaconn.service
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.bluetooth.*
|
import android.bluetooth.*
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.pm.PackageManager
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
||||||
|
@ -12,10 +15,11 @@ import info.nightscout.androidaps.diaconn.packet.*
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||||
import info.nightscout.androidaps.extensions.notify
|
import info.nightscout.androidaps.extensions.notify
|
||||||
import info.nightscout.androidaps.extensions.waitMillis
|
import info.nightscout.androidaps.extensions.waitMillis
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.ScheduledFuture
|
import java.util.concurrent.ScheduledFuture
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -66,6 +70,11 @@ class BLECommonService @Inject internal constructor(
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun connect(from: String, address: String?): Boolean {
|
fun connect(from: String, address: String?): Boolean {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
|
||||||
|
aapsLogger.error(LTag.PUMPBTCOMM, "missing permission: $from")
|
||||||
|
return false
|
||||||
|
}
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Initializing Bluetooth ")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Initializing Bluetooth ")
|
||||||
if (bluetoothAdapter == null) {
|
if (bluetoothAdapter == null) {
|
||||||
aapsLogger.error("Unable to obtain a BluetoothAdapter.")
|
aapsLogger.error("Unable to obtain a BluetoothAdapter.")
|
||||||
|
@ -98,6 +107,10 @@ class BLECommonService @Inject internal constructor(
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun disconnect(from: String) {
|
fun disconnect(from: String) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
aapsLogger.error(LTag.PUMPBTCOMM, "missing permission: $from")
|
||||||
|
return
|
||||||
|
}
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "disconnect from: $from")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "disconnect from: $from")
|
||||||
|
|
||||||
// cancel previous scheduled disconnection to prevent closing upcoming connection
|
// cancel previous scheduled disconnection to prevent closing upcoming connection
|
||||||
|
@ -117,6 +130,7 @@ class BLECommonService @Inject internal constructor(
|
||||||
SystemClock.sleep(2000)
|
SystemClock.sleep(2000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun close() {
|
fun close() {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "BluetoothAdapter close")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "BluetoothAdapter close")
|
||||||
|
@ -133,6 +147,9 @@ class BLECommonService @Inject internal constructor(
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "onServicesDiscovered")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "onServicesDiscovered")
|
||||||
if (status == BluetoothGatt.GATT_SUCCESS) {
|
if (status == BluetoothGatt.GATT_SUCCESS) {
|
||||||
findCharacteristic()
|
findCharacteristic()
|
||||||
|
SystemClock.sleep(1600)
|
||||||
|
isConnected = true
|
||||||
|
isConnecting = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +173,7 @@ class BLECommonService @Inject internal constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun writeCharacteristicNoResponse(characteristic: BluetoothGattCharacteristic, data: ByteArray) {
|
private fun writeCharacteristicNoResponse(characteristic: BluetoothGattCharacteristic, data: ByteArray) {
|
||||||
Thread(Runnable {
|
Thread(Runnable {
|
||||||
|
@ -194,6 +212,7 @@ class BLECommonService @Inject internal constructor(
|
||||||
return bluetoothGatt?.services
|
return bluetoothGatt?.services
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun findCharacteristic() {
|
private fun findCharacteristic() {
|
||||||
val gattServices = getSupportedGattServices() ?: return
|
val gattServices = getSupportedGattServices() ?: return
|
||||||
|
@ -206,6 +225,7 @@ class BLECommonService @Inject internal constructor(
|
||||||
uartIndicate = gattCharacteristic
|
uartIndicate = gattCharacteristic
|
||||||
//setCharacteristicNotification(uartIndicate, true)
|
//setCharacteristicNotification(uartIndicate, true)
|
||||||
bluetoothGatt?.setCharacteristicNotification(uartIndicate, true)
|
bluetoothGatt?.setCharacteristicNotification(uartIndicate, true)
|
||||||
|
|
||||||
// nRF Connect 참고하여 추가함
|
// nRF Connect 참고하여 추가함
|
||||||
val descriptor: BluetoothGattDescriptor = uartIndicate!!.getDescriptor(UUID.fromString(CHARACTERISTIC_CONFIG_UUID))
|
val descriptor: BluetoothGattDescriptor = uartIndicate!!.getDescriptor(UUID.fromString(CHARACTERISTIC_CONFIG_UUID))
|
||||||
descriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
|
descriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
|
||||||
|
@ -218,13 +238,12 @@ class BLECommonService @Inject internal constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun onConnectionStateChangeSynchronized(gatt: BluetoothGatt, newState: Int) {
|
private fun onConnectionStateChangeSynchronized(gatt: BluetoothGatt, newState: Int) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "onConnectionStateChange newState : $newState")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "onConnectionStateChange newState : $newState")
|
||||||
if (newState == BluetoothProfile.STATE_CONNECTED) {
|
if (newState == BluetoothProfile.STATE_CONNECTED) {
|
||||||
gatt.discoverServices()
|
gatt.discoverServices()
|
||||||
isConnected = true
|
|
||||||
isConnecting = false
|
|
||||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTED))
|
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTED))
|
||||||
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
|
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
|
||||||
close()
|
close()
|
||||||
|
@ -268,6 +287,7 @@ class BLECommonService @Inject internal constructor(
|
||||||
// process common packet response
|
// process common packet response
|
||||||
private fun processResponseMessage(data: ByteArray) {
|
private fun processResponseMessage(data: ByteArray) {
|
||||||
isConnected = true
|
isConnected = true
|
||||||
|
isConnecting = false
|
||||||
|
|
||||||
//요청정보
|
//요청정보
|
||||||
val originalMessageSeq = processedMessage?.getSeq(processedMessageByte)
|
val originalMessageSeq = processedMessage?.getSeq(processedMessageByte)
|
||||||
|
|
|
@ -136,13 +136,14 @@ class DiaconnG8Service : DaggerService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun sendMessage(message: DiaconnG8Packet) {
|
private fun sendMessage(message: DiaconnG8Packet) {
|
||||||
bleCommonService.sendMessage(message, 2000)
|
bleCommonService.sendMessage(message, 5000)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun readPumpStatus() {
|
fun readPumpStatus() {
|
||||||
try {
|
try {
|
||||||
val pump = activePlugin.activePump
|
val pump = activePlugin.activePump
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumpsettings)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumpsettings)))
|
||||||
|
sendMessage(SerialNumInquirePacket(injector))
|
||||||
|
|
||||||
val pumpFirmwareVersion = sp.getString(rh.gs(R.string.pumpversion), "")
|
val pumpFirmwareVersion = sp.getString(rh.gs(R.string.pumpversion), "")
|
||||||
|
|
||||||
|
@ -170,6 +171,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
|
|
||||||
// 시간 설정
|
// 시간 설정
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumptime)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumptime)))
|
||||||
|
sendMessage(TimeInquirePacket(injector))
|
||||||
var timeDiff = (diaconnG8Pump.getPumpTime() - System.currentTimeMillis()) / 1000L
|
var timeDiff = (diaconnG8Pump.getPumpTime() - System.currentTimeMillis()) / 1000L
|
||||||
if (diaconnG8Pump.getPumpTime() == 0L) {
|
if (diaconnG8Pump.getPumpTime() == 0L) {
|
||||||
// initial handshake was not successful
|
// initial handshake was not successful
|
||||||
|
@ -239,14 +241,12 @@ class DiaconnG8Service : DaggerService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadHistory(): PumpEnactResult {
|
fun loadHistory(): PumpEnactResult {
|
||||||
|
|
||||||
if (!diaconnG8Plugin.isInitialized()) {
|
if (!diaconnG8Plugin.isInitialized()) {
|
||||||
val result = PumpEnactResult(injector).success(false)
|
val result = PumpEnactResult(injector).success(false)
|
||||||
result.comment = "pump not initialized"
|
result.comment = "pump not initialized"
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
sendMessage(LogStatusInquirePacket(injector))
|
sendMessage(LogStatusInquirePacket(injector))
|
||||||
|
|
||||||
// pump version check
|
// pump version check
|
||||||
if (diaconnG8Pump.isPumpVersionGe2_63) {
|
if (diaconnG8Pump.isPumpVersionGe2_63) {
|
||||||
sendMessage(IncarnationInquirePacket(injector))
|
sendMessage(IncarnationInquirePacket(injector))
|
||||||
|
@ -257,7 +257,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
var apsWrappingCount = -1
|
var apsWrappingCount = -1
|
||||||
// get saved last loginfo
|
// get saved last loginfo
|
||||||
val diaconnHistoryRecord = diaconnHistoryRecordDao.getLastRecord(diaconnG8Pump.pumpUid)
|
val diaconnHistoryRecord = diaconnHistoryRecordDao.getLastRecord(diaconnG8Pump.pumpUid)
|
||||||
aapsLogger.error(LTag.PUMPCOMM, "diaconnHistoryRecord :: $diaconnHistoryRecord")
|
aapsLogger.debug(LTag.PUMPCOMM, "diaconnHistoryRecord :: $diaconnHistoryRecord")
|
||||||
|
|
||||||
if(diaconnHistoryRecord != null) {
|
if(diaconnHistoryRecord != null) {
|
||||||
apsLastLogNum = diaconnHistoryRecord.lognum
|
apsLastLogNum = diaconnHistoryRecord.lognum
|
||||||
|
@ -306,7 +306,6 @@ class DiaconnG8Service : DaggerService() {
|
||||||
result.success(true)
|
result.success(true)
|
||||||
diaconnG8Pump.lastConnection = System.currentTimeMillis()
|
diaconnG8Pump.lastConnection = System.currentTimeMillis()
|
||||||
}
|
}
|
||||||
|
|
||||||
// upload pump log to Diaconn Cloud
|
// upload pump log to Diaconn Cloud
|
||||||
if (sp.getBoolean(R.string.key_diaconn_g8_cloudsend, true)) {
|
if (sp.getBoolean(R.string.key_diaconn_g8_cloudsend, true)) {
|
||||||
SystemClock.sleep(1000)
|
SystemClock.sleep(1000)
|
||||||
|
@ -399,13 +398,6 @@ class DiaconnG8Service : DaggerService() {
|
||||||
fun bolus(insulin: Double, carbs: Int, carbTime: Long, t: EventOverviewBolusProgress.Treatment): Boolean {
|
fun bolus(insulin: Double, carbs: Int, carbTime: Long, t: EventOverviewBolusProgress.Treatment): Boolean {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
if (BolusProgressDialog.stopPressed) return false
|
if (BolusProgressDialog.stopPressed) return false
|
||||||
|
|
||||||
// Only Carbs
|
|
||||||
if (carbs > 0 && insulin == 0.0) {
|
|
||||||
pumpSync.syncCarbsWithTimestamp(carbTime, carbs.toDouble(), null, PumpType.DIACONN_G8, diaconnG8Pump.serialNo.toString())
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.startingbolus)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.startingbolus)))
|
||||||
|
|
||||||
// bolus speed setting
|
// bolus speed setting
|
||||||
|
@ -435,7 +427,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
val bolusStart = System.currentTimeMillis()
|
val bolusStart = System.currentTimeMillis()
|
||||||
if (insulin > 0) {
|
if (insulin > 0) {
|
||||||
if (!diaconnG8Pump.bolusStopped) {
|
if (!diaconnG8Pump.bolusStopped) {
|
||||||
sendMessage(start)
|
sendMessage(start, 100)
|
||||||
// otp process
|
// otp process
|
||||||
if (!processConfirm(start.msgType)) return false
|
if (!processConfirm(start.msgType)) return false
|
||||||
} else {
|
} else {
|
||||||
|
@ -460,26 +452,29 @@ class DiaconnG8Service : DaggerService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
val bolusDurationInMSec = (insulin * speed * 1000).toLong()
|
val bolusDurationInMSec = (insulin * speed * 1000).toLong()
|
||||||
val expectedEnd = bolusStart + bolusDurationInMSec + 7500L
|
val expectedEnd = bolusStart + bolusDurationInMSec + 3500L
|
||||||
val totalwaitTime = (expectedEnd - System.currentTimeMillis()) / 1000
|
val totalwaitTime = (expectedEnd - System.currentTimeMillis()) / 1000
|
||||||
while (!diaconnG8Pump.bolusDone) {
|
if(diaconnG8Pump.isReadyToBolus) {
|
||||||
val waitTime = (expectedEnd - System.currentTimeMillis()) / 1000
|
while (!diaconnG8Pump.bolusDone) {
|
||||||
bolusingEvent.status = rh.gs(R.string.waitingforestimatedbolusend, if (waitTime < 0) 0 else waitTime)
|
val waitTime = (expectedEnd - System.currentTimeMillis()) / 1000
|
||||||
var progressPecent = 0
|
bolusingEvent.status = String.format(rh.gs(R.string.waitingforestimatedbolusend), if (waitTime < 0) 0 else waitTime)
|
||||||
if (totalwaitTime > waitTime) {
|
var progressPecent = 0
|
||||||
progressPecent = ((totalwaitTime - waitTime) * 100 / totalwaitTime).toInt()
|
if (totalwaitTime > waitTime) {
|
||||||
|
progressPecent = ((totalwaitTime - waitTime) * 100 / totalwaitTime).toInt()
|
||||||
|
}
|
||||||
|
bolusingEvent.percent = min(progressPecent, 100)
|
||||||
|
rxBus.send(bolusingEvent)
|
||||||
|
SystemClock.sleep(200)
|
||||||
}
|
}
|
||||||
bolusingEvent.percent = min(progressPecent, 100)
|
|
||||||
rxBus.send(bolusingEvent)
|
|
||||||
SystemClock.sleep(200)
|
|
||||||
}
|
}
|
||||||
|
diaconnG8Pump.isReadyToBolus = false
|
||||||
|
|
||||||
// do not call loadHistory() directly, reconnection may be needed
|
// do not call loadHistory() directly, reconnection may be needed
|
||||||
commandQueue.loadEvents(object : Callback() {
|
commandQueue.loadEvents(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
// reread bolus status
|
// reread bolus status
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingbolusstatus)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingbolusstatus)))
|
||||||
sendMessage(InjectionSnackInquirePacket(injector), 1000) // last bolus
|
sendMessage(InjectionSnackInquirePacket(injector), 2000) // last bolus
|
||||||
// 볼러스 결과 보고패킷에서 처리함.
|
// 볼러스 결과 보고패킷에서 처리함.
|
||||||
bolusingEvent.percent = 100
|
bolusingEvent.percent = 100
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.disconnecting)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.disconnecting)))
|
||||||
|
@ -492,7 +487,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
val stop = InjectionCancelSettingPacket(injector, 0x07.toByte())
|
val stop = InjectionCancelSettingPacket(injector, 0x07.toByte())
|
||||||
diaconnG8Pump.bolusStopForced = true
|
diaconnG8Pump.bolusStopForced = true
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
sendMessage(stop)
|
sendMessage(stop, 100)
|
||||||
// otp process
|
// otp process
|
||||||
if (!processConfirm(stop.msgType)) return
|
if (!processConfirm(stop.msgType)) return
|
||||||
while (!diaconnG8Pump.bolusStopped) {
|
while (!diaconnG8Pump.bolusStopped) {
|
||||||
|
@ -513,7 +508,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
|
||||||
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
||||||
// tempbasal stop
|
// tempbasal stop
|
||||||
sendMessage(msgPacket)
|
sendMessage(msgPacket, 100)
|
||||||
// otp process
|
// otp process
|
||||||
if (!processConfirm(msgPacket.msgType)) return false
|
if (!processConfirm(msgPacket.msgType)) return false
|
||||||
diaconnG8Pump.tempBasalStart = dateUtil.now()
|
diaconnG8Pump.tempBasalStart = dateUtil.now()
|
||||||
|
@ -521,7 +516,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
|
||||||
val tbInjectRate = ((absoluteRate * 100) + 1000).toInt()
|
val tbInjectRate = ((absoluteRate * 100) + 1000).toInt()
|
||||||
val msgTBR = TempBasalSettingPacket(injector, 1, ((durationInHours * 60) / 15).toInt(), tbInjectRate)
|
val msgTBR = TempBasalSettingPacket(injector, 1, ((durationInHours * 60) / 15).toInt(), tbInjectRate)
|
||||||
sendMessage(msgTBR)
|
sendMessage(msgTBR, 100)
|
||||||
// otp process
|
// otp process
|
||||||
if (!processConfirm(msgTBR.msgType)) return false
|
if (!processConfirm(msgTBR.msgType)) return false
|
||||||
// pump tempbasal status inquire
|
// pump tempbasal status inquire
|
||||||
|
@ -545,7 +540,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
|
||||||
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
||||||
// tempbasal stop
|
// tempbasal stop
|
||||||
sendMessage(msgPacket)
|
sendMessage(msgPacket, 100)
|
||||||
// otp process
|
// otp process
|
||||||
if (!processConfirm(msgPacket.msgType)) return false
|
if (!processConfirm(msgPacket.msgType)) return false
|
||||||
SystemClock.sleep(500)
|
SystemClock.sleep(500)
|
||||||
|
@ -553,7 +548,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
|
||||||
val tbInjectRate = absoluteRate * 100 + 1000
|
val tbInjectRate = absoluteRate * 100 + 1000
|
||||||
val msgTBR = TempBasalSettingPacket(injector, 1, 2, tbInjectRate.toInt())
|
val msgTBR = TempBasalSettingPacket(injector, 1, 2, tbInjectRate.toInt())
|
||||||
sendMessage(msgTBR)
|
sendMessage(msgTBR, 100)
|
||||||
// otp process
|
// otp process
|
||||||
if (!processConfirm(msgTBR.msgType)) return false
|
if (!processConfirm(msgTBR.msgType)) return false
|
||||||
sendMessage(TempBasalInquirePacket(injector))
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
|
@ -577,7 +572,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
diaconnG8Pump.tbInjectRateRatio
|
diaconnG8Pump.tbInjectRateRatio
|
||||||
)
|
)
|
||||||
// tempbasal stop
|
// tempbasal stop
|
||||||
sendMessage(msgPacket)
|
sendMessage(msgPacket, 500)
|
||||||
// otp process
|
// otp process
|
||||||
if (!processConfirm(msgPacket.msgType)) return false
|
if (!processConfirm(msgPacket.msgType)) return false
|
||||||
SystemClock.sleep(500)
|
SystemClock.sleep(500)
|
||||||
|
@ -593,7 +588,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
fun extendedBolus(insulin: Double, durationInMinutes: Int): Boolean {
|
fun extendedBolus(insulin: Double, durationInMinutes: Int): Boolean {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingextendedbolus)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingextendedbolus)))
|
||||||
aapsLogger.error(LTag.PUMPCOMM, "insulin: $insulin durationInMinutes: $durationInMinutes")
|
aapsLogger.debug(LTag.PUMPCOMM, "insulin: $insulin durationInMinutes: $durationInMinutes")
|
||||||
|
|
||||||
val msgExtended = InjectionExtendedBolusSettingPacket(injector, (insulin * 100).toInt(), durationInMinutes, dateUtil.now())
|
val msgExtended = InjectionExtendedBolusSettingPacket(injector, (insulin * 100).toInt(), durationInMinutes, dateUtil.now())
|
||||||
sendMessage(msgExtended)
|
sendMessage(msgExtended)
|
||||||
|
@ -672,6 +667,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
(basalList[23] * 100).toInt()
|
(basalList[23] * 100).toInt()
|
||||||
)
|
)
|
||||||
// setting basal pattern 1,2,3,4
|
// setting basal pattern 1,2,3,4
|
||||||
|
sendMessage(SerialNumInquirePacket(injector), 2000)
|
||||||
sendMessage(requestReqPacket1, 500)
|
sendMessage(requestReqPacket1, 500)
|
||||||
sendMessage(requestReqPacket2, 500)
|
sendMessage(requestReqPacket2, 500)
|
||||||
sendMessage(requestReqPacket3, 500)
|
sendMessage(requestReqPacket3, 500)
|
||||||
|
@ -694,22 +690,22 @@ class DiaconnG8Service : DaggerService() {
|
||||||
|
|
||||||
private fun processConfirm(msgType: Byte): Boolean {
|
private fun processConfirm(msgType: Byte): Boolean {
|
||||||
// pump confirm
|
// pump confirm
|
||||||
|
var loopCnt = 0
|
||||||
|
// waiting 2 seconds for otp
|
||||||
|
while(loopCnt < 20) {
|
||||||
|
if (diaconnG8Pump.otpNumber == 0) {
|
||||||
|
SystemClock.sleep(100)
|
||||||
|
aapsLogger.error(LTag.PUMPCOMM, "OTP waiting 100ms $loopCnt / 20")
|
||||||
|
}
|
||||||
|
loopCnt++
|
||||||
|
}
|
||||||
|
// after 2 second
|
||||||
if (diaconnG8Pump.otpNumber == 0) {
|
if (diaconnG8Pump.otpNumber == 0) {
|
||||||
aapsLogger.error(LTag.PUMPCOMM, "otp is not received yet")
|
aapsLogger.error(LTag.PUMPCOMM, "otp is not received yet")
|
||||||
|
|
||||||
// Comments are made as dialogs are exposed twice each in the event of an error.
|
|
||||||
// Thread {
|
|
||||||
// val i = Intent(context, ErrorHelperActivity::class.java)
|
|
||||||
// i.putExtra("soundid", R.raw.boluserror)
|
|
||||||
// i.putExtra("status", rh.gs(R.string.diaconn_g8_errotpreceivedyet))
|
|
||||||
// i.putExtra("title", rh.gs(R.string.pumperror))
|
|
||||||
// i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
// context.startActivity(i)
|
|
||||||
// }.start()
|
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
sendMessage(AppConfirmSettingPacket(injector, msgType, diaconnG8Pump.otpNumber))
|
diaconnG8Pump.bolusConfirmMessage = msgType
|
||||||
|
sendMessage(AppConfirmSettingPacket(injector, msgType, diaconnG8Pump.otpNumber), 2000)
|
||||||
diaconnG8Pump.otpNumber = 0
|
diaconnG8Pump.otpNumber = 0
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,5 +169,5 @@
|
||||||
<string name="diaconn_g8_errorcode_36">Tempbasal stop is rejected when tempbasal is not running</string>
|
<string name="diaconn_g8_errorcode_36">Tempbasal stop is rejected when tempbasal is not running</string>
|
||||||
<string name="diaconn_g8_cloudsend_summary">Send pump logs to the Diaconn Cloud.</string>
|
<string name="diaconn_g8_cloudsend_summary">Send pump logs to the Diaconn Cloud.</string>
|
||||||
<string name="diaconn_g8_cloudsend_title">Diaconn Cloud Sync</string>
|
<string name="diaconn_g8_cloudsend_title">Diaconn Cloud Sync</string>
|
||||||
<string name="key_diaconn_g8_appuid" translatable="false">diaconn_g8_appuid</string>
|
<string name="key_diaconn_g8_appuid">diaconn_g8_appuid</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.insight.connection_service;
|
package info.nightscout.androidaps.plugins.pump.insight.connection_service;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.bluetooth.BluetoothManager;
|
import android.bluetooth.BluetoothManager;
|
||||||
import android.bluetooth.BluetoothSocket;
|
import android.bluetooth.BluetoothSocket;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
import org.spongycastle.crypto.InvalidCipherTextException;
|
import org.spongycastle.crypto.InvalidCipherTextException;
|
||||||
|
|
||||||
|
@ -23,8 +26,6 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.android.DaggerService;
|
import dagger.android.DaggerService;
|
||||||
import info.nightscout.androidaps.insight.R;
|
import info.nightscout.androidaps.insight.R;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.AppLayerMessage;
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.AppLayerMessage;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.ReadParameterBlockMessage;
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.ReadParameterBlockMessage;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.app_layer.configuration.CloseConfigurationWriteSessionMessage;
|
import info.nightscout.androidaps.plugins.pump.insight.app_layer.configuration.CloseConfigurationWriteSessionMessage;
|
||||||
|
@ -87,6 +88,8 @@ import info.nightscout.androidaps.plugins.pump.insight.utils.PairingDataStorage;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.utils.crypto.Cryptograph;
|
import info.nightscout.androidaps.plugins.pump.insight.utils.crypto.Cryptograph;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.utils.crypto.DerivedKeys;
|
import info.nightscout.androidaps.plugins.pump.insight.utils.crypto.DerivedKeys;
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.utils.crypto.KeyPair;
|
import info.nightscout.androidaps.plugins.pump.insight.utils.crypto.KeyPair;
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
|
import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
import info.nightscout.shared.sharedPreferences.SP;
|
||||||
|
|
||||||
public class InsightConnectionService extends DaggerService implements ConnectionEstablisher.Callback, InputStreamReader.Callback, OutputStreamWriter.Callback {
|
public class InsightConnectionService extends DaggerService implements ConnectionEstablisher.Callback, InputStreamReader.Callback, OutputStreamWriter.Callback {
|
||||||
|
@ -108,7 +111,7 @@ public class InsightConnectionService extends DaggerService implements Connectio
|
||||||
private DelayedActionThread disconnectTimer;
|
private DelayedActionThread disconnectTimer;
|
||||||
private DelayedActionThread recoveryTimer;
|
private DelayedActionThread recoveryTimer;
|
||||||
private DelayedActionThread timeoutTimer;
|
private DelayedActionThread timeoutTimer;
|
||||||
private BluetoothAdapter bluetoothAdapter;
|
@Nullable private BluetoothAdapter bluetoothAdapter;
|
||||||
private BluetoothDevice bluetoothDevice;
|
private BluetoothDevice bluetoothDevice;
|
||||||
private BluetoothSocket bluetoothSocket;
|
private BluetoothSocket bluetoothSocket;
|
||||||
private ConnectionEstablisher connectionEstablisher;
|
private ConnectionEstablisher connectionEstablisher;
|
||||||
|
@ -258,10 +261,12 @@ public class InsightConnectionService extends DaggerService implements Connectio
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onCreate() {
|
public synchronized void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
bluetoothAdapter = ((BluetoothManager)getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
|
||||||
pairingDataStorage = new PairingDataStorage(this);
|
bluetoothAdapter = ((BluetoothManager) getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
|
||||||
state = pairingDataStorage.isPaired() ? InsightState.DISCONNECTED : InsightState.NOT_PAIRED;
|
pairingDataStorage = new PairingDataStorage(this);
|
||||||
wakeLock = ((PowerManager) getSystemService(POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:InsightConnectionService");
|
state = pairingDataStorage.isPaired() ? InsightState.DISCONNECTED : InsightState.NOT_PAIRED;
|
||||||
|
wakeLock = ((PowerManager) getSystemService(POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:InsightConnectionService");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setState(InsightState state) {
|
private void setState(InsightState state) {
|
||||||
|
@ -426,6 +431,7 @@ public class InsightConnectionService extends DaggerService implements Connectio
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void connect() {
|
private synchronized void connect() {
|
||||||
|
if (bluetoothAdapter == null) return;
|
||||||
if (bluetoothDevice == null)
|
if (bluetoothDevice == null)
|
||||||
bluetoothDevice = bluetoothAdapter.getRemoteDevice(pairingDataStorage.getMacAddress());
|
bluetoothDevice = bluetoothAdapter.getRemoteDevice(pairingDataStorage.getMacAddress());
|
||||||
setState(InsightState.CONNECTING);
|
setState(InsightState.CONNECTING);
|
||||||
|
|
|
@ -341,6 +341,7 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
val refreshTypesNeededToReschedule: MutableSet<MedtronicStatusRefreshType> = mutableSetOf()
|
val refreshTypesNeededToReschedule: MutableSet<MedtronicStatusRefreshType> = mutableSetOf()
|
||||||
for ((key, value) in statusRefresh) {
|
for ((key, value) in statusRefresh) {
|
||||||
if (value > 0 && System.currentTimeMillis() > value) {
|
if (value > 0 && System.currentTimeMillis() > value) {
|
||||||
|
@Suppress("WHEN_ENUM_CAN_BE_NULL_IN_JAVA")
|
||||||
when (key) {
|
when (key) {
|
||||||
MedtronicStatusRefreshType.PumpHistory -> {
|
MedtronicStatusRefreshType.PumpHistory -> {
|
||||||
readPumpHistory()
|
readPumpHistory()
|
||||||
|
|
|
@ -18,20 +18,17 @@ object MedtronicConst {
|
||||||
val BolusDelay = R.string.key_medtronic_bolus_delay
|
val BolusDelay = R.string.key_medtronic_bolus_delay
|
||||||
val Encoding = R.string.key_medtronic_encoding
|
val Encoding = R.string.key_medtronic_encoding
|
||||||
val BatteryType = R.string.key_medtronic_battery_type
|
val BatteryType = R.string.key_medtronic_battery_type
|
||||||
val BolusDebugEnabled = R.string.key_medtronic_bolus_debug
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object Statistics {
|
object Statistics {
|
||||||
const val StatsPrefix = "medtronic_"
|
private const val StatsPrefix = "medtronic_"
|
||||||
const val FirstPumpStart = Prefix + "first_pump_use"
|
const val FirstPumpStart = Prefix + "first_pump_use"
|
||||||
const val LastGoodPumpCommunicationTime = Prefix + "lastGoodPumpCommunicationTime"
|
const val LastGoodPumpCommunicationTime = Prefix + "lastGoodPumpCommunicationTime"
|
||||||
const val LastGoodPumpFrequency = Prefix + "LastGoodPumpFrequency"
|
|
||||||
const val TBRsSet = StatsPrefix + "tbrs_set"
|
const val TBRsSet = StatsPrefix + "tbrs_set"
|
||||||
const val StandardBoluses = StatsPrefix + "std_boluses_delivered"
|
const val StandardBoluses = StatsPrefix + "std_boluses_delivered"
|
||||||
const val SMBBoluses = StatsPrefix + "smb_boluses_delivered"
|
const val SMBBoluses = StatsPrefix + "smb_boluses_delivered"
|
||||||
const val LastPumpHistoryEntry = StatsPrefix + "pump_history_entry"
|
const val LastPumpHistoryEntry = StatsPrefix + "pump_history_entry"
|
||||||
const val LastPrime = StatsPrefix + "last_sent_prime"
|
const val LastPrime = StatsPrefix + "last_sent_prime"
|
||||||
const val LastRewind = StatsPrefix + "last_sent_rewind"
|
const val LastRewind = StatsPrefix + "last_sent_rewind"
|
||||||
const val InternalTemporaryDatabase = StatsPrefix + "temporary_entries"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -46,6 +46,7 @@ import info.nightscout.androidaps.interfaces.Pump;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpPluginBase;
|
import info.nightscout.androidaps.interfaces.PumpPluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync;
|
import info.nightscout.androidaps.interfaces.PumpSync;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalSchedule;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
import info.nightscout.shared.logging.LTag;
|
import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus;
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
|
@ -628,8 +629,9 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
if (!podStateManager.isPodRunning()) {
|
if (!podStateManager.isPodRunning()) {
|
||||||
return 0.0d;
|
return 0.0d;
|
||||||
}
|
}
|
||||||
|
BasalSchedule schedule = podStateManager.getBasalSchedule();
|
||||||
return podStateManager.getBasalSchedule().rateAt(TimeUtil.toDuration(DateTime.now()));
|
if (schedule != null) return schedule.rateAt(TimeUtil.toDuration(DateTime.now()));
|
||||||
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -133,7 +133,7 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
|
||||||
aapsLogger.debug(TAG, "Device can be detected near, so trying to remove bond if possible.")
|
aapsLogger.debug(TAG, "Device can be detected near, so trying to remove bond if possible.")
|
||||||
bleSelector.removeDevice(bluetoothDevice!!)
|
bleSelector.removeDevice(bluetoothDevice!!)
|
||||||
} else {
|
} else {
|
||||||
val remoteDevice = bluetoothAdapter!!.getRemoteDevice(deviceAddress)
|
val remoteDevice = bluetoothAdapter?.getRemoteDevice(deviceAddress)
|
||||||
if (remoteDevice != null) {
|
if (remoteDevice != null) {
|
||||||
bleSelector.removeDevice(remoteDevice)
|
bleSelector.removeDevice(remoteDevice)
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun prepareForScanning() {
|
private fun prepareForScanning() {
|
||||||
bleScanner = bluetoothAdapter!!.bluetoothLeScanner
|
bleScanner = bluetoothAdapter?.bluetoothLeScanner
|
||||||
settings = bleSelector.getScanSettings()
|
settings = bleSelector.getScanSettings()
|
||||||
filters = bleSelector.getScanFilters()
|
filters = bleSelector.getScanFilters()
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
|
||||||
binding.pumpBleConfigButtonScanStop.visibility = View.VISIBLE
|
binding.pumpBleConfigButtonScanStop.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
scanning = true
|
scanning = true
|
||||||
bleScanner!!.startScan(filters, settings, bleScanCallback)
|
bleScanner?.startScan(filters, settings, bleScanCallback)
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "startLeDeviceScan: Scanning Start")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "startLeDeviceScan: Scanning Start")
|
||||||
bleSelector.onStartLeDeviceScan(this@PumpBLEConfigActivity)
|
bleSelector.onStartLeDeviceScan(this@PumpBLEConfigActivity)
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
|
||||||
private fun stopLeDeviceScan(manualStop: Boolean) {
|
private fun stopLeDeviceScan(manualStop: Boolean) {
|
||||||
if (scanning) {
|
if (scanning) {
|
||||||
scanning = false
|
scanning = false
|
||||||
bleScanner!!.stopScan(bleScanCallback)
|
bleScanner?.stopScan(bleScanCallback)
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "stopLeDeviceScan: Scanning Stop")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "stopLeDeviceScan: Scanning Stop")
|
||||||
bleSelector.onStopLeDeviceScan(this@PumpBLEConfigActivity)
|
bleSelector.onStopLeDeviceScan(this@PumpBLEConfigActivity)
|
||||||
handler.removeCallbacks(stopScanAfterTimeoutRunnable)
|
handler.removeCallbacks(stopScanAfterTimeoutRunnable)
|
||||||
|
@ -320,8 +320,8 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
|
||||||
if (currentlySelectedAddress == device.address) {
|
if (currentlySelectedAddress == device.address) {
|
||||||
deviceName += " (" + resources.getString(R.string.ble_config_scan_selected) + ")"
|
deviceName += " (" + resources.getString(R.string.ble_config_scan_selected) + ")"
|
||||||
}
|
}
|
||||||
holder.deviceName!!.text = deviceName
|
holder.deviceName?.text = deviceName
|
||||||
holder.deviceAddress!!.text = device.address
|
holder.deviceAddress?.text = device.address
|
||||||
return v!!
|
return v!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:theme="@style/YourSpinnerItemStyle"
|
android:theme="@style/CommonSpinnerItemStyle"
|
||||||
android:id="@+id/pump_history_type"
|
android:id="@+id/pump_history_type"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Operasie nog nie ondersteun deur pomp.</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
|
|
|
@ -1,11 +1,39 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_supported_by_pump_driver">Помпата не поддържа тази операция.</string>
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Операцията не се поддържа от помпата (ВСЕ ОЩЕ).</string>
|
||||||
|
<string name="common_resultok">ОК</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
|
<string name="pump_status_waking_up">Събуждане</string>
|
||||||
|
<string name="pump_status_error_comm">Грешка в комуникацията</string>
|
||||||
|
<string name="pump_status_timeout_comm">Изтече времето за връзка</string>
|
||||||
|
<string name="pump_status_pump_unreachable">Помпата е недостъпна</string>
|
||||||
|
<string name="pump_status_invalid_config">Грешна конфигурация</string>
|
||||||
|
<string name="pump_status_active">Активна</string>
|
||||||
|
<string name="pump_status_sleeping">Спинка си</string>
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
|
<string name="history_group_basal">Базали</string>
|
||||||
|
<string name="history_group_configuration">Конфигурации</string>
|
||||||
|
<string name="history_group_notification">Известия</string>
|
||||||
|
<string name="history_group_statistic">Статистика</string>
|
||||||
|
<string name="history_group_unknown">Неизвестни</string>
|
||||||
|
<string name="history_group_all">Всички</string>
|
||||||
|
<string name="history_group_bolus">Болуси</string>
|
||||||
|
<string name="history_group_prime">Пълнене</string>
|
||||||
|
<string name="history_group_alarm">Аларми</string>
|
||||||
|
<string name="history_group_glucose">Кръвна захар</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d ден</item>
|
||||||
|
<item quantity="other">%1$d дни</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d часа</item>
|
||||||
|
<item quantity="other">%1$d часа</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,11 +1,37 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_supported_by_pump_driver">Operació no compatible amb la bomba i/o controlador.</string>
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Operació no compatible ENCARA amb la bomba.</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
|
<string name="pump_status_waking_up">Iniciant</string>
|
||||||
|
<string name="pump_status_error_comm">Error de comunicació</string>
|
||||||
|
<string name="pump_status_timeout_comm">Temps d\'espera excedit en la comunicació</string>
|
||||||
|
<string name="pump_status_pump_unreachable">Bomba no accessible</string>
|
||||||
|
<string name="pump_status_invalid_config">Configuració no vàlida</string>
|
||||||
|
<string name="pump_status_active">Activa</string>
|
||||||
|
<string name="pump_status_sleeping">En suspens</string>
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
|
<string name="history_group_basal">Basals</string>
|
||||||
|
<string name="history_group_configuration">Configuracions</string>
|
||||||
|
<string name="history_group_notification">Avisos</string>
|
||||||
|
<string name="history_group_statistic">Estadístiques</string>
|
||||||
|
<string name="history_group_unknown">Desconeguts</string>
|
||||||
|
<string name="history_group_all">Tots</string>
|
||||||
|
<string name="history_group_bolus">Bolus</string>
|
||||||
|
<string name="history_group_prime">Encebaments</string>
|
||||||
|
<string name="history_group_alarm">Alarmes</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d dia</item>
|
||||||
|
<item quantity="other">%1$d dies</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d hora</item>
|
||||||
|
<item quantity="other">%1$d hores</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -8,4 +8,12 @@
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d dag</item>
|
||||||
|
<item quantity="other">%1$d dage</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d time</item>
|
||||||
|
<item quantity="other">%1$d timer</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,11 +1,39 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_supported_by_pump_driver">Aktion von Pumpe und/oder Treiber nicht unterstützt.</string>
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Operation NOCH NICHT von Pumpe unterstützt.</string>
|
||||||
|
<string name="common_resultok">OK</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
|
<string name="pump_status_waking_up">Aufwecken</string>
|
||||||
|
<string name="pump_status_error_comm">Fehler bei der Kommunikation</string>
|
||||||
|
<string name="pump_status_timeout_comm">Zeitüberschreitung bei Kommunikation</string>
|
||||||
|
<string name="pump_status_pump_unreachable">Pumpe nicht erreichbar</string>
|
||||||
|
<string name="pump_status_invalid_config">Ungültige Einstellung</string>
|
||||||
|
<string name="pump_status_active">Aktiv</string>
|
||||||
|
<string name="pump_status_sleeping">Schlafen</string>
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
|
<string name="history_group_basal">Basal</string>
|
||||||
|
<string name="history_group_configuration">Konfigurationen</string>
|
||||||
|
<string name="history_group_notification">Benachrichtigungen</string>
|
||||||
|
<string name="history_group_statistic">Statistiken</string>
|
||||||
|
<string name="history_group_unknown">Unbekannte</string>
|
||||||
|
<string name="history_group_all">Alle</string>
|
||||||
|
<string name="history_group_bolus">Boli</string>
|
||||||
|
<string name="history_group_prime">Füllen</string>
|
||||||
|
<string name="history_group_alarm">Alarme</string>
|
||||||
|
<string name="history_group_glucose">Glukose</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d Tag</item>
|
||||||
|
<item quantity="other">%1$d Tage</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d Stunde</item>
|
||||||
|
<item quantity="other">%1$d Stunden</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Η λειτουργία δεν υποστηρίζεται ΑΚΟΜΑ από την αντλία.</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="common_resultok">Ceart go leor</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
|
<string name="pump_status_active">Gníomhach</string>
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
|
<string name="history_group_basal">Bunaidhi</string>
|
||||||
|
<string name="history_group_all">Ar fad</string>
|
||||||
|
<string name="history_group_bolus">Bólasi</string>
|
||||||
|
<string name="history_group_alarm">Aláraim</string>
|
||||||
|
<string name="history_group_glucose">Glúcóis</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
|
|
|
@ -8,4 +8,12 @@
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d nap</item>
|
||||||
|
<item quantity="other">%1$d nap</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d óra</item>
|
||||||
|
<item quantity="other">%1$d óra</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<string name="pump_operation_not_supported_by_pump_driver">הפעולה לא נתמכת ע\"י המשאבה ו\\או מנהל ההתקן.</string>
|
<string name="pump_operation_not_supported_by_pump_driver">הפעולה לא נתמכת ע\"י המשאבה ו\\או מנהל ההתקן.</string>
|
||||||
<string name="pump_operation_not_yet_supported_by_pump">הפעולה עוד לא נתמכת על ידי המשאבה.</string>
|
<string name="pump_operation_not_yet_supported_by_pump">הפעולה עוד לא נתמכת על ידי המשאבה.</string>
|
||||||
<string name="common_resultok">אישור</string>
|
<string name="common_resultok">אישור</string>
|
||||||
|
<string name="pump_serial_number">המספר הסידורי של המשאבה</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
<string name="pump_status_never_contacted">מעולם לא נוצר קשר</string>
|
<string name="pump_status_never_contacted">מעולם לא נוצר קשר</string>
|
||||||
<string name="pump_status_waking_up">מתעורר</string>
|
<string name="pump_status_waking_up">מתעורר</string>
|
||||||
|
@ -13,6 +14,13 @@
|
||||||
<string name="pump_status_invalid_config">תצורה לא חוקית</string>
|
<string name="pump_status_invalid_config">תצורה לא חוקית</string>
|
||||||
<string name="pump_status_active">פעיל</string>
|
<string name="pump_status_active">פעיל</string>
|
||||||
<string name="pump_status_sleeping">שינה</string>
|
<string name="pump_status_sleeping">שינה</string>
|
||||||
|
<string name="pump_status_not_initialized">לא מאותחל</string>
|
||||||
|
<string name="pump_status_initialized">מאותחל</string>
|
||||||
|
<string name="pump_status_encrypt">מצפין תקשורת</string>
|
||||||
|
<string name="pump_status_ready">מוכן</string>
|
||||||
|
<string name="pump_status_busy">עסוק</string>
|
||||||
|
<string name="pump_status_suspended">מושהה</string>
|
||||||
|
<string name="pump_status_executing_command">מבצע פקודה</string>
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
<string name="history_group_basal">בזאלים</string>
|
<string name="history_group_basal">בזאלים</string>
|
||||||
<string name="history_group_configuration">תצורות</string>
|
<string name="history_group_configuration">תצורות</string>
|
||||||
|
@ -24,9 +32,67 @@
|
||||||
<string name="history_group_prime">תיחול</string>
|
<string name="history_group_prime">תיחול</string>
|
||||||
<string name="history_group_alarm">התראות</string>
|
<string name="history_group_alarm">התראות</string>
|
||||||
<string name="history_group_glucose">גלוקוז</string>
|
<string name="history_group_glucose">גלוקוז</string>
|
||||||
|
<string name="history_group_base">בסיס</string>
|
||||||
|
<string name="history_group_other">אחר</string>
|
||||||
|
<string name="history_group_events">כל האירועים</string>
|
||||||
|
<string name="history_group_events_no_stat">אירועים(ללא סטטיסטיקה)</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
|
<string name="time_today">היום</string>
|
||||||
|
<string name="time_last_hour">בשעה האחרונה</string>
|
||||||
|
<string name="time_last_3_hours">ב-3 השעות האחרונות</string>
|
||||||
|
<string name="time_last_6_hours">ב-6 השעות האחרונות</string>
|
||||||
|
<string name="time_last_12_hours">ב-12 השעות האחרונות</string>
|
||||||
|
<string name="time_last_2_days">ביומיים אחרונים</string>
|
||||||
|
<string name="time_last_4_days">ב-4 הימים האחרונים</string>
|
||||||
|
<string name="time_last_week">בשבוע שעבר</string>
|
||||||
|
<string name="time_last_month">בחודש שעבר</string>
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
|
<string name="ble_config_button_scan_start">סריקה</string>
|
||||||
|
<string name="ble_config_scan_stop">עצור</string>
|
||||||
|
<string name="ble_config_scan_selected">נבחר</string>
|
||||||
|
<string name="ble_config_scan_scanning">סורק</string>
|
||||||
|
<string name="ble_config_scan_finished">הסריקה הושלמה</string>
|
||||||
|
<string name="ble_config_scan_error">שגיאת סריקה: %1$d</string>
|
||||||
|
<string name="ble_config_connected_never">אף פעם</string>
|
||||||
|
<string name="ble_config_remove">הסרה</string>
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
|
<string name="ble_error_bt_disabled">בלוטות\' כבוי</string>
|
||||||
|
<string name="ble_error_no_bt_adapter">אין מתאם בלוטות\'</string>
|
||||||
|
<string name="ble_error_configured_pump_not_found">לא נמצאה משאבה מוגדרת</string>
|
||||||
|
<string name="ble_error_pump_unreachable">המשאבה אינה זמינה</string>
|
||||||
|
<string name="ble_error_failed_to_conn_to_ble_device">נכשל החיבור למכשיר בלוטות\'</string>
|
||||||
|
<string name="ble_error_encryption_failed">ההצפנה נכשלה</string>
|
||||||
|
<string name="ble_error_pump_found_unbonded">נמצאה משאבה שאינה מצומדת</string>
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
|
<string name="pump_settings_error_basal_profiles_not_enabled">הגדרת פרופילי הבזאלי\\תבניות אינה מאופשרת במשאבה. הפעילו אותן בגוף המשאבה.</string>
|
||||||
|
<string name="pump_settings_error_incorrect_basal_profile_selected">הפרופיל הבזאלי שהוגדר במשאבה שגוי (חייב להיות %s).</string>
|
||||||
|
<string name="pump_settings_error_wrong_tbr_type_set">סוג הבזאלי הזמני שהוגדר במשאבה שגוי (חייב להיות %s).</string>
|
||||||
|
<string name="pump_settings_error_wrong_max_bolus_set">מינון הבולוס המרבי המוגדר במשאבה אינו נכון (חייב להיות %1$.2f).</string>
|
||||||
|
<string name="pump_settings_error_wrong_max_basal_set">המינון הבזאלי המרבי המוגדר במשאבה אינו נכון (חייב להיות %1$.2f).</string>
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<string name="pump_history_type">סוג:</string>
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">יום %1$d</item>
|
||||||
|
<item quantity="two">יומיים</item>
|
||||||
|
<item quantity="many">%1$d ימים</item>
|
||||||
|
<item quantity="other">%1$d ימים</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">שעה</item>
|
||||||
|
<item quantity="two">שעתיים</item>
|
||||||
|
<item quantity="many">%1$d שעות</item>
|
||||||
|
<item quantity="other">%1$d שעות</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="hoursago">
|
||||||
|
<item quantity="one">לפני שעה</item>
|
||||||
|
<item quantity="two">לפני שעתיים</item>
|
||||||
|
<item quantity="many">לפני %1$d שעות</item>
|
||||||
|
<item quantity="other">לפני %1$d שעות</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="daysago">
|
||||||
|
<item quantity="one">לפני יום אחד</item>
|
||||||
|
<item quantity="two">לפני יומיים</item>
|
||||||
|
<item quantity="many">לפני %1$d ימים</item>
|
||||||
|
<item quantity="other">לפני %1$d ימים</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">펌프에서 지원되지 않는 작동.</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
|
@ -8,4 +9,10 @@
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="other">%1$d 일</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="other">%1$d 시간</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,11 +1,43 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_supported_by_pump_driver">Pompa ir/ar jos valdiklis nepalaiko operacijos.</string>
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Pompa dar nepalaiko operacijos.</string>
|
||||||
|
<string name="common_resultok">Gerai</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
|
<string name="pump_status_waking_up">Pažadinimas</string>
|
||||||
|
<string name="pump_status_error_comm">Ryšio klaida</string>
|
||||||
|
<string name="pump_status_timeout_comm">Ryšiui skirtas laikas baigėsi</string>
|
||||||
|
<string name="pump_status_pump_unreachable">Pompa nepasiekiama</string>
|
||||||
|
<string name="pump_status_invalid_config">Neteisinga konfigūracija</string>
|
||||||
|
<string name="pump_status_active">Aktyvi</string>
|
||||||
|
<string name="pump_status_sleeping">Užmigusi</string>
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
|
<string name="history_group_basal">Bazė</string>
|
||||||
|
<string name="history_group_configuration">Nustatymai</string>
|
||||||
|
<string name="history_group_notification">Pranešimai</string>
|
||||||
|
<string name="history_group_statistic">Statistika</string>
|
||||||
|
<string name="history_group_unknown">Nežinoma</string>
|
||||||
|
<string name="history_group_all">Visi</string>
|
||||||
|
<string name="history_group_bolus">Bolusai</string>
|
||||||
|
<string name="history_group_prime">Užpildyti sistemą</string>
|
||||||
|
<string name="history_group_alarm">Aliarmai</string>
|
||||||
|
<string name="history_group_glucose">Gliukozė</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d d.</item>
|
||||||
|
<item quantity="few">%1$d d.</item>
|
||||||
|
<item quantity="many">%1$d d.</item>
|
||||||
|
<item quantity="other">%1$d d.</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d val.</item>
|
||||||
|
<item quantity="few">%1$d val.</item>
|
||||||
|
<item quantity="many">%1$d val.</item>
|
||||||
|
<item quantity="other">%1$d val.</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -3,9 +3,22 @@
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
|
<string name="history_group_prime">Napełnianie</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d dzień</item>
|
||||||
|
<item quantity="few">%1$d dni</item>
|
||||||
|
<item quantity="many">%1$d dni</item>
|
||||||
|
<item quantity="other">%1$d dni</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d godzina</item>
|
||||||
|
<item quantity="few">%1$d godziny</item>
|
||||||
|
<item quantity="many">%1$d godzin</item>
|
||||||
|
<item quantity="other">%1$d godzin</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Operação não suportada ainda pela Bomba.</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
|
|
|
@ -1,11 +1,39 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_supported_by_pump_driver">Operação não suportada pela Bomba e/ou Controlador.</string>
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Operação não suportada ainda pela Bomba.</string>
|
||||||
|
<string name="common_resultok">OK</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
|
<string name="pump_status_waking_up">A acordar</string>
|
||||||
|
<string name="pump_status_error_comm">Erro com comunicação</string>
|
||||||
|
<string name="pump_status_timeout_comm">Tempo limite para comunicação</string>
|
||||||
|
<string name="pump_status_pump_unreachable">Bomba inacessível</string>
|
||||||
|
<string name="pump_status_invalid_config">Configuração inválida</string>
|
||||||
|
<string name="pump_status_active">Activo</string>
|
||||||
|
<string name="pump_status_sleeping">A dormir</string>
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
|
<string name="history_group_basal">Basais</string>
|
||||||
|
<string name="history_group_configuration">Configurações</string>
|
||||||
|
<string name="history_group_notification">Notificações</string>
|
||||||
|
<string name="history_group_statistic">Estatísticas</string>
|
||||||
|
<string name="history_group_unknown">Desconhecido</string>
|
||||||
|
<string name="history_group_all">Tudo</string>
|
||||||
|
<string name="history_group_bolus">Bólus</string>
|
||||||
|
<string name="history_group_prime">Purgar</string>
|
||||||
|
<string name="history_group_alarm">Alarmes</string>
|
||||||
|
<string name="history_group_glucose">Glucose</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d dia</item>
|
||||||
|
<item quantity="other">%1$d dias</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d hora</item>
|
||||||
|
<item quantity="other">%1$d horas</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,11 +1,41 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_supported_by_pump_driver">Operațiunea nu este suportată de către pompă și/sau driver.</string>
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Operațiunea nu este ÎNCĂ suportată de către pompă.</string>
|
||||||
|
<string name="common_resultok">OK</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
|
<string name="pump_status_waking_up">Se pornește</string>
|
||||||
|
<string name="pump_status_error_comm">Eroare de comunicație</string>
|
||||||
|
<string name="pump_status_timeout_comm">Comunicația nu a reușit la timp</string>
|
||||||
|
<string name="pump_status_pump_unreachable">Pompă indisponibilă</string>
|
||||||
|
<string name="pump_status_invalid_config">Configurație invalidă</string>
|
||||||
|
<string name="pump_status_active">Activă</string>
|
||||||
|
<string name="pump_status_sleeping">În repaus</string>
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
|
<string name="history_group_basal">Bazale</string>
|
||||||
|
<string name="history_group_configuration">Configurații</string>
|
||||||
|
<string name="history_group_notification">Notificări</string>
|
||||||
|
<string name="history_group_statistic">Statistici</string>
|
||||||
|
<string name="history_group_unknown">Necunoscute</string>
|
||||||
|
<string name="history_group_all">Toate</string>
|
||||||
|
<string name="history_group_bolus">Bolusuri</string>
|
||||||
|
<string name="history_group_prime">Amorsare</string>
|
||||||
|
<string name="history_group_alarm">Alarme</string>
|
||||||
|
<string name="history_group_glucose">Glicemie</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d zi</item>
|
||||||
|
<item quantity="few">%1$d zile</item>
|
||||||
|
<item quantity="other">%1$d zile</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d oră</item>
|
||||||
|
<item quantity="few">%1$d ore</item>
|
||||||
|
<item quantity="other">%1$d ore</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -40,8 +40,59 @@
|
||||||
<string name="time_today">Сегодня</string>
|
<string name="time_today">Сегодня</string>
|
||||||
<string name="time_last_hour">За прошедший час</string>
|
<string name="time_last_hour">За прошедший час</string>
|
||||||
<string name="time_last_3_hours">За прошедшие 3 часа</string>
|
<string name="time_last_3_hours">За прошедшие 3 часа</string>
|
||||||
|
<string name="time_last_6_hours">За прошедшие 6 часов</string>
|
||||||
|
<string name="time_last_12_hours">За прошедшие 12 часов</string>
|
||||||
|
<string name="time_last_2_days">За прошедшие 2 дня</string>
|
||||||
|
<string name="time_last_4_days">За прошедшие 4 дня</string>
|
||||||
|
<string name="time_last_week">За прошедшую неделю</string>
|
||||||
|
<string name="time_last_month">За прошлый месяц</string>
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
|
<string name="ble_config_button_scan_start">Сканирование</string>
|
||||||
|
<string name="ble_config_scan_stop">Прервать</string>
|
||||||
|
<string name="ble_config_scan_selected">Выбрано</string>
|
||||||
|
<string name="ble_config_scan_scanning">Сканирование</string>
|
||||||
|
<string name="ble_config_scan_finished">Сканирование завершено</string>
|
||||||
|
<string name="ble_config_scan_error">Ошибка сканирования: %1$d</string>
|
||||||
|
<string name="ble_config_connected_never">Не было</string>
|
||||||
|
<string name="ble_config_remove">Удалить</string>
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
|
<string name="ble_error_bt_disabled">Bluetooth выключен</string>
|
||||||
|
<string name="ble_error_no_bt_adapter">Адаптер Bluetooth не найден</string>
|
||||||
|
<string name="ble_error_configured_pump_not_found">Сконфигурированная помпа не найдена</string>
|
||||||
|
<string name="ble_error_pump_unreachable">Помпа недоступна</string>
|
||||||
|
<string name="ble_error_failed_to_conn_to_ble_device">Не удалось подключиться к устройству BLE</string>
|
||||||
|
<string name="ble_error_encryption_failed">Ошибка шифрования</string>
|
||||||
|
<string name="ble_error_pump_found_unbonded">Найдена несопряженная помпа</string>
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
|
<string name="pump_settings_error_basal_profiles_not_enabled">Базальные профили/настройки шаблонов не активированы в помпе. Включите их на помпе.</string>
|
||||||
|
<string name="pump_settings_error_incorrect_basal_profile_selected">Базальный профиль на помпе неверен (должен быть %s).</string>
|
||||||
|
<string name="pump_settings_error_wrong_tbr_type_set">Неверный тип временной скорости базала TBR на помпе (должен быть %s).</string>
|
||||||
|
<string name="pump_settings_error_wrong_max_bolus_set">На помпе задан неверный макс болюс (должен быть %1$.2f).</string>
|
||||||
|
<string name="pump_settings_error_wrong_max_basal_set">На помпе задан неверный макс базал (должен быть %1$.2f).</string>
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<string name="pump_history_type">Тип:</string>
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d день</item>
|
||||||
|
<item quantity="few">%1$d дня</item>
|
||||||
|
<item quantity="many">%1$d дней</item>
|
||||||
|
<item quantity="other">%1$d дн</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d час</item>
|
||||||
|
<item quantity="few">%1$d часа</item>
|
||||||
|
<item quantity="many">%1$d часов</item>
|
||||||
|
<item quantity="other">%1$d ч</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="hoursago">
|
||||||
|
<item quantity="one">%1$d час назад</item>
|
||||||
|
<item quantity="few">%1$d часа назад</item>
|
||||||
|
<item quantity="many">%1$d часов назад</item>
|
||||||
|
<item quantity="other">%1$d ч назад</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="daysago">
|
||||||
|
<item quantity="one">%1$d день назад</item>
|
||||||
|
<item quantity="few">%1$d дня назад</item>
|
||||||
|
<item quantity="many">%1$d дней назад</item>
|
||||||
|
<item quantity="other">%1$d дн назад</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -29,4 +29,16 @@
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d deň</item>
|
||||||
|
<item quantity="few">%1$d dní</item>
|
||||||
|
<item quantity="many">%1$d dní</item>
|
||||||
|
<item quantity="other">%1$d dní</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d hodina</item>
|
||||||
|
<item quantity="few">%1$d hodín</item>
|
||||||
|
<item quantity="many">%1$d hodín</item>
|
||||||
|
<item quantity="other">%1$d hodín</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,11 +1,39 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- PumoCommon - Pump Abstract -->
|
<!-- PumoCommon - Pump Abstract -->
|
||||||
|
<string name="pump_operation_not_supported_by_pump_driver">Operation stöds inte av pumpen/pumpdrivrutinen.</string>
|
||||||
|
<string name="pump_operation_not_yet_supported_by_pump">Operationen stöds inte av pumpen ännu.</string>
|
||||||
|
<string name="common_resultok">OK</string>
|
||||||
<!-- PumpCommon - Pump Status -->
|
<!-- PumpCommon - Pump Status -->
|
||||||
|
<string name="pump_status_waking_up">Väcker</string>
|
||||||
|
<string name="pump_status_error_comm">Kommunikationsfel</string>
|
||||||
|
<string name="pump_status_timeout_comm">Kommunikationstimeout</string>
|
||||||
|
<string name="pump_status_pump_unreachable">Pumpen kan inte nås</string>
|
||||||
|
<string name="pump_status_invalid_config">Felaktig konfiguration</string>
|
||||||
|
<string name="pump_status_active">Aktiv</string>
|
||||||
|
<string name="pump_status_sleeping">Sover</string>
|
||||||
<!-- PumpCommon - History Group -->
|
<!-- PumpCommon - History Group -->
|
||||||
|
<string name="history_group_basal">Basaldoser</string>
|
||||||
|
<string name="history_group_configuration">Konfigurationer</string>
|
||||||
|
<string name="history_group_notification">Notiser</string>
|
||||||
|
<string name="history_group_statistic">Statistik</string>
|
||||||
|
<string name="history_group_unknown">Okända</string>
|
||||||
|
<string name="history_group_all">Alla</string>
|
||||||
|
<string name="history_group_bolus">Bolusar</string>
|
||||||
|
<string name="history_group_prime">Förfyllningar</string>
|
||||||
|
<string name="history_group_alarm">Larm</string>
|
||||||
|
<string name="history_group_glucose">Glukos</string>
|
||||||
<!-- Time -->
|
<!-- Time -->
|
||||||
<!-- BLE Config -->
|
<!-- BLE Config -->
|
||||||
<!-- BLE Errors -->
|
<!-- BLE Errors -->
|
||||||
<!-- Pump Error -->
|
<!-- Pump Error -->
|
||||||
<!-- Pump History -->
|
<!-- Pump History -->
|
||||||
|
<plurals name="duration_days">
|
||||||
|
<item quantity="one">%1$d dag</item>
|
||||||
|
<item quantity="other">%1$d dagar</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="duration_hours">
|
||||||
|
<item quantity="one">%1$d tim</item>
|
||||||
|
<item quantity="other">%1$d tim</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
<resources>
|
|
||||||
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
|
||||||
<item name="android:spinnerItemStyle">@style/YourSpinnerItemStyle</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="YourSpinnerItemStyle" parent="Widget.AppCompat.TextView.SpinnerItem">
|
|
||||||
<item name="android:textColor">@android:color/white</item>
|
|
||||||
<item name="android:textSize">15sp</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="mySpinnerItemStyle" parent="ThemeOverlay.AppCompat.Dark">
|
|
||||||
<item name="android:textSize">15sp</item>
|
|
||||||
<item name="android:textColor">@color/white</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.dialog
|
package info.nightscout.androidaps.plugins.pump.common.dialog
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.bluetooth.BluetoothAdapter
|
import android.bluetooth.BluetoothAdapter
|
||||||
import android.bluetooth.BluetoothDevice
|
import android.bluetooth.BluetoothDevice
|
||||||
|
@ -10,6 +11,7 @@ import android.bluetooth.le.ScanFilter
|
||||||
import android.bluetooth.le.ScanResult
|
import android.bluetooth.le.ScanResult
|
||||||
import android.bluetooth.le.ScanSettings
|
import android.bluetooth.le.ScanSettings
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.HandlerThread
|
import android.os.HandlerThread
|
||||||
|
@ -22,8 +24,10 @@ import android.widget.AdapterView.OnItemClickListener
|
||||||
import android.widget.BaseAdapter
|
import android.widget.BaseAdapter
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
import dagger.android.support.DaggerAppCompatActivity
|
import dagger.android.support.DaggerAppCompatActivity
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
|
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.R
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst
|
||||||
|
@ -32,7 +36,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.Gatt
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.databinding.RileyLinkBleConfigActivityBinding
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.databinding.RileyLinkBleConfigActivityBinding
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -225,16 +228,20 @@ class RileyLinkBLEConfigActivity : DaggerAppCompatActivity() {
|
||||||
binding.rileyLinkBleConfigButtonScanStop.visibility = View.VISIBLE
|
binding.rileyLinkBleConfigButtonScanStop.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
scanning = true
|
scanning = true
|
||||||
bleScanner?.startScan(filters, settings, bleScanCallback)
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "startLeDeviceScan: Scanning Start")
|
bleScanner?.startScan(filters, settings, bleScanCallback)
|
||||||
Toast.makeText(this@RileyLinkBLEConfigActivity, R.string.riley_link_ble_config_scan_scanning, Toast.LENGTH_SHORT).show()
|
aapsLogger.debug(LTag.PUMPBTCOMM, "startLeDeviceScan: Scanning Start")
|
||||||
|
Toast.makeText(this@RileyLinkBLEConfigActivity, R.string.riley_link_ble_config_scan_scanning, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun stopLeDeviceScan() {
|
private fun stopLeDeviceScan() {
|
||||||
if (scanning) {
|
if (scanning) {
|
||||||
scanning = false
|
scanning = false
|
||||||
if (bluetoothAdapter?.isEnabled == true && bluetoothAdapter?.state == BluetoothAdapter.STATE_ON)
|
if (bluetoothAdapter?.isEnabled == true && bluetoothAdapter?.state == BluetoothAdapter.STATE_ON)
|
||||||
bleScanner?.stopScan(bleScanCallback)
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
bleScanner?.stopScan(bleScanCallback)
|
||||||
|
}
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "stopLeDeviceScan: Scanning Stop")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "stopLeDeviceScan: Scanning Stop")
|
||||||
Toast.makeText(this, R.string.riley_link_ble_config_scan_finished, Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, R.string.riley_link_ble_config_scan_finished, Toast.LENGTH_SHORT).show()
|
||||||
handler.removeCallbacks(stopScanAfterTimeoutRunnable)
|
handler.removeCallbacks(stopScanAfterTimeoutRunnable)
|
||||||
|
@ -268,7 +275,7 @@ class RileyLinkBLEConfigActivity : DaggerAppCompatActivity() {
|
||||||
override fun getItem(i: Int): Any = leDevices[i]
|
override fun getItem(i: Int): Any = leDevices[i]
|
||||||
override fun getItemId(i: Int): Long = i.toLong()
|
override fun getItemId(i: Int): Long = i.toLong()
|
||||||
|
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams", "MissingPermission")
|
||||||
override fun getView(i: Int, v: View?, viewGroup: ViewGroup): View {
|
override fun getView(i: Int, v: View?, viewGroup: ViewGroup): View {
|
||||||
var view = v
|
var view = v
|
||||||
val viewHolder: ViewHolder
|
val viewHolder: ViewHolder
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.content.Intent
|
||||||
import dagger.android.DaggerService
|
import dagger.android.DaggerService
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager
|
||||||
|
@ -17,8 +18,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLink
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -85,8 +84,6 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract val deviceCommunicationManager: RileyLinkCommunicationManager<*>
|
abstract val deviceCommunicationManager: RileyLinkCommunicationManager<*>
|
||||||
val rileyLinkServiceState: RileyLinkServiceState?
|
|
||||||
get() = rileyLinkServiceData.rileyLinkServiceState
|
|
||||||
|
|
||||||
// Here is where the wake-lock begins:
|
// Here is where the wake-lock begins:
|
||||||
// We've received a service startCommand, we grab the lock.
|
// We've received a service startCommand, we grab the lock.
|
||||||
|
@ -94,7 +91,7 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
|
|
||||||
fun bluetoothInit(): Boolean {
|
fun bluetoothInit(): Boolean {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "bluetoothInit: attempting to get an adapter")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "bluetoothInit: attempting to get an adapter")
|
||||||
rileyLinkServiceData.rileyLinkServiceState = RileyLinkServiceState.BluetoothInitializing
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothInitializing)
|
||||||
if (bluetoothAdapter == null) {
|
if (bluetoothAdapter == null) {
|
||||||
aapsLogger.error("Unable to obtain a BluetoothAdapter.")
|
aapsLogger.error("Unable to obtain a BluetoothAdapter.")
|
||||||
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.NoBluetoothAdapter)
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.NoBluetoothAdapter)
|
||||||
|
@ -103,7 +100,7 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
aapsLogger.error("Bluetooth is not enabled.")
|
aapsLogger.error("Bluetooth is not enabled.")
|
||||||
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled)
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled)
|
||||||
} else {
|
} else {
|
||||||
rileyLinkServiceData.rileyLinkServiceState = RileyLinkServiceState.BluetoothReady
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothReady)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +109,7 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
|
|
||||||
// returns true if our Rileylink configuration changed
|
// returns true if our Rileylink configuration changed
|
||||||
fun reconfigureRileyLink(deviceAddress: String): Boolean {
|
fun reconfigureRileyLink(deviceAddress: String): Boolean {
|
||||||
rileyLinkServiceData.rileyLinkServiceState = RileyLinkServiceState.RileyLinkInitializing
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.RileyLinkInitializing)
|
||||||
return if (rileyLinkBLE.isConnected) {
|
return if (rileyLinkBLE.isConnected) {
|
||||||
if (deviceAddress == rileyLinkServiceData.rileyLinkAddress) {
|
if (deviceAddress == rileyLinkServiceData.rileyLinkAddress) {
|
||||||
aapsLogger.info(LTag.PUMPBTCOMM, "No change to RL address. Not reconnecting.")
|
aapsLogger.info(LTag.PUMPBTCOMM, "No change to RL address. Not reconnecting.")
|
||||||
|
@ -141,7 +138,7 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
|
|
||||||
// FIXME: This needs to be run in a session so that is incorruptible, has a separate thread, etc.
|
// FIXME: This needs to be run in a session so that is incorruptible, has a separate thread, etc.
|
||||||
fun doTuneUpDevice() {
|
fun doTuneUpDevice() {
|
||||||
rileyLinkServiceData.rileyLinkServiceState = RileyLinkServiceState.TuneUpDevice
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.TuneUpDevice)
|
||||||
setPumpDeviceState(PumpDeviceState.Sleeping)
|
setPumpDeviceState(PumpDeviceState.Sleeping)
|
||||||
val lastGoodFrequency = rileyLinkServiceData.lastGoodFrequency ?: sp.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0)
|
val lastGoodFrequency = rileyLinkServiceData.lastGoodFrequency ?: sp.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0)
|
||||||
val newFrequency = deviceCommunicationManager.tuneForDevice()
|
val newFrequency = deviceCommunicationManager.tuneForDevice()
|
||||||
|
@ -157,7 +154,7 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
rileyLinkServiceData.setServiceState(RileyLinkServiceState.PumpConnectorError, RileyLinkError.TuneUpOfDeviceFailed)
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.PumpConnectorError, RileyLinkError.TuneUpOfDeviceFailed)
|
||||||
} else {
|
} else {
|
||||||
deviceCommunicationManager.clearNotConnectedCount()
|
deviceCommunicationManager.clearNotConnectedCount()
|
||||||
rileyLinkServiceData.rileyLinkServiceState = RileyLinkServiceState.PumpConnectorReady
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.PumpConnectorReady)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +165,7 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
rileyLinkServiceData.rileyLinkAddress = null
|
rileyLinkServiceData.rileyLinkAddress = null
|
||||||
rileyLinkServiceData.rileyLinkName = null
|
rileyLinkServiceData.rileyLinkName = null
|
||||||
}
|
}
|
||||||
rileyLinkServiceData.rileyLinkServiceState = RileyLinkServiceState.BluetoothReady
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothReady)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun changeRileyLinkEncoding(encodingType: RileyLinkEncodingType?) {
|
fun changeRileyLinkEncoding(encodingType: RileyLinkEncodingType?) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ class RileyLinkServiceData @Inject constructor() {
|
||||||
var tuneUpDone = false
|
var tuneUpDone = false
|
||||||
var rileyLinkError: RileyLinkError? = null
|
var rileyLinkError: RileyLinkError? = null
|
||||||
var rileyLinkServiceState: RileyLinkServiceState = RileyLinkServiceState.NotStarted
|
var rileyLinkServiceState: RileyLinkServiceState = RileyLinkServiceState.NotStarted
|
||||||
|
private set
|
||||||
var lastServiceStateChange = 0L
|
var lastServiceStateChange = 0L
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
@ -62,11 +63,11 @@ class RileyLinkServiceData @Inject constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun setServiceState(newState: RileyLinkServiceState, errorCode: RileyLinkError) {
|
fun setServiceState(newState: RileyLinkServiceState, errorCode: RileyLinkError? = null) {
|
||||||
rileyLinkServiceState = newState
|
rileyLinkServiceState = newState
|
||||||
lastServiceStateChange = System.currentTimeMillis()
|
lastServiceStateChange = System.currentTimeMillis()
|
||||||
rileyLinkError = errorCode
|
rileyLinkError = errorCode
|
||||||
aapsLogger.info(LTag.PUMP, String.format(Locale.ENGLISH, "RileyLink State Changed: $newState - Error State: ${errorCode.name}"))
|
aapsLogger.info(LTag.PUMP, String.format(Locale.ENGLISH, "RileyLink State Changed: $newState - Error State: ${errorCode?.name}"))
|
||||||
rileyLinkUtil.rileyLinkHistory.add(RLHistoryItem(rileyLinkServiceState, errorCode, targetDevice))
|
rileyLinkUtil.rileyLinkHistory.add(RLHistoryItem(rileyLinkServiceState, errorCode, targetDevice))
|
||||||
rxBus.send(EventRileyLinkDeviceStatusChange(targetDevice!!, newState, errorCode))
|
rxBus.send(EventRileyLinkDeviceStatusChange(targetDevice!!, newState, errorCode))
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue