new plugin "NFC Commands" - #4968
Conversation
(cherry picked from commit a0668b9)
(cherry picked from commit b77fd03)
(cherry picked from commit 8ecd0cc)
(cherry picked from commit 45c874b)
(cherry picked from commit 3ade7b1)
(cherry picked from commit a2d2280)
(cherry picked from commit 825e488)
(cherry picked from commit 950ef2d)
…_TAG_DISCOVERED (cherry picked from commit 6c97e1e)
(cherry picked from commit fdb9107)
(cherry picked from commit 2d7c4dc)
(cherry picked from commit 1eb09e2)
(cherry picked from commit 9211a47)
(cherry picked from commit 9c40e54)
(cherry picked from commit 95c95ff)
…function calls (cherry picked from commit 9237001)
|
Nice! Merges with current def. Works as expected.👍 |
|
@vanelsberg BolusWizard issue (mmol units) fixed with d736225 |
Confirming: fixed! 😃 |
|
PR merges with current dev V4 without problems👍 |
|
Just tried this, seems to work as expected 👍 I didn't realize old sensors could be reused like this. Another tag I tested was a large credit-card sized tag inside a book from library, works just like Libre 3+. |
|
A personal example on how I use this: Tag1: I always start the day with a sort of standard breakfast (fixed amount of carbs, meal bolus, TT). This to prevent my BG spiking as in the morning I am very sensitive for carbs. Enabling SMS for a full day does not work for me because of extreme changes in insulin sensitivity during the day (And before you ask: yes, my profile is perfectly tuned). Instead of tapping several command into AAPS I scan my "breakfast" tag:
I just scan the tag, make coffee and have my breakfast. Love it Tag2: When taking a snack (also always about the same amount of carbs):
Tag3: When going for a walk, go shopping or do a small physical task I have another NFC tag: -Set Temp target,
Still experimenting on other meaningful usage, for instance tasks more effectively replacing "eating soon"... I think, maybe in future versions (?), we could look into option to scan a tag using the watch (my GW6 can scan NFC). This way there would not even be a need to take out the phone... |
|
Requirement is to unlock the phone's screen and confirm the scan. Thats why I think in future it is worth looking into Wear integration: scanning the tag from watch could be just as safe as scanning a pay terminal? |
|
How to not mixing up different tags? I have NFC stickers. Location (office, coffee machine, bedside, door, car, etc) of the sticker should me being able to associate its use. I also have a key-tag always with me. Easy to remember it's use. Having some other tags that are looking very different can help remembering... |
|
Hint: If you are looking to by NFC tags: Search Amazon for instance. Search for "NFC tags". |
Fixes stale class names (LoopClosedAction, TempTargetManualAction), corrects the SYSTEM category and BolusWizardAction descriptions, and documents behavior added since the doc was last written: the execution confirmation dialog, bolus progress dialog, blank-name/overwrite confirmations, the scene-availability filter, the actual nfc_tech_filter.xml contents, the ACTION_TECH_DISCOVERED intent, and the rewrite/remote-bolus cooldowns and cross-pump basal duration rounding. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts: # app/src/main/AndroidManifest.xml
b31213c to
fcff744
Compare
Fix implemented: 1. core/keys/.../StringNonKey.kt — registered the NFC tag list as StringNonKey.NfcCreatedTags (key "nfccommunicator_created_tags_v1", exportable by default) and the interaction log as StringNonKey.NfcLog (key "nfccommunicator_log_v1", exportable = false, 2. NfcTagStore.kt — now takes an injected Preferences instead of raw SP, and reads/writes both blobs via preferences.get/put/remove(StringNonKey.X) instead of hardcoded SharedPreferences keys — same pattern already used for QuickWizard/SceneDefinitions. Effect: - Registered tags (and their command chains) are now included in exports and correctly restored on import. - The log still resets to empty on import, same as before — that was your explicit choice. Test updates: replaced the old TestSp/SharedPreferencesMock double (which no longer matches NfcTagStore's constructor) with a small stateful Preferences mock (TestNfcPreferences.kt) used by NfcTagStoreTest, NfcControlActivityTest, and NfcCommandsPluginTest. Deleted the now-unused TestSp.kt. Verified: plugins:sync and core:keys compile cleanly (full debug + unit test sources), and all NFC-related unit tests pass.
Replace string concatenation in user facing text with format string resources, so translators keep control of separators and word order, and RTL languages render correctly. - Add text_with_detail to :core:ui, next to its sibling confirmation_line. Five modules already carried a private copy of this "%1$s (%2$s)" pattern, so NFC reuses one shared template instead of adding a sixth. - BolusAction, LoopSuspendAction and PumpDisconnectAction build their result message with that template. - nfccommands_tag_id_label becomes a full template "Tag ID: %1$s" instead of a label joined to the tag UID by a hardcoded space. Both call sites pass the UID as an argument. - Add nfccommands_add_action, replacing stringResource(add) plus a literal " Action". That second half was plain English no translator could reach. The visible text is unchanged. - NfcCommonUi no longer imports android.R. Its dismiss button used the Android platform cancel string while the confirm button next to it used the one from :core:ui. Both now come from :core:ui. No behaviour change. Verified: :plugins:sync compiles (full debug plus unit test sources) with no Kotlin errors, and all 84 NFC unit tests pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
done by CC Opus
|




This plugin is an updated version of @juehv's proposal included within PR #4655
I opened this new PR, at least to keep this topic "for discussion" (I personnaly found this proposal as a very nice feature, especially with the possibility to reuse my hundred of old FSL sensors...)
Reminder of the feature:
All the NFC communication has been developed by @juehv (unchanged)
actionssub-foldergeneraltosyncmoduleNfcCommandCodeFile and 100% of the action's code is centralized within each Action Class)AapsClientRestartActionandRestartAction). Probably several other actions could be hidden or removed (especially within LOOP Category)Note, I cherry-picked within this branch the commit included within PR #4966, it was needed for BolusWizard source management in uel.log (NFC instead of Wizard Dialog)
@juehv, @vanelsberg, @xitation and others, feel free to test and comment