Merge branch 'Fix/AutotuneKeyboad' into Autotune/TuneWeekDaysClean

# Conflicts:
#	app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt
This commit is contained in:
Philoul 2022-07-28 00:27:17 +02:00
commit 7fa35b2742
117 changed files with 1168 additions and 273 deletions

3
.gitignore vendored
View file

@ -19,3 +19,6 @@ app/.classpath
app/.settings/org.eclipse.buildship.core.prefs
wear/.classpath
wear/.settings/org.eclipse.buildship.core.prefs
app/nsclient/*
app/nsclient2/*
app/pumpcontrol/*

View file

@ -3,9 +3,11 @@
<words>
<w>aaps</w>
<w>abcdef</w>
<w>accu</w>
<w>acked</w>
<w>actionstring</w>
<w>aidex</w>
<w>alarmack</w>
<w>allowednumbers</w>
<w>androidaps</w>
<w>autosens</w>
@ -26,11 +28,15 @@
<w>carbsreq</w>
<w>careportal</w>
<w>cellnovo</w>
<w>chek</w>
<w>clearalarm</w>
<w>crashlytics</w>
<w>danar</w>
<w>danars</w>
<w>dataset</w>
<w>datasets</w>
<w>dbadd</w>
<w>dbupdate</w>
<w>devicestatus</w>
<w>devicestatuses</w>
<w>devslope</w>
@ -39,12 +45,14 @@
<w>diaconn</w>
<w>enteredby</w>
<w>enteredinsulin</w>
<w>eopatch</w>
<w>eveningoutpost</w>
<w>eversense</w>
<w>extendedbolus</w>
<w>fileprovider</w>
<w>firebase</w>
<w>glimp</w>
<w>glunovo</w>
<w>gson</w>
<w>hmac</w>
<w>iage</w>
@ -79,12 +87,14 @@
<w>pred</w>
<w>profileswitch</w>
<w>pumpbtcomm</w>
<w>pumpcontrol</w>
<w>quickwizard</w>
<w>readstatus</w>
<w>realduration</w>
<w>refresheventsfromnightscout</w>
<w>rileylink</w>
<w>roboelectric</w>
<w>rozman</w>
<w>sgvs</w>
<w>shortgramm</w>
<w>sitechange</w>
@ -108,7 +118,8 @@
<w>tirs</w>
<w>totp</w>
<w>tunedays</w>
<w>uart</w>
<w>uart</w>
<w>urgentalarm</w>
<w>wizzardpage</w>
<w>xdrip</w>
<w>xstream</w>

View file

@ -105,7 +105,7 @@ android {
defaultConfig {
multiDexEnabled true
versionCode 1500
version "3.0.0.2-dev-o"
version "3.1.0.2-dev-a"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'

View file

@ -68,6 +68,7 @@ class OpenAPSSMBDynamicISFPlugin @Inject constructor(
.shortName(R.string.dynisf_shortname)
.preferencesId(R.xml.pref_openapssmbdynamicisf)
.setDefault(false)
.showInList(buildHelper.isEngineeringMode() && buildHelper.isDev())
}
override fun specialEnableCondition(): Boolean = buildHelper.isEngineeringMode() && buildHelper.isDev()

View file

@ -134,7 +134,8 @@ class AutotuneFragment : DaggerFragment() {
profile = ATProfile(profileStore.getSpecificProfile(profileName)?.let { ProfileSealed.Pure(it) } ?: currentProfile, LocalInsulin(""), injector)
}
autotunePlugin.selectedProfile = profileName
resetParam(true)
resetParam()
binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
}
updateGui()
}
@ -295,6 +296,7 @@ class AutotuneFragment : DaggerFragment() {
.observeOn(aapsSchedulers.main)
.subscribe({ updateGui() }, fabricPrivacy::logException)
checkNewDay()
binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
binding.selectWeekDays.visibility = binding.showWeekDaysCheckbox.isChecked.toVisibility()
updateGui()
}
@ -308,7 +310,6 @@ class AutotuneFragment : DaggerFragment() {
@Synchronized
private fun updateGui() {
_binding ?: return
binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
profileStore = activePlugin.activeProfileSource.profile ?: ProfileStore(injector, JSONObject(), dateUtil)
profileName = if (binding.profileList.text.toString() == rh.gs(R.string.active)) "" else binding.profileList.text.toString()
profileFunction.getProfile()?.let { currentProfile ->
@ -413,7 +414,7 @@ class AutotuneFragment : DaggerFragment() {
try {
if (autotunePlugin.calculationRunning)
binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
if (binding.tuneDays.value != autotunePlugin.lastNbDays.toDouble()) {
if (binding.tuneDays.text != autotunePlugin.lastNbDays) {
autotunePlugin.lastNbDays = binding.tuneDays.text
resetParam(false)
}

View file

@ -61,6 +61,7 @@ class AutotunePlugin @Inject constructor(
.pluginName(R.string.autotune)
.shortName(R.string.autotune_shortname)
.preferencesId(R.xml.pref_autotune)
.showInList(buildHelper.isEngineeringMode() && buildHelper.isDev())
.description(R.string.autotune_description),
aapsLogger, resourceHelper, injector
), Autotune {

View file

@ -5,6 +5,7 @@ import android.bluetooth.BluetoothManager
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.provider.Settings
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
@ -113,7 +114,7 @@ class ImportExportPrefsImpl @Inject constructor(
val n1 = Settings.System.getString(context.contentResolver, "bluetooth_name")
val n2 = Settings.Secure.getString(context.contentResolver, "bluetooth_name")
val n3 = try {
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.name
} else null
} catch (e: Exception){

View file

@ -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 title = item.title
val s = SpannableString(" $title ")
s.setSpan(ForegroundColorSpan(rh.gac(context, m.attrTextId)), 0, s.length, 0)
s.setSpan(BackgroundColorSpan(rh.gac(context, m.attrId)), 0, s.length, 0)
s.setSpan(ForegroundColorSpan(rh.gac(m.attrTextId)), 0, s.length, 0)
s.setSpan(BackgroundColorSpan(rh.gac(m.attrId)), 0, s.length, 0)
item.title = s
item.isCheckable = true
item.isChecked = settingsCopy[g][m.ordinal]

View file

@ -46,6 +46,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import io.reactivex.rxjava3.kotlin.subscribeBy
import java.util.*
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import javax.inject.Singleton
@ -81,6 +82,7 @@ class CommandQueueImplementation @Inject constructor(
disposable += rxBus
.toObservable(EventProfileSwitchChanged::class.java)
.observeOn(aapsSchedulers.io)
.throttleLatest(3L, TimeUnit.SECONDS)
.subscribe({
if (config.NSCLIENT) { // Effective profileswitch should be synced over NS, do not create EffectiveProfileSwitch here
return@subscribe

View file

@ -2,7 +2,6 @@ package info.nightscout.androidaps.utils
import android.Manifest
import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.bluetooth.BluetoothAdapter
import android.content.ActivityNotFoundException
import android.content.Context
@ -95,13 +94,14 @@ class AndroidPermission @Inject constructor(
}
}
@SuppressLint("MissingPermission")
@Synchronized
fun notifyForBtConnectPermission(activity: FragmentActivity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// 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)
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))
} else {
activity.startActivity(Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE))

View file

@ -443,12 +443,7 @@ class BolusWizard @Inject constructor(
commandQueue.tempBasalPercent(0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
override fun run() {
if (!result.success) {
val i = Intent(ctx, ErrorHelperActivity::class.java)
i.putExtra(ErrorHelperActivity.SOUND_ID, R.raw.boluserror)
i.putExtra(ErrorHelperActivity.STATUS, result.comment)
i.putExtra(ErrorHelperActivity.TITLE, rh.gs(R.string.tempbasaldeliveryerror))
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
ctx.startActivity(i)
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
}
}
})

View file

@ -645,7 +645,6 @@
<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="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="open_navigation">Otevřít menu</string>
<string name="close_navigation">Zavřít menu</string>

View file

@ -636,7 +636,6 @@
<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="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="open_navigation">Åbn navigation</string>
<string name="close_navigation">Luk navigation</string>

View file

@ -633,7 +633,6 @@
<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="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="open_navigation">Menü öffnen</string>
<string name="close_navigation">Menü schließen</string>

View file

@ -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="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="needconnectpermission">La aplicación necesita permiso de bluetooth</string>
<string name="request">Solicitar</string>
<string name="open_navigation">Abrir navegación</string>
<string name="close_navigation">Cerrar navegación</string>

View file

@ -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="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="needconnectpermission">L\'application a besoin de l\'autorisation Bluetooth</string>
<string name="request">Demande</string>
<string name="open_navigation">Ouvrir navigation</string>
<string name="close_navigation">Fermer navigation</string>

View file

@ -136,6 +136,19 @@
<string name="wronginsulin_compare">Compara i valori in AndroidAPS con lo storico micro (se supportato).</string>
<string name="wronginsulin_prime">Erogare un bolo con parte della tua insulina calcolata \"mancante\" usando una siringa/penna o la funzione caricamento.</string>
<string name="wronginsulin_donothing">Non fare nulla e permettere ad AndroidAPS di correggere eventuali glicemie alte.</string>
<string name="cob_label">CHO attivi (COB)</string>
<string name="cob_question">In che modo la modifica del valore ISF influisce sul calcolo dei COB?</string>
<string name="cob_longer">L\'aumento di ISF richiederà un tempo maggiore per l\'assorbimento dei CHO</string>
<string name="cob_shorter">L\'aumento di ISF richiederà un tempo minore per l\'assorbimento dei CHO</string>
<string name="cob_no_effect">L\'aumento di ISF non influirà sull\'assorbimento calcolato dei CHO</string>
<string name="cob2_question">In che modo la modifica del valore IC influisce sul calcolo dei COB?</string>
<string name="cob2_longer">L\'aumento di IC richiederà un tempo maggiore per l\'assorbimento dei CHO</string>
<string name="cob2_shorter">L\'aumento di IC richiederà un tempo minore per l\'assorbimento dei CHO</string>
<string name="cob2_no_effect">L\'aumento di IC non influirà sull\'assorbimento calcolato dei CHO</string>
<string name="cob3_question">In che modo la modifica della percentuale profilo influisce sul calcolo dei COB?</string>
<string name="cob3_longer">Impostare il profilo al 150% richiederà un tempo maggiore per l\'assorbimento dei CHO</string>
<string name="cob3_shorter">Impostare il profilo al 150% richiederà un tempo minore per l\'assorbimento dei CHO</string>
<string name="cob3_no_effect">Impostare il profilo al 150% non influirà sull\'assorbimento calcolato dei CHO</string>
<string name="iob_label">Insulina attiva (IOB)</string>
<string name="iob_value">Il valore IOB è influenzato dalle basali temporanee emesse.</string>
<string name="iob_hightemp">Non verrà emessa una basale temporanea alta quando la tua glicemia è al di sotto del target.</string>

View file

@ -645,7 +645,6 @@
<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="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="open_navigation">Apri navigazione</string>
<string name="close_navigation">Chiudi navigazione</string>
@ -1037,10 +1036,12 @@
<string name="a11y_only_on_watch">solo su smartwatch</string>
<string name="a11y_only_on_phone">solo su telefono</string>
<string name="a11y_drag_and_drop_handle">trascina e rilascia</string>
<string name="search">Cerca</string>
<!-- Aidex Cgms -->
<string name="aidex">GlucoRx Aidex</string>
<string name="aidex_short">GlucoRx Aidex</string>
<string name="description_source_aidex">Ricevi valori glicemia da CGM GlucoRx Aidex.</string>
<string name="blocked_by_charging">Bloccato dalle opzioni di ricarica</string>
<string name="blocked_by_connectivity">Bloccato dalle opzioni di connettività</string>
<string name="no_watch_connected">(Nessuno smartwatch connesso)</string>
</resources>

View file

@ -645,7 +645,6 @@
<string name="needsystemwindowpermission">האפליקציה צריכה הרשאת מערכת של חלונות לצורך התראות</string>
<string name="needlocationpermission">דרושה הרשאת מיקום עבור סריקת בלוטות\' וזיהוי WiFi</string>
<string name="needstoragepermission">דרושה הרשאת אחסון כדי שתוכלו לאחסן קובצי יומן והגדרות יצוא.</string>
<string name="needconnectpermission">האפליקציה צריכה הרשאה לבלוטות\'</string>
<string name="request">בקשה</string>
<string name="open_navigation">פתח ניווט</string>
<string name="close_navigation">סגור ניווט</string>

View file

@ -631,7 +631,6 @@
<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="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="open_navigation">Atidaryti meniu</string>
<string name="close_navigation">Uždaryti meniu</string>
@ -894,6 +893,7 @@
<string name="not_available_full">Negalimas</string>
<!-- Theme switcher dark and light mode-->
<!-- WEAR OS-->
<string name="sort_label">Rūšiuoti</string>
<string name="login">Prisijungti</string>
<!-- Aidex Cgms -->
</resources>

View file

@ -645,7 +645,6 @@
<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="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="open_navigation">Open navigatie</string>
<string name="close_navigation">Sluit navigatie</string>

View file

@ -645,7 +645,6 @@
<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="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="open_navigation">Åpne meny</string>
<string name="close_navigation">Lukk meny</string>

View file

@ -244,6 +244,7 @@
<string name="wear">Oprogramowanie Wear (Smartwatch)</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="basal_rate">Dawka bazowa</string>
<string name="basalvaluebelowminimum">Wartość bazy poniżej minimum. Nie ustawiono profilu!</string>
<string name="sms_actualbg">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="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="needconnectpermission">Aplikacja wymaga uprawnienia Bluetooth</string>
<string name="request">Żądanie</string>
<string name="open_navigation">Otwórz 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="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="log_files">Log files</string>
<string name="nav_logsettings">Ustawienia logów</string>
<string name="resettodefaults">Przywróć ustawienia domyślne</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="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="age">Czas</string>
<string name="weight_label">Waga</string>
<string name="id">ID:</string>
<string name="submit">Wyślij</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_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_treatments">Zabiegi</string>
<string name="overview_show_deviationslope">Krzywa odchylenie</string>
<string name="authorizationfailed">Autoryzacja nie powiodła się</string>
<string name="overview_show_absinsulin">Cała insulina</string>
@ -896,6 +900,7 @@
<!-- WEAR OS-->
<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="no_records_available">Brak wpisów</string>
<string name="count_selected">Wybrany %1$d</string>
<string name="sort_label">Sortuj</string>
<string name="login">Zaloguj się</string>

View file

@ -631,7 +631,6 @@
<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="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="open_navigation">Abrir a navegação</string>
<string name="close_navigation">Fechar a navegação</string>

View file

@ -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="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="needconnectpermission">Aplicația are nevoie de permisiune Bluetooth</string>
<string name="request">Cerință</string>
<string name="open_navigation">Afișare navigație</string>
<string name="close_navigation">Închidere navigație</string>

View file

@ -645,7 +645,6 @@
<string name="needsystemwindowpermission">Приложению требуется разрешение системного окна для уведомлений</string>
<string name="needlocationpermission">Приложению требуется разрешение на доступ к местоположению для сканирования BT и идентификации WiFi</string>
<string name="needstoragepermission">Приложение требует разрешения на доступ к записи в память, чтобы хранить файлы журналов и настройки экспорта</string>
<string name="needconnectpermission">Приложению требуется разрешение Bluetooth</string>
<string name="request">Запрос</string>
<string name="open_navigation">Показать панель навигации</string>
<string name="close_navigation">рыть панель навигации</string>

View file

@ -645,7 +645,6 @@
<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="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="open_navigation">Otvoriť Menu</string>
<string name="close_navigation">Zavrieť Menu</string>

View file

@ -636,7 +636,6 @@ Eversense-appen.</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="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="open_navigation">Öppna menyn</string>
<string name="close_navigation">Stäng menyn</string>

View file

@ -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="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="needconnectpermission">Uygulama bluetooth iznine ihtiyac duyuyor</string>
<string name="request">İstek</string>
<string name="open_navigation">Navigasyonu aç</string>
<string name="close_navigation">Navigasyonu kapat</string>

View file

@ -432,6 +432,7 @@
<string name="ns_localbroadcasts_title">启用本地广播。</string>
<string name="openapssmb">OpenAPS SMB</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="enablesmb">启用微型大剂量</string>
<string name="enablesmb_summary">使用微型大剂量代替使用临时基础率,更快的干预</string>
@ -636,7 +637,6 @@
<string name="needsystemwindowpermission">应用程序需要悬浮窗权限用于发送通知。</string>
<string name="needlocationpermission">应用程序需要定位权限才能进行蓝牙扫描及WIFI识别。</string>
<string name="needstoragepermission">应用程序需要文件存储权限,才能存储日志文件及导出设置。</string>
<string name="needconnectpermission">应用程序需要蓝牙权限。</string>
<string name="request">请求</string>
<string name="open_navigation">打开导航栏</string>
<string name="close_navigation">关闭导航栏</string>

View file

@ -789,7 +789,6 @@
<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="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="open_navigation">Open navigation</string>
<string name="close_navigation">Close navigation</string>

View file

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:validate="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:key="@string/key_autotune_plugin"
android:title="@string/autotune_settings"
@ -24,12 +26,19 @@
android:summary="@string/autotune_tune_insulin_curve_summary"
android:title="@string/autotune_tune_insulin_curve_title" />
-->
<EditTextPreference
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:defaultValue="5"
android:inputType="number"
android:key="@string/key_autotune_default_tune_days"
android:summary="@string/autotune_default_tune_days_summary"
android:title="@string/autotune_default_tune_days_title" />
android:title="@string/autotune_default_tune_days_title"
android:dialogMessage="@string/autotune_default_tune_days_summary"
android:digits="0123456789"
android:inputType="number"
android:selectAllOnFocus="true"
android:singleLine="true"
validate:maxNumber="30"
validate:minNumber="1"
validate:testType="numericRange" />
<SwitchPreference
android:defaultValue="false"

View file

@ -1,8 +1,12 @@
package info.nightscout.androidaps.plugins.general.automation.triggers
import android.Manifest
import android.bluetooth.BluetoothManager
import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.widget.LinearLayout
import androidx.core.app.ActivityCompat
import com.google.common.base.Optional
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.automation.R
@ -13,9 +17,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.StaticLabel
import info.nightscout.androidaps.utils.JsonHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.shared.logging.LTag
import org.json.JSONObject
import java.util.*
import javax.inject.Inject
class TriggerBTDevice(injector: HasAndroidInjector) : Trigger(injector) {
@ -74,12 +78,16 @@ class TriggerBTDevice(injector: HasAndroidInjector) : Trigger(injector) {
// Get the list of paired BT devices to use in dropdown menu
private fun devicesPaired(): ArrayList<CharSequence> {
val s = ArrayList<CharSequence>()
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.bondedDevices?.forEach { s.add(it.name) }
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || 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
}
private fun eventExists(): Boolean {
automationPlugin.btConnects.forEach {
ArrayList(automationPlugin.btConnects).forEach {
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_DISCONNECT && it.state == EventBTChange.Change.DISCONNECT) return true

View file

@ -123,4 +123,5 @@
<string name="run_automations">Esegui automazioni</string>
<string name="add_automation">Aggiungi regola</string>
<string name="remove_sort">Rimuovi/ordina</string>
<string name="stop_processing">Interrompere l\'elaborazione</string>
</resources>

View file

@ -112,4 +112,5 @@
<string name="automation_event">Automatizuotas įvykis</string>
<string name="reorder_label">Pertvarkyti</string>
<string name="user_action">Vartotojo veiksmas</string>
<string name="sort_label">Rūšiuoti</string>
</resources>

View file

@ -49,7 +49,7 @@ buildscript {
}
dependencies {
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'
// NOTE: Do not place your application dependencies here; they belong
@ -63,7 +63,7 @@ buildscript {
}
plugins {
id "io.gitlab.arturbosch.detekt" version "1.20.0"
id "io.gitlab.arturbosch.detekt" version "1.21.0"
id "org.jlleitschuh.gradle.ktlint" version "10.3.0"
id 'org.barfuin.gradle.jacocolog' version '2.0.0'
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false

View file

@ -8,6 +8,8 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<application android:supportsRtl="true">
<activity
android:name="info.nightscout.androidaps.activities.TDDStatsActivity"

View file

@ -70,6 +70,7 @@ class ErrorDialog : DaggerDialogFragment() {
binding.title.text = title
binding.ok.setOnClickListener {
uel.log(Action.ERROR_DIALOG_OK, Sources.Unknown)
stopAlarm("Dismiss")
dismiss()
}
binding.mute.setOnClickListener {
@ -110,7 +111,6 @@ class ErrorDialog : DaggerDialogFragment() {
super.dismissAllowingStateLoss()
helperActivity?.finish()
handler.removeCallbacksAndMessages(null)
stopAlarm("Dismiss")
}
private fun startAlarm() {

View file

@ -36,6 +36,7 @@ fun bolusCalculatorResultFromJson(jsonObject: JSONObject): BolusCalculatorResult
it.id = 0
it.isValid = isValid
it.interfaceIDs.nightscoutId = id
it.version = 0
}
} catch (e: JsonSyntaxException) {
null

View file

@ -43,11 +43,10 @@ class BlePreCheck @Inject constructor(
}
// change after SDK = 31+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_CONNECT") != PackageManager.PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_SCAN") != PackageManager.PERMISSION_GRANTED
if (ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) != 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("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT"), PERMISSION_REQUEST_BLUETOOTH)
ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT), PERMISSION_REQUEST_BLUETOOTH)
return false
}
}

View file

@ -0,0 +1,33 @@
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.os.Build
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 (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || 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))
}
}
}

View file

@ -289,6 +289,7 @@
<string name="sms" comment="26 characters max for translation">SMS</string>
<string name="basal">Базал</string>
<!-- Autotune -->
<string name="needconnectpermission">Апликацията изисква разрешение за bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d дeн</item>
<item quantity="other">%1$d дни</item>

View file

@ -70,4 +70,5 @@
<!-- Command Queue + readStatus reasons -->
<string name="basal">Basal</string>
<!-- Autotune -->
<string name="needconnectpermission">L\'aplicació necessita el permís del bluethoot</string>
</resources>

View file

@ -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_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="needconnectpermission">Aplikace potřebuje oprávnění bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d den</item>
<item quantity="few">%1$d dnů</item>

View file

@ -482,6 +482,7 @@
<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_error">Fejl under sidste Autotune kørsel</string>
<string name="needconnectpermission">Applikationen kræver tilladelse til bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d dag</item>
<item quantity="other">%1$d dage</item>

View file

@ -433,6 +433,7 @@
<string name="count_selected">%1$d ausgewählt</string>
<string name="sort_label">Sortieren</string>
<!-- Autotune -->
<string name="needconnectpermission">App benötigt Bluetooth-Berechtigung</string>
<plurals name="days">
<item quantity="one">%1$d Tag</item>
<item quantity="other">%1$d Tage</item>

View file

@ -489,6 +489,7 @@
<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_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">
<item quantity="one">%1$d día</item>
<item quantity="other">%1$d días</item>

View file

@ -488,6 +488,8 @@
<string name="autotune_run_without_autoswitch">Autotune eseguito senza cambio profilo</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_cancelled">È stata rilevata un\'altra esecuzione di Autotune, esecuzione annullata</string>
<string name="needconnectpermission">L\'applicazione richiede l\'autorizzazione bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d giorno</item>
<item quantity="other">%1$d giorni</item>

View file

@ -489,6 +489,7 @@
<string name="autotune_run_with_autoswitch">כוונון אוטומטי הופעל והפרופיל הוחלף אוטומטית</string>
<string name="autotune_run_with_error">שגיאה במהלך הכיוונון האוטומטי האחרון</string>
<string name="autotune_run_cancelled">נמצאה הפעלה נוספת של הכוונון האוטומטי ברקע, ההפעלה מבוטלת</string>
<string name="needconnectpermission">האפליקציה צריכה הרשאה לבלוטות\'</string>
<plurals name="days">
<item quantity="one">%1$d יום</item>
<item quantity="two">%1$d ימים</item>

View file

@ -422,6 +422,7 @@
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Mygtukas Naujinti</string>
<string name="basal">Valandinė bazė</string>
<!-- Autotune -->
<string name="needconnectpermission">Programai reikalinga Bluetooth prieigos teisė</string>
<plurals name="days">
<item quantity="one">%1$d d.</item>
<item quantity="few">%1$d d.</item>

View file

@ -246,6 +246,14 @@
<!---Icons in Loop area -->
<item name="profileColor">@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 name="Aaps_ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar">

View file

@ -489,6 +489,7 @@
<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_cancelled">Autotune kjører allerede. Kjøring avbrutt</string>
<string name="needconnectpermission">Appen trenger bluetooth tillatelse</string>
<plurals name="days">
<item quantity="one">%1$d dag</item>
<item quantity="other">%1$d dager</item>

View file

@ -424,6 +424,7 @@
<string name="count_selected">Wybrany %1$d</string>
<string name="sort_label">Sortuj</string>
<!-- Autotune -->
<string name="needconnectpermission">Aplikacja wymaga uprawnienia Bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d dzień</item>
<item quantity="few">%1$d dni</item>

View file

@ -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_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="needconnectpermission">O aplicativo precisa de permissão bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d dia</item>
<item quantity="other">%1$d dias</item>

View file

@ -341,6 +341,7 @@
<!-- Command Queue + readStatus reasons -->
<string name="basal">Basal</string>
<!-- Autotune -->
<string name="needconnectpermission">Aplicação precisa de permissão Bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d dia</item>
<item quantity="other">%1$d dias</item>

View file

@ -424,6 +424,7 @@
<string name="basal">Rate bazale</string>
<string name="sort_label">Sortează</string>
<!-- Autotune -->
<string name="needconnectpermission">Aplicația are nevoie de permisiune Bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d zi</item>
<item quantity="few">%1$d zile</item>

View file

@ -489,6 +489,7 @@
<string name="autotune_run_with_autoswitch">Autotune выполнен и профиль переключён автоматически</string>
<string name="autotune_run_with_error">Ошибка во время последнего выполнения Autotune</string>
<string name="autotune_run_cancelled">Обнаружен другой запуск Autotune, выполнение отменено</string>
<string name="needconnectpermission">Приложению требуется разрешение Bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d день</item>
<item quantity="few">%1$d дня</item>

View file

@ -489,6 +489,7 @@
<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_cancelled">Bola zistená iná spustená úloha Autotune, spustenie zrušené</string>
<string name="needconnectpermission">Aplikácia vyžaduje povolenie bluetooth</string>
<plurals name="days">
<item quantity="one">%1$d deň</item>
<item quantity="few">%1$d dní</item>

View file

@ -430,6 +430,7 @@
<string name="a11y_plus_button_description">öka %1$s med %2$s</string>
<string name="basal">Basal</string>
<!-- Autotune -->
<string name="needconnectpermission">Applikationen behöver bluetooth-behörighet</string>
<plurals name="days">
<item quantity="one">%1$d dag</item>
<item quantity="other">%1$d dagar</item>

View file

@ -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_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="needconnectpermission">Uygulama bluetooth iznine ihtiyac duyuyor</string>
<plurals name="days">
<item quantity="one">%1$d gün</item>
<item quantity="other">%1$d gün</item>

View file

@ -442,6 +442,7 @@
<string name="a11y_file">文件</string>
<string name="a11y_user">用户</string>
<!-- Autotune -->
<string name="needconnectpermission">应用程序需要蓝牙权限。</string>
<plurals name="days">
<item quantity="other">%1$d </item>
</plurals>

View file

@ -602,6 +602,7 @@
<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_cancelled">Another run of Autotune is detected, run cancelled</string>
<string name="needconnectpermission">Application needs bluetooth permission</string>
<plurals name="days">
<item quantity="one">%1$d day</item>

View file

@ -247,8 +247,16 @@
<!---Icons in Loop area -->
<item name="profileColor">@color/black</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/black</item>
<item name="android:textSize">15sp</item>
</style>
<style name="Aaps_ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">@style/Theme.Aaps.ActionBar.TitleTextStyle</item>
</style>

View file

@ -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()
}
}

View file

@ -1,14 +1,19 @@
package info.nightscout.androidaps.danar.services;
import android.Manifest;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.IBinder;
import android.os.SystemClock;
import androidx.core.app.ActivityCompat;
import java.io.IOException;
import java.util.Set;
import java.util.UUID;
@ -41,8 +46,7 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.interfaces.Profile;
import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.shared.logging.AAPSLogger;
import info.nightscout.shared.logging.LTag;
import info.nightscout.androidaps.interfaces.ResourceHelper;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
@ -50,8 +54,9 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.ToastUtils;
import info.nightscout.androidaps.interfaces.ResourceHelper;
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 io.reactivex.rxjava3.disposables.CompositeDisposable;
@ -191,30 +196,32 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
protected void getBTSocketForSelectedPump() {
mDevName = sp.getString(R.string.key_danar_bt_name, "");
BluetoothAdapter bluetoothAdapter = ((BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
BluetoothAdapter bluetoothAdapter = ((BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
if (bluetoothAdapter != null) {
Set<BluetoothDevice> bondedDevices = bluetoothAdapter.getBondedDevices();
if (bluetoothAdapter != null) {
Set<BluetoothDevice> bondedDevices = bluetoothAdapter.getBondedDevices();
if (bondedDevices != null)
for (BluetoothDevice device : bondedDevices) {
if (mDevName.equals(device.getName())) {
mBTDevice = device;
try {
mRfcommSocket = mBTDevice.createRfcommSocketToServiceRecord(SPP_UUID);
} catch (IOException e) {
aapsLogger.error("Error creating socket: ", e);
if (bondedDevices != null)
for (BluetoothDevice device : bondedDevices) {
if (mDevName.equals(device.getName())) {
mBTDevice = device;
try {
mRfcommSocket = mBTDevice.createRfcommSocketToServiceRecord(SPP_UUID);
} catch (IOException 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 {
ToastUtils.INSTANCE.showToastInUiThread(context.getApplicationContext(),
rh.gs(R.string.nobtadapter));
}
if (mBTDevice == null) {
ToastUtils.INSTANCE.showToastInUiThread(context.getApplicationContext(),
rh.gs(R.string.devicenotfound));
ToastUtils.INSTANCE.errorToast(context, context.getString(R.string.needconnectpermission));
}
}

View file

@ -8,7 +8,7 @@
android:title="@string/danar_pump_settings"
app:initialExpandedChildrenCount="0">
<info.nightscout.androidaps.danar.BluetoothDevicePreference
<info.nightscout.androidaps.utils.ui.BluetoothDevicePreference
android:dialogTitle="@string/danar_bt_name_title"
android:key="@string/key_danar_bt_name"
android:title="@string/danar_bt_name_title" />

View file

@ -8,7 +8,7 @@
android:title="@string/danar_pump_settings"
app:initialExpandedChildrenCount="0">
<info.nightscout.androidaps.danar.BluetoothDevicePreference
<info.nightscout.androidaps.utils.ui.BluetoothDevicePreference
android:dialogTitle="@string/danar_bt_name_title"
android:key="@string/key_danar_bt_name"
android:title="@string/danar_bt_name_title" />

View file

@ -8,7 +8,7 @@
android:title="@string/danar_pump_settings"
app:initialExpandedChildrenCount="0">
<info.nightscout.androidaps.danar.BluetoothDevicePreference
<info.nightscout.androidaps.utils.ui.BluetoothDevicePreference
android:dialogTitle="@string/danar_bt_name_title"
android:key="@string/key_danar_bt_name"
android:title="@string/danar_bt_name_title" />

View file

@ -5,6 +5,8 @@
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<application>
<activity
android:name="info.nightscout.androidaps.danars.activities.BLEScanActivity"

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.danars.activities
import android.Manifest
import android.annotation.SuppressLint
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
@ -9,6 +10,8 @@ import android.bluetooth.le.ScanCallback
import android.bluetooth.le.ScanResult
import android.content.Context
import android.content.pm.ActivityInfo
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
@ -16,14 +19,14 @@ import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.TextView
import androidx.core.app.ActivityCompat
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.danars.R
import info.nightscout.androidaps.danars.databinding.DanarsBlescannerActivityBinding
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.utils.ToastUtils
import info.nightscout.shared.sharedPreferences.SP
import java.util.*
import java.util.regex.Pattern
import javax.inject.Inject
@ -58,8 +61,12 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
override fun onResume() {
super.onResume()
if (bluetoothAdapter?.isEnabled != true) bluetoothAdapter?.enable()
startScan()
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
if (bluetoothAdapter?.isEnabled != true) bluetoothAdapter?.enable()
startScan()
} else {
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
}
}
override fun onPause() {
@ -68,17 +75,26 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
}
private fun startScan() =
try {
bluetoothLeScanner?.startScan(mBleScanCallback)
} catch (e: IllegalStateException) {
} // ignore BT not on
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
try {
bluetoothLeScanner?.startScan(mBleScanCallback)
} catch (ignore: IllegalStateException) {
} // ignore BT not on
} else {
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
}
private fun stopScan() =
try {
bluetoothLeScanner?.stopScan(mBleScanCallback)
} catch (e: IllegalStateException) {
} // ignore BT not on
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
try {
bluetoothLeScanner?.stopScan(mBleScanCallback)
} 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?) {
if (device == null || device.name == null || device.name == "") {
return
@ -132,11 +148,16 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
override fun onClick(v: View) {
sp.putString(R.string.key_danars_address, item.device.address)
sp.putString(R.string.key_danars_name, name.text.toString())
item.device.createBond()
rxBus.send(EventDanaRSDeviceChange())
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
item.device.createBond()
rxBus.send(EventDanaRSDeviceChange())
} else {
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
}
finish()
}
@SuppressLint("MissingPermission")
fun setData(data: BluetoothDeviceItem) {
var tTitle = data.device.name
if (tTitle == null || tTitle == "") {

View file

@ -1,10 +1,15 @@
package info.nightscout.androidaps.danars.services
import android.Manifest
import android.annotation.SuppressLint
import android.bluetooth.*
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.SystemClock
import android.util.Base64
import androidx.core.app.ActivityCompat
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.danars.DanaRSPlugin
@ -21,6 +26,7 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.extensions.notify
import info.nightscout.androidaps.extensions.waitMillis
import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
@ -28,7 +34,6 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
@ -90,6 +95,13 @@ class BLEComm @Inject internal constructor(
@Synchronized
fun connect(from: String, address: String?): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
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.")
if (bluetoothAdapter == null) {
aapsLogger.error("Unable to obtain a BluetoothAdapter.")
@ -107,8 +119,10 @@ class BLEComm @Inject internal constructor(
return false
}
if (device.bondState == BluetoothDevice.BOND_NONE) {
device.createBond()
SystemClock.sleep(10000)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
device.createBond()
SystemClock.sleep(10000)
}
return false
}
isConnected = false
@ -131,6 +145,12 @@ class BLEComm @Inject internal constructor(
@Synchronized
fun disconnect(from: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
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")
if (!encryptedDataRead && encryptedCommandSent && encryption == EncryptionType.ENCRYPTION_BLE5) {
@ -191,6 +211,7 @@ class BLEComm @Inject internal constructor(
}
}
@SuppressLint("MissingPermission")
@Synchronized fun close() {
/*
if (!encryptedDataRead && !encryptedCommandSent) {
@ -268,6 +289,7 @@ class BLEComm @Inject internal constructor(
}
}
@SuppressLint("MissingPermission")
@Synchronized
private fun setCharacteristicNotification(characteristic: BluetoothGattCharacteristic?, enabled: Boolean) {
aapsLogger.debug(LTag.PUMPBTCOMM, "setCharacteristicNotification")
@ -287,6 +309,7 @@ class BLEComm @Inject internal constructor(
}
}
@SuppressLint("MissingPermission")
@Synchronized
private fun writeCharacteristicNoResponse(characteristic: BluetoothGattCharacteristic, data: ByteArray) {
Thread(Runnable {
@ -346,6 +369,7 @@ class BLEComm @Inject internal constructor(
}
}
@SuppressLint("MissingPermission")
@Synchronized
private fun onConnectionStateChangeSynchronized(gatt: BluetoothGatt, newState: Int) {
aapsLogger.debug(LTag.PUMPBTCOMM, "onConnectionStateChange")
@ -559,7 +583,7 @@ class BLEComm @Inject internal constructor(
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, "")
if (storedPairingKey.isNullOrBlank()) {
if (storedPairingKey.isBlank()) {
removeBond()
disconnect("Non existing pairing key")
}

View file

@ -19,7 +19,9 @@ class DiaconnG8Pump @Inject constructor(
private val aapsLogger: AAPSLogger,
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 pumpIncarnationNum: Int = 65536
var isPumpVersionGe2_63: Boolean = false // is pumpVersion higher then 2.63

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.diaconn.activities
import android.Manifest
import android.annotation.SuppressLint
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
@ -11,6 +12,8 @@ import android.bluetooth.le.ScanResult
import android.bluetooth.le.ScanSettings
import android.content.Context
import android.content.pm.ActivityInfo
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
@ -19,12 +22,13 @@ import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.TextView
import androidx.core.app.ActivityCompat
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8DeviceChange
import info.nightscout.androidaps.diaconn.R
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.utils.ToastUtils
import info.nightscout.shared.sharedPreferences.SP
import java.util.*
import javax.inject.Inject
@ -61,18 +65,25 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
override fun onResume() {
super.onResume()
bluetoothAdapter?.let { bluetoothAdapter ->
if (!bluetoothAdapter.isEnabled) bluetoothAdapter.enable()
bluetoothLeScanner = bluetoothAdapter.bluetoothLeScanner
startScan()
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
bluetoothAdapter?.let { bluetoothAdapter ->
if (!bluetoothAdapter.isEnabled) bluetoothAdapter.enable()
bluetoothLeScanner = bluetoothAdapter.bluetoothLeScanner
startScan()
}
} else {
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
}
}
override fun onPause() {
super.onPause()
stopScan()
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
stopScan()
}
}
@SuppressLint("MissingPermission")
private fun startScan() =
try {
val filters: MutableList<ScanFilter> = ArrayList()
@ -86,16 +97,23 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
.build()
bluetoothLeScanner?.startScan(filters, settings, mBleScanCallback)
} catch (e: IllegalStateException) {
} catch (ignored: IllegalStateException) {
} // ignore BT not on
@SuppressLint("MissingPermission")
private fun stopScan() =
try {
bluetoothLeScanner?.stopScan(mBleScanCallback)
} catch (e: IllegalStateException) {
} catch (ignored: IllegalStateException) {
} // ignore BT not on
private fun addBleDevice(device: BluetoothDevice?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
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 == "") {
return
}
@ -145,6 +163,7 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
v.setOnClickListener(this@ViewHolder)
}
@SuppressLint("MissingPermission")
override fun onClick(v: View) {
sp.putString(R.string.key_diaconn_g8_address, item.device.address)
sp.putString(R.string.key_diaconn_g8_name, name.text.toString())
@ -153,6 +172,7 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
finish()
}
@SuppressLint("MissingPermission")
fun setData(data: BluetoothDeviceItem) {
var tTitle = data.device.name
if (tTitle == null || tTitle == "") {
@ -168,6 +188,7 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
//
inner class BluetoothDeviceItem internal constructor(val device: BluetoothDevice) {
override fun equals(other: Any?): Boolean {
if (other !is BluetoothDeviceItem) {
return false

View file

@ -152,12 +152,7 @@ class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
commandQueue.setUserOptions(object : Callback() {
override fun run() {
if (!result.success) {
val i = Intent(context, ErrorHelperActivity::class.java)
i.putExtra("soundid", R.raw.boluserror)
i.putExtra("status", result.comment)
i.putExtra("title", rh.gs(R.string.pumperror))
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(i)
ErrorHelperActivity.runAlarm(context, result.comment, rh.gs(R.string.pumperror), R.raw.boluserror)
}
}
})

View file

@ -77,6 +77,8 @@ abstract class DiaconnG8PacketModule {
@ContributesAndroidInjector abstract fun contributesLanguageInquireResponsePacket(): LanguageInquireResponsePacket
@ContributesAndroidInjector abstract fun contributesBigAPSMainInfoInquirePacket(): BigAPSMainInfoInquirePacket
@ContributesAndroidInjector abstract fun contributesBigAPSMainInfoInquireResponsePacket(): BigAPSMainInfoInquireResponsePacket
@ContributesAndroidInjector abstract fun contributesSerialNumInquirePacket(): SerialNumInquirePacket
@ContributesAndroidInjector abstract fun contributesSerialNumInquireResponsePacket(): SerialNumInquireResponsePacket
}

View file

@ -35,6 +35,10 @@ class AppConfirmSettingResponsePacket(
failed = true
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 {

View file

@ -25,7 +25,6 @@ class DiaconnG8ResponseMessageHashTable @Inject constructor(val injector: HasAnd
put(SneckLimitInquireResponsePacket(injector))
put(BasalLimitInquireResponsePacket(injector))
put(TempBasalInquireResponsePacket(injector))
put(TimeInquirePacket(injector))
put(TimeInquireResponsePacket(injector))
put(TimeReportPacket(injector))
put(LogStatusInquireResponsePacket(injector))
@ -34,6 +33,8 @@ class DiaconnG8ResponseMessageHashTable @Inject constructor(val injector: HasAnd
put(SoundInquireResponsePacket(injector))
put(DisplayTimeInquireResponsePacket(injector))
put(LanguageInquireResponsePacket(injector))
put(SerialNumInquireResponsePacket(injector))
// Report Packet
put(BasalPauseReportPacket(injector))

View file

@ -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"
}
}

View file

@ -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"
}
}

View file

@ -15,24 +15,30 @@ class TimeInquireResponsePacket(
@Inject lateinit var diaconnG8Pump: DiaconnG8Pump
init {
msgType = 0x50.toByte()
msgType = 0x8F.toByte()
aapsLogger.debug(LTag.PUMPCOMM, "TimeInquireResponsePacket init")
}
override fun handleMessage(data: ByteArray?) {
val result = defect(data)
if (result != 0) {
val defectCheck = defect(data)
if (defectCheck != 0) {
aapsLogger.debug(LTag.PUMPCOMM, "TimeInquireResponsePacket Got some Error")
failed = true
return
} else failed = false
val bufferData = prefixDecode(data)
val result2 = getByteToInt(bufferData)
if(!isSuccInquireResponseResult(result2)) {
val result = getByteToInt(bufferData)
if(!isSuccInquireResponseResult(result)) {
failed = true
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 {

View file

@ -1,9 +1,13 @@
package info.nightscout.androidaps.diaconn.service
import android.Manifest
import android.annotation.SuppressLint
import android.bluetooth.*
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.SystemClock
import androidx.core.app.ActivityCompat
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
@ -12,10 +16,11 @@ import info.nightscout.androidaps.diaconn.packet.*
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.extensions.notify
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.LTag
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.interfaces.ResourceHelper
import java.util.*
import java.util.concurrent.ScheduledFuture
import javax.inject.Inject
@ -31,9 +36,10 @@ class BLECommonService @Inject internal constructor(
private val diaconnG8ResponseMessageHashTable: DiaconnG8ResponseMessageHashTable,
private val diaconnG8SettingResponseMessageHashTable: DiaconnG8SettingResponseMessageHashTable,
private val diaconnG8Pump: DiaconnG8Pump,
){
) {
companion object {
private const val WRITE_DELAY_MILLIS: Long = 50
private const val INDICATION_UUID = "6e400003-b5a3-f393-e0a9-e50e24dcca9e"
private const val WRITE_UUID = "6e400002-b5a3-f393-e0a9-e50e24dcca9e"
@ -53,7 +59,7 @@ class BLECommonService @Inject internal constructor(
private var uartIndicate: BluetoothGattCharacteristic? = null
private var uartWrite: BluetoothGattCharacteristic? = null
private var mSequence : Int = 0
private var mSequence: Int = 0
private fun getMsgSequence(): Int {
val seq = mSequence % 255
@ -66,6 +72,13 @@ class BLECommonService @Inject internal constructor(
@Synchronized
fun connect(from: String, address: String?): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
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 ")
if (bluetoothAdapter == null) {
aapsLogger.error("Unable to obtain a BluetoothAdapter.")
@ -98,6 +111,12 @@ class BLECommonService @Inject internal constructor(
@Synchronized
fun disconnect(from: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
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")
// cancel previous scheduled disconnection to prevent closing upcoming connection
@ -117,6 +136,7 @@ class BLECommonService @Inject internal constructor(
SystemClock.sleep(2000)
}
@SuppressLint("MissingPermission")
@Synchronized
fun close() {
aapsLogger.debug(LTag.PUMPBTCOMM, "BluetoothAdapter close")
@ -133,13 +153,16 @@ class BLECommonService @Inject internal constructor(
aapsLogger.debug(LTag.PUMPBTCOMM, "onServicesDiscovered")
if (status == BluetoothGatt.GATT_SUCCESS) {
findCharacteristic()
SystemClock.sleep(1600)
isConnected = true
isConnecting = false
}
}
override fun onCharacteristicChanged(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) {
aapsLogger.debug(LTag.PUMPBTCOMM, "(응답) onCharacteristicChanged: " + DiaconnG8Packet.toHex(characteristic.value))
// 대량로그응답 처리.
if(characteristic.value[1] == 0xb2.toByte()) {
if (characteristic.value[1] == 0xb2.toByte()) {
aapsLogger.debug(LTag.PUMPBTCOMM, "(대량 로그 처리 응답) onCharacteristicChanged: " + DiaconnG8Packet.toHex(characteristic.value))
val message = BigLogInquireResponsePacket(injector)
message.handleMessage(characteristic.value)
@ -156,6 +179,7 @@ class BLECommonService @Inject internal constructor(
}
}
@SuppressLint("MissingPermission")
@Synchronized
private fun writeCharacteristicNoResponse(characteristic: BluetoothGattCharacteristic, data: ByteArray) {
Thread(Runnable {
@ -194,6 +218,7 @@ class BLECommonService @Inject internal constructor(
return bluetoothGatt?.services
}
@SuppressLint("MissingPermission")
@Synchronized
private fun findCharacteristic() {
val gattServices = getSupportedGattServices() ?: return
@ -206,6 +231,7 @@ class BLECommonService @Inject internal constructor(
uartIndicate = gattCharacteristic
//setCharacteristicNotification(uartIndicate, true)
bluetoothGatt?.setCharacteristicNotification(uartIndicate, true)
// nRF Connect 참고하여 추가함
val descriptor: BluetoothGattDescriptor = uartIndicate!!.getDescriptor(UUID.fromString(CHARACTERISTIC_CONFIG_UUID))
descriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
@ -218,13 +244,12 @@ class BLECommonService @Inject internal constructor(
}
}
@SuppressLint("MissingPermission")
@Synchronized
private fun onConnectionStateChangeSynchronized(gatt: BluetoothGatt, newState: Int) {
aapsLogger.debug(LTag.PUMPBTCOMM, "onConnectionStateChange newState : $newState")
if (newState == BluetoothProfile.STATE_CONNECTED) {
gatt.discoverServices()
isConnected = true
isConnecting = false
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTED))
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
close()
@ -250,7 +275,7 @@ class BLECommonService @Inject internal constructor(
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
// 요청 큐에 요청할 바이트 정보 담기.
synchronized(mSendQueue) {
if(mSendQueue.size > 10) mSendQueue.clear()
if (mSendQueue.size > 10) mSendQueue.clear()
mSendQueue.add(bytes)
}
aapsLogger.debug(LTag.PUMPBTCOMM, "sendMessage() after mSendQueue.size :: ${mSendQueue.size}")
@ -268,6 +293,7 @@ class BLECommonService @Inject internal constructor(
// process common packet response
private fun processResponseMessage(data: ByteArray) {
isConnected = true
isConnecting = false
//요청정보
val originalMessageSeq = processedMessage?.getSeq(processedMessageByte)
@ -281,44 +307,29 @@ class BLECommonService @Inject internal constructor(
aapsLogger.debug(LTag.PUMPBTCOMM, "receivedCommand :: $receivedCommand")
// 응답메시지가 조회응답인지. 설정응답인지 구분해야됨.
var message:DiaconnG8Packet? = null
var message: DiaconnG8Packet? = null
// 요청시퀀스와 응답의 시퀀스가 동일한 경우에만 처리.
// 펌프로부터 받은 보고응답의 경우 처리
if(receivedType == 3) {
if (receivedType == 3) {
message = diaconnG8ResponseMessageHashTable.findMessage(receivedCommand)
// injection Blocked Report
if(message is InjectionBlockReportPacket ) {
if (message is InjectionBlockReportPacket) {
message.handleMessage(data)
diaconnG8Pump.bolusBlocked = true
val i = Intent(context, ErrorHelperActivity::class.java)
i.putExtra("soundid", R.raw.boluserror)
i.putExtra("status", rh.gs(R.string.injectionblocked))
i.putExtra("title", rh.gs(R.string.injectionblocked))
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(i)
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.injectionblocked), rh.gs(R.string.injectionblocked), R.raw.boluserror)
return
}
// battery warning report
if(message is BatteryWarningReportPacket ) {
if (message is BatteryWarningReportPacket) {
message.handleMessage(data)
val i = Intent(context, ErrorHelperActivity::class.java)
i.putExtra("soundid", R.raw.boluserror)
i.putExtra("status", rh.gs(R.string.needbatteryreplace))
i.putExtra("title", rh.gs(R.string.batterywarning))
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(i)
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.needbatteryreplace), rh.gs(R.string.batterywarning), R.raw.boluserror)
return
}
// insulin lack warning report
if(message is InsulinLackReportPacket ) {
if (message is InsulinLackReportPacket) {
message.handleMessage(data)
val i = Intent(context, ErrorHelperActivity::class.java)
i.putExtra("soundid", R.raw.boluserror)
i.putExtra("status", rh.gs(R.string.needinsullinreplace))
i.putExtra("title", rh.gs(R.string.insulinlackwarning))
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(i)
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.needinsullinreplace), rh.gs(R.string.insulinlackwarning), R.raw.boluserror)
return
}
@ -327,7 +338,7 @@ class BLECommonService @Inject internal constructor(
synchronized(mSendQueue) {
val sendQueueSize = mSendQueue.size
if (sendQueueSize > 0) {
for (i in sendQueueSize-1 downTo 0 ) {
for (i in sendQueueSize - 1 downTo 0) {
val sendQueueSeq = DiaconnG8Packet(injector).getSeq(mSendQueue[i])
val sendQueueType = DiaconnG8Packet(injector).getType(mSendQueue[i])
if (sendQueueSeq == receivedSeq) {

View file

@ -136,13 +136,14 @@ class DiaconnG8Service : DaggerService() {
}
private fun sendMessage(message: DiaconnG8Packet) {
bleCommonService.sendMessage(message, 2000)
bleCommonService.sendMessage(message, 5000)
}
fun readPumpStatus() {
try {
val pump = activePlugin.activePump
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumpsettings)))
sendMessage(SerialNumInquirePacket(injector))
val pumpFirmwareVersion = sp.getString(rh.gs(R.string.pumpversion), "")
@ -170,6 +171,7 @@ class DiaconnG8Service : DaggerService() {
// 시간 설정
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumptime)))
sendMessage(TimeInquirePacket(injector))
var timeDiff = (diaconnG8Pump.getPumpTime() - System.currentTimeMillis()) / 1000L
if (diaconnG8Pump.getPumpTime() == 0L) {
// initial handshake was not successful
@ -239,14 +241,12 @@ class DiaconnG8Service : DaggerService() {
}
fun loadHistory(): PumpEnactResult {
if (!diaconnG8Plugin.isInitialized()) {
val result = PumpEnactResult(injector).success(false)
result.comment = "pump not initialized"
return result
}
sendMessage(LogStatusInquirePacket(injector))
// pump version check
if (diaconnG8Pump.isPumpVersionGe2_63) {
sendMessage(IncarnationInquirePacket(injector))
@ -257,7 +257,7 @@ class DiaconnG8Service : DaggerService() {
var apsWrappingCount = -1
// get saved last loginfo
val diaconnHistoryRecord = diaconnHistoryRecordDao.getLastRecord(diaconnG8Pump.pumpUid)
aapsLogger.error(LTag.PUMPCOMM, "diaconnHistoryRecord :: $diaconnHistoryRecord")
aapsLogger.debug(LTag.PUMPCOMM, "diaconnHistoryRecord :: $diaconnHistoryRecord")
if(diaconnHistoryRecord != null) {
apsLastLogNum = diaconnHistoryRecord.lognum
@ -306,7 +306,6 @@ class DiaconnG8Service : DaggerService() {
result.success(true)
diaconnG8Pump.lastConnection = System.currentTimeMillis()
}
// upload pump log to Diaconn Cloud
if (sp.getBoolean(R.string.key_diaconn_g8_cloudsend, true)) {
SystemClock.sleep(1000)
@ -399,13 +398,6 @@ class DiaconnG8Service : DaggerService() {
fun bolus(insulin: Double, carbs: Int, carbTime: Long, t: EventOverviewBolusProgress.Treatment): Boolean {
if (!isConnected) 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)))
// bolus speed setting
@ -435,7 +427,7 @@ class DiaconnG8Service : DaggerService() {
val bolusStart = System.currentTimeMillis()
if (insulin > 0) {
if (!diaconnG8Pump.bolusStopped) {
sendMessage(start)
sendMessage(start, 100)
// otp process
if (!processConfirm(start.msgType)) return false
} else {
@ -460,26 +452,29 @@ class DiaconnG8Service : DaggerService() {
}
val bolusDurationInMSec = (insulin * speed * 1000).toLong()
val expectedEnd = bolusStart + bolusDurationInMSec + 7500L
val expectedEnd = bolusStart + bolusDurationInMSec + 3500L
val totalwaitTime = (expectedEnd - System.currentTimeMillis()) / 1000
while (!diaconnG8Pump.bolusDone) {
val waitTime = (expectedEnd - System.currentTimeMillis()) / 1000
bolusingEvent.status = rh.gs(R.string.waitingforestimatedbolusend, if (waitTime < 0) 0 else waitTime)
var progressPecent = 0
if (totalwaitTime > waitTime) {
progressPecent = ((totalwaitTime - waitTime) * 100 / totalwaitTime).toInt()
if(diaconnG8Pump.isReadyToBolus) {
while (!diaconnG8Pump.bolusDone) {
val waitTime = (expectedEnd - System.currentTimeMillis()) / 1000
bolusingEvent.status = String.format(rh.gs(R.string.waitingforestimatedbolusend), if (waitTime < 0) 0 else waitTime)
var progressPecent = 0
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
commandQueue.loadEvents(object : Callback() {
override fun run() {
// reread bolus status
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingbolusstatus)))
sendMessage(InjectionSnackInquirePacket(injector), 1000) // last bolus
sendMessage(InjectionSnackInquirePacket(injector), 2000) // last bolus
// 볼러스 결과 보고패킷에서 처리함.
bolusingEvent.percent = 100
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.disconnecting)))
@ -492,7 +487,7 @@ class DiaconnG8Service : DaggerService() {
val stop = InjectionCancelSettingPacket(injector, 0x07.toByte())
diaconnG8Pump.bolusStopForced = true
if (isConnected) {
sendMessage(stop)
sendMessage(stop, 100)
// otp process
if (!processConfirm(stop.msgType)) return
while (!diaconnG8Pump.bolusStopped) {
@ -513,7 +508,7 @@ class DiaconnG8Service : DaggerService() {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
// tempbasal stop
sendMessage(msgPacket)
sendMessage(msgPacket, 100)
// otp process
if (!processConfirm(msgPacket.msgType)) return false
diaconnG8Pump.tempBasalStart = dateUtil.now()
@ -521,7 +516,7 @@ class DiaconnG8Service : DaggerService() {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
val tbInjectRate = ((absoluteRate * 100) + 1000).toInt()
val msgTBR = TempBasalSettingPacket(injector, 1, ((durationInHours * 60) / 15).toInt(), tbInjectRate)
sendMessage(msgTBR)
sendMessage(msgTBR, 100)
// otp process
if (!processConfirm(msgTBR.msgType)) return false
// pump tempbasal status inquire
@ -545,7 +540,7 @@ class DiaconnG8Service : DaggerService() {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
// tempbasal stop
sendMessage(msgPacket)
sendMessage(msgPacket, 100)
// otp process
if (!processConfirm(msgPacket.msgType)) return false
SystemClock.sleep(500)
@ -553,7 +548,7 @@ class DiaconnG8Service : DaggerService() {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
val tbInjectRate = absoluteRate * 100 + 1000
val msgTBR = TempBasalSettingPacket(injector, 1, 2, tbInjectRate.toInt())
sendMessage(msgTBR)
sendMessage(msgTBR, 100)
// otp process
if (!processConfirm(msgTBR.msgType)) return false
sendMessage(TempBasalInquirePacket(injector))
@ -577,7 +572,7 @@ class DiaconnG8Service : DaggerService() {
diaconnG8Pump.tbInjectRateRatio
)
// tempbasal stop
sendMessage(msgPacket)
sendMessage(msgPacket, 500)
// otp process
if (!processConfirm(msgPacket.msgType)) return false
SystemClock.sleep(500)
@ -593,7 +588,7 @@ class DiaconnG8Service : DaggerService() {
fun extendedBolus(insulin: Double, durationInMinutes: Int): Boolean {
if (!isConnected) return false
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())
sendMessage(msgExtended)
@ -672,6 +667,7 @@ class DiaconnG8Service : DaggerService() {
(basalList[23] * 100).toInt()
)
// setting basal pattern 1,2,3,4
sendMessage(SerialNumInquirePacket(injector), 2000)
sendMessage(requestReqPacket1, 500)
sendMessage(requestReqPacket2, 500)
sendMessage(requestReqPacket3, 500)
@ -694,22 +690,22 @@ class DiaconnG8Service : DaggerService() {
private fun processConfirm(msgType: Byte): Boolean {
// 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) {
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
}
sendMessage(AppConfirmSettingPacket(injector, msgType, diaconnG8Pump.otpNumber))
diaconnG8Pump.bolusConfirmMessage = msgType
sendMessage(AppConfirmSettingPacket(injector, msgType, diaconnG8Pump.otpNumber), 2000)
diaconnG8Pump.otpNumber = 0
return true
}

View file

@ -169,5 +169,5 @@
<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_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>

View file

@ -1,16 +1,20 @@
package info.nightscout.androidaps.plugins.pump.insight.connection_service;
import android.Manifest;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.os.PowerManager;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import org.spongycastle.crypto.InvalidCipherTextException;
@ -23,8 +27,6 @@ import javax.inject.Inject;
import dagger.android.DaggerService;
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.ReadParameterBlockMessage;
import info.nightscout.androidaps.plugins.pump.insight.app_layer.configuration.CloseConfigurationWriteSessionMessage;
@ -87,6 +89,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.DerivedKeys;
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;
public class InsightConnectionService extends DaggerService implements ConnectionEstablisher.Callback, InputStreamReader.Callback, OutputStreamWriter.Callback {
@ -108,7 +112,7 @@ public class InsightConnectionService extends DaggerService implements Connectio
private DelayedActionThread disconnectTimer;
private DelayedActionThread recoveryTimer;
private DelayedActionThread timeoutTimer;
private BluetoothAdapter bluetoothAdapter;
@Nullable private BluetoothAdapter bluetoothAdapter;
private BluetoothDevice bluetoothDevice;
private BluetoothSocket bluetoothSocket;
private ConnectionEstablisher connectionEstablisher;
@ -258,7 +262,9 @@ public class InsightConnectionService extends DaggerService implements Connectio
@Override
public synchronized void onCreate() {
super.onCreate();
bluetoothAdapter = ((BluetoothManager)getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
bluetoothAdapter = ((BluetoothManager) getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
}
pairingDataStorage = new PairingDataStorage(this);
state = pairingDataStorage.isPaired() ? InsightState.DISCONNECTED : InsightState.NOT_PAIRED;
wakeLock = ((PowerManager) getSystemService(POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:InsightConnectionService");
@ -426,6 +432,7 @@ public class InsightConnectionService extends DaggerService implements Connectio
}
private synchronized void connect() {
if (bluetoothAdapter == null) return;
if (bluetoothDevice == null)
bluetoothDevice = bluetoothAdapter.getRemoteDevice(pairingDataStorage.getMacAddress());
setState(InsightState.CONNECTING);

View file

@ -341,6 +341,7 @@ class MedtronicPumpPlugin @Inject constructor(
val refreshTypesNeededToReschedule: MutableSet<MedtronicStatusRefreshType> = mutableSetOf()
for ((key, value) in statusRefresh) {
if (value > 0 && System.currentTimeMillis() > value) {
@Suppress("WHEN_ENUM_CAN_BE_NULL_IN_JAVA")
when (key) {
MedtronicStatusRefreshType.PumpHistory -> {
readPumpHistory()

View file

@ -18,20 +18,17 @@ object MedtronicConst {
val BolusDelay = R.string.key_medtronic_bolus_delay
val Encoding = R.string.key_medtronic_encoding
val BatteryType = R.string.key_medtronic_battery_type
val BolusDebugEnabled = R.string.key_medtronic_bolus_debug
}
object Statistics {
const val StatsPrefix = "medtronic_"
private const val StatsPrefix = "medtronic_"
const val FirstPumpStart = Prefix + "first_pump_use"
const val LastGoodPumpCommunicationTime = Prefix + "lastGoodPumpCommunicationTime"
const val LastGoodPumpFrequency = Prefix + "LastGoodPumpFrequency"
const val TBRsSet = StatsPrefix + "tbrs_set"
const val StandardBoluses = StatsPrefix + "std_boluses_delivered"
const val SMBBoluses = StatsPrefix + "smb_boluses_delivered"
const val LastPumpHistoryEntry = StatsPrefix + "pump_history_entry"
const val LastPrime = StatsPrefix + "last_sent_prime"
const val LastRewind = StatsPrefix + "last_sent_rewind"
const val InternalTemporaryDatabase = StatsPrefix + "temporary_entries"
}
}

View file

@ -46,6 +46,7 @@ import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpPluginBase;
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.LTag;
import info.nightscout.androidaps.plugins.bus.RxBus;
@ -628,8 +629,9 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
if (!podStateManager.isPodRunning()) {
return 0.0d;
}
return podStateManager.getBasalSchedule().rateAt(TimeUtil.toDuration(DateTime.now()));
BasalSchedule schedule = podStateManager.getBasalSchedule();
if (schedule != null) return schedule.rateAt(TimeUtil.toDuration(DateTime.now()));
else return 0;
}
@Override

View file

@ -133,7 +133,7 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
aapsLogger.debug(TAG, "Device can be detected near, so trying to remove bond if possible.")
bleSelector.removeDevice(bluetoothDevice!!)
} else {
val remoteDevice = bluetoothAdapter!!.getRemoteDevice(deviceAddress)
val remoteDevice = bluetoothAdapter?.getRemoteDevice(deviceAddress)
if (remoteDevice != null) {
bleSelector.removeDevice(remoteDevice)
}
@ -184,7 +184,7 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
}
private fun prepareForScanning() {
bleScanner = bluetoothAdapter!!.bluetoothLeScanner
bleScanner = bluetoothAdapter?.bluetoothLeScanner
settings = bleSelector.getScanSettings()
filters = bleSelector.getScanFilters()
}
@ -243,7 +243,7 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
binding.pumpBleConfigButtonScanStop.visibility = View.VISIBLE
}
scanning = true
bleScanner!!.startScan(filters, settings, bleScanCallback)
bleScanner?.startScan(filters, settings, bleScanCallback)
aapsLogger.debug(LTag.PUMPBTCOMM, "startLeDeviceScan: Scanning Start")
bleSelector.onStartLeDeviceScan(this@PumpBLEConfigActivity)
}
@ -251,7 +251,7 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
private fun stopLeDeviceScan(manualStop: Boolean) {
if (scanning) {
scanning = false
bleScanner!!.stopScan(bleScanCallback)
bleScanner?.stopScan(bleScanCallback)
aapsLogger.debug(LTag.PUMPBTCOMM, "stopLeDeviceScan: Scanning Stop")
bleSelector.onStopLeDeviceScan(this@PumpBLEConfigActivity)
handler.removeCallbacks(stopScanAfterTimeoutRunnable)
@ -320,8 +320,8 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
if (currentlySelectedAddress == device.address) {
deviceName += " (" + resources.getString(R.string.ble_config_scan_selected) + ")"
}
holder.deviceName!!.text = deviceName
holder.deviceAddress!!.text = device.address
holder.deviceName?.text = deviceName
holder.deviceAddress?.text = device.address
return v!!
}
}

View file

@ -29,7 +29,7 @@
android:textAppearance="?android:attr/textAppearanceSmall" />
<Spinner
android:theme="@style/YourSpinnerItemStyle"
android:theme="@style/CommonSpinnerItemStyle"
android:id="@+id/pump_history_type"
android:layout_width="100dp"

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- PumoCommon - Pump Abstract -->
<string name="pump_operation_not_yet_supported_by_pump">Operasie nog nie ondersteun deur pomp.</string>
<!-- PumpCommon - Pump Status -->
<!-- PumpCommon - History Group -->
<!-- Time -->

View file

@ -1,11 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 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 -->
<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 -->
<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 -->
<!-- BLE Config -->
<!-- BLE Errors -->
<!-- Pump Error -->
<!-- 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>

View file

@ -1,11 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 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 -->
<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 -->
<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 -->
<!-- BLE Config -->
<!-- BLE Errors -->
<!-- Pump Error -->
<!-- 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>

View file

@ -8,4 +8,12 @@
<!-- BLE Errors -->
<!-- Pump Error -->
<!-- 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>

View file

@ -1,11 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 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 -->
<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 -->
<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 -->
<!-- BLE Config -->
<!-- BLE Errors -->
<!-- Pump Error -->
<!-- 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>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- PumoCommon - Pump Abstract -->
<string name="pump_operation_not_yet_supported_by_pump">Η λειτουργία δεν υποστηρίζεται ΑΚΟΜΑ από την αντλία.</string>
<!-- PumpCommon - Pump Status -->
<!-- PumpCommon - History Group -->
<!-- Time -->

View file

@ -4,6 +4,7 @@
<string name="pump_operation_not_supported_by_pump_driver">Operación no soportada por la bomba y/o por el controlador.</string>
<string name="pump_operation_not_yet_supported_by_pump">Operación no soportada todavía por la bomba.</string>
<string name="common_resultok">OK</string>
<string name="pump_serial_number">Número de serie de la bomba</string>
<!-- PumpCommon - Pump Status -->
<string name="pump_status_never_contacted">Nunca contactado</string>
<string name="pump_status_waking_up">En fase de inicio</string>
@ -13,6 +14,13 @@
<string name="pump_status_invalid_config">Configuración inválida</string>
<string name="pump_status_active">Activo</string>
<string name="pump_status_sleeping">Suspendida</string>
<string name="pump_status_not_initialized">No Inicializado</string>
<string name="pump_status_initialized">Inicializado</string>
<string name="pump_status_encrypt">Encriptando comunicación</string>
<string name="pump_status_ready">Preparado</string>
<string name="pump_status_busy">Ocupado</string>
<string name="pump_status_suspended">Suspendido</string>
<string name="pump_status_executing_command">Ejecutando comando</string>
<!-- PumpCommon - History Group -->
<string name="history_group_basal">Basales</string>
<string name="history_group_configuration">Configuraciones</string>
@ -24,9 +32,59 @@
<string name="history_group_prime">Cebado</string>
<string name="history_group_alarm">Alarmas</string>
<string name="history_group_glucose">Glucosa</string>
<string name="history_group_base">Base</string>
<string name="history_group_other">Otro</string>
<string name="history_group_events">Todos los Eventos</string>
<string name="history_group_events_no_stat">Eventos (sin estadísticas)</string>
<!-- Time -->
<string name="time_today">Hoy</string>
<string name="time_last_hour">Última hora</string>
<string name="time_last_3_hours">Últimas 3 horas</string>
<string name="time_last_6_hours">Últimas 6 horas</string>
<string name="time_last_12_hours">Últimas 12 horas</string>
<string name="time_last_2_days">Últimos 2 días</string>
<string name="time_last_4_days">Últimos 4 días</string>
<string name="time_last_week">Última semana</string>
<string name="time_last_month">Último mes</string>
<!-- BLE Config -->
<string name="ble_config_button_scan_start">Escanear</string>
<string name="ble_config_scan_stop">Parar</string>
<string name="ble_config_scan_selected">Seleccionado</string>
<string name="ble_config_scan_scanning">Escaneando</string>
<string name="ble_config_scan_finished">Escaneo finalizado</string>
<string name="ble_config_scan_error">Error escaneando: %1$d</string>
<string name="ble_config_connected_never">Nunca</string>
<string name="ble_config_remove">Eliminar</string>
<!-- BLE Errors -->
<string name="ble_error_bt_disabled">Bluetooth desactivado</string>
<string name="ble_error_no_bt_adapter">No hay adaptador Bluetooth</string>
<string name="ble_error_configured_pump_not_found">Bomba configurada no encontrada</string>
<string name="ble_error_pump_unreachable">Bomba inalcanzable</string>
<string name="ble_error_failed_to_conn_to_ble_device">Error al conectar al dispositivo BLE</string>
<string name="ble_error_encryption_failed">Encriptación fallida</string>
<string name="ble_error_pump_found_unbonded">Encontrada bomba no vinculada</string>
<!-- Pump Error -->
<string name="pump_settings_error_basal_profiles_not_enabled">La configuración de perfiles basales no está habilitada en la bomba. Habilítalo en la bomba.</string>
<string name="pump_settings_error_incorrect_basal_profile_selected">El perfil basal establecido en la bomba es incorrecto (debe ser %s).</string>
<string name="pump_settings_error_wrong_tbr_type_set">EL TBR establecido en la bomba es incorrecto (debe ser %s).</string>
<string name="pump_settings_error_wrong_max_bolus_set">El máximo bolo establecido en la bomba es incorrecto (debe ser %1$.2f),</string>
<string name="pump_settings_error_wrong_max_basal_set">La basal máxima establecida en la bomba es incorrecta (debe ser %1$.2f).</string>
<!-- Pump History -->
<string name="pump_history_type">Tipo:</string>
<plurals name="duration_days">
<item quantity="one">%1$d día</item>
<item quantity="other">%1$d días</item>
</plurals>
<plurals name="duration_hours">
<item quantity="one">%1$d hora</item>
<item quantity="other">%1$d horas</item>
</plurals>
<plurals name="hoursago">
<item quantity="one">Hace %1$d hora</item>
<item quantity="other">Hace %1$d horas</item>
</plurals>
<plurals name="daysago">
<item quantity="one">Hace %1$d día</item>
<item quantity="other">Hace %1$d días</item>
</plurals>
</resources>

View file

@ -4,6 +4,7 @@
<string name="pump_operation_not_supported_by_pump_driver">Opération non prise en charge par la pompe et/ou le pilote.</string>
<string name="pump_operation_not_yet_supported_by_pump">Opération PAS ENCORE supportée par la pompe.</string>
<string name="common_resultok">OK</string>
<string name="pump_serial_number">Numéro de série de la pompe</string>
<!-- PumpCommon - Pump Status -->
<string name="pump_status_never_contacted">Jamais contacté</string>
<string name="pump_status_waking_up">Réveil en cours</string>
@ -13,6 +14,13 @@
<string name="pump_status_invalid_config">Configuration invalide</string>
<string name="pump_status_active">Actif</string>
<string name="pump_status_sleeping">En veille</string>
<string name="pump_status_not_initialized">Non initialisé</string>
<string name="pump_status_initialized">Initialisé</string>
<string name="pump_status_encrypt">Cryptage de la communication</string>
<string name="pump_status_ready">Prêt</string>
<string name="pump_status_busy">Occupé</string>
<string name="pump_status_suspended">Suspendu</string>
<string name="pump_status_executing_command">Exécution de la commande</string>
<!-- PumpCommon - History Group -->
<string name="history_group_basal">Basales</string>
<string name="history_group_configuration">Configurations</string>
@ -24,9 +32,59 @@
<string name="history_group_prime">Amorcer</string>
<string name="history_group_alarm">Alarmes</string>
<string name="history_group_glucose">Glycémie</string>
<string name="history_group_base">Base</string>
<string name="history_group_other">Autre</string>
<string name="history_group_events">Tous les événements</string>
<string name="history_group_events_no_stat">Événements (sans stat)</string>
<!-- Time -->
<string name="time_today">Aujourdhui</string>
<string name="time_last_hour">Dernière heure</string>
<string name="time_last_3_hours">3 dernières heures</string>
<string name="time_last_6_hours">6 dernières heures</string>
<string name="time_last_12_hours">12 dernières heures</string>
<string name="time_last_2_days">2 derniers jours</string>
<string name="time_last_4_days">4 derniers jours</string>
<string name="time_last_week">Dernière semaine</string>
<string name="time_last_month">Mois dernier</string>
<!-- BLE Config -->
<string name="ble_config_button_scan_start">Scanner</string>
<string name="ble_config_scan_stop">Arrêter</string>
<string name="ble_config_scan_selected">Sélectionné</string>
<string name="ble_config_scan_scanning">Recherche en cours</string>
<string name="ble_config_scan_finished">Recherche terminée</string>
<string name="ble_config_scan_error">Erreur de scan : %1$d</string>
<string name="ble_config_connected_never">Jamais</string>
<string name="ble_config_remove">Supprimer</string>
<!-- BLE Errors -->
<string name="ble_error_bt_disabled">Bluetooth désactivé</string>
<string name="ble_error_no_bt_adapter">Aucun adaptateur Bluetooth</string>
<string name="ble_error_configured_pump_not_found">Pompe configurée introuvable</string>
<string name="ble_error_pump_unreachable">Pompe hors de portée</string>
<string name="ble_error_failed_to_conn_to_ble_device">Échec de la connexion à lappareil BLE</string>
<string name="ble_error_encryption_failed">Echec du cryptage</string>
<string name="ble_error_pump_found_unbonded">Pas de pompe appairée trouvée</string>
<!-- Pump Error -->
<string name="pump_settings_error_basal_profiles_not_enabled">Le réglage des profils de basal n\'est pas activé sur la pompe. Activez-le sur la pompe.</string>
<string name="pump_settings_error_incorrect_basal_profile_selected">Le profil Basal défini sur la pompe est incorrect (doit être %s).</string>
<string name="pump_settings_error_wrong_tbr_type_set">Mauvais type DBT (TBR) réglé sur la pompe (doit être %s).</string>
<string name="pump_settings_error_wrong_max_bolus_set">Mauvais paramètre Max Bolus sur la pompe (doit être %1$.2f).</string>
<string name="pump_settings_error_wrong_max_basal_set">Mauvais paramètre Max Basal sur la pompe (doit être %1$.2f).</string>
<!-- Pump History -->
<string name="pump_history_type">Type :</string>
<plurals name="duration_days">
<item quantity="one">%1$d jour</item>
<item quantity="other">%1$d jours</item>
</plurals>
<plurals name="duration_hours">
<item quantity="one">%1$d heure</item>
<item quantity="other">%1$d heures</item>
</plurals>
<plurals name="hoursago">
<item quantity="one">Il y a %1$d heure</item>
<item quantity="other">Il y a %1$d heures</item>
</plurals>
<plurals name="daysago">
<item quantity="one">Il y a %1$d jour</item>
<item quantity="other">Il y a %1$d jours</item>
</plurals>
</resources>

View file

@ -1,8 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- PumoCommon - Pump Abstract -->
<string name="common_resultok">Ceart go leor</string>
<!-- PumpCommon - Pump Status -->
<string name="pump_status_active">Gníomhach</string>
<!-- 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 -->
<!-- BLE Config -->
<!-- BLE Errors -->

View file

@ -8,4 +8,12 @@
<!-- BLE Errors -->
<!-- Pump Error -->
<!-- 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>

View file

@ -4,6 +4,7 @@
<string name="pump_operation_not_supported_by_pump_driver">Operazione non supportata dal micro e/o dal driver.</string>
<string name="pump_operation_not_yet_supported_by_pump">Operazione NON ANCORA supportata dal micro.</string>
<string name="common_resultok">OK</string>
<string name="pump_serial_number">Numero seriale micro</string>
<!-- PumpCommon - Pump Status -->
<string name="pump_status_never_contacted">Mai connesso</string>
<string name="pump_status_waking_up">Risveglio</string>
@ -13,6 +14,13 @@
<string name="pump_status_invalid_config">Configurazione non valida</string>
<string name="pump_status_active">Attivo</string>
<string name="pump_status_sleeping">In sospensione</string>
<string name="pump_status_not_initialized">Non inizializzato</string>
<string name="pump_status_initialized">Inizializzato</string>
<string name="pump_status_encrypt">Comunicazione crittata</string>
<string name="pump_status_ready">Pronto</string>
<string name="pump_status_busy">Occupato</string>
<string name="pump_status_suspended">Sospeso</string>
<string name="pump_status_executing_command">Eseguzione comando</string>
<!-- PumpCommon - History Group -->
<string name="history_group_basal">Basali</string>
<string name="history_group_configuration">Configurazioni</string>
@ -24,9 +32,59 @@
<string name="history_group_prime">Caricamento</string>
<string name="history_group_alarm">Allarmi</string>
<string name="history_group_glucose">Glicemia</string>
<string name="history_group_base">Base</string>
<string name="history_group_other">Altro</string>
<string name="history_group_events">Tutti gli eventi</string>
<string name="history_group_events_no_stat">Eventi (no stat)</string>
<!-- Time -->
<string name="time_today">Oggi</string>
<string name="time_last_hour">Ultima ora</string>
<string name="time_last_3_hours">Ultime 3 ore</string>
<string name="time_last_6_hours">Ultime 6 ore</string>
<string name="time_last_12_hours">Ultime 12 ore</string>
<string name="time_last_2_days">Ultimi 2 giorni</string>
<string name="time_last_4_days">Ultimi 4 giorni</string>
<string name="time_last_week">Ultima settimana</string>
<string name="time_last_month">Ultimo mese</string>
<!-- BLE Config -->
<string name="ble_config_button_scan_start">Scansione</string>
<string name="ble_config_scan_stop">Stop</string>
<string name="ble_config_scan_selected">Selezionato</string>
<string name="ble_config_scan_scanning">Scansione</string>
<string name="ble_config_scan_finished">Scansione terminata</string>
<string name="ble_config_scan_error">Errore scansione: %1$d</string>
<string name="ble_config_connected_never">Mai</string>
<string name="ble_config_remove">Rimuovi</string>
<!-- BLE Errors -->
<string name="ble_error_bt_disabled">Bluetooth disabilitato</string>
<string name="ble_error_no_bt_adapter">Nessun trasmettitore bluetooth</string>
<string name="ble_error_configured_pump_not_found">Micro configurato non trovato</string>
<string name="ble_error_pump_unreachable">Micro irraggiungibile</string>
<string name="ble_error_failed_to_conn_to_ble_device">Impossibile connettersi al dispositivo BLE</string>
<string name="ble_error_encryption_failed">Crittografia fallita</string>
<string name="ble_error_pump_found_unbonded">Trovato micro non collegato</string>
<!-- Pump Error -->
<string name="pump_settings_error_basal_profiles_not_enabled">L\'impostazione di modelli/profili basali non è abilitata sul micro. Abilitarla.</string>
<string name="pump_settings_error_incorrect_basal_profile_selected">Il profilo basale impostato sul micro non è corretto (deve essere %s).</string>
<string name="pump_settings_error_wrong_tbr_type_set">Il tipo di TBR impostato sul micro è errato (deve essere %s).</string>
<string name="pump_settings_error_wrong_max_bolus_set">Il bolo massimo impostato sul micro è errato (deve essere %1$.2f).</string>
<string name="pump_settings_error_wrong_max_basal_set">La basale massima impostata sul micro è errata (deve essere %1$.2f).</string>
<!-- Pump History -->
<string name="pump_history_type">Tipo:</string>
<plurals name="duration_days">
<item quantity="one">%1$d giorno</item>
<item quantity="other">%1$d giorni</item>
</plurals>
<plurals name="duration_hours">
<item quantity="one">%1$d ora</item>
<item quantity="other">%1$d ore</item>
</plurals>
<plurals name="hoursago">
<item quantity="one">%1$d ora fa</item>
<item quantity="other">%1$d ore fa</item>
</plurals>
<plurals name="daysago">
<item quantity="one">%1$d giorno fa</item>
<item quantity="other">%1$d giorni fa</item>
</plurals>
</resources>

Some files were not shown because too many files have changed in this diff Show more