Merge remote-tracking branch 'Nightscout/dev' into wear/new_custom_watchface

This commit is contained in:
Philoul 2023-08-15 23:50:35 +02:00
commit 5cac5526c4
195 changed files with 1443 additions and 475 deletions

View file

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
<g>
<ellipse fill="#0FBBE0" cx="24" cy="24" rx="22.031" ry="21.688"/>
<g>
<path fill="#FFFFFF" d="M36.136,17.006c0.073,0.633,0.147,1.265,0.11,1.898c-0.055,1.066-0.165,2.133-0.349,3.199
c-0.257,1.428-0.643,2.801-1.138,4.175c-0.569,1.536-1.285,3-2.075,4.428c-0.698,1.283-1.469,2.494-2.313,3.687
c-0.643,0.922-1.34,1.825-2.056,2.711c-0.789,0.94-2.442,2.856-3.598,3.958c-0.441,0.416-1.01,0.416-1.432,0
c-1.157-1.121-2.221-2.331-3.25-3.56c-1.157-1.374-2.221-2.783-3.195-4.265c-0.973-1.464-1.836-2.982-2.589-4.572
c-0.863-1.825-1.524-3.723-1.983-5.675c-0.147-0.687-0.239-1.392-0.349-2.096c-0.11-0.705-0.129-1.41-0.147-2.151
c-0.037-0.614,0.018-1.247,0.11-1.843c0.092-0.759,0.275-1.482,0.514-2.205c0.459-1.301,1.12-2.494,2.001-3.578
c1.248-1.554,2.772-2.765,4.627-3.578c1.083-0.47,2.185-0.813,3.378-0.94c0.551-0.054,1.12-0.127,1.689-0.127
c1.763,0.036,3.433,0.398,5.03,1.121c1.138,0.524,2.166,1.211,3.121,2.06c1.267,1.121,2.221,2.458,2.938,3.976
C35.677,14.711,35.989,15.831,36.136,17.006z M33.712,21.181c0.257-1.102,0.496-2.187,0.22-3.325
c-0.294-1.319-1.028-2.331-2.277-2.91c-1.469-0.687-2.974-0.669-4.425,0.145c-1.377,0.777-2.075,2.024-2.13,3.56
c-0.055,1.753,0,3.506,0,5.241c0,0.506-0.092,0.596-0.624,0.596c-0.33,0-0.643-0.018-0.973,0.018
c-0.422,0.036-0.606-0.163-0.606-0.596c0-0.904,0-1.789,0-2.693c0-0.759,0-1.536,0-2.313c0.018-0.38-0.037-0.759-0.129-1.139
c-0.257-1.139-0.881-2.042-1.891-2.639c-1.046-0.633-2.185-0.777-3.396-0.578c-2.111,0.361-3.488,2.205-3.543,4.211
c-0.018,0.578,0.092,1.139,0.184,1.717c0.202,1.048,0.569,2.042,1.102,2.946c0.734,1.229,1.652,2.295,2.827,3.127
c1.542,1.102,3.231,1.753,5.104,1.88c1.212,0.09,2.405-0.018,3.58-0.343c2.056-0.578,3.745-1.663,5.086-3.289
C32.702,23.729,33.363,22.518,33.712,21.181z M31.197,12.632c0.349,0.072,0.661,0.199,1.01,0.235
c-1.909-2.602-4.516-4.084-7.766-4.211c-3.617-0.127-6.518,1.337-8.702,4.229c0.092,0,0.11,0.018,0.147,0
c0.129-0.036,0.239-0.072,0.367-0.108c1.046-0.343,2.13-0.398,3.213-0.253c1.377,0.181,2.589,0.741,3.617,1.681
c0.275,0.253,0.514,0.542,0.716,0.831c0.11,0.163,0.22,0.307,0.404,0.018c0.312-0.488,0.716-0.904,1.193-1.247
C27.158,12.524,29.104,12.198,31.197,12.632z M31.601,28.03c-0.569,0.398-1.157,0.759-1.762,1.102
c-1.707,0.922-3.543,1.374-5.471,1.464c-0.165,0.018-0.239,0.054-0.312,0.199c-0.147,0.289-0.312,0.56-0.477,0.831
c-0.734,1.265-1.542,2.476-2.387,3.651c-0.11,0.127-0.092,0.181,0,0.289c0.257,0.325,0.532,0.651,0.808,0.976
c0.624,0.759,1.304,1.482,2.001,2.223C27.084,35.549,29.728,32.061,31.601,28.03z M21.705,30.633
c0.092-0.163,0.129-0.235-0.147-0.289c-0.955-0.181-1.873-0.488-2.772-0.904c-0.826-0.398-1.616-0.886-2.387-1.41
c0.9,1.988,2.038,3.831,3.305,5.621c0.165-0.217,0.312-0.416,0.441-0.614C20.695,32.259,21.191,31.428,21.705,30.633z"/>
<path fill="#FFFFFF" d="M29.6,15c2.111,0.018,3.837,1.681,3.819,3.813c-0.018,2.115-1.671,3.741-3.855,3.759
c-2.111,0-3.855-1.717-3.837-3.85C25.763,16.662,27.488,14.982,29.6,15z M31.252,18.813c0.037-0.922-0.808-1.771-1.689-1.663
c-0.826-0.108-1.652,0.759-1.671,1.572c-0.018,0.904,0.789,1.699,1.671,1.717C30.499,20.44,31.234,19.608,31.252,18.813z"/>
<path fill="#FFFFFF" d="M18.602,15c1.909,0.054,3.672,1.681,3.672,3.759c-0.018,2.205-1.763,3.813-3.874,3.795
c-2.13,0-3.819-1.663-3.819-3.813C14.582,16.735,16.252,14.927,18.602,15z M18.419,20.44c0.863,0,1.762-0.777,1.671-1.681
c0.092-0.886-0.826-1.59-1.524-1.627c-1.138-0.054-1.799,0.868-1.818,1.608C16.73,19.681,17.538,20.422,18.419,20.44z"/>
</g>
<g>
<path fill="#010101" d="M38.394,16.066c0.055,0.343,0.184,1.374,0.184,2.512c0,1.283-0.165,2.892-0.257,3.416
c-0.202,1.464-0.588,2.91-1.046,4.319c-0.624,1.825-1.395,3.597-2.332,5.295c-0.588,1.048-1.193,2.06-1.854,3.054
c-0.698,1.066-1.45,2.115-2.258,3.109c-0.771,0.958-1.542,1.916-2.35,2.819c-0.275,0.289-0.551,0.578-0.826,0.868
c-0.514,0.578-0.973,1.048-1.579,1.536c-1.304,1.211-3.213,1.121-4.351-0.145c-0.863-0.831-1.671-1.699-2.46-2.584
c-0.973-1.121-1.909-2.259-2.791-3.434c-1.322-1.753-2.515-3.578-3.562-5.494c-0.753-1.355-1.377-2.783-1.909-4.265
c-0.698-1.97-1.267-3.994-1.469-6.109c-0.018-0.253-0.11-1.283-0.11-2.386c0-1.157,0.129-2.096,0.184-2.44
c0.202-1.374,0.661-2.657,1.267-3.886c0.477-1.012,1.102-1.934,1.818-2.819c0.716-0.831,1.487-1.59,2.35-2.259
c0.955-0.723,1.983-1.337,3.103-1.807c1.212-0.524,2.479-0.886,3.8-1.066c0.239-0.018,1.102-0.108,2.148-0.108
c1.322,0,2.644,0.199,3.231,0.343c1.34,0.307,2.625,0.795,3.837,1.464c1.707,0.94,3.158,2.187,4.37,3.687
c0.863,1.084,1.561,2.277,2.075,3.578C37.953,14.168,38.229,15.108,38.394,16.066z M36.246,18.903
c0.037-0.633-0.037-1.265-0.11-1.898c-0.147-1.175-0.459-2.295-0.955-3.38c-0.716-1.518-1.671-2.856-2.938-3.976
c-0.955-0.849-1.983-1.536-3.121-2.06c-1.597-0.723-3.268-1.084-5.03-1.121c-0.569,0-1.138,0.072-1.689,0.127
c-1.193,0.127-2.295,0.47-3.378,0.94c-1.854,0.813-3.378,2.024-4.627,3.578c-0.881,1.084-1.542,2.277-2.001,3.578
c-0.239,0.723-0.422,1.446-0.514,2.205c-0.092,0.596-0.147,1.229-0.11,1.843c0.018,0.741,0.037,1.446,0.147,2.151
c0.11,0.705,0.202,1.41,0.349,2.096c0.459,1.952,1.12,3.85,1.983,5.675c0.753,1.59,1.616,3.109,2.589,4.572
c0.973,1.482,2.038,2.892,3.195,4.265c1.028,1.229,2.093,2.44,3.25,3.56c0.422,0.416,0.991,0.416,1.432,0
c1.157-1.102,2.809-3.018,3.598-3.958c0.716-0.886,1.414-1.789,2.056-2.711c0.845-1.193,1.616-2.404,2.313-3.687
c0.789-1.428,1.505-2.892,2.075-4.428c0.496-1.374,0.881-2.747,1.138-4.175C36.08,21.036,36.191,19.97,36.246,18.903z"/>
<path fill="#010101" d="M33.932,17.855c0.275,1.139,0.037,2.223-0.22,3.325c-0.349,1.337-1.01,2.548-1.891,3.615
c-1.34,1.627-3.029,2.711-5.086,3.289c-1.175,0.325-2.368,0.434-3.58,0.343c-1.873-0.127-3.562-0.777-5.104-1.88
c-1.175-0.831-2.093-1.898-2.827-3.127c-0.532-0.904-0.9-1.898-1.102-2.946c-0.092-0.578-0.202-1.139-0.184-1.717
c0.055-2.006,1.432-3.85,3.543-4.211c1.212-0.199,2.35-0.054,3.396,0.578c1.01,0.596,1.634,1.5,1.891,2.639
c0.092,0.38,0.147,0.759,0.129,1.139c0,0.777,0,1.554,0,2.313c0,0.904,0,1.789,0,2.693c0,0.434,0.184,0.633,0.606,0.596
c0.33-0.036,0.643-0.018,0.973-0.018c0.532,0,0.624-0.09,0.624-0.596c0-1.735-0.055-3.488,0-5.241
c0.055-1.536,0.753-2.783,2.13-3.56c1.45-0.813,2.956-0.831,4.425-0.145C32.904,15.524,33.639,16.536,33.932,17.855z
M33.418,18.813C33.437,16.68,31.711,15.018,29.6,15s-3.837,1.663-3.874,3.723c-0.018,2.133,1.726,3.85,3.837,3.85
C31.748,22.554,33.4,20.928,33.418,18.813z M22.274,18.759c0-2.078-1.763-3.705-3.672-3.759c-2.35-0.072-4.021,1.735-4.021,3.741
c0,2.151,1.689,3.813,3.819,3.813C20.512,22.572,22.256,20.964,22.274,18.759z"/>
<path fill="#010101" d="M32.207,12.867c-0.349-0.036-0.661-0.163-1.01-0.235c-2.093-0.434-4.039-0.108-5.802,1.175
c-0.477,0.343-0.881,0.759-1.193,1.247c-0.184,0.289-0.294,0.145-0.404-0.018c-0.202-0.289-0.441-0.578-0.716-0.831
c-1.028-0.94-2.24-1.5-3.617-1.681c-1.083-0.145-2.166-0.09-3.213,0.253c-0.129,0.036-0.239,0.072-0.367,0.108
c-0.037,0.018-0.055,0-0.147,0c2.185-2.892,5.086-4.356,8.702-4.229C27.69,8.783,30.297,10.265,32.207,12.867z"/>
<path fill="#010101" d="M29.563,17.15c0.881-0.108,1.726,0.741,1.689,1.663c-0.018,0.795-0.753,1.627-1.689,1.627
c-0.881-0.018-1.689-0.813-1.671-1.717C27.911,17.909,28.737,17.042,29.563,17.15z"/>
<path fill="#010101" d="M29.838,29.133c0.606-0.343,1.193-0.705,1.762-1.102c-1.873,4.03-4.516,7.518-7.601,10.735
c-0.698-0.741-1.377-1.464-2.001-2.223c-0.275-0.325-0.551-0.651-0.808-0.976c-0.092-0.108-0.11-0.163,0-0.289
c0.845-1.175,1.652-2.386,2.387-3.651c0.165-0.271,0.33-0.542,0.477-0.831c0.073-0.145,0.147-0.181,0.312-0.199
C26.295,30.506,28.131,30.054,29.838,29.133z"/>
<path fill="#010101" d="M21.558,30.344c0.275,0.054,0.239,0.127,0.147,0.289c-0.514,0.795-1.01,1.627-1.561,2.404
c-0.129,0.199-0.275,0.398-0.441,0.614c-1.267-1.789-2.405-3.633-3.305-5.621c0.771,0.524,1.561,1.012,2.387,1.41
C19.686,29.856,20.604,30.163,21.558,30.344z"/>
<path fill="#010101" d="M20.089,18.759c0.092,0.904-0.808,1.681-1.671,1.681c-0.881-0.018-1.689-0.759-1.671-1.699
c0.018-0.741,0.679-1.663,1.818-1.608C19.263,17.168,20.181,17.873,20.089,18.759z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
<g>
<ellipse fill="#E8C50C" cx="24" cy="24" rx="22.031" ry="21.688"/>
<g>
<path fill="#FFFFFF" d="M36.136,17.006c0.073,0.633,0.147,1.265,0.11,1.898c-0.055,1.066-0.165,2.133-0.349,3.199
c-0.257,1.428-0.643,2.801-1.138,4.175c-0.569,1.536-1.285,3-2.075,4.428c-0.698,1.283-1.469,2.494-2.313,3.687
c-0.643,0.922-1.34,1.825-2.056,2.711c-0.789,0.94-2.442,2.856-3.598,3.958c-0.441,0.416-1.01,0.416-1.432,0
c-1.157-1.121-2.221-2.331-3.25-3.56c-1.157-1.374-2.221-2.783-3.195-4.265c-0.973-1.464-1.836-2.982-2.589-4.572
c-0.863-1.825-1.524-3.723-1.983-5.675c-0.147-0.687-0.239-1.392-0.349-2.096c-0.11-0.705-0.129-1.41-0.147-2.151
c-0.037-0.614,0.018-1.247,0.11-1.843c0.092-0.759,0.275-1.482,0.514-2.205c0.459-1.301,1.12-2.494,2.001-3.578
c1.248-1.554,2.772-2.765,4.627-3.578c1.083-0.47,2.185-0.813,3.378-0.94c0.551-0.054,1.12-0.127,1.689-0.127
c1.763,0.036,3.433,0.398,5.03,1.121c1.138,0.524,2.166,1.211,3.121,2.06c1.267,1.121,2.221,2.458,2.938,3.976
C35.677,14.711,35.989,15.831,36.136,17.006z M33.712,21.181c0.257-1.102,0.496-2.187,0.22-3.325
c-0.294-1.319-1.028-2.331-2.277-2.91c-1.469-0.687-2.974-0.669-4.425,0.145c-1.377,0.777-2.075,2.024-2.13,3.56
c-0.055,1.753,0,3.506,0,5.241c0,0.506-0.092,0.596-0.624,0.596c-0.33,0-0.643-0.018-0.973,0.018
c-0.422,0.036-0.606-0.163-0.606-0.596c0-0.904,0-1.789,0-2.693c0-0.759,0-1.536,0-2.313c0.018-0.38-0.037-0.759-0.129-1.139
c-0.257-1.139-0.881-2.042-1.891-2.639c-1.046-0.633-2.185-0.777-3.396-0.578c-2.111,0.361-3.488,2.205-3.543,4.211
c-0.018,0.578,0.092,1.139,0.184,1.717c0.202,1.048,0.569,2.042,1.102,2.946c0.734,1.229,1.652,2.295,2.827,3.127
c1.542,1.102,3.231,1.753,5.104,1.88c1.212,0.09,2.405-0.018,3.58-0.343c2.056-0.578,3.745-1.663,5.086-3.289
C32.702,23.729,33.363,22.518,33.712,21.181z M31.197,12.632c0.349,0.072,0.661,0.199,1.01,0.235
c-1.909-2.602-4.516-4.084-7.766-4.211c-3.617-0.127-6.518,1.337-8.702,4.229c0.092,0,0.11,0.018,0.147,0
c0.129-0.036,0.239-0.072,0.367-0.108c1.046-0.343,2.13-0.398,3.213-0.253c1.377,0.181,2.589,0.741,3.617,1.681
c0.275,0.253,0.514,0.542,0.716,0.831c0.11,0.163,0.22,0.307,0.404,0.018c0.312-0.488,0.716-0.904,1.193-1.247
C27.158,12.524,29.104,12.198,31.197,12.632z M31.601,28.03c-0.569,0.398-1.157,0.759-1.762,1.102
c-1.707,0.922-3.543,1.374-5.471,1.464c-0.165,0.018-0.239,0.054-0.312,0.199c-0.147,0.289-0.312,0.56-0.477,0.831
c-0.734,1.265-1.542,2.476-2.387,3.651c-0.11,0.127-0.092,0.181,0,0.289c0.257,0.325,0.532,0.651,0.808,0.976
c0.624,0.759,1.304,1.482,2.001,2.223C27.084,35.549,29.728,32.061,31.601,28.03z M21.705,30.633
c0.092-0.163,0.129-0.235-0.147-0.289c-0.955-0.181-1.873-0.488-2.772-0.904c-0.826-0.398-1.616-0.886-2.387-1.41
c0.9,1.988,2.038,3.831,3.305,5.621c0.165-0.217,0.312-0.416,0.441-0.614C20.695,32.259,21.191,31.428,21.705,30.633z"/>
<path fill="#FFFFFF" d="M29.6,15c2.111,0.018,3.837,1.681,3.819,3.813c-0.018,2.115-1.671,3.741-3.855,3.759
c-2.111,0-3.855-1.717-3.837-3.85C25.763,16.662,27.488,14.982,29.6,15z M31.252,18.813c0.037-0.922-0.808-1.771-1.689-1.663
c-0.826-0.108-1.652,0.759-1.671,1.572c-0.018,0.904,0.789,1.699,1.671,1.717C30.499,20.44,31.234,19.608,31.252,18.813z"/>
<path fill="#FFFFFF" d="M18.602,15c1.909,0.054,3.672,1.681,3.672,3.759c-0.018,2.205-1.763,3.813-3.874,3.795
c-2.13,0-3.819-1.663-3.819-3.813C14.582,16.735,16.252,14.927,18.602,15z M18.419,20.44c0.863,0,1.762-0.777,1.671-1.681
c0.092-0.886-0.826-1.59-1.524-1.627c-1.138-0.054-1.799,0.868-1.818,1.608C16.73,19.681,17.538,20.422,18.419,20.44z"/>
</g>
<g>
<path fill="#010101" d="M38.394,16.066c0.055,0.343,0.184,1.374,0.184,2.512c0,1.283-0.165,2.892-0.257,3.416
c-0.202,1.464-0.588,2.91-1.046,4.319c-0.624,1.825-1.395,3.597-2.332,5.295c-0.588,1.048-1.193,2.06-1.854,3.054
c-0.698,1.066-1.45,2.115-2.258,3.109c-0.771,0.958-1.542,1.916-2.35,2.819c-0.275,0.289-0.551,0.578-0.826,0.868
c-0.514,0.578-0.973,1.048-1.579,1.536c-1.304,1.211-3.213,1.121-4.351-0.145c-0.863-0.831-1.671-1.699-2.46-2.584
c-0.973-1.121-1.909-2.259-2.791-3.434c-1.322-1.753-2.515-3.578-3.562-5.494c-0.753-1.355-1.377-2.783-1.909-4.265
c-0.698-1.97-1.267-3.994-1.469-6.109c-0.018-0.253-0.11-1.283-0.11-2.386c0-1.157,0.129-2.096,0.184-2.44
c0.202-1.374,0.661-2.657,1.267-3.886c0.477-1.012,1.102-1.934,1.818-2.819c0.716-0.831,1.487-1.59,2.35-2.259
c0.955-0.723,1.983-1.337,3.103-1.807c1.212-0.524,2.479-0.886,3.8-1.066c0.239-0.018,1.102-0.108,2.148-0.108
c1.322,0,2.644,0.199,3.231,0.343c1.34,0.307,2.625,0.795,3.837,1.464c1.707,0.94,3.158,2.187,4.37,3.687
c0.863,1.084,1.561,2.277,2.075,3.578C37.953,14.168,38.229,15.108,38.394,16.066z M36.246,18.903
c0.037-0.633-0.037-1.265-0.11-1.898c-0.147-1.175-0.459-2.295-0.955-3.38c-0.716-1.518-1.671-2.856-2.938-3.976
c-0.955-0.849-1.983-1.536-3.121-2.06c-1.597-0.723-3.268-1.084-5.03-1.121c-0.569,0-1.138,0.072-1.689,0.127
c-1.193,0.127-2.295,0.47-3.378,0.94c-1.854,0.813-3.378,2.024-4.627,3.578c-0.881,1.084-1.542,2.277-2.001,3.578
c-0.239,0.723-0.422,1.446-0.514,2.205c-0.092,0.596-0.147,1.229-0.11,1.843c0.018,0.741,0.037,1.446,0.147,2.151
c0.11,0.705,0.202,1.41,0.349,2.096c0.459,1.952,1.12,3.85,1.983,5.675c0.753,1.59,1.616,3.109,2.589,4.572
c0.973,1.482,2.038,2.892,3.195,4.265c1.028,1.229,2.093,2.44,3.25,3.56c0.422,0.416,0.991,0.416,1.432,0
c1.157-1.102,2.809-3.018,3.598-3.958c0.716-0.886,1.414-1.789,2.056-2.711c0.845-1.193,1.616-2.404,2.313-3.687
c0.789-1.428,1.505-2.892,2.075-4.428c0.496-1.374,0.881-2.747,1.138-4.175C36.08,21.036,36.191,19.97,36.246,18.903z"/>
<path fill="#010101" d="M33.932,17.855c0.275,1.139,0.037,2.223-0.22,3.325c-0.349,1.337-1.01,2.548-1.891,3.615
c-1.34,1.627-3.029,2.711-5.086,3.289c-1.175,0.325-2.368,0.434-3.58,0.343c-1.873-0.127-3.562-0.777-5.104-1.88
c-1.175-0.831-2.093-1.898-2.827-3.127c-0.532-0.904-0.9-1.898-1.102-2.946c-0.092-0.578-0.202-1.139-0.184-1.717
c0.055-2.006,1.432-3.85,3.543-4.211c1.212-0.199,2.35-0.054,3.396,0.578c1.01,0.596,1.634,1.5,1.891,2.639
c0.092,0.38,0.147,0.759,0.129,1.139c0,0.777,0,1.554,0,2.313c0,0.904,0,1.789,0,2.693c0,0.434,0.184,0.633,0.606,0.596
c0.33-0.036,0.643-0.018,0.973-0.018c0.532,0,0.624-0.09,0.624-0.596c0-1.735-0.055-3.488,0-5.241
c0.055-1.536,0.753-2.783,2.13-3.56c1.45-0.813,2.956-0.831,4.425-0.145C32.904,15.524,33.639,16.536,33.932,17.855z
M33.418,18.813C33.437,16.68,31.711,15.018,29.6,15s-3.837,1.663-3.874,3.723c-0.018,2.133,1.726,3.85,3.837,3.85
C31.748,22.554,33.4,20.928,33.418,18.813z M22.274,18.759c0-2.078-1.763-3.705-3.672-3.759c-2.35-0.072-4.021,1.735-4.021,3.741
c0,2.151,1.689,3.813,3.819,3.813C20.512,22.572,22.256,20.964,22.274,18.759z"/>
<path fill="#010101" d="M32.207,12.867c-0.349-0.036-0.661-0.163-1.01-0.235c-2.093-0.434-4.039-0.108-5.802,1.175
c-0.477,0.343-0.881,0.759-1.193,1.247c-0.184,0.289-0.294,0.145-0.404-0.018c-0.202-0.289-0.441-0.578-0.716-0.831
c-1.028-0.94-2.24-1.5-3.617-1.681c-1.083-0.145-2.166-0.09-3.213,0.253c-0.129,0.036-0.239,0.072-0.367,0.108
c-0.037,0.018-0.055,0-0.147,0c2.185-2.892,5.086-4.356,8.702-4.229C27.69,8.783,30.297,10.265,32.207,12.867z"/>
<path fill="#010101" d="M29.563,17.15c0.881-0.108,1.726,0.741,1.689,1.663c-0.018,0.795-0.753,1.627-1.689,1.627
c-0.881-0.018-1.689-0.813-1.671-1.717C27.911,17.909,28.737,17.042,29.563,17.15z"/>
<path fill="#010101" d="M29.838,29.133c0.606-0.343,1.193-0.705,1.762-1.102c-1.873,4.03-4.516,7.518-7.601,10.735
c-0.698-0.741-1.377-1.464-2.001-2.223c-0.275-0.325-0.551-0.651-0.808-0.976c-0.092-0.108-0.11-0.163,0-0.289
c0.845-1.175,1.652-2.386,2.387-3.651c0.165-0.271,0.33-0.542,0.477-0.831c0.073-0.145,0.147-0.181,0.312-0.199
C26.295,30.506,28.131,30.054,29.838,29.133z"/>
<path fill="#010101" d="M21.558,30.344c0.275,0.054,0.239,0.127,0.147,0.289c-0.514,0.795-1.01,1.627-1.561,2.404
c-0.129,0.199-0.275,0.398-0.441,0.614c-1.267-1.789-2.405-3.633-3.305-5.621c0.771,0.524,1.561,1.012,2.387,1.41
C19.686,29.856,20.604,30.163,21.558,30.344z"/>
<path fill="#010101" d="M20.089,18.759c0.092,0.904-0.808,1.681-1.671,1.681c-0.881-0.018-1.689-0.759-1.671-1.699
c0.018-0.741,0.679-1.663,1.818-1.608C19.263,17.168,20.181,17.873,20.089,18.759z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -21,4 +21,5 @@
<string name="handshaking">Handskudding</string> <string name="handshaking">Handskudding</string>
<string name="connected">Gekoppel</string> <string name="connected">Gekoppel</string>
<string name="disconnecting">Ontkoppel</string> <string name="disconnecting">Ontkoppel</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -33,4 +33,5 @@
<string name="connected">Свързана</string> <string name="connected">Свързана</string>
<string name="disconnecting">Разкачане</string> <string name="disconnecting">Разкачане</string>
<string name="waiting_for_disconnection">Изчакване за разкачане</string> <string name="waiting_for_disconnection">Изчакване за разкачане</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -24,4 +24,5 @@
<string name="connected">Connectat</string> <string name="connected">Connectat</string>
<string name="disconnecting">Desconnectant</string> <string name="disconnecting">Desconnectant</string>
<string name="waiting_for_disconnection">S\'està esperant la desconnexió</string> <string name="waiting_for_disconnection">S\'està esperant la desconnexió</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -33,4 +33,11 @@
<string name="connected">Připojeno</string> <string name="connected">Připojeno</string>
<string name="disconnecting">Odpojuji</string> <string name="disconnecting">Odpojuji</string>
<string name="waiting_for_disconnection">Čekám na odpojení</string> <string name="waiting_for_disconnection">Čekám na odpojení</string>
<!-- Custom Watchface -->
<string name="metadata_label_watchface_created_at">Vytvořeno: %1$s</string>
<string name="metadata_label_watchface_author">Autor: %1$s</string>
<string name="metadata_label_watchface_name">Jméno %1$s</string>
<string name="metadata_wear_import_filename">Název souboru: %1$s</string>
<string name="metadata_label_watchface_version">Verze ciferníku: %1$s</string>
<string name="wear_default_watchface">Výchozí ciferník</string>
</resources> </resources>

View file

@ -33,4 +33,5 @@
<string name="connected">Tilsuttet</string> <string name="connected">Tilsuttet</string>
<string name="disconnecting">Afbryder</string> <string name="disconnecting">Afbryder</string>
<string name="waiting_for_disconnection">Venter på afbrydelse</string> <string name="waiting_for_disconnection">Venter på afbrydelse</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -33,4 +33,5 @@
<string name="connected">Verbunden</string> <string name="connected">Verbunden</string>
<string name="disconnecting">Verbindung wird getrennt</string> <string name="disconnecting">Verbindung wird getrennt</string>
<string name="waiting_for_disconnection">Warte auf Trennung der Verbindung</string> <string name="waiting_for_disconnection">Warte auf Trennung der Verbindung</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -20,4 +20,5 @@
<string name="handshaking">Δημιουργία σύνδεσης</string> <string name="handshaking">Δημιουργία σύνδεσης</string>
<string name="connected">Συνδέθηκε</string> <string name="connected">Συνδέθηκε</string>
<string name="disconnecting">Αποσυνδέεται</string> <string name="disconnecting">Αποσυνδέεται</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -33,4 +33,5 @@
<string name="connected">Conectado</string> <string name="connected">Conectado</string>
<string name="disconnecting">Desconectando</string> <string name="disconnecting">Desconectando</string>
<string name="waiting_for_disconnection">Esperando la desconexión</string> <string name="waiting_for_disconnection">Esperando la desconexión</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -33,4 +33,5 @@
<string name="connected">Connectée</string> <string name="connected">Connectée</string>
<string name="disconnecting">Déconnexion en cours</string> <string name="disconnecting">Déconnexion en cours</string>
<string name="waiting_for_disconnection">Attente de déconnexion</string> <string name="waiting_for_disconnection">Attente de déconnexion</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -22,4 +22,5 @@
<string name="connecting_for">Ag nascadh le %1$d s</string> <string name="connecting_for">Ag nascadh le %1$d s</string>
<string name="connected">Nasctha</string> <string name="connected">Nasctha</string>
<string name="disconnecting">Dícheangal</string> <string name="disconnecting">Dícheangal</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -5,4 +5,5 @@
<string name="shortday">n</string> <string name="shortday">n</string>
<!-- Rx --> <!-- Rx -->
<string name="connected">Kapcsolódva</string> <string name="connected">Kapcsolódva</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -33,4 +33,5 @@
<string name="connected">Connesso</string> <string name="connected">Connesso</string>
<string name="disconnecting">Disconnessione</string> <string name="disconnecting">Disconnessione</string>
<string name="waiting_for_disconnection">In attesa della disconnessione</string> <string name="waiting_for_disconnection">In attesa della disconnessione</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -33,4 +33,5 @@
<string name="connected">מחובר</string> <string name="connected">מחובר</string>
<string name="disconnecting">מתנתק</string> <string name="disconnecting">מתנתק</string>
<string name="waiting_for_disconnection">ממתין לניתוק</string> <string name="waiting_for_disconnection">ממתין לניתוק</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -33,4 +33,5 @@
<string name="connected">接続されました</string> <string name="connected">接続されました</string>
<string name="disconnecting">切断中</string> <string name="disconnecting">切断中</string>
<string name="waiting_for_disconnection">切断待ち</string> <string name="waiting_for_disconnection">切断待ち</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -24,4 +24,5 @@
<string name="connected">Conectat</string> <string name="connected">Conectat</string>
<string name="disconnecting">Se deconectează</string> <string name="disconnecting">Se deconectează</string>
<string name="waiting_for_disconnection">Se așteaptă deconectarea</string> <string name="waiting_for_disconnection">Se așteaptă deconectarea</string>
<!-- Custom Watchface -->
</resources> </resources>

View file

@ -148,7 +148,7 @@ android {
versionName version + "-aapsclient" versionName version + "-aapsclient"
manifestPlaceholders = [ manifestPlaceholders = [
appIcon : "@mipmap/ic_yellowowl", appIcon : "@mipmap/ic_yellowowl",
appIconRound: "@null" appIconRound: "@mipmap/ic_yellowowl"
] ]
} }
aapsclient2 { aapsclient2 {
@ -157,8 +157,8 @@ android {
resValue "string", "app_name", "AAPSClient2" resValue "string", "app_name", "AAPSClient2"
versionName version + "-aapsclient" versionName version + "-aapsclient"
manifestPlaceholders = [ manifestPlaceholders = [
appIcon : "@mipmap/ic_yellowowl", appIcon : "@mipmap/ic_blueowl",
appIconRound: "@null" appIconRound: "@mipmap/ic_blueowl"
] ]
} }
} }

View file

@ -21,6 +21,7 @@ import android.view.inputmethod.InputMethodManager
import android.widget.EditText import android.widget.EditText
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.ActionBarDrawerToggle import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
@ -151,7 +152,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
.subscribe({ processPreferenceChange(it) }, fabricPrivacy::logException) .subscribe({ processPreferenceChange(it) }, fabricPrivacy::logException)
if (startWizard() && !isRunningRealPumpTest()) { if (startWizard() && !isRunningRealPumpTest()) {
protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, { protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, {
startActivity(Intent(this, SetupWizardActivity::class.java)) startActivity(Intent(this, SetupWizardActivity::class.java).setAction("info.nightscout.androidaps.MainActivity"))
}) })
} }
androidPermission.notifyForStoragePermission(this) androidPermission.notifyForStoragePermission(this)
@ -163,6 +164,17 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
androidPermission.notifyForBtConnectPermission(this) androidPermission.notifyForBtConnectPermission(this)
} }
passwordResetCheck(this) passwordResetCheck(this)
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if (binding.mainDrawerLayout.isDrawerOpen(GravityCompat.START))
binding.mainDrawerLayout.closeDrawers()
else if (menuOpen)
menu?.close()
else if (binding.mainPager.currentItem != 0)
binding.mainPager.currentItem = 0
else finish()
}
})
} }
private fun checkPluginPreferences(viewPager: ViewPager2) { private fun checkPluginPreferences(viewPager: ViewPager2) {
@ -219,9 +231,11 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
menuItem.setIcon(info.nightscout.core.ui.R.drawable.ic_settings) menuItem.setIcon(info.nightscout.core.ui.R.drawable.ic_settings)
} }
menuItem.setOnMenuItemClickListener { menuItem.setOnMenuItemClickListener {
val intent = Intent(this, SingleFragmentActivity::class.java) startActivity(
intent.putExtra("plugin", activePlugin.getPluginsList().indexOf(p)) Intent(this, SingleFragmentActivity::class.java)
startActivity(intent) .setAction("info.nightscout.androidaps.MainActivity")
.putExtra("plugin", activePlugin.getPluginsList().indexOf(p))
)
binding.mainDrawerLayout.closeDrawers() binding.mainDrawerLayout.closeDrawers()
true true
} }
@ -318,26 +332,28 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
when (item.itemId) { when (item.itemId) {
R.id.nav_preferences -> { R.id.nav_preferences -> {
protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, { protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, {
val i = Intent(this, PreferencesActivity::class.java) startActivity(
i.putExtra("id", -1) Intent(this, PreferencesActivity::class.java)
startActivity(i) .setAction("info.nightscout.androidaps.MainActivity")
.putExtra("id", -1)
)
}) })
return true return true
} }
R.id.nav_historybrowser -> { R.id.nav_historybrowser -> {
startActivity(Intent(this, HistoryBrowseActivity::class.java)) startActivity(Intent(this, HistoryBrowseActivity::class.java).setAction("info.nightscout.androidaps.MainActivity"))
return true return true
} }
R.id.nav_treatments -> { R.id.nav_treatments -> {
startActivity(Intent(this, TreatmentsActivity::class.java)) startActivity(Intent(this, TreatmentsActivity::class.java).setAction("info.nightscout.androidaps.MainActivity"))
return true return true
} }
R.id.nav_setupwizard -> { R.id.nav_setupwizard -> {
protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, { protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, {
startActivity(Intent(this, SetupWizardActivity::class.java)) startActivity(Intent(this, SetupWizardActivity::class.java).setAction("info.nightscout.androidaps.MainActivity"))
}) })
return true return true
} }
@ -384,9 +400,11 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
R.id.nav_plugin_preferences -> { R.id.nav_plugin_preferences -> {
val plugin = (binding.mainPager.adapter as TabPageAdapter).getPluginAt(binding.mainPager.currentItem) val plugin = (binding.mainPager.adapter as TabPageAdapter).getPluginAt(binding.mainPager.currentItem)
protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, { protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, {
val i = Intent(this, PreferencesActivity::class.java) startActivity(
i.putExtra("id", plugin.preferencesId) Intent(this, PreferencesActivity::class.java)
startActivity(i) .setAction("info.nightscout.androidaps.MainActivity")
.putExtra("id", plugin.preferencesId)
)
}) })
return true return true
} }
@ -397,35 +415,18 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
} }
*/ */
R.id.nav_defaultprofile -> { R.id.nav_defaultprofile -> {
startActivity(Intent(this, ProfileHelperActivity::class.java)) startActivity(Intent(this, ProfileHelperActivity::class.java).setAction("info.nightscout.androidaps.MainActivity"))
return true return true
} }
R.id.nav_stats -> { R.id.nav_stats -> {
startActivity(Intent(this, StatsActivity::class.java)) startActivity(Intent(this, StatsActivity::class.java).setAction("info.nightscout.androidaps.MainActivity"))
return true return true
} }
} }
return actionBarDrawerToggle.onOptionsItemSelected(item) return actionBarDrawerToggle.onOptionsItemSelected(item)
} }
override fun onBackPressed() {
if (binding.mainDrawerLayout.isDrawerOpen(GravityCompat.START)) {
binding.mainDrawerLayout.closeDrawers()
return
}
if (menuOpen) {
this.menu?.close()
return
}
if (binding.mainPager.currentItem != 0) {
binding.mainPager.currentItem = 0
return
}
@Suppress("DEPRECATION")
super.onBackPressed()
}
// Correct place for calling setUserStats() would be probably MainApp // Correct place for calling setUserStats() would be probably MainApp
// but we need to have it called at least once a day. Thus this location // but we need to have it called at least once a day. Thus this location

View file

@ -2,8 +2,10 @@ package info.nightscout.androidaps.activities
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.core.view.MenuProvider
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
@ -33,10 +35,13 @@ class PreferencesActivity : DaggerAppCompatActivityWithResult(), PreferenceFragm
it.putInt("id", preferenceId) it.putInt("id", preferenceId)
} }
if (savedInstanceState == null) if (savedInstanceState == null)
@Suppress("CommitTransaction")
supportFragmentManager.beginTransaction().replace(R.id.frame_layout, myPreferenceFragment!!).commit() supportFragmentManager.beginTransaction().replace(R.id.frame_layout, myPreferenceFragment!!).commit()
}
override fun onCreateOptionsMenu(menu: Menu): Boolean { // Add menu items without overriding methods in the Activity
addMenuProvider(object : MenuProvider {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
// Add menu items here
menuInflater.inflate(R.menu.menu_preferences, menu) menuInflater.inflate(R.menu.menu_preferences, menu)
val searchItem = menu.findItem(R.id.menu_search) val searchItem = menu.findItem(R.id.menu_search)
searchView = searchItem.actionView as SearchView searchView = searchItem.actionView as SearchView
@ -47,11 +52,20 @@ class PreferencesActivity : DaggerAppCompatActivityWithResult(), PreferenceFragm
return false return false
} }
override fun onQueryTextSubmit(query: String): Boolean { override fun onQueryTextSubmit(query: String): Boolean = false
return false })
}
override fun onMenuItemSelected(menuItem: MenuItem): Boolean =
when (menuItem.itemId) {
android.R.id.home -> {
onBackPressedDispatcher.onBackPressed()
true
}
else -> false
} }
}) })
return super.onCreateOptionsMenu(menu)
} }
override fun onPreferenceStartScreen(caller: PreferenceFragmentCompat, pref: PreferenceScreen): Boolean { override fun onPreferenceStartScreen(caller: PreferenceFragmentCompat, pref: PreferenceScreen): Boolean {
@ -60,18 +74,8 @@ class PreferencesActivity : DaggerAppCompatActivityWithResult(), PreferenceFragm
it.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, pref.key) it.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, pref.key)
it.putInt("id", preferenceId) it.putInt("id", preferenceId)
} }
@Suppress("CommitTransaction")
supportFragmentManager.beginTransaction().replace(R.id.frame_layout, fragment, pref.key).addToBackStack(pref.key).commit() supportFragmentManager.beginTransaction().replace(R.id.frame_layout, fragment, pref.key).addToBackStack(pref.key).commit()
return true return true
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
android.R.id.home -> {
@Suppress("DEPRECATION")
onBackPressed()
true
}
else -> super.onOptionsItemSelected(item)
}
} }

View file

@ -18,6 +18,8 @@ class ConfigImpl @Inject constructor(
override val SUPPORTED_NS_VERSION = 150000 // 15.0.0 override val SUPPORTED_NS_VERSION = 150000 // 15.0.0
override val APS = BuildConfig.FLAVOR == "full" override val APS = BuildConfig.FLAVOR == "full"
override val NSCLIENT = BuildConfig.FLAVOR == "aapsclient" || BuildConfig.FLAVOR == "aapsclient2" override val NSCLIENT = BuildConfig.FLAVOR == "aapsclient" || BuildConfig.FLAVOR == "aapsclient2"
override val NSCLIENT1 = BuildConfig.FLAVOR == "aapsclient"
override val NSCLIENT2 = BuildConfig.FLAVOR == "aapsclient2"
override val PUMPCONTROL = BuildConfig.FLAVOR == "pumpcontrol" override val PUMPCONTROL = BuildConfig.FLAVOR == "pumpcontrol"
override val PUMPDRIVERS = BuildConfig.FLAVOR == "full" || BuildConfig.FLAVOR == "pumpcontrol" override val PUMPDRIVERS = BuildConfig.FLAVOR == "full" || BuildConfig.FLAVOR == "pumpcontrol"
override val FLAVOR = BuildConfig.FLAVOR override val FLAVOR = BuildConfig.FLAVOR

View file

@ -20,7 +20,7 @@ buildscript {
material_version = '1.9.0' material_version = '1.9.0'
gridlayout_version = '1.0.0' gridlayout_version = '1.0.0'
constraintlayout_version = '2.1.4' constraintlayout_version = '2.1.4'
preferencektx_version = '1.2.0' preferencektx_version = '1.2.1'
commonslang3_version = '3.13.0' commonslang3_version = '3.13.0'
commonscodec_version = '1.16.0' commonscodec_version = '1.16.0'
guava_version = '32.1.2-jre' guava_version = '32.1.2-jre'

View file

@ -4,7 +4,9 @@ package info.nightscout.interfaces
interface Config { interface Config {
val SUPPORTED_NS_VERSION: Int val SUPPORTED_NS_VERSION: Int
val APS: Boolean val APS: Boolean
val NSCLIENT: Boolean val NSCLIENT: Boolean // aapsclient || aapsclient2
val NSCLIENT1: Boolean // aapsclient
val NSCLIENT2: Boolean // aapsclient2
val PUMPCONTROL: Boolean val PUMPCONTROL: Boolean
val PUMPDRIVERS: Boolean val PUMPDRIVERS: Boolean
val FLAVOR: String val FLAVOR: String

View file

@ -137,6 +137,7 @@ open class Notification {
const val PATCH_NOT_ACTIVE = 83 const val PATCH_NOT_ACTIVE = 83
const val PUMP_SETTINGS_FAILED = 84 const val PUMP_SETTINGS_FAILED = 84
const val PUMP_TIMEZONE_UPDATE_FAILED = 85 const val PUMP_TIMEZONE_UPDATE_FAILED = 85
const val BLUETOOTH_NOT_SUPPORTED = 86
const val USER_MESSAGE = 1000 const val USER_MESSAGE = 1000

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -376,6 +376,9 @@
<string name="carbs_g">SACHARIDY %1$d g</string> <string name="carbs_g">SACHARIDY %1$d g</string>
<string name="extended_bolus_u_min">ROZLOŽENÝ BOLUS %1$.2f U %2$d min</string> <string name="extended_bolus_u_min">ROZLOŽENÝ BOLUS %1$.2f U %2$d min</string>
<string name="load_events">NAČÍST UDÁLOSTI</string> <string name="load_events">NAČÍST UDÁLOSTI</string>
<string name="clear_alarms">SMAZAT ALARMY</string>
<string name="deactivate">DEAKTIVOVAT</string>
<string name="update_time">AKTUALIZOVAT ČAS</string>
<string name="load_history">NAČÍST HISTORII %1$d</string> <string name="load_history">NAČÍST HISTORII %1$d</string>
<string name="load_tdds">NAČÍST CDD</string> <string name="load_tdds">NAČÍST CDD</string>
<string name="set_profile">NASTAVIT PROFIL</string> <string name="set_profile">NASTAVIT PROFIL</string>
@ -453,6 +456,7 @@
<string name="cobvsiob">COB vs. IOB</string> <string name="cobvsiob">COB vs. IOB</string>
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!! Detekována pomalá absorbce sacharidů: %2$d%% času. Překontrolujte kalkulaci. COB může být nadhodnocené, a proto může být započítáno více inzulínu !!!!!</font>]]></string> <string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!! Detekována pomalá absorbce sacharidů: %2$d%% času. Překontrolujte kalkulaci. COB může být nadhodnocené, a proto může být započítáno více inzulínu !!!!!</font>]]></string>
<string name="partialboluswizard">Podat tuto část z výsledku kalkulace [%]</string> <string name="partialboluswizard">Podat tuto část z výsledku kalkulace [%]</string>
<string name="partialboluswizard_reset_time">Časový limit staré glykémie [min]</string>
<string name="bolus_constraint_applied_warn">Použito omezení bolusu: %1$.2f U na %2$.2f U</string> <string name="bolus_constraint_applied_warn">Použito omezení bolusu: %1$.2f U na %2$.2f U</string>
<string name="bolus_recorded_only">Bolus nebude pumpou vydán, pouze zaznamenán</string> <string name="bolus_recorded_only">Bolus nebude pumpou vydán, pouze zaznamenán</string>
<string name="advisoralarm">Spustit alarm, když je čas na jídlo</string> <string name="advisoralarm">Spustit alarm, když je čas na jídlo</string>

View file

@ -376,6 +376,9 @@
<string name="carbs_g">CARBOHIDRATOS %1$d g</string> <string name="carbs_g">CARBOHIDRATOS %1$d g</string>
<string name="extended_bolus_u_min">BOLO EXTENDIDO %1$.2f U %2$d min</string> <string name="extended_bolus_u_min">BOLO EXTENDIDO %1$.2f U %2$d min</string>
<string name="load_events">CARGAR EVENTOS</string> <string name="load_events">CARGAR EVENTOS</string>
<string name="clear_alarms">BORRAR ALARMAS</string>
<string name="deactivate">DESACTIVAR</string>
<string name="update_time">ACTUALIZAR HORA</string>
<string name="load_history">CARGAR HISTORIAL %1$d</string> <string name="load_history">CARGAR HISTORIAL %1$d</string>
<string name="load_tdds">CARGAR TDDs</string> <string name="load_tdds">CARGAR TDDs</string>
<string name="set_profile">ESTABLECER PERFIL</string> <string name="set_profile">ESTABLECER PERFIL</string>
@ -453,6 +456,7 @@
<string name="cobvsiob">COB vs IOB</string> <string name="cobvsiob">COB vs IOB</string>
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>¡Se ha detectado una absorción lenta de carbohidratos: %2$d%% de tiempo. Comprueba de nuevo el cálculo. Los COB se pueden sobrestimar, por lo que se podría administrar más insulina de la cuenta!</font>]]></string> <string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>¡Se ha detectado una absorción lenta de carbohidratos: %2$d%% de tiempo. Comprueba de nuevo el cálculo. Los COB se pueden sobrestimar, por lo que se podría administrar más insulina de la cuenta!</font>]]></string>
<string name="partialboluswizard">Administrar esta parte del resultado del asistente de bolos [%]</string> <string name="partialboluswizard">Administrar esta parte del resultado del asistente de bolos [%]</string>
<string name="partialboluswizard_reset_time">Antiguo umbral de tiempo de glucemia [min]</string>
<string name="bolus_constraint_applied_warn">Restricción de bolo aplicada: %1$.2f U a %2$.2f U</string> <string name="bolus_constraint_applied_warn">Restricción de bolo aplicada: %1$.2f U a %2$.2f U</string>
<string name="bolus_recorded_only">El bolo sólo se anotará (no será entregado por la bomba)</string> <string name="bolus_recorded_only">El bolo sólo se anotará (no será entregado por la bomba)</string>
<string name="advisoralarm">Ejecutar alarma cuando sea hora de comer</string> <string name="advisoralarm">Ejecutar alarma cuando sea hora de comer</string>

View file

@ -376,6 +376,9 @@
<string name="carbs_g">GLUCIDES %1$d g</string> <string name="carbs_g">GLUCIDES %1$d g</string>
<string name="extended_bolus_u_min">BOLUS ÉTENDU %1$.2f U %2$d min</string> <string name="extended_bolus_u_min">BOLUS ÉTENDU %1$.2f U %2$d min</string>
<string name="load_events">CHARGER LES ÉVÉNEMENTS</string> <string name="load_events">CHARGER LES ÉVÉNEMENTS</string>
<string name="clear_alarms">SUPPRIMER LES ALARMES</string>
<string name="deactivate">DÉSACTIVER</string>
<string name="update_time">METTRE À JOUR L\'HEURE</string>
<string name="load_history">CHARGER L\'HISTORIQUE %1$d</string> <string name="load_history">CHARGER L\'HISTORIQUE %1$d</string>
<string name="load_tdds">CHARGER les DTQ</string> <string name="load_tdds">CHARGER les DTQ</string>
<string name="set_profile">DÉFINIR LE PROFIL</string> <string name="set_profile">DÉFINIR LE PROFIL</string>
@ -451,8 +454,9 @@
<string name="bolus_advisor">Assistant bolus</string> <string name="bolus_advisor">Assistant bolus</string>
<string name="bolus_advisor_message">Vous avez une glycémie élevée. Au lieu de manger maintenant, il est recommandé d\'attendre une meilleure glycémie. Voulez-vous faire un bolus de correction maintenant et avoir une alerte quand il sera temps de manger ? Dans ce cas, aucun glucide ne sera enregistré et vous devrez utiliser l\'assistant à nouveau lorsque nous vous le rappelons.</string> <string name="bolus_advisor_message">Vous avez une glycémie élevée. Au lieu de manger maintenant, il est recommandé d\'attendre une meilleure glycémie. Voulez-vous faire un bolus de correction maintenant et avoir une alerte quand il sera temps de manger ? Dans ce cas, aucun glucide ne sera enregistré et vous devrez utiliser l\'assistant à nouveau lorsque nous vous le rappelons.</string>
<string name="cobvsiob">GA vs IA</string> <string name="cobvsiob">GA vs IA</string>
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!! Absorption lente des glucides détectée : %2$d%% du temps. Vérifiez de nouveau votre calcul. Les GA (Glucides Actifs) peuvent être surestimés et alors plus d\'insuline pourrait être délivré !!!!!</font>]]></string> <string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!! Absorption lente des glucides détectée dans %2$d%% des cas. Vérifiez de nouveau votre calcul. Les GA (Glucides Actifs) peuvent être surestimés et alors trop d\'insuline pourrait être injectée !!!!!</font>]]></string>
<string name="partialboluswizard">Injecter ce pourcentage du bolus calculé par lassistant [%]</string> <string name="partialboluswizard">Injecter ce pourcentage du bolus calculé par lassistant [%]</string>
<string name="partialboluswizard_reset_time">Durée limite après la dernière Gly reçue pour appliquer le % de bolus [min]</string>
<string name="bolus_constraint_applied_warn">Contrainte de Bolus appliquée : %1$.2f U vers %2$.2f U</string> <string name="bolus_constraint_applied_warn">Contrainte de Bolus appliquée : %1$.2f U vers %2$.2f U</string>
<string name="bolus_recorded_only">Les bolus seront seulement enregistrés (pas délivrés par la pompe)</string> <string name="bolus_recorded_only">Les bolus seront seulement enregistrés (pas délivrés par la pompe)</string>
<string name="advisoralarm">Alerter quand il est temps de manger</string> <string name="advisoralarm">Alerter quand il est temps de manger</string>

View file

@ -376,6 +376,7 @@
<string name="carbs_g">CHO %1$d g</string> <string name="carbs_g">CHO %1$d g</string>
<string name="extended_bolus_u_min">BOLO ESTESO %1$.2f U %2$d min</string> <string name="extended_bolus_u_min">BOLO ESTESO %1$.2f U %2$d min</string>
<string name="load_events">CARICA EVENTI</string> <string name="load_events">CARICA EVENTI</string>
<string name="deactivate">DISATTIVA</string>
<string name="load_history">CARICA STORICO %1$d</string> <string name="load_history">CARICA STORICO %1$d</string>
<string name="load_tdds">CARICA TDD</string> <string name="load_tdds">CARICA TDD</string>
<string name="set_profile">IMPOSTA PROFILO</string> <string name="set_profile">IMPOSTA PROFILO</string>
@ -453,6 +454,7 @@
<string name="cobvsiob">COB vs IOB</string> <string name="cobvsiob">COB vs IOB</string>
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!! Rilevato assorbimento lento dei carboidrati: %2$d%% del tempo. Ricontrolla il tuo calcolo. COB potrebbero essere sovrastimati e potrebbe essere somministrata più insulina !!!!!</font>]]></string> <string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!! Rilevato assorbimento lento dei carboidrati: %2$d%% del tempo. Ricontrolla il tuo calcolo. COB potrebbero essere sovrastimati e potrebbe essere somministrata più insulina !!!!!</font>]]></string>
<string name="partialboluswizard">Eroga parte del risultato del calcolatore [%]</string> <string name="partialboluswizard">Eroga parte del risultato del calcolatore [%]</string>
<string name="partialboluswizard_reset_time">Soglia tempo glicemia \"vecchia\" [min]</string>
<string name="bolus_constraint_applied_warn">Vincolo bolo applicato: %1$.2f U a %2$.2f U</string> <string name="bolus_constraint_applied_warn">Vincolo bolo applicato: %1$.2f U a %2$.2f U</string>
<string name="bolus_recorded_only">Il bolo sarà solo registrato (non erogato dal micro)</string> <string name="bolus_recorded_only">Il bolo sarà solo registrato (non erogato dal micro)</string>
<string name="advisoralarm">Esegui allarme quando è tempo di mangiare</string> <string name="advisoralarm">Esegui allarme quando è tempo di mangiare</string>

View file

@ -23,7 +23,7 @@
<string name="mgdl">мг/дл</string> <string name="mgdl">мг/дл</string>
<string name="mmol">ммоль/л</string> <string name="mmol">ммоль/л</string>
<string name="save">Сохранить</string> <string name="save">Сохранить</string>
<string name="snooze">Отложить</string> <string name="snooze">Убрать оповещение</string>
<string name="virtual_pump">Виртуальная помпа</string> <string name="virtual_pump">Виртуальная помпа</string>
<string name="constraints">Ограничения</string> <string name="constraints">Ограничения</string>
<string name="superbolus">Суперболюс</string> <string name="superbolus">Суперболюс</string>
@ -527,7 +527,7 @@
<string name="message">Сообщение</string> <string name="message">Сообщение</string>
<string name="ok">OK</string> <string name="ok">OK</string>
<string name="cancel">Отменить</string> <string name="cancel">Отменить</string>
<string name="dismiss">ОТКЛОНИТЬ</string> <string name="dismiss">УБРАТЬ</string>
<string name="yes">Да</string> <string name="yes">Да</string>
<string name="no">Нет</string> <string name="no">Нет</string>
<string name="close">Закрыть</string> <string name="close">Закрыть</string>

View file

@ -11,7 +11,8 @@ class IconsProviderImplementation @Inject constructor(private val config: Config
override fun getIcon(): Int = override fun getIcon(): Int =
when { when {
config.NSCLIENT -> info.nightscout.core.ui.R.mipmap.ic_yellowowl config.NSCLIENT2 -> info.nightscout.core.ui.R.mipmap.ic_blueowl
config.NSCLIENT1 -> info.nightscout.core.ui.R.mipmap.ic_yellowowl
config.PUMPCONTROL -> info.nightscout.core.ui.R.mipmap.ic_pumpcontrol config.PUMPCONTROL -> info.nightscout.core.ui.R.mipmap.ic_pumpcontrol
else -> info.nightscout.core.ui.R.mipmap.ic_launcher else -> info.nightscout.core.ui.R.mipmap.ic_launcher
} }

View file

@ -70,9 +70,9 @@
<string name="enable_smb_with_temp_target_summary">Activer les SMB lorsqu\'il y a une cible temporaire active (repas imminent, exercise)</string> <string name="enable_smb_with_temp_target_summary">Activer les SMB lorsqu\'il y a une cible temporaire active (repas imminent, exercise)</string>
<string name="enable_smb_with_high_temp_target">Activer les SMB avec cibles temp hautes</string> <string name="enable_smb_with_high_temp_target">Activer les SMB avec cibles temp hautes</string>
<string name="enable_smb_with_high_temp_target_summary">Activer les SMB quand il y a une cible temp haute active (exercise, au dessus de 100 mg/dl ou 5.5 mmol/l)</string> <string name="enable_smb_with_high_temp_target_summary">Activer les SMB quand il y a une cible temp haute active (exercise, au dessus de 100 mg/dl ou 5.5 mmol/l)</string>
<string name="smb_max_minutes_summary">Max minutes de basal pour limiter le SMB</string> <string name="smb_max_minutes_summary">Max minutes de basal comme limite des SMB</string>
<string name="uam_smb_max_minutes">SMB RNS minutes max</string> <string name="uam_smb_max_minutes">SMB RNS minutes max</string>
<string name="uam_smb_max_minutes_summary">Minutes de basal max pour limiter les SMB des RNS</string> <string name="uam_smb_max_minutes_summary">Minutes de basal max comme limite des SMB pendant les RNS</string>
<string name="carbs_req_threshold">Glucides minimum requis pour suggestion</string> <string name="carbs_req_threshold">Glucides minimum requis pour suggestion</string>
<string name="carbs_req_threshold_summary">Quantité de glucides minimum en g pour afficher une alerte de suggestion de glucides. Les suggestions inférieures ne déclencheront pas de notification.</string> <string name="carbs_req_threshold_summary">Quantité de glucides minimum en g pour afficher une alerte de suggestion de glucides. Les suggestions inférieures ne déclencheront pas de notification.</string>
<string name="lgs_threshold_summary">Valeur glycémique au-dessous de laquelle l\'injection de l\'insuline est suspendu. La valeur par défaut utilise le modèle standard de la cible. L\'utilisateur peut choisir entre 60mg/dl (3.3mmol/l) et 100mg/dl (5.5mmol/l). Les valeurs au-dessous de 65/3.6 déclenchent l\'utilisation du modèle standard</string> <string name="lgs_threshold_summary">Valeur glycémique au-dessous de laquelle l\'injection de l\'insuline est suspendu. La valeur par défaut utilise le modèle standard de la cible. L\'utilisateur peut choisir entre 60mg/dl (3.3mmol/l) et 100mg/dl (5.5mmol/l). Les valeurs au-dessous de 65/3.6 déclenchent l\'utilisation du modèle standard</string>

View file

@ -92,6 +92,7 @@
<string name="lastboluscompared">Ora ultimo bolo %1$s %2$s min fa</string> <string name="lastboluscompared">Ora ultimo bolo %1$s %2$s min fa</string>
<string name="triggercoblabel">COB</string> <string name="triggercoblabel">COB</string>
<string name="cobcompared">COB %1$s %2$.0f</string> <string name="cobcompared">COB %1$s %2$.0f</string>
<string name="triggerHeartRate">Frequenza cardiaca</string>
<string name="iob_u">IOB [U]:</string> <string name="iob_u">IOB [U]:</string>
<string name="distance_short">Dist [m]:</string> <string name="distance_short">Dist [m]:</string>
<string name="recurringTime">Tempo ricorrente</string> <string name="recurringTime">Tempo ricorrente</string>

View file

@ -92,6 +92,8 @@
<string name="lastboluscompared">Siste bolus for %1$s %2$s min siden</string> <string name="lastboluscompared">Siste bolus for %1$s %2$s min siden</string>
<string name="triggercoblabel">COB</string> <string name="triggercoblabel">COB</string>
<string name="cobcompared">COB %1$s %2$.0f</string> <string name="cobcompared">COB %1$s %2$.0f</string>
<string name="triggerHeartRate">Puls</string>
<string name="triggerHeartRateDesc">HR %1$s %2$.0f</string>
<string name="iob_u">IOB [U]:</string> <string name="iob_u">IOB [U]:</string>
<string name="distance_short">Dist [m]:</string> <string name="distance_short">Dist [m]:</string>
<string name="recurringTime">Gjentakende tidspunkt</string> <string name="recurringTime">Gjentakende tidspunkt</string>

View file

@ -92,6 +92,8 @@
<string name="lastboluscompared">Время болюса %1$s %2$s мин назад</string> <string name="lastboluscompared">Время болюса %1$s %2$s мин назад</string>
<string name="triggercoblabel">Активн углеводы</string> <string name="triggercoblabel">Активн углеводы</string>
<string name="cobcompared">Активн углеводы %1$s %2$.0f</string> <string name="cobcompared">Активн углеводы %1$s %2$.0f</string>
<string name="triggerHeartRate">Частота сердечных сокращений</string>
<string name="triggerHeartRateDesc">ЧСС%1$s%2$.0f</string>
<string name="iob_u">Акт инс IOB [U]:</string> <string name="iob_u">Акт инс IOB [U]:</string>
<string name="distance_short">Расст [м]:</string> <string name="distance_short">Расст [м]:</string>
<string name="recurringTime">Время повторения</string> <string name="recurringTime">Время повторения</string>

View file

@ -3,7 +3,9 @@ package info.nightscout.configuration.activities
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
import androidx.core.view.MenuProvider
import info.nightscout.configuration.R import info.nightscout.configuration.R
import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
@ -33,29 +35,32 @@ class SingleFragmentActivity : DaggerAppCompatActivityWithResult() {
supportFragmentManager.fragmentFactory.instantiate(ClassLoader.getSystemClassLoader(), plugin?.pluginDescription?.fragmentClass!!) supportFragmentManager.fragmentFactory.instantiate(ClassLoader.getSystemClassLoader(), plugin?.pluginDescription?.fragmentClass!!)
).commit() ).commit()
} }
// Add menu items without overriding methods in the Activity
addMenuProvider(object : MenuProvider {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
if (plugin?.preferencesId != -1) menuInflater.inflate(R.menu.menu_single_fragment, menu)
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean = override fun onMenuItemSelected(menuItem: MenuItem): Boolean =
when (item.itemId) { when (menuItem.itemId) {
android.R.id.home -> { android.R.id.home -> {
finish() onBackPressedDispatcher.onBackPressed()
true true
} }
R.id.nav_plugin_preferences -> { R.id.nav_plugin_preferences -> {
protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, { protectionCheck.queryProtection(this@SingleFragmentActivity, ProtectionCheck.Protection.PREFERENCES, {
val i = Intent(this, uiInteraction.preferencesActivity) val i = Intent(this@SingleFragmentActivity, uiInteraction.preferencesActivity)
i.putExtra("id", plugin?.preferencesId) .setAction("info.nightscout.configuration.activities.SingleFragmentActivity")
.putExtra("id", plugin?.preferencesId)
startActivity(i) startActivity(i)
}, null) }, null)
true true
} }
else -> super.onOptionsItemSelected(item) else -> false
} }
})
override fun onCreateOptionsMenu(menu: Menu): Boolean {
if (plugin?.preferencesId != -1) menuInflater.inflate(R.menu.menu_single_fragment, menu)
return super.onCreateOptionsMenu(menu)
} }
} }

View file

@ -3,9 +3,12 @@ package info.nightscout.configuration.maintenance.activities
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.MenuProvider
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -41,6 +44,21 @@ class PrefImportListActivity : TranslatedDaggerAppCompatActivity() {
binding.recyclerview.layoutManager = LinearLayoutManager(this) binding.recyclerview.layoutManager = LinearLayoutManager(this)
binding.recyclerview.adapter = RecyclerViewAdapter(prefFileListProvider.listPreferenceFiles(loadMetadata = true)) binding.recyclerview.adapter = RecyclerViewAdapter(prefFileListProvider.listPreferenceFiles(loadMetadata = true))
// Add menu items without overriding methods in the Activity
addMenuProvider(object : MenuProvider {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {}
override fun onMenuItemSelected(menuItem: MenuItem): Boolean =
when (menuItem.itemId) {
android.R.id.home -> {
onBackPressedDispatcher.onBackPressed()
true
}
else -> false
}
})
} }
inner class RecyclerViewAdapter internal constructor(private var prefFileList: List<PrefsFile>) : RecyclerView.Adapter<RecyclerViewAdapter.PrefFileViewHolder>() { inner class RecyclerViewAdapter internal constructor(private var prefFileList: List<PrefsFile>) : RecyclerView.Adapter<RecyclerViewAdapter.PrefFileViewHolder>() {
@ -106,12 +124,4 @@ class PrefImportListActivity : TranslatedDaggerAppCompatActivity() {
} }
} }
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
finish()
return true
}
return super.onOptionsItemSelected(item)
}
} }

View file

@ -4,6 +4,7 @@ import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.widget.TextView import android.widget.TextView
import androidx.activity.OnBackPressedCallback
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.configuration.R import info.nightscout.configuration.R
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
@ -64,6 +65,12 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
generateLayout() generateLayout()
updateButtons() updateButtons()
} }
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if (currentWizardPage == 0)
OKDialog.showConfirmation(this@SetupWizardActivity, rh.gs(R.string.exitwizard)) { finish() } else showPreviousPage(null)
}
})
} }
override fun onPause() { override fun onPause() {
@ -134,10 +141,6 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
} }
} }
override fun onBackPressed() {
if (currentWizardPage == 0) OKDialog.showConfirmation(this, rh.gs(R.string.exitwizard)) { finish() } else showPreviousPage(null)
}
@Suppress("UNUSED_PARAMETER") @Suppress("UNUSED_PARAMETER")
fun exitPressed(view: View?) { fun exitPressed(view: View?) {
sp.putBoolean(R.string.key_setupwizard_processed, true) sp.putBoolean(R.string.key_setupwizard_processed, true)
@ -147,7 +150,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
@Suppress("UNUSED_PARAMETER") @Suppress("UNUSED_PARAMETER")
fun showNextPage(view: View?) { fun showNextPage(view: View?) {
finish() finish()
val intent = Intent(this, SetupWizardActivity::class.java) val intent = Intent(this, SetupWizardActivity::class.java).setAction("info.nightscout.configuration.setupwizard.SetupWizardActivity")
intent.putExtra(intentMessage, nextPage(null)) intent.putExtra(intentMessage, nextPage(null))
startActivity(intent) startActivity(intent)
} }
@ -155,7 +158,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
@Suppress("UNUSED_PARAMETER") @Suppress("UNUSED_PARAMETER")
fun showPreviousPage(view: View?) { fun showPreviousPage(view: View?) {
finish() finish()
val intent = Intent(this, SetupWizardActivity::class.java) val intent = Intent(this, SetupWizardActivity::class.java).setAction("info.nightscout.configuration.setupwizard.SetupWizardActivity")
intent.putExtra(intentMessage, previousPage(null)) intent.putExtra(intentMessage, previousPage(null))
startActivity(intent) startActivity(intent)
} }
@ -164,7 +167,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
@Suppress("UNUSED_PARAMETER") @Suppress("UNUSED_PARAMETER")
fun finishSetupWizard(view: View?) { fun finishSetupWizard(view: View?) {
sp.putBoolean(R.string.key_setupwizard_processed, true) sp.putBoolean(R.string.key_setupwizard_processed, true)
val intent = Intent(this, uiInteraction.mainActivity) val intent = Intent(this, uiInteraction.mainActivity).setAction("info.nightscout.configuration.setupwizard.SetupWizardActivity")
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(intent) startActivity(intent)
finish() finish()

View file

@ -243,6 +243,7 @@
<string name="short_tabtitles">Krátké názvy modulů</string> <string name="short_tabtitles">Krátké názvy modulů</string>
<string name="overview_show_notes_field_in_dialogs_title">Zobrazovat kolonku poznámky v dialozích ošetření</string> <string name="overview_show_notes_field_in_dialogs_title">Zobrazovat kolonku poznámky v dialozích ošetření</string>
<string name="deliverpartofboluswizard">Kalkulátor provede výpočet, ale dodána je pouze tato část inzulínu. Výhodné při používání SMB algoritmu.</string> <string name="deliverpartofboluswizard">Kalkulátor provede výpočet, ale dodána je pouze tato část inzulínu. Výhodné při používání SMB algoritmu.</string>
<string name="deliver_part_of_boluswizard_reset_time">Vydat celý bolus (100%), pokud je glykémie starší než</string>
<string name="enable_bolus_advisor">Povolit poradce s bolusem</string> <string name="enable_bolus_advisor">Povolit poradce s bolusem</string>
<string name="enable_bolus_advisor_summary">Při vysoké glykémii použijte připomenutí, abyste začali jíst později, namísto výsledku z kalkulátoru („prebolus“)</string> <string name="enable_bolus_advisor_summary">Při vysoké glykémii použijte připomenutí, abyste začali jíst později, namísto výsledku z kalkulátoru („prebolus“)</string>
<string name="enablesuperbolus">Povolit superbolus</string> <string name="enablesuperbolus">Povolit superbolus</string>
@ -315,6 +316,11 @@
<string name="wear_notifysmb_summary">Ukazovat SMB na hodinkách jako normální bolus.</string> <string name="wear_notifysmb_summary">Ukazovat SMB na hodinkách jako normální bolus.</string>
<string name="wear_predictions_summary">Zobrazovat predikce na hodinkách.</string> <string name="wear_predictions_summary">Zobrazovat predikce na hodinkách.</string>
<string name="wear_predictions_title">Predikce</string> <string name="wear_predictions_title">Predikce</string>
<string name="wear_custom_watchface">Vlastní ciferník: %1$s</string>
<string name="wear_load_watchface">Nahrát ciferník</string>
<string name="wear_send_watchface">Odeslat ciferník</string>
<string name="wear_export_watchface">Exportovat ciferník</string>
<string name="wear_new_custom_watchface_exported">Vlastní ciferník exportován</string>
<string name="resend_all_data">Znovu poslat všechna data</string> <string name="resend_all_data">Znovu poslat všechna data</string>
<string name="open_settings_on_wear">Otevřít nastavení na hodinkách Wear</string> <string name="open_settings_on_wear">Otevřít nastavení na hodinkách Wear</string>
<!-- PersistentNotification--> <!-- PersistentNotification-->

View file

@ -243,6 +243,7 @@
<string name="short_tabtitles">Nombres cortos en pestañas</string> <string name="short_tabtitles">Nombres cortos en pestañas</string>
<string name="overview_show_notes_field_in_dialogs_title">Mostrar el campo notas en diálogos de tratamientos</string> <string name="overview_show_notes_field_in_dialogs_title">Mostrar el campo notas en diálogos de tratamientos</string>
<string name="deliverpartofboluswizard">El asistente de bolos realiza el cálculo, pero solo se entrega esta parte de la insulina calculada. Útil con el algoritmo SMB.</string> <string name="deliverpartofboluswizard">El asistente de bolos realiza el cálculo, pero solo se entrega esta parte de la insulina calculada. Útil con el algoritmo SMB.</string>
<string name="deliver_part_of_boluswizard_reset_time">Administrar bolo completo (100%) si la glucemia es mayor de</string>
<string name="enable_bolus_advisor">Habilitar asistente de bolo</string> <string name="enable_bolus_advisor">Habilitar asistente de bolo</string>
<string name="enable_bolus_advisor_summary">Utiliza un recordatorio para empezar a comer más tarde, en lugar del resultado del asistente durante una glucemia alta (\"pre-bolo\")</string> <string name="enable_bolus_advisor_summary">Utiliza un recordatorio para empezar a comer más tarde, en lugar del resultado del asistente durante una glucemia alta (\"pre-bolo\")</string>
<string name="enablesuperbolus">Activar superbolo en asistente</string> <string name="enablesuperbolus">Activar superbolo en asistente</string>

View file

@ -243,6 +243,7 @@
<string name="short_tabtitles">Raccourcir les titres des onglets</string> <string name="short_tabtitles">Raccourcir les titres des onglets</string>
<string name="overview_show_notes_field_in_dialogs_title">Affiche les notes dans les dialogues</string> <string name="overview_show_notes_field_in_dialogs_title">Affiche les notes dans les dialogues</string>
<string name="deliverpartofboluswizard">L\'assistant bolus effectue le calcul mais seulement ce pourcentage de l\'insuline calculée est délivré. Utile avec l\'algorithme SMB.</string> <string name="deliverpartofboluswizard">L\'assistant bolus effectue le calcul mais seulement ce pourcentage de l\'insuline calculée est délivré. Utile avec l\'algorithme SMB.</string>
<string name="deliver_part_of_boluswizard_reset_time">Faire un bolus complet (100%) si la glycémie est plus ancienne que</string>
<string name="enable_bolus_advisor">Activer l\'assistant bolus</string> <string name="enable_bolus_advisor">Activer l\'assistant bolus</string>
<string name="enable_bolus_advisor_summary">Utiliser un rappel pour commencer le repas à la place du résultat de l\'assistant quand la glycémie est élevée (\"pré-bolus\")</string> <string name="enable_bolus_advisor_summary">Utiliser un rappel pour commencer le repas à la place du résultat de l\'assistant quand la glycémie est élevée (\"pré-bolus\")</string>
<string name="enablesuperbolus">Activer les Superbolus dans lAssistant</string> <string name="enablesuperbolus">Activer les Superbolus dans lAssistant</string>

View file

@ -243,6 +243,7 @@
<string name="short_tabtitles">Accorcia titoli schede</string> <string name="short_tabtitles">Accorcia titoli schede</string>
<string name="overview_show_notes_field_in_dialogs_title">Finestre tratt.nto: mostra campo note</string> <string name="overview_show_notes_field_in_dialogs_title">Finestre tratt.nto: mostra campo note</string>
<string name="deliverpartofboluswizard">Il calcolatore esegue il calcolo, ma solo questa parte dell\'insulina calcolata è erogata. Utile con algoritmo SMB.</string> <string name="deliverpartofboluswizard">Il calcolatore esegue il calcolo, ma solo questa parte dell\'insulina calcolata è erogata. Utile con algoritmo SMB.</string>
<string name="deliver_part_of_boluswizard_reset_time">Eroga bolo completo (100%) se la glicemia è più \"vecchia\" di</string>
<string name="enable_bolus_advisor">Abilita consiglio bolo</string> <string name="enable_bolus_advisor">Abilita consiglio bolo</string>
<string name="enable_bolus_advisor_summary">Usa un promemoria per iniziare a mangiare invece del risultato del calcolatore durante la glicemia alta (\"pre-bolo\")</string> <string name="enable_bolus_advisor_summary">Usa un promemoria per iniziare a mangiare invece del risultato del calcolatore durante la glicemia alta (\"pre-bolo\")</string>
<string name="enablesuperbolus">Abilita superbolo nel calcolatore</string> <string name="enablesuperbolus">Abilita superbolo nel calcolatore</string>

View file

@ -3,11 +3,15 @@ package info.nightscout.plugins.sync.openhumans.ui
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import android.widget.CheckBox import android.widget.CheckBox
import androidx.activity.OnBackPressedCallback
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.browser.customtabs.CustomTabsIntent import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.view.MenuProvider
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
@ -94,6 +98,25 @@ class OHLoginActivity : TranslatedDaggerAppCompatActivity() {
if (code != null) { if (code != null) {
viewModel.submitBearerToken(code) viewModel.submitBearerToken(code)
} }
// Add menu items without overriding methods in the Activity
addMenuProvider(object : MenuProvider {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {}
override fun onMenuItemSelected(menuItem: MenuItem): Boolean =
when (menuItem.itemId) {
android.R.id.home -> {
onBackPressedDispatcher.onBackPressed()
true
}
else -> false
}
})
onBackPressedDispatcher.addCallback(this, object: OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if (!viewModel.goBack()) finish()
}
})
} }
override fun onNewIntent(intent: Intent) { override fun onNewIntent(intent: Intent) {
@ -103,21 +126,4 @@ class OHLoginActivity : TranslatedDaggerAppCompatActivity() {
viewModel.submitBearerToken(code) viewModel.submitBearerToken(code)
} }
} }
override fun onBackPressed() {
if (!viewModel.goBack()) {
@Suppress("DEPRECATION")
super.onBackPressed()
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean =
if (item.itemId == android.R.id.home) {
@Suppress("DEPRECATION")
onBackPressed()
true
} else {
super.onOptionsItemSelected(item)
}
} }

View file

@ -12,6 +12,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.comboctl.android.AndroidBluetoothInterface import info.nightscout.comboctl.android.AndroidBluetoothInterface
import info.nightscout.comboctl.base.BasicProgressStage import info.nightscout.comboctl.base.BasicProgressStage
import info.nightscout.comboctl.base.BluetoothException import info.nightscout.comboctl.base.BluetoothException
import info.nightscout.comboctl.base.BluetoothNotAvailableException
import info.nightscout.comboctl.base.BluetoothNotEnabledException import info.nightscout.comboctl.base.BluetoothNotEnabledException
import info.nightscout.comboctl.base.ComboException import info.nightscout.comboctl.base.ComboException
import info.nightscout.comboctl.base.DisplayFrame import info.nightscout.comboctl.base.DisplayFrame
@ -346,10 +347,24 @@ class ComboV2Plugin @Inject constructor (
_pairedStateUIFlow.value = paired _pairedStateUIFlow.value = paired
pumpManager = newPumpManager pumpManager = newPumpManager
} catch (_: BluetoothNotAvailableException) {
uiInteraction.addNotification(
Notification.BLUETOOTH_NOT_SUPPORTED,
text = rh.gs(R.string.combov2_bluetooth_not_supported),
level = Notification.URGENT
)
// Deliberately _not_ setting the driver state here before
// exiting this scope. We are essentially aborting the start
// since Bluetooth is not supported by the hardware, so the
// driver cannot do anything, and therefore cannot leave the
// DriverState.NotInitialized state.
aapsLogger.error(LTag.PUMP, "combov2 driver start cannot be completed since the hardware does not support Bluetooth")
return@runWithPermissionCheck
} catch (_: BluetoothNotEnabledException) { } catch (_: BluetoothNotEnabledException) {
uiInteraction.addNotification( uiInteraction.addNotification(
Notification.BLUETOOTH_NOT_ENABLED, Notification.BLUETOOTH_NOT_ENABLED,
text = rh.gs(info.nightscout.core.ui.R.string.ble_not_enabled), text = rh.gs(R.string.combov2_bluetooth_disabled),
level = Notification.INFO level = Notification.INFO
) )
@ -761,7 +776,7 @@ class ComboV2Plugin @Inject constructor (
} catch (_: BluetoothNotEnabledException) { } catch (_: BluetoothNotEnabledException) {
uiInteraction.addNotification( uiInteraction.addNotification(
Notification.BLUETOOTH_NOT_ENABLED, Notification.BLUETOOTH_NOT_ENABLED,
text = rh.gs(info.nightscout.core.ui.R.string.ble_not_enabled), text = rh.gs(R.string.combov2_bluetooth_disabled),
level = Notification.INFO level = Notification.INFO
) )
} catch (e: Exception) { } catch (e: Exception) {

View file

@ -9,6 +9,7 @@ import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.View import android.view.View
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.OnBackPressedCallback
import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
@ -17,9 +18,11 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle import androidx.lifecycle.repeatOnLifecycle
import info.nightscout.comboctl.base.BasicProgressStage import info.nightscout.comboctl.base.BasicProgressStage
import info.nightscout.comboctl.base.PAIRING_PIN_SIZE
import info.nightscout.comboctl.base.PairingPIN import info.nightscout.comboctl.base.PairingPIN
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.pump.combov2.ComboV2Plugin import info.nightscout.pump.combov2.ComboV2Plugin
import info.nightscout.pump.combov2.R import info.nightscout.pump.combov2.R
import info.nightscout.pump.combov2.databinding.Combov2PairingActivityBinding import info.nightscout.pump.combov2.databinding.Combov2PairingActivityBinding
@ -184,13 +187,13 @@ class ComboV2PairingActivity : TranslatedDaggerAppCompatActivity() {
.launchIn(this) .launchIn(this)
} }
} }
} onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
override fun onBackPressed() {
aapsLogger.info(LTag.PUMP, "User pressed the back button; cancelling any ongoing pairing") aapsLogger.info(LTag.PUMP, "User pressed the back button; cancelling any ongoing pairing")
combov2Plugin.cancelPairing() combov2Plugin.cancelPairing()
@Suppress("DEPRECATION") finish()
super.onBackPressed() }
})
} }
override fun onDestroy() { override fun onDestroy() {
@ -334,6 +337,10 @@ class ComboV2PairingActivity : TranslatedDaggerAppCompatActivity() {
// We need to skip whitespaces since the // We need to skip whitespaces since the
// TextWatcher above inserts some. // TextWatcher above inserts some.
val pinString = binding.combov2PinEntryEdit.text.replace(whitespaceRemovalRegex, "") val pinString = binding.combov2PinEntryEdit.text.replace(whitespaceRemovalRegex, "")
if (pinString.length != PAIRING_PIN_SIZE) {
ToastUtils.showToastInUiThread(this, rh.gs(R.string.combov2_pairing_invalid_pin_length, PAIRING_PIN_SIZE, pinString.length))
return@setOnClickListener
}
runBlocking { runBlocking {
val PIN = PairingPIN(pinString.map { it - '0' }.toIntArray()) val PIN = PairingPIN(pinString.map { it - '0' }.toIntArray())
combov2Plugin.providePairingPIN(PIN) combov2Plugin.providePairingPIN(PIN)

View file

@ -47,6 +47,7 @@ Pokud po více než ~5 minutách není navázáno žádné spojení:\n\n
<string name="combov2_pairing_combo_scan_timeout_reached">Časový limit pro vyhledávání Combo dosažen</string> <string name="combov2_pairing_combo_scan_timeout_reached">Časový limit pro vyhledávání Combo dosažen</string>
<string name="combov2_pairing_failed_due_to_error">Párování se nezdařilo z důvodu chyby: %1$s</string> <string name="combov2_pairing_failed_due_to_error">Párování se nezdařilo z důvodu chyby: %1$s</string>
<string name="combov2_pairing_aborted_unknown_reasons">Párování přerušeno z neznámých důvodů</string> <string name="combov2_pairing_aborted_unknown_reasons">Párování přerušeno z neznámých důvodů</string>
<string name="combov2_pairing_invalid_pin_length">"Neplatná délka PINu párování: potřeba %1$d číslic, zadáno %2$d"</string>
<string name="combov2_scanning_for_pump">Vyhledávání pumpy</string> <string name="combov2_scanning_for_pump">Vyhledávání pumpy</string>
<string name="combov2_establishing_bt_connection">Navazování připojení Bluetooth (pokus č. %1$d)</string> <string name="combov2_establishing_bt_connection">Navazování připojení Bluetooth (pokus č. %1$d)</string>
<string name="combov2_pairing_performing_handshake">Provádím navazování spojení s pumpou</string> <string name="combov2_pairing_performing_handshake">Provádím navazování spojení s pumpou</string>
@ -124,4 +125,6 @@ Pokud po více než ~5 minutách není navázáno žádné spojení:\n\n
<string name="combov2_refresh_pump_status_after_error">Obnovování stavu pumpy po nahlášení chyby</string> <string name="combov2_refresh_pump_status_after_error">Obnovování stavu pumpy po nahlášení chyby</string>
<string name="combov2_go_back">Zpět</string> <string name="combov2_go_back">Zpět</string>
<string name="combov2_cannot_pair_driver_not_initialized_explanation">Nelze provést párování, protože ovladač není inicializován. To se obvykle stává, protože nebyla udělena potřebná oprávnění Bluetooth. Jděte zpět, udělte oprávnění Bluetooth, pak zkuste znovu spárovat.</string> <string name="combov2_cannot_pair_driver_not_initialized_explanation">Nelze provést párování, protože ovladač není inicializován. To se obvykle stává, protože nebyla udělena potřebná oprávnění Bluetooth. Jděte zpět, udělte oprávnění Bluetooth, pak zkuste znovu spárovat.</string>
<string name="combov2_bluetooth_disabled">Nelze spustit ovladač - Bluetooth je zakázáno</string>
<string name="combov2_bluetooth_not_supported">Ovladač nelze spustit - toto zařízení nepodporuje Bluetooth</string>
</resources> </resources>

View file

@ -47,6 +47,7 @@ Si no puedes establecer ninguna conexión después de unos ~5 minutos:\n\n
<string name="combov2_pairing_combo_scan_timeout_reached">Tiempo de espera de escaneo alcanzado</string> <string name="combov2_pairing_combo_scan_timeout_reached">Tiempo de espera de escaneo alcanzado</string>
<string name="combov2_pairing_failed_due_to_error">No se pudo emparejar debido al error: %1$s</string> <string name="combov2_pairing_failed_due_to_error">No se pudo emparejar debido al error: %1$s</string>
<string name="combov2_pairing_aborted_unknown_reasons">Emparejamiento abortado por razones desconocidas</string> <string name="combov2_pairing_aborted_unknown_reasons">Emparejamiento abortado por razones desconocidas</string>
<string name="combov2_pairing_invalid_pin_length">"Longitud del PIN de emparejamiento inválida: Necesita %1$d digits, obtuvo %2$d"</string>
<string name="combov2_scanning_for_pump">Buscando bomba</string> <string name="combov2_scanning_for_pump">Buscando bomba</string>
<string name="combov2_establishing_bt_connection">Estableciendo conexión Bluetooth (intento número %1$d)</string> <string name="combov2_establishing_bt_connection">Estableciendo conexión Bluetooth (intento número %1$d)</string>
<string name="combov2_pairing_performing_handshake">Realizando emparejamiento con la bomba</string> <string name="combov2_pairing_performing_handshake">Realizando emparejamiento con la bomba</string>
@ -124,4 +125,6 @@ Si no puedes establecer ninguna conexión después de unos ~5 minutos:\n\n
<string name="combov2_refresh_pump_status_after_error">Actualizando el estado de la bomba después de que informara de un error</string> <string name="combov2_refresh_pump_status_after_error">Actualizando el estado de la bomba después de que informara de un error</string>
<string name="combov2_go_back">Retroceder</string> <string name="combov2_go_back">Retroceder</string>
<string name="combov2_cannot_pair_driver_not_initialized_explanation">No se puede realizar el emparejamiento porque el controlador no está inicializado. Esto suele ocurrir porque no se han concedido los permisos Bluetooth necesarios. Vuelve atrás, concede los permisos Bluetooth e intenta de nuevo el emparejamiento</string> <string name="combov2_cannot_pair_driver_not_initialized_explanation">No se puede realizar el emparejamiento porque el controlador no está inicializado. Esto suele ocurrir porque no se han concedido los permisos Bluetooth necesarios. Vuelve atrás, concede los permisos Bluetooth e intenta de nuevo el emparejamiento</string>
<string name="combov2_bluetooth_disabled">No se puede iniciar el controlador - El bluetooth está desactivado</string>
<string name="combov2_bluetooth_not_supported">El controlador no puede ejecutarse - este dispositivo no es compatible con Bluetooth</string>
</resources> </resources>

View file

@ -97,6 +97,7 @@ Se non viene stabilita alcuna connessione dopo più di ~5 minuti:\n\n
<string name="combov2_set_emulated_100_tbr">Imposta TBR 100% (emulato)</string> <string name="combov2_set_emulated_100_tbr">Imposta TBR 100% (emulato)</string>
<string name="combov2_letting_emulated_100_tbr_finish">Lasciando finire il TBR 100% (emulato) in esecuzione</string> <string name="combov2_letting_emulated_100_tbr_finish">Lasciando finire il TBR 100% (emulato) in esecuzione</string>
<string name="combov2_ignoring_redundant_100_tbr">TBR 100%: ignorando la richiesta ridondante</string> <string name="combov2_ignoring_redundant_100_tbr">TBR 100%: ignorando la richiesta ridondante</string>
<string name="combov2_hit_unexpected_tbr_limit">Limite inatteso riscontrato durante la regolazione di TBR: la percentuale target era %1$d%%, raggiunto un limite a %2$d%%</string>
<string name="combov2_cannot_set_absolute_tbr_if_basal_zero">Impossibile impostare un TBR assoluto se la velocità basale di base è zero</string> <string name="combov2_cannot_set_absolute_tbr_if_basal_zero">Impossibile impostare un TBR assoluto se la velocità basale di base è zero</string>
<string name="combov2_pair_with_pump_summary">Associa AndroidAPS e Android con un micro Accu-Chek Combo attualmente non associato</string> <string name="combov2_pair_with_pump_summary">Associa AndroidAPS e Android con un micro Accu-Chek Combo attualmente non associato</string>
<string name="combov2_unpair_pump_summary">Disassocia AndroidAPS e Android dal micro Accu-Chek Combo attualmente associato</string> <string name="combov2_unpair_pump_summary">Disassocia AndroidAPS e Android dal micro Accu-Chek Combo attualmente associato</string>

View file

@ -90,6 +90,7 @@
<string name="combov2_set_emulated_100_tbr">הגדר בזאלי זמני 100% מדומה</string> <string name="combov2_set_emulated_100_tbr">הגדר בזאלי זמני 100% מדומה</string>
<string name="combov2_letting_emulated_100_tbr_finish">מאפשר לבזאלי הזמני 100% המדומה לסיים</string> <string name="combov2_letting_emulated_100_tbr_finish">מאפשר לבזאלי הזמני 100% המדומה לסיים</string>
<string name="combov2_ignoring_redundant_100_tbr">מתעלם מבקשה מיותרת של בזאלי זמני 100%</string> <string name="combov2_ignoring_redundant_100_tbr">מתעלם מבקשה מיותרת של בזאלי זמני 100%</string>
<string name="combov2_hit_unexpected_tbr_limit">נמצאה מגבלה בלתי צפוי בעת הגדרת בזאלי זמני: אחוז המטרה היה %1$d%% והגיע למגבלה ב-%2$d%%</string>
<string name="combov2_cannot_set_absolute_tbr_if_basal_zero">לא ניתן להגדיר בזאלי זמני אם המינון הבזאלי הבסיסי הוא 0</string> <string name="combov2_cannot_set_absolute_tbr_if_basal_zero">לא ניתן להגדיר בזאלי זמני אם המינון הבזאלי הבסיסי הוא 0</string>
<string name="combov2_pair_with_pump_summary">צימוד AndroidAPS ואנדרואיד עם משאבת Accu-Chek combo שאינה מצומדת</string> <string name="combov2_pair_with_pump_summary">צימוד AndroidAPS ואנדרואיד עם משאבת Accu-Chek combo שאינה מצומדת</string>
<string name="combov2_unpair_pump_summary">ביטול צימוד AndroidAPS ואנדרואיד ממשאבת Accu-Chek combo המצומדת</string> <string name="combov2_unpair_pump_summary">ביטול צימוד AndroidAPS ואנדרואיד ממשאבת Accu-Chek combo המצומדת</string>

View file

@ -98,6 +98,7 @@ knappene samtidig for å avbryte parringen)\n
<string name="combov2_set_emulated_100_tbr">Angi emulert 100% TBR</string> <string name="combov2_set_emulated_100_tbr">Angi emulert 100% TBR</string>
<string name="combov2_letting_emulated_100_tbr_finish">Lar aktive emulert 100% TBR få avslutte</string> <string name="combov2_letting_emulated_100_tbr_finish">Lar aktive emulert 100% TBR få avslutte</string>
<string name="combov2_ignoring_redundant_100_tbr">Ignorerer redundant 100% TBR forespørsel</string> <string name="combov2_ignoring_redundant_100_tbr">Ignorerer redundant 100% TBR forespørsel</string>
<string name="combov2_hit_unexpected_tbr_limit">Uventet begrensning oppsto ved justering av TBR: målprosenten var %1$d%%, nådde grense på %2$d%%</string>
<string name="combov2_cannot_set_absolute_tbr_if_basal_zero">Kan ikke sette absolutt TBR hvis basalraten er null</string> <string name="combov2_cannot_set_absolute_tbr_if_basal_zero">Kan ikke sette absolutt TBR hvis basalraten er null</string>
<string name="combov2_pair_with_pump_summary">Sammenkoble AndroidAPS og Android med en ikke-tilkoblet Accu-Chek Combo pumpe</string> <string name="combov2_pair_with_pump_summary">Sammenkoble AndroidAPS og Android med en ikke-tilkoblet Accu-Chek Combo pumpe</string>
<string name="combov2_unpair_pump_summary">Koble fra AndroidAPS og Android fra den ilkoblede Accu-Chek Combo pumpen</string> <string name="combov2_unpair_pump_summary">Koble fra AndroidAPS og Android fra den ilkoblede Accu-Chek Combo pumpen</string>

View file

@ -98,6 +98,7 @@
<string name="combov2_set_emulated_100_tbr">Установить эмуляцию. временного базала TBR 100%</string> <string name="combov2_set_emulated_100_tbr">Установить эмуляцию. временного базала TBR 100%</string>
<string name="combov2_letting_emulated_100_tbr_finish">Позволить завершиться текущей эмуляции временного базала 100% TBR</string> <string name="combov2_letting_emulated_100_tbr_finish">Позволить завершиться текущей эмуляции временного базала 100% TBR</string>
<string name="combov2_ignoring_redundant_100_tbr">Игнорирование избыточного запроса на 100% TBR</string> <string name="combov2_ignoring_redundant_100_tbr">Игнорирование избыточного запроса на 100% TBR</string>
<string name="combov2_hit_unexpected_tbr_limit">При настройке ВБС: обнаружен непредвиденный предел: целевой процент %1$d%%, достиг предела %2$d%%</string>
<string name="combov2_cannot_set_absolute_tbr_if_basal_zero">Невозможно установить абсолютный TBR, если базовая скорость равна нулю</string> <string name="combov2_cannot_set_absolute_tbr_if_basal_zero">Невозможно установить абсолютный TBR, если базовая скорость равна нулю</string>
<string name="combov2_pair_with_pump_summary">Выполнить сопряжение AndroidAPS и Android с помпой Accu-Chek Combo</string> <string name="combov2_pair_with_pump_summary">Выполнить сопряжение AndroidAPS и Android с помпой Accu-Chek Combo</string>
<string name="combov2_unpair_pump_summary">Отключить AndroidAPS и AndroidAPS от помпы Accu-Chek Combo</string> <string name="combov2_unpair_pump_summary">Отключить AndroidAPS и AndroidAPS от помпы Accu-Chek Combo</string>

View file

@ -53,6 +53,7 @@ buttons at the same time to cancel pairing)\n
<string name="combov2_pairing_combo_scan_timeout_reached">Combo scan timeout reached</string> <string name="combov2_pairing_combo_scan_timeout_reached">Combo scan timeout reached</string>
<string name="combov2_pairing_failed_due_to_error">Pairing failed due to error: %1$s</string> <string name="combov2_pairing_failed_due_to_error">Pairing failed due to error: %1$s</string>
<string name="combov2_pairing_aborted_unknown_reasons">Pairing aborted for unknown reasons</string> <string name="combov2_pairing_aborted_unknown_reasons">Pairing aborted for unknown reasons</string>
<string name="combov2_pairing_invalid_pin_length">"Invalid pairing PIN length: need %1$d digits, got %2$d"</string>
<string name="combov2_scanning_for_pump">Scanning for pump</string> <string name="combov2_scanning_for_pump">Scanning for pump</string>
<string name="combov2_establishing_bt_connection">Establishing Bluetooth connection (attempt no. %1$d)</string> <string name="combov2_establishing_bt_connection">Establishing Bluetooth connection (attempt no. %1$d)</string>
<string name="combov2_pairing_performing_handshake">Performing handshake with pump</string> <string name="combov2_pairing_performing_handshake">Performing handshake with pump</string>
@ -139,4 +140,6 @@ buttons at the same time to cancel pairing)\n
<string name="combov2_refresh_pump_status_after_error">Refreshing pump status after the pump reported an error</string> <string name="combov2_refresh_pump_status_after_error">Refreshing pump status after the pump reported an error</string>
<string name="combov2_go_back">Go back</string> <string name="combov2_go_back">Go back</string>
<string name="combov2_cannot_pair_driver_not_initialized_explanation">Cannot perform pairing because the driver is not initialized. This typically happens because the necessary Bluetooth permissions have not been granted. Go back, grant the Bluetooth permissions, then try again to pair.</string> <string name="combov2_cannot_pair_driver_not_initialized_explanation">Cannot perform pairing because the driver is not initialized. This typically happens because the necessary Bluetooth permissions have not been granted. Go back, grant the Bluetooth permissions, then try again to pair.</string>
<string name="combov2_bluetooth_disabled">Cannot start driver - Bluetooth is disabled</string>
<string name="combov2_bluetooth_not_supported">Driver cannot run - this device does not support Bluetooth</string>
</resources> </resources>

View file

@ -6,6 +6,7 @@ import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.os.Bundle import android.os.Bundle
import android.view.MotionEvent import android.view.MotionEvent
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import info.nightscout.androidaps.plugins.pump.eopatch.R import info.nightscout.androidaps.plugins.pump.eopatch.R
@ -103,6 +104,16 @@ class EopatchActivity : EoBaseActivity<ActivityEopatchBinding>() {
} }
} }
} }
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
binding.viewModel?.apply {
when (patchStep.value) {
PatchStep.SAFE_DEACTIVATION -> this@EopatchActivity.finish()
else -> Unit
}
}
}
})
} }
override fun onNewIntent(intent: Intent?) { override fun onNewIntent(intent: Intent?) {
@ -274,15 +285,6 @@ class EopatchActivity : EoBaseActivity<ActivityEopatchBinding>() {
this@EopatchActivity.finish() this@EopatchActivity.finish()
} }
override fun onBackPressed() {
binding.viewModel?.apply{
when(patchStep.value){
PatchStep.SAFE_DEACTIVATION -> this@EopatchActivity.finish()
else -> Unit
}
}
}
companion object { companion object {
const val RESULT_DISCARDED = RESULT_FIRST_USER + 1 const val RESULT_DISCARDED = RESULT_FIRST_USER + 1
const val EXTRA_START_PATCH_STEP = "EXTRA_START_PATCH_FRAGMENT_UI" const val EXTRA_START_PATCH_STEP = "EXTRA_START_PATCH_FRAGMENT_UI"

View file

@ -293,12 +293,12 @@ import kotlin.math.abs
val pumpRate = constraintChecker.applyBasalConstraints(Constraint(absoluteRate), profile).value() val pumpRate = constraintChecker.applyBasalConstraints(Constraint(absoluteRate), profile).value()
temporaryBasalStorage.add(PumpSync.PumpState.TemporaryBasal(dateUtil.now(), T.mins(durationInMinutes.toLong()).msecs(), pumpRate, true, tbrType, 0L, 0L)) temporaryBasalStorage.add(PumpSync.PumpState.TemporaryBasal(dateUtil.now(), T.mins(durationInMinutes.toLong()).msecs(), pumpRate, true, tbrType, 0L, 0L))
val connectionOK = medtrumService?.setTempBasal(pumpRate, durationInMinutes) ?: false val connectionOK = medtrumService?.setTempBasal(pumpRate, durationInMinutes) ?: false
if (connectionOK return if (connectionOK
&& medtrumPump.tempBasalInProgress && medtrumPump.tempBasalInProgress
&& Math.abs(medtrumPump.tempBasalAbsoluteRate - pumpRate) <= 0.05 && abs(medtrumPump.tempBasalAbsoluteRate - pumpRate) <= 0.05
) { ) {
return PumpEnactResult(injector).success(true).enacted(true).duration(durationInMinutes).absolute(medtrumPump.tempBasalAbsoluteRate) PumpEnactResult(injector).success(true).enacted(true).duration(durationInMinutes).absolute(medtrumPump.tempBasalAbsoluteRate)
.isPercent(false) .isPercent(false)
.isTempCancel(false) .isTempCancel(false)
} else { } else {
@ -306,7 +306,7 @@ import kotlin.math.abs
LTag.PUMP, LTag.PUMP,
"setTempBasalAbsolute failed, connectionOK: $connectionOK, tempBasalInProgress: ${medtrumPump.tempBasalInProgress}, tempBasalAbsoluteRate: ${medtrumPump.tempBasalAbsoluteRate}" "setTempBasalAbsolute failed, connectionOK: $connectionOK, tempBasalInProgress: ${medtrumPump.tempBasalInProgress}, tempBasalAbsoluteRate: ${medtrumPump.tempBasalAbsoluteRate}"
) )
return PumpEnactResult(injector).success(false).enacted(false).comment("Medtrum setTempBasalAbsolute failed") PumpEnactResult(injector).success(false).enacted(false).comment("Medtrum setTempBasalAbsolute failed")
} }
} }
@ -325,11 +325,11 @@ import kotlin.math.abs
aapsLogger.info(LTag.PUMP, "cancelTempBasal - enforceNew: $enforceNew") aapsLogger.info(LTag.PUMP, "cancelTempBasal - enforceNew: $enforceNew")
val connectionOK = medtrumService?.cancelTempBasal() ?: false val connectionOK = medtrumService?.cancelTempBasal() ?: false
if (connectionOK && !medtrumPump.tempBasalInProgress) { return if (connectionOK && !medtrumPump.tempBasalInProgress) {
return PumpEnactResult(injector).success(true).enacted(true).isTempCancel(true) PumpEnactResult(injector).success(true).enacted(true).isTempCancel(true)
} else { } else {
aapsLogger.error(LTag.PUMP, "cancelTempBasal failed, connectionOK: $connectionOK, tempBasalInProgress: ${medtrumPump.tempBasalInProgress}") aapsLogger.error(LTag.PUMP, "cancelTempBasal failed, connectionOK: $connectionOK, tempBasalInProgress: ${medtrumPump.tempBasalInProgress}")
return PumpEnactResult(injector).success(false).enacted(false).comment("Medtrum cancelTempBasal failed") PumpEnactResult(injector).success(false).enacted(false).comment("Medtrum cancelTempBasal failed")
} }
} }
@ -436,7 +436,7 @@ import kotlin.math.abs
if (isInitialized()) { if (isInitialized()) {
commandQueue.updateTime(object : Callback() { commandQueue.updateTime(object : Callback() {
override fun run() { override fun run() {
if (this.result.success == false) { if (!this.result.success) {
aapsLogger.error(LTag.PUMP, "Medtrum time update failed") aapsLogger.error(LTag.PUMP, "Medtrum time update failed")
// Only notify here on failure (connection may be failed), service will handle success // Only notify here on failure (connection may be failed), service will handle success
medtrumService?.timeUpdateNotification(false) medtrumService?.timeUpdateNotification(false)

View file

@ -291,11 +291,11 @@ class MedtrumPump @Inject constructor(
} }
fun loadUserSettingsFromSP() { fun loadUserSettingsFromSP() {
desiredPatchExpiration = sp.getBoolean(info.nightscout.pump.medtrum.R.string.key_patch_expiration, false) desiredPatchExpiration = sp.getBoolean(R.string.key_patch_expiration, false)
val alarmSettingCode = sp.getString(info.nightscout.pump.medtrum.R.string.key_alarm_setting, AlarmSetting.LIGHT_VIBRATE_AND_BEEP.code.toString()).toByte() val alarmSettingCode = sp.getString(R.string.key_alarm_setting, AlarmSetting.LIGHT_VIBRATE_AND_BEEP.code.toString()).toByte()
desiredAlarmSetting = AlarmSetting.values().firstOrNull { it.code == alarmSettingCode } ?: AlarmSetting.LIGHT_VIBRATE_AND_BEEP desiredAlarmSetting = AlarmSetting.values().firstOrNull { it.code == alarmSettingCode } ?: AlarmSetting.LIGHT_VIBRATE_AND_BEEP
desiredHourlyMaxInsulin = sp.getInt(info.nightscout.pump.medtrum.R.string.key_hourly_max_insulin, 40) desiredHourlyMaxInsulin = sp.getInt(R.string.key_hourly_max_insulin, 40)
desiredDailyMaxInsulin = sp.getInt(info.nightscout.pump.medtrum.R.string.key_daily_max_insulin, 180) desiredDailyMaxInsulin = sp.getInt(R.string.key_daily_max_insulin, 180)
_pumpSN = pumpSNFromSP _pumpSN = pumpSNFromSP
} }
@ -502,11 +502,11 @@ class MedtrumPump @Inject constructor(
AlarmState.PUMP_LOW_BATTERY -> R.string.alarm_pump_low_battery AlarmState.PUMP_LOW_BATTERY -> R.string.alarm_pump_low_battery
AlarmState.PUMP_LOW_RESERVOIR -> R.string.alarm_pump_low_reservoir AlarmState.PUMP_LOW_RESERVOIR -> R.string.alarm_pump_low_reservoir
AlarmState.PUMP_EXPIRES_SOON -> R.string.alarm_pump_expires_soon AlarmState.PUMP_EXPIRES_SOON -> R.string.alarm_pump_expires_soon
AlarmState.LOWBG_SUSPENDED -> R.string.alarm_lowbg_suspended AlarmState.LOW_BG_SUSPENDED -> R.string.alarm_low_bg_suspended
AlarmState.LOWBG_SUSPENDED2 -> R.string.alarm_lowbg_suspended2 AlarmState.LOW_BG_SUSPENDED2 -> R.string.alarm_low_bg_suspended2
AlarmState.AUTO_SUSPENDED -> R.string.alarm_auto_suspended AlarmState.AUTO_SUSPENDED -> R.string.alarm_auto_suspended
AlarmState.HMAX_SUSPENDED -> R.string.alarm_hmax_suspended AlarmState.HOURLY_MAX_SUSPENDED -> R.string.alarm_hourly_max_suspended
AlarmState.DMAX_SUSPENDED -> R.string.alarm_dmax_suspended AlarmState.DAILY_MAX_SUSPENDED -> R.string.alarm_daily_max_suspended
AlarmState.SUSPENDED -> R.string.alarm_suspended AlarmState.SUSPENDED -> R.string.alarm_suspended
AlarmState.PAUSED -> R.string.alarm_paused AlarmState.PAUSED -> R.string.alarm_paused
AlarmState.OCCLUSION -> R.string.alarm_occlusion AlarmState.OCCLUSION -> R.string.alarm_occlusion
@ -528,10 +528,10 @@ class MedtrumPump @Inject constructor(
private fun loadActiveAlarms() { private fun loadActiveAlarms() {
val alarmsStr = sp.getString(R.string.key_active_alarms, "") val alarmsStr = sp.getString(R.string.key_active_alarms, "")
if (alarmsStr.isNullOrEmpty()) { activeAlarms = if (alarmsStr.isEmpty()) {
activeAlarms = EnumSet.noneOf(AlarmState::class.java) EnumSet.noneOf(AlarmState::class.java)
} else { } else {
activeAlarms = alarmsStr.split(",") alarmsStr.split(",")
.mapNotNull { AlarmState.values().find { alarm -> alarm.name == it } } .mapNotNull { AlarmState.values().find { alarm -> alarm.name == it } }
.let { EnumSet.copyOf(it) } .let { EnumSet.copyOf(it) }
} }

View file

@ -1,20 +1,7 @@
package info.nightscout.pump.medtrum.bindingadapters package info.nightscout.pump.medtrum.bindingadapters
import android.view.View import android.view.View
import android.widget.TextView
import androidx.annotation.ColorRes
import androidx.databinding.BindingAdapter import androidx.databinding.BindingAdapter
import info.nightscout.pump.medtrum.extension.setVisibleOrGone
@BindingAdapter("android:visibility")
fun setVisibility(view: View, visible: Boolean) {
view.setVisibleOrGone(visible)
}
@BindingAdapter("visibleOrGone")
fun setVisibleOrGone(view: View, visibleOrGone: Boolean) {
view.setVisibleOrGone(visibleOrGone)
}
@BindingAdapter("onSafeClick") @BindingAdapter("onSafeClick")
fun View.setOnSafeClickListener(clickListener: View.OnClickListener?) { fun View.setOnSafeClickListener(clickListener: View.OnClickListener?) {
@ -22,8 +9,3 @@ fun View.setOnSafeClickListener(clickListener: View.OnClickListener?) {
setOnClickListener(OnSafeClickListener(it)) setOnClickListener(OnSafeClickListener(it))
} ?: setOnClickListener(null) } ?: setOnClickListener(null)
} }
@BindingAdapter("textColor")
fun setTextColor(view: TextView, @ColorRes colorResId: Int) {
view.setTextColor(view.context.getColor(colorResId))
}

View file

@ -3,7 +3,7 @@ package info.nightscout.pump.medtrum.comm
import kotlin.experimental.and import kotlin.experimental.and
import info.nightscout.pump.medtrum.extension.toLong import info.nightscout.pump.medtrum.extension.toLong
class ManufacturerData(private val manufacturerDataBytes: ByteArray) { class ManufacturerData(manufacturerDataBytes: ByteArray) {
private var deviceID: Long = 0 private var deviceID: Long = 0
private var deviceType = 0 private var deviceType = 0
private var version = 0 private var version = 0
@ -12,7 +12,7 @@ class ManufacturerData(private val manufacturerDataBytes: ByteArray) {
setData(manufacturerDataBytes) setData(manufacturerDataBytes)
} }
fun setData(inputData: ByteArray) { private fun setData(inputData: ByteArray) {
var index = 0 var index = 0
val deviceIDBytes: ByteArray = inputData.copyOfRange(index, index + 4) val deviceIDBytes: ByteArray = inputData.copyOfRange(index, index + 4)
deviceID = deviceIDBytes.toLong() deviceID = deviceIDBytes.toLong()

View file

@ -9,21 +9,20 @@ class WriteCommandPackets(data: ByteArray, sequenceNumber: Int) {
init { init {
// PackageIndex: 0 initially, if there are multiple packets, for the first packet it is set to 0 (not included in CRC calculation but sent in actual header) // PackageIndex: 0 initially, if there are multiple packets, for the first packet it is set to 0 (not included in CRC calculation but sent in actual header)
var pkgIndex = 0 val header = byteArrayOf(
var header = byteArrayOf(
(data.size + 4).toByte(), (data.size + 4).toByte(),
data[0], data[0],
sequenceNumber.toByte(), sequenceNumber.toByte(),
pkgIndex.toByte() 0.toByte() // pkgIndex
) )
var tmp: ByteArray = header + data.copyOfRange(1, data.size) var tmp: ByteArray = header + data.copyOfRange(1, data.size)
var totalCommand: ByteArray = tmp + calcCrc8(tmp, tmp.size).toByte() val totalCommand: ByteArray = tmp + calcCrc8(tmp, tmp.size).toByte()
if ((totalCommand.size - header.size) <= 15) { if ((totalCommand.size - header.size) <= 15) {
packages.add(totalCommand + 0.toByte()) packages.add(totalCommand + 0.toByte())
} else { } else {
pkgIndex = 1 var pkgIndex = 1
var remainingCommand = totalCommand.copyOfRange(4, totalCommand.size) var remainingCommand = totalCommand.copyOfRange(4, totalCommand.size)
while (remainingCommand.size > 15) { while (remainingCommand.size > 15) {
@ -52,13 +51,13 @@ class WriteCommandPackets(data: ByteArray, sequenceNumber: Int) {
} }
fun allPacketsConsumed(): Boolean { fun allPacketsConsumed(): Boolean {
return !(index < packages.size) return index >= packages.size
} }
private fun calcCrc8(value: ByteArray, size: Int): Int { private fun calcCrc8(value: ByteArray, size: Int): Int {
var crc8 = 0 var crc8 = 0
for (i in 0 until size) { for (i in 0 until size) {
crc8 = CRC_8_TABLE[(value[i].toInt() and 255) xor (crc8 and 255)].toInt() and 255 crc8 = CRC_8_TABLE[(value[i].toInt() and 255) xor (crc8 and 255)] and 255
} }
return crc8 return crc8
} }

View file

@ -5,11 +5,11 @@ enum class AlarmState {
PUMP_LOW_BATTERY, // Mapped from error flag 1 PUMP_LOW_BATTERY, // Mapped from error flag 1
PUMP_LOW_RESERVOIR, // Mapped from error flag 2 PUMP_LOW_RESERVOIR, // Mapped from error flag 2
PUMP_EXPIRES_SOON, // Mapped from error flag 3 PUMP_EXPIRES_SOON, // Mapped from error flag 3
LOWBG_SUSPENDED, // Mapped from pump status 64 LOW_BG_SUSPENDED, // Mapped from pump status 64
LOWBG_SUSPENDED2, // Mapped from pump status 65 LOW_BG_SUSPENDED2, // Mapped from pump status 65
AUTO_SUSPENDED, // Mapped from pump status 66 AUTO_SUSPENDED, // Mapped from pump status 66
HMAX_SUSPENDED, // Mapped from pump status 67 HOURLY_MAX_SUSPENDED, // Mapped from pump status 67
DMAX_SUSPENDED, // Mapped from pump status 68 DAILY_MAX_SUSPENDED, // Mapped from pump status 68
SUSPENDED, // Mapped from pump status 69 SUSPENDED, // Mapped from pump status 69
PAUSED, // Mapped from pump status 70 PAUSED, // Mapped from pump status 70
OCCLUSION, // Mapped from pump status 96 OCCLUSION, // Mapped from pump status 96

View file

@ -10,11 +10,11 @@ enum class MedtrumPumpState(val state: Byte) {
EJECTED(6), EJECTED(6),
ACTIVE(32), ACTIVE(32),
ACTIVE_ALT(33), ACTIVE_ALT(33),
LOWBG_SUSPENDED(64), LOW_BG_SUSPENDED(64),
LOWBG_SUSPENDED2(65), LOW_BG_SUSPENDED2(65),
AUTO_SUSPENDED(66), AUTO_SUSPENDED(66),
HMAX_SUSPENDED(67), HOURLY_MAX_SUSPENDED(67),
DMAX_SUSPENDED(68), DAILY_MAX_SUSPENDED(68),
SUSPENDED(69), SUSPENDED(69),
PAUSED(70), PAUSED(70),
OCCLUSION(96), OCCLUSION(96),
@ -28,6 +28,7 @@ enum class MedtrumPumpState(val state: Byte) {
STOPPED(128.toByte()); STOPPED(128.toByte());
companion object { companion object {
fun fromByte(state: Byte) = values().find { it.state == state } fun fromByte(state: Byte) = values().find { it.state == state }
?: throw IllegalAccessException("") ?: throw IllegalAccessException("")
} }

View file

@ -55,7 +55,7 @@ class ActivatePacket(injector: HasAndroidInjector, private val basalProfile: Byt
* byte 6: predictiveLowSuspend // Value for auto mode, not used for AAPS * byte 6: predictiveLowSuspend // Value for auto mode, not used for AAPS
* byte 7: predictiveLowSuspendRange // Value for auto mode, not used for AAPS * byte 7: predictiveLowSuspendRange // Value for auto mode, not used for AAPS
* byte 8-9: hourlyMaxInsulin // Max hourly dose of insulin, divided by 0.05 * byte 8-9: hourlyMaxInsulin // Max hourly dose of insulin, divided by 0.05
* byte 10-11: daylyMaxSet // Max daily dose of insulin, divided by 0.05 * byte 10-11: dailyMaxSet // Max daily dose of insulin, divided by 0.05
* byte 12-13: tddToday // Current TDD (of present day), divided by 0.05 * byte 12-13: tddToday // Current TDD (of present day), divided by 0.05
* byte 14: 1 // Always 1 * byte 14: 1 // Always 1
* bytes 15 - end // Basal profile > see MedtrumPump * bytes 15 - end // Basal profile > see MedtrumPump
@ -98,7 +98,7 @@ class ActivatePacket(injector: HasAndroidInjector, private val basalProfile: Byt
medtrumPump.currentSequenceNumber = basalSequence // We are activated, set the new seq nr medtrumPump.currentSequenceNumber = basalSequence // We are activated, set the new seq nr
medtrumPump.syncedSequenceNumber = basalSequence // We are activated, reset the synced seq nr () medtrumPump.syncedSequenceNumber = basalSequence // We are activated, reset the synced seq nr ()
// Sync canula change // Sync cannula change
pumpSync.insertTherapyEventIfNewWithTimestamp( pumpSync.insertTherapyEventIfNewWithTimestamp(
timestamp = System.currentTimeMillis(), timestamp = System.currentTimeMillis(),
type = DetailedBolusInfo.EventType.CANNULA_CHANGE, type = DetailedBolusInfo.EventType.CANNULA_CHANGE,

View file

@ -7,7 +7,6 @@ import info.nightscout.pump.medtrum.comm.enums.BasalType
import info.nightscout.pump.medtrum.extension.toInt import info.nightscout.pump.medtrum.extension.toInt
import info.nightscout.pump.medtrum.extension.toLong import info.nightscout.pump.medtrum.extension.toLong
import info.nightscout.pump.medtrum.util.MedtrumTimeUtil import info.nightscout.pump.medtrum.util.MedtrumTimeUtil
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.DateUtil
import javax.inject.Inject import javax.inject.Inject

View file

@ -4,7 +4,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.pump.medtrum.comm.enums.CommandType.CLEAR_ALARM import info.nightscout.pump.medtrum.comm.enums.CommandType.CLEAR_ALARM
import info.nightscout.pump.medtrum.extension.toByteArray import info.nightscout.pump.medtrum.extension.toByteArray
class ClearPumpAlarmPacket(injector: HasAndroidInjector, val clearType: Int) : MedtrumPacket(injector) { class ClearPumpAlarmPacket(injector: HasAndroidInjector, private val clearType: Int) : MedtrumPacket(injector) {
init { init {
opCode = CLEAR_ALARM.code opCode = CLEAR_ALARM.code

View file

@ -15,7 +15,6 @@ import info.nightscout.pump.medtrum.extension.toLong
import info.nightscout.pump.medtrum.util.MedtrumTimeUtil import info.nightscout.pump.medtrum.util.MedtrumTimeUtil
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import javax.inject.Inject import javax.inject.Inject
class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int) : MedtrumPacket(injector) { class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int) : MedtrumPacket(injector) {
@ -38,9 +37,9 @@ class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int
private const val RESP_RECORD_UNKNOWN1_END = RESP_RECORD_UNKNOWN1_START + 1 private const val RESP_RECORD_UNKNOWN1_END = RESP_RECORD_UNKNOWN1_START + 1
private const val RESP_RECORD_SERIAL_START = RESP_RECORD_UNKNOWN1_END private const val RESP_RECORD_SERIAL_START = RESP_RECORD_UNKNOWN1_END
private const val RESP_RECORD_SERIAL_END = RESP_RECORD_SERIAL_START + 4 private const val RESP_RECORD_SERIAL_END = RESP_RECORD_SERIAL_START + 4
private const val RESP_RECORD_PATCHID_START = RESP_RECORD_SERIAL_END private const val RESP_RECORD_PATCH_ID_START = RESP_RECORD_SERIAL_END
private const val RESP_RECORD_PATCHID_END = RESP_RECORD_PATCHID_START + 2 private const val RESP_RECORD_PATCH_ID_END = RESP_RECORD_PATCH_ID_START + 2
private const val RESP_RECORD_SEQUENCE_START = RESP_RECORD_PATCHID_END private const val RESP_RECORD_SEQUENCE_START = RESP_RECORD_PATCH_ID_END
private const val RESP_RECORD_SEQUENCE_END = RESP_RECORD_SEQUENCE_START + 2 private const val RESP_RECORD_SEQUENCE_END = RESP_RECORD_SEQUENCE_START + 2
private const val RESP_RECORD_DATA_START = RESP_RECORD_SEQUENCE_END private const val RESP_RECORD_DATA_START = RESP_RECORD_SEQUENCE_END
@ -75,7 +74,7 @@ class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int
val recordUnknown = data.copyOfRange(RESP_RECORD_UNKNOWN_START, RESP_RECORD_UNKNOWN_END).toInt() val recordUnknown = data.copyOfRange(RESP_RECORD_UNKNOWN_START, RESP_RECORD_UNKNOWN_END).toInt()
val recordType = data.copyOfRange(RESP_RECORD_TYPE_START, RESP_RECORD_TYPE_END).toInt() val recordType = data.copyOfRange(RESP_RECORD_TYPE_START, RESP_RECORD_TYPE_END).toInt()
val recordSerial = data.copyOfRange(RESP_RECORD_SERIAL_START, RESP_RECORD_SERIAL_END).toLong() val recordSerial = data.copyOfRange(RESP_RECORD_SERIAL_START, RESP_RECORD_SERIAL_END).toLong()
val recordPatchId = data.copyOfRange(RESP_RECORD_PATCHID_START, RESP_RECORD_PATCHID_END).toInt() val recordPatchId = data.copyOfRange(RESP_RECORD_PATCH_ID_START, RESP_RECORD_PATCH_ID_END).toInt()
val recordSequence = data.copyOfRange(RESP_RECORD_SEQUENCE_START, RESP_RECORD_SEQUENCE_END).toInt() val recordSequence = data.copyOfRange(RESP_RECORD_SEQUENCE_START, RESP_RECORD_SEQUENCE_END).toInt()
aapsLogger.debug( aapsLogger.debug(
@ -101,13 +100,15 @@ class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int
val bolusCarb = data.copyOfRange(RESP_RECORD_DATA_START + 18, RESP_RECORD_DATA_START + 20).toInt() val bolusCarb = data.copyOfRange(RESP_RECORD_DATA_START + 18, RESP_RECORD_DATA_START + 20).toInt()
val bolusGlucose = data.copyOfRange(RESP_RECORD_DATA_START + 20, RESP_RECORD_DATA_START + 22).toInt() val bolusGlucose = data.copyOfRange(RESP_RECORD_DATA_START + 20, RESP_RECORD_DATA_START + 22).toInt()
val bolusIOB = data.copyOfRange(RESP_RECORD_DATA_START + 22, RESP_RECORD_DATA_START + 24).toInt() val bolusIOB = data.copyOfRange(RESP_RECORD_DATA_START + 22, RESP_RECORD_DATA_START + 24).toInt()
val unkown1 = data.copyOfRange(RESP_RECORD_DATA_START + 24, RESP_RECORD_DATA_START + 26).toInt() val unknown1 = data.copyOfRange(RESP_RECORD_DATA_START + 24, RESP_RECORD_DATA_START + 26).toInt()
val unkown2 = data.copyOfRange(RESP_RECORD_DATA_START + 26, RESP_RECORD_DATA_START + 28).toInt() val unknown2 = data.copyOfRange(RESP_RECORD_DATA_START + 26, RESP_RECORD_DATA_START + 28).toInt()
val bolusType = enumValues<BolusType>()[typeAndWizard and 0x0F] val bolusType = enumValues<BolusType>()[typeAndWizard and 0x0F]
val bolusWizard = (typeAndWizard and 0xF0) != 0 val bolusWizard = (typeAndWizard and 0xF0) != 0
aapsLogger.debug( aapsLogger.debug(
LTag.PUMPCOMM, LTag.PUMPCOMM,
"GetRecordPacket HandleResponse: BOLUS_RECORD: typeAndWizard: $typeAndWizard, bolusCause: $bolusCause, unknown: $unknown, bolusStartTime: $bolusStartTime, " + "bolusNormalAmount: $bolusNormalAmount, bolusNormalDelivered: $bolusNormalDelivered, bolusExtendedAmount: $bolusExtendedAmount, bolusExtendedDuration: $bolusExtendedDuration, " + "bolusExtendedDelivered: $bolusExtendedDelivered, bolusCarb: $bolusCarb, bolusGlucose: $bolusGlucose, bolusIOB: $bolusIOB, unkown1: $unkown1, unkown2: $unkown2, " + "bolusType: $bolusType, bolusWizard: $bolusWizard" "GetRecordPacket HandleResponse: BOLUS_RECORD: typeAndWizard: $typeAndWizard, bolusCause: $bolusCause, unknown: $unknown, bolusStartTime: $bolusStartTime, " +
"bolusNormalAmount: $bolusNormalAmount, bolusNormalDelivered: $bolusNormalDelivered, bolusExtendedAmount: $bolusExtendedAmount, bolusExtendedDuration: " +
"$bolusExtendedDuration, " + "bolusExtendedDelivered: $bolusExtendedDelivered, bolusCarb: $bolusCarb, bolusGlucose: $bolusGlucose, bolusIOB: $bolusIOB, unknown1: $unknown1, unknown2: $unknown2, " + "bolusType: $bolusType, bolusWizard: $bolusWizard"
) )
if (bolusType == BolusType.NORMAL) { if (bolusType == BolusType.NORMAL) {
@ -123,7 +124,7 @@ class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int
pumpType = medtrumPump.pumpType(), pumpType = medtrumPump.pumpType(),
pumpSerial = medtrumPump.pumpSN.toString(radix = 16) pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
) )
if (syncOk == false) { if (!syncOk) {
aapsLogger.warn(LTag.PUMPCOMM, "GetRecordPacket HandleResponse: BOLUS_RECORD: Failed to sync bolus with tempId: ${detailedBolusInfo.timestamp}") aapsLogger.warn(LTag.PUMPCOMM, "GetRecordPacket HandleResponse: BOLUS_RECORD: Failed to sync bolus with tempId: ${detailedBolusInfo.timestamp}")
// detailedInfo can be from another similar record. Reinsert // detailedInfo can be from another similar record. Reinsert
detailedBolusInfoStorage.add(detailedBolusInfo) detailedBolusInfoStorage.add(detailedBolusInfo)
@ -298,7 +299,7 @@ class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int
aapsLogger.debug(LTag.PUMPCOMM, "GetRecordPacket HandleResponse: TDD_RECORD") aapsLogger.debug(LTag.PUMPCOMM, "GetRecordPacket HandleResponse: TDD_RECORD")
val timestamp = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(RESP_RECORD_DATA_START, RESP_RECORD_DATA_START + 4).toLong()) val timestamp = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(RESP_RECORD_DATA_START, RESP_RECORD_DATA_START + 4).toLong())
val timeZoneOffset = data.copyOfRange(RESP_RECORD_DATA_START + 4, RESP_RECORD_DATA_START + 6).toInt() val timeZoneOffset = data.copyOfRange(RESP_RECORD_DATA_START + 4, RESP_RECORD_DATA_START + 6).toInt()
val tddMins = data.copyOfRange(RESP_RECORD_DATA_START + 6, RESP_RECORD_DATA_START + 8).toInt() val tddMinutes = data.copyOfRange(RESP_RECORD_DATA_START + 6, RESP_RECORD_DATA_START + 8).toInt()
val glucoseRecordTime = data.copyOfRange(RESP_RECORD_DATA_START + 8, RESP_RECORD_DATA_START + 12).toLong() val glucoseRecordTime = data.copyOfRange(RESP_RECORD_DATA_START + 8, RESP_RECORD_DATA_START + 12).toLong()
val tdd = data.copyOfRange(RESP_RECORD_DATA_START + 12, RESP_RECORD_DATA_START + 16).toFloat() val tdd = data.copyOfRange(RESP_RECORD_DATA_START + 12, RESP_RECORD_DATA_START + 16).toFloat()
val basalTdd = data.copyOfRange(RESP_RECORD_DATA_START + 16, RESP_RECORD_DATA_START + 20).toFloat() val basalTdd = data.copyOfRange(RESP_RECORD_DATA_START + 16, RESP_RECORD_DATA_START + 20).toFloat()
@ -315,7 +316,7 @@ class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int
val newUMax = data.copyOfRange(RESP_RECORD_DATA_START + 60, RESP_RECORD_DATA_START + 64).toFloat() val newUMax = data.copyOfRange(RESP_RECORD_DATA_START + 60, RESP_RECORD_DATA_START + 64).toFloat()
aapsLogger.debug( aapsLogger.debug(
LTag.PUMPCOMM, "TDD_RECORD: timestamp: $timestamp, timeZoneOffset: $timeZoneOffset, tddMins: $tddMins, glucoseRecordTime: $glucoseRecordTime, tdd: " + LTag.PUMPCOMM, "TDD_RECORD: timestamp: $timestamp, timeZoneOffset: $timeZoneOffset, tddMinutes: $tddMinutes, glucoseRecordTime: $glucoseRecordTime, tdd: " +
"$tdd, basalTdd: $basalTdd, glucose: $glucose, unknown: $unknown, meanSomething: $meanSomething, usedTdd: $usedTdd, usedIBasal: $usedIBasal, usedSgBasal: " + "$tdd, basalTdd: $basalTdd, glucose: $glucose, unknown: $unknown, meanSomething: $meanSomething, usedTdd: $usedTdd, usedIBasal: $usedIBasal, usedSgBasal: " +
"$usedSgBasal, usedUMax: $usedUMax, newTdd: $newTdd, newIBasal: $newIBasal, newSgBasal: $newSgBasal, newUMax: $newUMax" "$usedSgBasal, usedUMax: $usedUMax, newTdd: $newTdd, newIBasal: $newIBasal, newSgBasal: $newSgBasal, newUMax: $newUMax"
) )

View file

@ -25,7 +25,7 @@ open class MedtrumPacket(protected var injector: HasAndroidInjector) {
} }
init { init {
// @Suppress("LeakingThis") @Suppress("LeakingThis")
injector.androidInjector().inject(this) injector.androidInjector().inject(this)
} }
@ -33,7 +33,7 @@ open class MedtrumPacket(protected var injector: HasAndroidInjector) {
return byteArrayOf(opCode) return byteArrayOf(opCode)
} }
/** handles a response from the Medtrum pump, returns true if command was successfull, returns false if command failed or waiting for response */ /** handles a response from the Medtrum pump, returns true if command was successful, returns false if command failed or waiting for response */
open fun handleResponse(data: ByteArray): Boolean { open fun handleResponse(data: ByteArray): Boolean {
// Check for broken packets // Check for broken packets
if (RESP_RESULT_END > data.size) { if (RESP_RESULT_END > data.size) {

View file

@ -19,7 +19,7 @@ class NotificationPacket(val injector: HasAndroidInjector) {
* but a notification packet. It is sent by the pump to the phone * but a notification packet. It is sent by the pump to the phone
* when the pump has a notification to send. * when the pump has a notification to send.
* *
* Notifications are sent regualary, regardless of the pump state. * Notifications are sent regularly, regardless of the pump state.
* *
* There can be multiple messages in one packet, this is noted by the fieldMask. * There can be multiple messages in one packet, this is noted by the fieldMask.
* *
@ -97,10 +97,10 @@ class NotificationPacket(val injector: HasAndroidInjector) {
if (fieldMask and MASK_NORMAL_BOLUS != 0) { if (fieldMask and MASK_NORMAL_BOLUS != 0) {
aapsLogger.debug(LTag.PUMPCOMM, "Normal bolus notification received") aapsLogger.debug(LTag.PUMPCOMM, "Normal bolus notification received")
var bolusData = data.copyOfRange(offset, offset + 1).toInt() val bolusData = data.copyOfRange(offset, offset + 1).toInt()
var bolusType = bolusData and 0x7F val bolusType = bolusData and 0x7F
val bolusCompleted: Boolean = ((bolusData shr 7) and 0x01) != 0 val bolusCompleted: Boolean = ((bolusData shr 7) and 0x01) != 0
var bolusDelivered = data.copyOfRange(offset + 1, offset + 3).toInt() * 0.05 val bolusDelivered = data.copyOfRange(offset + 1, offset + 3).toInt() * 0.05
aapsLogger.debug(LTag.PUMPCOMM, "Bolus type: $bolusType, bolusData: $bolusData bolus completed: $bolusCompleted, bolus delivered: $bolusDelivered") aapsLogger.debug(LTag.PUMPCOMM, "Bolus type: $bolusType, bolusData: $bolusData bolus completed: $bolusCompleted, bolus delivered: $bolusDelivered")
medtrumPump.handleBolusStatusUpdate(bolusType, bolusCompleted, bolusDelivered) medtrumPump.handleBolusStatusUpdate(bolusType, bolusCompleted, bolusDelivered)
offset += 3 offset += 3
@ -115,12 +115,12 @@ class NotificationPacket(val injector: HasAndroidInjector) {
if (fieldMask and MASK_BASAL != 0) { if (fieldMask and MASK_BASAL != 0) {
aapsLogger.debug(LTag.PUMPCOMM, "Basal notification received") aapsLogger.debug(LTag.PUMPCOMM, "Basal notification received")
val basalType = enumValues<BasalType>()[data.copyOfRange(offset, offset + 1).toInt()] val basalType = enumValues<BasalType>()[data.copyOfRange(offset, offset + 1).toInt()]
var basalSequence = data.copyOfRange(offset + 1, offset + 3).toInt() val basalSequence = data.copyOfRange(offset + 1, offset + 3).toInt()
var basalPatchId = data.copyOfRange(offset + 3, offset + 5).toLong() val basalPatchId = data.copyOfRange(offset + 3, offset + 5).toLong()
var basalStartTime = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(offset + 5, offset + 9).toLong()) val basalStartTime = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(offset + 5, offset + 9).toLong())
var basalRateAndDelivery = data.copyOfRange(offset + 9, offset + 12).toInt() val basalRateAndDelivery = data.copyOfRange(offset + 9, offset + 12).toInt()
var basalRate = (basalRateAndDelivery and 0xFFF) * 0.05 val basalRate = (basalRateAndDelivery and 0xFFF) * 0.05
var basalDelivery = (basalRateAndDelivery shr 12) * 0.05 val basalDelivery = (basalRateAndDelivery shr 12) * 0.05
aapsLogger.debug( aapsLogger.debug(
LTag.PUMPCOMM, LTag.PUMPCOMM,
"Basal type: $basalType, basal sequence: $basalSequence, basal patch id: $basalPatchId, basal time: $basalStartTime, basal rate: $basalRate, basal delivery: $basalDelivery" "Basal type: $basalType, basal sequence: $basalSequence, basal patch id: $basalPatchId, basal time: $basalStartTime, basal rate: $basalRate, basal delivery: $basalDelivery"
@ -159,7 +159,7 @@ class NotificationPacket(val injector: HasAndroidInjector) {
if (fieldMask and MASK_BATTERY != 0) { if (fieldMask and MASK_BATTERY != 0) {
aapsLogger.debug(LTag.PUMPCOMM, "Battery notification received") aapsLogger.debug(LTag.PUMPCOMM, "Battery notification received")
var parameter = data.copyOfRange(offset, offset + 3).toInt() val parameter = data.copyOfRange(offset, offset + 3).toInt()
// Precision for voltage A is a guess, voltage B is the important one, threshold: < 2.64 // Precision for voltage A is a guess, voltage B is the important one, threshold: < 2.64
medtrumPump.batteryVoltage_A = (parameter and 0xFFF) / 512.0 medtrumPump.batteryVoltage_A = (parameter and 0xFFF) / 512.0
medtrumPump.batteryVoltage_B = (parameter shr 12) / 512.0 medtrumPump.batteryVoltage_B = (parameter shr 12) / 512.0

View file

@ -2,7 +2,6 @@ package info.nightscout.pump.medtrum.comm.packets
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.pump.medtrum.comm.enums.CommandType.RESUME_PUMP import info.nightscout.pump.medtrum.comm.enums.CommandType.RESUME_PUMP
import info.nightscout.pump.medtrum.extension.toByteArray
class ResumePumpPacket(injector: HasAndroidInjector) : MedtrumPacket(injector) { class ResumePumpPacket(injector: HasAndroidInjector) : MedtrumPacket(injector) {

View file

@ -13,7 +13,7 @@ class SetTimeZonePacket(injector: HasAndroidInjector) : MedtrumPacket(injector)
@Inject lateinit var dateUtil: DateUtil @Inject lateinit var dateUtil: DateUtil
@Inject lateinit var medtrumPump: MedtrumPump @Inject lateinit var medtrumPump: MedtrumPump
var offsetMins: Int = 0 private var offsetMinutes: Int = 0
init { init {
opCode = SET_TIME_ZONE.code opCode = SET_TIME_ZONE.code
@ -21,15 +21,15 @@ class SetTimeZonePacket(injector: HasAndroidInjector) : MedtrumPacket(injector)
override fun getRequest(): ByteArray { override fun getRequest(): ByteArray {
val time = MedtrumTimeUtil().getCurrentTimePumpSeconds() val time = MedtrumTimeUtil().getCurrentTimePumpSeconds()
offsetMins = dateUtil.getTimeZoneOffsetMinutes(dateUtil.now()) offsetMinutes = dateUtil.getTimeZoneOffsetMinutes(dateUtil.now())
if (offsetMins < 0) offsetMins += 65536 if (offsetMinutes < 0) offsetMinutes += 65536
return byteArrayOf(opCode) + offsetMins.toByteArray(2) + time.toByteArray(4) return byteArrayOf(opCode) + offsetMinutes.toByteArray(2) + time.toByteArray(4)
} }
override fun handleResponse(data: ByteArray): Boolean { override fun handleResponse(data: ByteArray): Boolean {
val success = super.handleResponse(data) val success = super.handleResponse(data)
if (success) { if (success) {
medtrumPump.pumpTimeZoneOffset = offsetMins medtrumPump.pumpTimeZoneOffset = offsetMinutes
} }
return success return success
} }

View file

@ -16,7 +16,6 @@ class SynchronizePacket(injector: HasAndroidInjector) : MedtrumPacket(injector)
companion object { companion object {
private const val RESP_STATE_START = 6 private const val RESP_STATE_START = 6
private const val RESP_STATE_END = RESP_STATE_START + 1
private const val RESP_FIELDS_START = 7 private const val RESP_FIELDS_START = 7
private const val RESP_FIELDS_END = RESP_FIELDS_START + 2 private const val RESP_FIELDS_END = RESP_FIELDS_START + 2
private const val RESP_SYNC_DATA_START = 9 private const val RESP_SYNC_DATA_START = 9
@ -34,7 +33,7 @@ class SynchronizePacket(injector: HasAndroidInjector) : MedtrumPacket(injector)
override fun handleResponse(data: ByteArray): Boolean { override fun handleResponse(data: ByteArray): Boolean {
val success = super.handleResponse(data) val success = super.handleResponse(data)
if (success) { if (success) {
var state = MedtrumPumpState.fromByte(data[RESP_STATE_START]) val state = MedtrumPumpState.fromByte(data[RESP_STATE_START])
aapsLogger.debug(LTag.PUMPCOMM, "SynchronizePacket: state: $state") aapsLogger.debug(LTag.PUMPCOMM, "SynchronizePacket: state: $state")
if (state != medtrumPump.pumpState) { if (state != medtrumPump.pumpState) {

View file

@ -8,7 +8,7 @@ class Crypt {
private val RIJNDEAL_S_BOX: IntArray = intArrayOf(99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22) private val RIJNDEAL_S_BOX: IntArray = intArrayOf(99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22)
private val RIJNDEAL_INVERSE_S_BOX: IntArray = intArrayOf(82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125) private val RIJNDEAL_INVERSE_S_BOX: IntArray = intArrayOf(82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125)
val MED_CIPHER: Long = 1344751489 private val MED_CIPHER: Long = 1344751489
fun keyGen(input: Long): Long { fun keyGen(input: Long): Long {
val key = randomGen(randomGen(MED_CIPHER xor input)) val key = randomGen(randomGen(MED_CIPHER xor input))
@ -25,7 +25,7 @@ class Crypt {
private fun simpleCrypt(inputData: Long): Long { private fun simpleCrypt(inputData: Long): Long {
var temp = inputData xor MED_CIPHER var temp = inputData xor MED_CIPHER
for (i in 0 until 32) { for (i in 0 until 32) {
temp = changeByTable(rotatoLeft(temp, 32, 1), RIJNDEAL_S_BOX).toLong() temp = changeByTable(rotatoLeft(temp, 32, 1), RIJNDEAL_S_BOX)
} }
return temp return temp
} }

View file

@ -21,7 +21,7 @@ fun ByteArray.toInt(): Int {
var result = 0 var result = 0
for (i in this.indices) { for (i in this.indices) {
val byte = this[i] val byte = this[i]
val shifted = (byte.toInt() and 0xFF).toInt() shl 8 * i val shifted = (byte.toInt() and 0xFF) shl 8 * i
result = result or shifted result = result or shifted
} }
return result return result

View file

@ -9,26 +9,3 @@ fun View?.visible(vararg views: View?) {
for (view in views) for (view in views)
view.visible() view.visible()
} }
fun View?.invisible() = this?.run { visibility = View.INVISIBLE }
fun View?.invisible(vararg views: View?) {
invisible()
for (view in views)
view.invisible()
}
fun View?.gone() = this?.run { visibility = View.GONE }
fun View?.gone(vararg views: View?) {
gone()
for (view in views)
view.gone()
}
fun View?.setVisibleOrGone(visibleOrGone: Boolean, vararg views: View?) {
for (view in views)
if (visibleOrGone) view.visible() else view.gone()
}
fun View?.setVisibleOrGone(visibleOrGone: Boolean) = setVisibleOrGone(visibleOrGone, this)

View file

@ -241,16 +241,16 @@ class BLEComm @Inject internal constructor(
} }
override fun onCharacteristicRead(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) { override fun onCharacteristicRead(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) {
aapsLogger.debug(LTag.PUMPBTCOMM, "onCharacteristicRead data: " + characteristic.value.contentToString() + " UUID: " + characteristic.getUuid().toString() + " status: " + status) aapsLogger.debug(LTag.PUMPBTCOMM, "onCharacteristicRead data: " + characteristic.value.contentToString() + " UUID: " + characteristic.uuid.toString() + " status: " + status)
} }
override fun onCharacteristicChanged(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) { override fun onCharacteristicChanged(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) {
aapsLogger.debug(LTag.PUMPBTCOMM, "onCharacteristicChanged data: " + characteristic.value.contentToString() + " UUID: " + characteristic.getUuid().toString()) aapsLogger.debug(LTag.PUMPBTCOMM, "onCharacteristicChanged data: " + characteristic.value.contentToString() + " UUID: " + characteristic.uuid.toString())
val value = characteristic.getValue() val value = characteristic.value
if (characteristic.getUuid() == UUID.fromString(READ_UUID)) { if (characteristic.uuid == UUID.fromString(READ_UUID)) {
mCallback?.onNotification(value) mCallback?.onNotification(value)
} else if (characteristic.getUuid() == UUID.fromString(WRITE_UUID)) { } else if (characteristic.uuid == UUID.fromString(WRITE_UUID)) {
synchronized(readLock) { synchronized(readLock) {
if (mReadPacket == null) { if (mReadPacket == null) {
mReadPacket = ReadDataPacket(value) mReadPacket = ReadDataPacket(value)
@ -398,7 +398,7 @@ class BLEComm @Inject internal constructor(
@Synchronized @Synchronized
fun sendMessage(message: ByteArray) { fun sendMessage(message: ByteArray) {
aapsLogger.debug(LTag.PUMPBTCOMM, "sendMessage message = " + Arrays.toString(message)) aapsLogger.debug(LTag.PUMPBTCOMM, "sendMessage message = " + message.contentToString())
if (mWritePackets?.allPacketsConsumed() == false) { if (mWritePackets?.allPacketsConsumed() == false) {
aapsLogger.error(LTag.PUMPBTCOMM, "sendMessage not all packets consumed!! unable to sent message!") aapsLogger.error(LTag.PUMPBTCOMM, "sendMessage not all packets consumed!! unable to sent message!")
return return
@ -455,7 +455,7 @@ class BLEComm @Inject internal constructor(
val gattService = getGattService() ?: return val gattService = getGattService() ?: return
var uuid: String var uuid: String
val gattCharacteristics = gattService.characteristics val gattCharacteristics = gattService.characteristics
for (i in 0..gattCharacteristics.size - 1) { for (i in 0 until gattCharacteristics.size) {
val gattCharacteristic = gattCharacteristics.get(i) val gattCharacteristic = gattCharacteristics.get(i)
// Check whether read or write properties is set, the pump needs us to enable notifications on all characteristics that have these properties // Check whether read or write properties is set, the pump needs us to enable notifications on all characteristics that have these properties
if (gattCharacteristic.properties and NEEDS_ENABLE > 0) { if (gattCharacteristic.properties and NEEDS_ENABLE > 0) {

View file

@ -29,7 +29,6 @@ import info.nightscout.pump.medtrum.code.ConnectionState
import info.nightscout.pump.medtrum.comm.enums.AlarmState import info.nightscout.pump.medtrum.comm.enums.AlarmState
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
import info.nightscout.pump.medtrum.comm.packets.* import info.nightscout.pump.medtrum.comm.packets.*
import info.nightscout.pump.medtrum.util.MedtrumTimeUtil
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAppExit import info.nightscout.rx.events.EventAppExit
@ -84,8 +83,6 @@ class MedtrumService : DaggerService(), BLECommCallback {
private const val ALARM_DAILY_MAX_CLEAR_CODE = 5 private const val ALARM_DAILY_MAX_CLEAR_CODE = 5
} }
val timeUtil = MedtrumTimeUtil()
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
private val mBinder: IBinder = LocalBinder() private val mBinder: IBinder = LocalBinder()
@ -124,7 +121,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
medtrumPump.loadUserSettingsFromSP() medtrumPump.loadUserSettingsFromSP()
commandQueue.setUserOptions(object : Callback() { commandQueue.setUserOptions(object : Callback() {
override fun run() { override fun run() {
if (medtrumPlugin.isInitialized() && this.result.success == false) { if (medtrumPlugin.isInitialized() && !this.result.success) {
uiInteraction.addNotification( uiInteraction.addNotification(
Notification.PUMP_SETTINGS_FAILED, Notification.PUMP_SETTINGS_FAILED,
rh.gs(R.string.pump_setting_failed), rh.gs(R.string.pump_setting_failed),
@ -204,7 +201,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
} }
fun readPumpStatus() { fun readPumpStatus() {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumpstatus))) rxBus.send(EventPumpStatusChanged(rh.gs(R.string.getting_pump_status)))
updateTimeIfNeeded(false) updateTimeIfNeeded(false)
loadEvents() loadEvents()
} }
@ -229,7 +226,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
fun updateTimeIfNeeded(needLoadHistory: Boolean = true): Boolean { fun updateTimeIfNeeded(needLoadHistory: Boolean = true): Boolean {
// Note we only check timeZone here, time is updated each connection attempt if needed, because the pump requires it to be checked // Note we only check timeZone here, time is updated each connection attempt if needed, because the pump requires it to be checked
// But we dont check timeZone each time, therefore we do it here (if needed) // But we don't check timeZone each time, therefore we do it here (if needed)
var result = true var result = true
if (medtrumPump.pumpTimeZoneOffset != dateUtil.getTimeZoneOffsetMinutes(dateUtil.now())) { if (medtrumPump.pumpTimeZoneOffset != dateUtil.getTimeZoneOffsetMinutes(dateUtil.now())) {
result = sendPacketAndGetResponse(SetTimePacket(injector)) result = sendPacketAndGetResponse(SetTimePacket(injector))
@ -245,7 +242,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
} }
fun loadEvents(): Boolean { fun loadEvents(): Boolean {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumpstatus))) rxBus.send(EventPumpStatusChanged(rh.gs(R.string.getting_pump_status)))
// Sync records // Sync records
val result = syncRecords() val result = syncRecords()
if (result) { if (result) {
@ -261,16 +258,16 @@ class MedtrumService : DaggerService(), BLECommCallback {
var result = true var result = true
if (medtrumPump.pumpState in listOf( if (medtrumPump.pumpState in listOf(
MedtrumPumpState.PAUSED, MedtrumPumpState.PAUSED,
MedtrumPumpState.HMAX_SUSPENDED, MedtrumPumpState.HOURLY_MAX_SUSPENDED,
MedtrumPumpState.DMAX_SUSPENDED MedtrumPumpState.DAILY_MAX_SUSPENDED
) )
) { ) {
when (medtrumPump.pumpState) { when (medtrumPump.pumpState) {
MedtrumPumpState.HMAX_SUSPENDED -> { MedtrumPumpState.HOURLY_MAX_SUSPENDED -> {
result = sendPacketAndGetResponse(ClearPumpAlarmPacket(injector, ALARM_HOURLY_MAX_CLEAR_CODE)) result = sendPacketAndGetResponse(ClearPumpAlarmPacket(injector, ALARM_HOURLY_MAX_CLEAR_CODE))
} }
MedtrumPumpState.DMAX_SUSPENDED -> { MedtrumPumpState.DAILY_MAX_SUSPENDED -> {
result = sendPacketAndGetResponse(ClearPumpAlarmPacket(injector, ALARM_DAILY_MAX_CLEAR_CODE)) result = sendPacketAndGetResponse(ClearPumpAlarmPacket(injector, ALARM_DAILY_MAX_CLEAR_CODE))
} }
@ -285,7 +282,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
} }
fun setUserSettings(): Boolean { fun setUserSettings(): Boolean {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingpumpsettings))) rxBus.send(EventPumpStatusChanged(rh.gs(R.string.setting_pump_settings)))
return sendPacketAndGetResponse(SetPatchPacket(injector)) return sendPacketAndGetResponse(SetPatchPacket(injector))
} }
@ -301,16 +298,16 @@ class MedtrumService : DaggerService(), BLECommCallback {
medtrumPump.bolusStopped = false medtrumPump.bolusStopped = false
medtrumPump.bolusProgressLastTimeStamp = bolusStart medtrumPump.bolusProgressLastTimeStamp = bolusStart
if (insulin > 0 && !medtrumPump.bolusStopped) { if (insulin > 0) {
val result = sendPacketAndGetResponse(SetBolusPacket(injector, insulin)) val result = sendPacketAndGetResponse(SetBolusPacket(injector, insulin))
if (result == false) { if (!result) {
aapsLogger.error(LTag.PUMPCOMM, "Failed to set bolus") aapsLogger.error(LTag.PUMPCOMM, "Failed to set bolus")
commandQueue.loadEvents(null) // make sure if anything is delivered (which is highly unlikely at this point) we get it commandQueue.loadEvents(null) // make sure if anything is delivered (which is highly unlikely at this point) we get it
t.insulin = 0.0 t.insulin = 0.0
return false return false
} }
} else { } else {
aapsLogger.debug(LTag.PUMPCOMM, "Bolus not set, insulin: $insulin, bolusStopped: ${medtrumPump.bolusStopped}") aapsLogger.debug(LTag.PUMPCOMM, "Bolus not set, insulin: $insulin")
t.insulin = 0.0 t.insulin = 0.0
return false return false
} }
@ -384,7 +381,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
// Do not call update status directly, reconnection may be needed // Do not call update status directly, reconnection may be needed
commandQueue.loadEvents(object : Callback() { commandQueue.loadEvents(object : Callback() {
override fun run() { override fun run() {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingbolusstatus))) rxBus.send(EventPumpStatusChanged(rh.gs(R.string.getting_bolus_status)))
bolusingEvent.percent = 100 bolusingEvent.percent = 100
} }
}) })
@ -395,7 +392,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
aapsLogger.debug(LTag.PUMPCOMM, "bolusStop >>>>> @ " + if (medtrumPump.bolusingTreatment == null) "" else medtrumPump.bolusingTreatment?.insulin) aapsLogger.debug(LTag.PUMPCOMM, "bolusStop >>>>> @ " + if (medtrumPump.bolusingTreatment == null) "" else medtrumPump.bolusingTreatment?.insulin)
if (isConnected) { if (isConnected) {
var success = sendPacketAndGetResponse(CancelBolusPacket(injector)) var success = sendPacketAndGetResponse(CancelBolusPacket(injector))
var timeout = System.currentTimeMillis() + T.secs(30).msecs() val timeout = System.currentTimeMillis() + T.secs(30).msecs()
while (!success && System.currentTimeMillis() < timeout) { while (!success && System.currentTimeMillis() < timeout) {
success = sendPacketAndGetResponse(CancelBolusPacket(injector)) success = sendPacketAndGetResponse(CancelBolusPacket(injector))
SystemClock.sleep(200) SystemClock.sleep(200)
@ -414,11 +411,11 @@ class MedtrumService : DaggerService(), BLECommCallback {
} }
if (result) result = sendPacketAndGetResponse(SetTempBasalPacket(injector, absoluteRate, durationInMinutes)) if (result) result = sendPacketAndGetResponse(SetTempBasalPacket(injector, absoluteRate, durationInMinutes))
// Get history records, this will update the prevoius basals // Get history records, this will update the previous basals
// Do not call update status directly, reconnection may be needed // Do not call update status directly, reconnection may be needed
commandQueue.loadEvents(object : Callback() { commandQueue.loadEvents(object : Callback() {
override fun run() { override fun run() {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingtempbasalstatus))) rxBus.send(EventPumpStatusChanged(rh.gs(R.string.getting_temp_basal_status)))
} }
}) })
@ -426,13 +423,13 @@ class MedtrumService : DaggerService(), BLECommCallback {
} }
fun cancelTempBasal(): Boolean { fun cancelTempBasal(): Boolean {
var result = sendPacketAndGetResponse(CancelTempBasalPacket(injector)) val result = sendPacketAndGetResponse(CancelTempBasalPacket(injector))
// Get history records, this will update the prevoius basals // Get history records, this will update the previous basals
// Do not call update status directly, reconnection may be needed // Do not call update status directly, reconnection may be needed
commandQueue.loadEvents(object : Callback() { commandQueue.loadEvents(object : Callback() {
override fun run() { override fun run() {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingtempbasalstatus))) rxBus.send(EventPumpStatusChanged(rh.gs(R.string.getting_temp_basal_status)))
} }
}) })
@ -462,7 +459,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
if (medtrumPump.syncedSequenceNumber < medtrumPump.currentSequenceNumber) { if (medtrumPump.syncedSequenceNumber < medtrumPump.currentSequenceNumber) {
for (sequence in (medtrumPump.syncedSequenceNumber + 1)..medtrumPump.currentSequenceNumber) { for (sequence in (medtrumPump.syncedSequenceNumber + 1)..medtrumPump.currentSequenceNumber) {
result = sendPacketAndGetResponse(GetRecordPacket(injector, sequence), COMMAND_SYNC_TIMEOUT_SEC) result = sendPacketAndGetResponse(GetRecordPacket(injector, sequence), COMMAND_SYNC_TIMEOUT_SEC)
if (result == false) break if (!result) break
} }
} }
return result return result
@ -472,11 +469,11 @@ class MedtrumService : DaggerService(), BLECommCallback {
// Map the pump state to an alarm state and add it to the active alarms // Map the pump state to an alarm state and add it to the active alarms
val alarmState = when (state) { val alarmState = when (state) {
MedtrumPumpState.NONE -> AlarmState.NONE MedtrumPumpState.NONE -> AlarmState.NONE
MedtrumPumpState.LOWBG_SUSPENDED -> AlarmState.LOWBG_SUSPENDED MedtrumPumpState.LOW_BG_SUSPENDED -> AlarmState.LOW_BG_SUSPENDED
MedtrumPumpState.LOWBG_SUSPENDED2 -> AlarmState.LOWBG_SUSPENDED2 MedtrumPumpState.LOW_BG_SUSPENDED2 -> AlarmState.LOW_BG_SUSPENDED2
MedtrumPumpState.AUTO_SUSPENDED -> AlarmState.AUTO_SUSPENDED MedtrumPumpState.AUTO_SUSPENDED -> AlarmState.AUTO_SUSPENDED
MedtrumPumpState.HMAX_SUSPENDED -> AlarmState.HMAX_SUSPENDED MedtrumPumpState.HOURLY_MAX_SUSPENDED -> AlarmState.HOURLY_MAX_SUSPENDED
MedtrumPumpState.DMAX_SUSPENDED -> AlarmState.DMAX_SUSPENDED MedtrumPumpState.DAILY_MAX_SUSPENDED -> AlarmState.DAILY_MAX_SUSPENDED
MedtrumPumpState.SUSPENDED -> AlarmState.SUSPENDED MedtrumPumpState.SUSPENDED -> AlarmState.SUSPENDED
MedtrumPumpState.PAUSED -> AlarmState.PAUSED MedtrumPumpState.PAUSED -> AlarmState.PAUSED
MedtrumPumpState.OCCLUSION -> AlarmState.OCCLUSION MedtrumPumpState.OCCLUSION -> AlarmState.OCCLUSION
@ -533,8 +530,8 @@ class MedtrumService : DaggerService(), BLECommCallback {
medtrumPump.clearAlarmState() medtrumPump.clearAlarmState()
} }
MedtrumPumpState.LOWBG_SUSPENDED, MedtrumPumpState.LOW_BG_SUSPENDED,
MedtrumPumpState.LOWBG_SUSPENDED2, MedtrumPumpState.LOW_BG_SUSPENDED2,
MedtrumPumpState.AUTO_SUSPENDED, MedtrumPumpState.AUTO_SUSPENDED,
MedtrumPumpState.SUSPENDED, MedtrumPumpState.SUSPENDED,
MedtrumPumpState.PAUSED -> { MedtrumPumpState.PAUSED -> {
@ -546,7 +543,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
// Pump will report proper TBR for this // Pump will report proper TBR for this
} }
MedtrumPumpState.HMAX_SUSPENDED -> { MedtrumPumpState.HOURLY_MAX_SUSPENDED -> {
uiInteraction.addNotification( uiInteraction.addNotification(
Notification.PUMP_SUSPENDED, Notification.PUMP_SUSPENDED,
rh.gs(R.string.pump_is_suspended_hour_max), rh.gs(R.string.pump_is_suspended_hour_max),
@ -555,7 +552,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
// Pump will report proper TBR for this // Pump will report proper TBR for this
} }
MedtrumPumpState.DMAX_SUSPENDED -> { MedtrumPumpState.DAILY_MAX_SUSPENDED -> {
uiInteraction.addNotification( uiInteraction.addNotification(
Notification.PUMP_SUSPENDED, Notification.PUMP_SUSPENDED,
rh.gs(R.string.pump_is_suspended_day_max), rh.gs(R.string.pump_is_suspended_day_max),
@ -721,8 +718,6 @@ class MedtrumService : DaggerService(), BLECommCallback {
// State for connect flow // State for connect flow
private inner class AuthState : State() { private inner class AuthState : State() {
val retryCounter = 0
override fun onEnter() { override fun onEnter() {
aapsLogger.debug(LTag.PUMPCOMM, "Medtrum Service reached AuthState") aapsLogger.debug(LTag.PUMPCOMM, "Medtrum Service reached AuthState")
mPacket = AuthorizePacket(injector) mPacket = AuthorizePacket(injector)
@ -734,7 +729,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
override fun onIndication(data: ByteArray) { override fun onIndication(data: ByteArray) {
if (mPacket?.handleResponse(data) == true) { if (mPacket?.handleResponse(data) == true) {
// Succes! // Success!
responseHandled = true responseHandled = true
responseSuccess = true responseSuccess = true
// Check if we have a supported pump // Check if we have a supported pump
@ -776,7 +771,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
override fun onIndication(data: ByteArray) { override fun onIndication(data: ByteArray) {
if (mPacket?.handleResponse(data) == true) { if (mPacket?.handleResponse(data) == true) {
// Succes! // Success!
responseHandled = true responseHandled = true
responseSuccess = true responseSuccess = true
// Place holder, not really used (yet) // Place holder, not really used (yet)
@ -808,7 +803,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
override fun onIndication(data: ByteArray) { override fun onIndication(data: ByteArray) {
if (mPacket?.handleResponse(data) == true) { if (mPacket?.handleResponse(data) == true) {
// Succes! // Success!
responseHandled = true responseHandled = true
responseSuccess = true responseSuccess = true
val currTime = dateUtil.now() val currTime = dateUtil.now()
@ -843,7 +838,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
override fun onIndication(data: ByteArray) { override fun onIndication(data: ByteArray) {
if (mPacket?.handleResponse(data) == true) { if (mPacket?.handleResponse(data) == true) {
// Succes! // Success!
responseHandled = true responseHandled = true
responseSuccess = true responseSuccess = true
toState(SetTimeZoneState()) toState(SetTimeZoneState())
@ -871,7 +866,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
override fun onIndication(data: ByteArray) { override fun onIndication(data: ByteArray) {
if (mPacket?.handleResponse(data) == true) { if (mPacket?.handleResponse(data) == true) {
// Succes! // Success!
responseHandled = true responseHandled = true
responseSuccess = true responseSuccess = true
medtrumPump.needCheckTimeUpdate = false medtrumPump.needCheckTimeUpdate = false
@ -901,7 +896,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
override fun onIndication(data: ByteArray) { override fun onIndication(data: ByteArray) {
if (mPacket?.handleResponse(data) == true) { if (mPacket?.handleResponse(data) == true) {
// Succes! // Success!
responseHandled = true responseHandled = true
responseSuccess = true responseSuccess = true
toState(SubscribeState()) toState(SubscribeState())
@ -929,7 +924,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
override fun onIndication(data: ByteArray) { override fun onIndication(data: ByteArray) {
if (mPacket?.handleResponse(data) == true) { if (mPacket?.handleResponse(data) == true) {
// Succes! // Success!
responseHandled = true responseHandled = true
responseSuccess = true responseSuccess = true
toState(ReadyState()) toState(ReadyState())
@ -949,7 +944,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
override fun onEnter() { override fun onEnter() {
aapsLogger.debug(LTag.PUMPCOMM, "Medtrum Service reached ReadyState!") aapsLogger.debug(LTag.PUMPCOMM, "Medtrum Service reached ReadyState!")
// Now we are fully connected and authenticated and we can start sending commands. Let AAPS know // Now we are fully connected and authenticated and we can start sending commands. Let AAPS know
if (isConnected == false) { if (!isConnected) {
medtrumPump.connectionState = ConnectionState.CONNECTED medtrumPump.connectionState = ConnectionState.CONNECTED
} }
} }
@ -964,7 +959,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
override fun onIndication(data: ByteArray) { override fun onIndication(data: ByteArray) {
if (mPacket?.handleResponse(data) == true) { if (mPacket?.handleResponse(data) == true) {
// Succes! // Success!
responseHandled = true responseHandled = true
responseSuccess = true responseSuccess = true
toState(ReadyState()) toState(ReadyState())

View file

@ -6,6 +6,7 @@ import android.content.pm.ActivityInfo
import android.os.Bundle import android.os.Bundle
import android.view.MotionEvent import android.view.MotionEvent
import android.view.WindowManager import android.view.WindowManager
import androidx.activity.OnBackPressedCallback
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import info.nightscout.core.utils.extensions.safeGetSerializableExtra import info.nightscout.core.utils.extensions.safeGetSerializableExtra
import info.nightscout.pump.medtrum.R import info.nightscout.pump.medtrum.R
@ -19,17 +20,13 @@ class MedtrumActivity : MedtrumBaseActivity<ActivityMedtrumBinding>() {
override fun getLayoutId(): Int = R.layout.activity_medtrum override fun getLayoutId(): Int = R.layout.activity_medtrum
override fun dispatchTouchEvent(event: MotionEvent): Boolean {
return super.dispatchTouchEvent(event)
}
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
binding.apply { binding.apply {
viewModel = ViewModelProvider(this@MedtrumActivity, viewModelFactory).get(MedtrumViewModel::class.java) viewModel = ViewModelProvider(this@MedtrumActivity, viewModelFactory)[MedtrumViewModel::class.java]
viewModel?.apply { viewModel?.apply {
processIntent(intent) processIntent(intent)
@ -70,6 +67,28 @@ class MedtrumActivity : MedtrumBaseActivity<ActivityMedtrumBinding>() {
} }
} }
} }
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
binding.viewModel?.apply {
when (patchStep.value) {
PatchStep.PREPARE_PATCH,
PatchStep.START_DEACTIVATION,
PatchStep.RETRY_ACTIVATION -> {
handleCancel()
this@MedtrumActivity.finish()
}
PatchStep.COMPLETE,
PatchStep.DEACTIVATION_COMPLETE -> {
handleComplete()
this@MedtrumActivity.finish()
}
else -> Unit
}
}
}
})
} }
override fun onNewIntent(intent: Intent?) { override fun onNewIntent(intent: Intent?) {
@ -88,20 +107,10 @@ class MedtrumActivity : MedtrumBaseActivity<ActivityMedtrumBinding>() {
} }
} }
override fun onDestroy() {
super.onDestroy()
}
override fun onBackPressed() {
binding.viewModel?.apply {
// Do nothing
}
}
companion object { companion object {
const val EXTRA_START_PATCH_STEP = "EXTRA_START_PATCH_FRAGMENT_UI" const val EXTRA_START_PATCH_STEP = "EXTRA_START_PATCH_FRAGMENT_UI"
const val EXTRA_START_FROM_MENU = "EXTRA_START_FROM_MENU" private const val EXTRA_START_FROM_MENU = "EXTRA_START_FROM_MENU"
@JvmStatic fun createIntentFromMenu(context: Context, patchStep: PatchStep): Intent { @JvmStatic fun createIntentFromMenu(context: Context, patchStep: PatchStep): Intent {
return Intent(context, MedtrumActivity::class.java).apply { return Intent(context, MedtrumActivity::class.java).apply {
@ -115,5 +124,4 @@ class MedtrumActivity : MedtrumBaseActivity<ActivityMedtrumBinding>() {
private fun setupViewFragment(baseFragment: MedtrumBaseFragment<*>) { private fun setupViewFragment(baseFragment: MedtrumBaseFragment<*>) {
replaceFragmentInActivity(baseFragment, R.id.framelayout_fragment, false) replaceFragmentInActivity(baseFragment, R.id.framelayout_fragment, false)
} }
} }

View file

@ -5,7 +5,6 @@ import android.view.View
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import info.nightscout.pump.medtrum.R import info.nightscout.pump.medtrum.R
import info.nightscout.pump.medtrum.databinding.FragmentMedtrumPreparePatchBinding import info.nightscout.pump.medtrum.databinding.FragmentMedtrumPreparePatchBinding
import info.nightscout.pump.medtrum.ui.MedtrumBaseFragment
import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag

View file

@ -8,7 +8,6 @@ import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.pump.medtrum.R import info.nightscout.pump.medtrum.R
import info.nightscout.pump.medtrum.code.PatchStep import info.nightscout.pump.medtrum.code.PatchStep
import info.nightscout.pump.medtrum.databinding.FragmentMedtrumPrimeCompleteBinding import info.nightscout.pump.medtrum.databinding.FragmentMedtrumPrimeCompleteBinding
import info.nightscout.pump.medtrum.ui.MedtrumBaseFragment
import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag

View file

@ -8,7 +8,6 @@ import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.pump.medtrum.R import info.nightscout.pump.medtrum.R
import info.nightscout.pump.medtrum.code.PatchStep import info.nightscout.pump.medtrum.code.PatchStep
import info.nightscout.pump.medtrum.databinding.FragmentMedtrumPrimeBinding import info.nightscout.pump.medtrum.databinding.FragmentMedtrumPrimeBinding
import info.nightscout.pump.medtrum.ui.MedtrumBaseFragment
import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag

View file

@ -8,7 +8,6 @@ import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.pump.medtrum.R import info.nightscout.pump.medtrum.R
import info.nightscout.pump.medtrum.code.PatchStep import info.nightscout.pump.medtrum.code.PatchStep
import info.nightscout.pump.medtrum.databinding.FragmentMedtrumPrimingBinding import info.nightscout.pump.medtrum.databinding.FragmentMedtrumPrimingBinding
import info.nightscout.pump.medtrum.ui.MedtrumBaseFragment
import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag

View file

@ -7,7 +7,6 @@ import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.pump.medtrum.R import info.nightscout.pump.medtrum.R
import info.nightscout.pump.medtrum.code.PatchStep import info.nightscout.pump.medtrum.code.PatchStep
import info.nightscout.pump.medtrum.databinding.FragmentMedtrumRetryActivationConnectBinding import info.nightscout.pump.medtrum.databinding.FragmentMedtrumRetryActivationConnectBinding
import info.nightscout.pump.medtrum.ui.MedtrumBaseFragment
import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag

View file

@ -7,7 +7,6 @@ import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.pump.medtrum.R import info.nightscout.pump.medtrum.R
import info.nightscout.pump.medtrum.code.PatchStep import info.nightscout.pump.medtrum.code.PatchStep
import info.nightscout.pump.medtrum.databinding.FragmentMedtrumRetryActivationBinding import info.nightscout.pump.medtrum.databinding.FragmentMedtrumRetryActivationBinding
import info.nightscout.pump.medtrum.ui.MedtrumBaseFragment
import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
@ -32,7 +31,7 @@ class MedtrumRetryActivationFragment : MedtrumBaseFragment<FragmentMedtrumRetryA
binding.apply { binding.apply {
viewModel = ViewModelProvider(requireActivity(), viewModelFactory)[MedtrumViewModel::class.java] viewModel = ViewModelProvider(requireActivity(), viewModelFactory)[MedtrumViewModel::class.java]
viewModel?.apply { viewModel?.apply {
preparePatch() // Use this to make sure we are disconnceted at this stage preparePatch() // Use this to make sure we are disconnected at this stage
} }
btnNegative.setOnClickListener { btnNegative.setOnClickListener {
OKDialog.showConfirmation(requireActivity(), rh.gs(R.string.medtrum_deactivate_pump_confirm)) { OKDialog.showConfirmation(requireActivity(), rh.gs(R.string.medtrum_deactivate_pump_confirm)) {

View file

@ -7,7 +7,6 @@ import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.pump.medtrum.R import info.nightscout.pump.medtrum.R
import info.nightscout.pump.medtrum.code.PatchStep import info.nightscout.pump.medtrum.code.PatchStep
import info.nightscout.pump.medtrum.databinding.FragmentMedtrumStartDeactivationBinding import info.nightscout.pump.medtrum.databinding.FragmentMedtrumStartDeactivationBinding
import info.nightscout.pump.medtrum.ui.MedtrumBaseFragment
import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag

View file

@ -9,7 +9,7 @@ import java.lang.ref.WeakReference
abstract class BaseViewModel<N : MedtrumBaseNavigator> : ViewModel() { abstract class BaseViewModel<N : MedtrumBaseNavigator> : ViewModel() {
private var _navigator: WeakReference<N?>? = null private var _navigator: WeakReference<N?>? = null
var navigator: N? private var navigator: N?
set(value) { set(value) {
_navigator = WeakReference(value) _navigator = WeakReference(value)
} }

View file

@ -114,7 +114,7 @@ class MedtrumOverviewViewModel @Inject constructor(
aapsLogger.debug(LTag.PUMP, "MedtrumViewModel pumpStateFlow: $state") aapsLogger.debug(LTag.PUMP, "MedtrumViewModel pumpStateFlow: $state")
_canDoResetAlarms.postValue( _canDoResetAlarms.postValue(
medtrumPump.pumpState in listOf( medtrumPump.pumpState in listOf(
MedtrumPumpState.PAUSED, MedtrumPumpState.HMAX_SUSPENDED, MedtrumPumpState.DMAX_SUSPENDED MedtrumPumpState.PAUSED, MedtrumPumpState.HOURLY_MAX_SUSPENDED, MedtrumPumpState.DAILY_MAX_SUSPENDED
) )
) )
@ -153,7 +153,7 @@ class MedtrumOverviewViewModel @Inject constructor(
} }
} }
fun updateGUI() { private fun updateGUI() {
// Update less dynamic values // Update less dynamic values
if (medtrumPump.lastConnection != 0L) { if (medtrumPump.lastConnection != 0L) {
val agoMilliseconds = System.currentTimeMillis() - medtrumPump.lastConnection val agoMilliseconds = System.currentTimeMillis() - medtrumPump.lastConnection

View file

@ -10,13 +10,10 @@ import info.nightscout.pump.medtrum.MedtrumPump
import info.nightscout.pump.medtrum.R import info.nightscout.pump.medtrum.R
import info.nightscout.pump.medtrum.code.ConnectionState import info.nightscout.pump.medtrum.code.ConnectionState
import info.nightscout.pump.medtrum.services.MedtrumService import info.nightscout.pump.medtrum.services.MedtrumService
import info.nightscout.pump.medtrum.code.EventType
import info.nightscout.pump.medtrum.code.PatchStep import info.nightscout.pump.medtrum.code.PatchStep
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
import info.nightscout.pump.medtrum.encryption.Crypt import info.nightscout.pump.medtrum.encryption.Crypt
import info.nightscout.pump.medtrum.ui.MedtrumBaseNavigator import info.nightscout.pump.medtrum.ui.MedtrumBaseNavigator
import info.nightscout.pump.medtrum.ui.event.SingleLiveEvent
import info.nightscout.pump.medtrum.ui.event.UIEvent
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@ -43,10 +40,6 @@ class MedtrumViewModel @Inject constructor(
val title: LiveData<Int> val title: LiveData<Int>
get() = _title get() = _title
private val _eventHandler = SingleLiveEvent<UIEvent<EventType>>()
val eventHandler: LiveData<UIEvent<EventType>>
get() = _eventHandler
private var oldPatchStep: PatchStep? = null private var oldPatchStep: PatchStep? = null
private var mInitPatchStep: PatchStep? = null private var mInitPatchStep: PatchStep? = null
private var connectRetryCounter = 0 private var connectRetryCounter = 0
@ -155,7 +148,7 @@ class MedtrumViewModel @Inject constructor(
PatchStep.RETRY_ACTIVATION_CONNECT, PatchStep.RETRY_ACTIVATION_CONNECT,
PatchStep.PREPARE_PATCH_CONNECT -> { PatchStep.PREPARE_PATCH_CONNECT -> {
// Make sure we are disconnected, else dont move step // Make sure we are disconnected, else don't move step
if (medtrumService?.isConnected == true) { if (medtrumService?.isConnected == true) {
aapsLogger.info(LTag.PUMP, "moveStep: connected, not moving step") aapsLogger.info(LTag.PUMP, "moveStep: connected, not moving step")
return return
@ -167,7 +160,7 @@ class MedtrumViewModel @Inject constructor(
PatchStep.PRIME_COMPLETE, PatchStep.PRIME_COMPLETE,
PatchStep.ATTACH_PATCH, PatchStep.ATTACH_PATCH,
PatchStep.ACTIVATE -> { PatchStep.ACTIVATE -> {
// Make sure we are connected, else dont move step // Make sure we are connected, else don't move step
if (medtrumService?.isConnected == false) { if (medtrumService?.isConnected == false) {
aapsLogger.info(LTag.PUMP, "moveStep: not connected, not moving step") aapsLogger.info(LTag.PUMP, "moveStep: not connected, not moving step")
return return
@ -321,7 +314,7 @@ class MedtrumViewModel @Inject constructor(
aapsLogger.info(LTag.PUMP, "prepareStep: title before cond: $stringResId") aapsLogger.info(LTag.PUMP, "prepareStep: title before cond: $stringResId")
if (currentTitle != stringResId) { if (currentTitle != stringResId) {
aapsLogger.info(LTag.PUMP, "prepareStep: title: $stringResId") aapsLogger.info(LTag.PUMP, "prepareStep: title: $stringResId")
_title.postValue(stringResId) stringResId?.let { _title.postValue(it) }
} }
patchStep.postValue(newStep) patchStep.postValue(newStep)

View file

@ -11,12 +11,6 @@ class MedtrumTimeUtil {
return Duration.between(startInstant, currentInstant).seconds return Duration.between(startInstant, currentInstant).seconds
} }
fun getCurrentTimePumpMillis() : Long {
val startInstant = Instant.parse("2014-01-01T00:00:00Z")
val currentInstant = Instant.now()
return Duration.between(startInstant, currentInstant).seconds * 1000
}
fun convertPumpTimeToSystemTimeMillis(pumpTime: Long): Long { fun convertPumpTimeToSystemTimeMillis(pumpTime: Long): Long {
val startInstant = Instant.parse("2014-01-01T00:00:00Z") val startInstant = Instant.parse("2014-01-01T00:00:00Z")
val pumpInstant = startInstant.plusSeconds(pumpTime) val pumpInstant = startInstant.plusSeconds(pumpTime)

View file

@ -34,8 +34,7 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent" />
tools:text="@string/string_change_patch" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -26,19 +26,33 @@
tools:context=".ui.MedtrumActivity"> tools:context=".ui.MedtrumActivity">
<TextView <TextView
android:id="@+id/text_remove_base_discard_patch" android:id="@+id/text_retract_needle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:gravity="center" android:gravity="center"
android:text="@string/remove_base_discard_patch" android:text="@string/retract_needle"
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_remove_base_discard_patch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:gravity="center"
android:text="@string/remove_base_discard_patch"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_retract_needle" />
<TextView <TextView
android:id="@+id/text_press_next_or_OK" android:id="@+id/text_press_next_or_OK"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -1,6 +1,5 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:tools="http://schemas.android.com/tools">
<data> <data>

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- MedtrumPump -->
<!-- overview fragment -->
<!-- Alarm strings -->
<!-- wizard-->
<!-- settings-->
<!-- treatment state-->
</resources>

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