Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
6
600SeriesAndroidUploader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cgm
uploader
600SeriesAndroidUploader
Commits
2dd42852
Commit
2dd42852
authored
7 years ago
by
Volker Richert
Browse files
Options
Downloads
Patches
Plain Diff
add check on successfull while pushing to NS
rename bolusApi to bolusEndpoints to be consistant
parent
4dabbb0f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/info/nightscout/android/upload/nightscout/NightScoutUpload.java
+14
-8
14 additions, 8 deletions
...ightscout/android/upload/nightscout/NightScoutUpload.java
app/src/main/java/info/nightscout/api/UploadApi.java
+4
-5
4 additions, 5 deletions
app/src/main/java/info/nightscout/api/UploadApi.java
with
18 additions
and
13 deletions
app/src/main/java/info/nightscout/android/upload/nightscout/NightScoutUpload.java
+
14
−
8
View file @
2dd42852
...
@@ -27,6 +27,9 @@ import info.nightscout.api.DeviceEndpoints.Battery;
...
@@ -27,6 +27,9 @@ import info.nightscout.api.DeviceEndpoints.Battery;
import
info.nightscout.api.DeviceEndpoints.PumpStatus
;
import
info.nightscout.api.DeviceEndpoints.PumpStatus
;
import
info.nightscout.api.DeviceEndpoints.PumpInfo
;
import
info.nightscout.api.DeviceEndpoints.PumpInfo
;
import
info.nightscout.api.DeviceEndpoints.DeviceStatus
;
import
info.nightscout.api.DeviceEndpoints.DeviceStatus
;
import
okhttp3.ResponseBody
;
import
retrofit2.Response
;
import
retrofit2.Retrofit
;
class
NightScoutUpload
{
class
NightScoutUpload
{
...
@@ -59,7 +62,7 @@ class NightScoutUpload {
...
@@ -59,7 +62,7 @@ class NightScoutUpload {
UploadApi
uploadApi
=
new
UploadApi
(
baseURL
,
formToken
(
secret
));
UploadApi
uploadApi
=
new
UploadApi
(
baseURL
,
formToken
(
secret
));
boolean
eventsUploaded
=
uploadEvents
(
uploadApi
.
getGlucoseEndpoints
(),
boolean
eventsUploaded
=
uploadEvents
(
uploadApi
.
getGlucoseEndpoints
(),
uploadApi
.
getBolus
Api
(),
uploadApi
.
getBolus
Endpoints
(),
records
);
records
);
boolean
deviceStatusUploaded
=
uploadDeviceStatus
(
uploadApi
.
getDeviceEndpoints
(),
boolean
deviceStatusUploaded
=
uploadDeviceStatus
(
uploadApi
.
getDeviceEndpoints
(),
...
@@ -103,15 +106,16 @@ class NightScoutUpload {
...
@@ -103,15 +106,16 @@ class NightScoutUpload {
}
}
boolean
uploaded
=
true
;
if
(
glucoseEntries
.
size
()
>
0
)
{
if
(
glucoseEntries
.
size
()
>
0
)
{
glucoseEndpoints
.
sendEntries
(
glucoseEntries
).
execute
();
Response
<
ResponseBody
>
result
=
glucoseEndpoints
.
sendEntries
(
glucoseEntries
).
execute
();
uploaded
=
uploaded
&&
result
.
isSuccessful
();
}
}
if
(
bolusEntries
.
size
()
>
0
)
{
if
(
bolusEntries
.
size
()
>
0
)
{
bolusEndpoints
.
sendEntries
(
bolusEntries
).
execute
();
Response
<
ResponseBody
>
result
=
bolusEndpoints
.
sendEntries
(
bolusEntries
).
execute
();
uploaded
=
uploaded
&&
result
.
isSuccessful
();
}
}
return
uploaded
;
return
true
;
}
}
private
boolean
uploadDeviceStatus
(
DeviceEndpoints
deviceEndpoints
,
private
boolean
uploadDeviceStatus
(
DeviceEndpoints
deviceEndpoints
,
...
@@ -152,11 +156,13 @@ class NightScoutUpload {
...
@@ -152,11 +156,13 @@ class NightScoutUpload {
deviceEntries
.
add
(
deviceStatus
);
deviceEntries
.
add
(
deviceStatus
);
}
}
boolean
uploaded
=
true
;
for
(
DeviceStatus
status
:
deviceEntries
)
{
for
(
DeviceStatus
status
:
deviceEntries
)
{
deviceEndpoints
.
sendDeviceStatus
(
status
).
execute
();
Response
<
ResponseBody
>
result
=
deviceEndpoints
.
sendDeviceStatus
(
status
).
execute
();
uploaded
=
uploaded
&&
result
.
isSuccessful
();
}
}
return
true
;
return
uploaded
;
}
}
@NonNull
@NonNull
...
...
This diff is collapsed.
Click to expand it.
app/src/main/java/info/nightscout/api/UploadApi.java
+
4
−
5
View file @
2dd42852
...
@@ -15,15 +15,15 @@ import retrofit2.converter.gson.GsonConverterFactory;
...
@@ -15,15 +15,15 @@ import retrofit2.converter.gson.GsonConverterFactory;
public
class
UploadApi
{
public
class
UploadApi
{
private
Retrofit
retrofit
;
private
Retrofit
retrofit
;
private
GlucoseEndpoints
glucoseEndpoints
;
private
GlucoseEndpoints
glucoseEndpoints
;
private
BolusEndpoints
bolus
Api
;
private
BolusEndpoints
bolus
Endpoints
;
private
DeviceEndpoints
deviceEndpoints
;
private
DeviceEndpoints
deviceEndpoints
;
public
GlucoseEndpoints
getGlucoseEndpoints
()
{
public
GlucoseEndpoints
getGlucoseEndpoints
()
{
return
glucoseEndpoints
;
return
glucoseEndpoints
;
}
}
public
BolusEndpoints
getBolus
Api
()
{
public
BolusEndpoints
getBolus
Endpoints
()
{
return
bolus
Api
;
return
bolus
Endpoints
;
}
}
public
DeviceEndpoints
getDeviceEndpoints
()
{
public
DeviceEndpoints
getDeviceEndpoints
()
{
...
@@ -71,8 +71,7 @@ public class UploadApi {
...
@@ -71,8 +71,7 @@ public class UploadApi {
.
build
();
.
build
();
glucoseEndpoints
=
retrofit
.
create
(
GlucoseEndpoints
.
class
);
glucoseEndpoints
=
retrofit
.
create
(
GlucoseEndpoints
.
class
);
bolus
Api
=
retrofit
.
create
(
BolusEndpoints
.
class
);
bolus
Endpoints
=
retrofit
.
create
(
BolusEndpoints
.
class
);
deviceEndpoints
=
retrofit
.
create
(
DeviceEndpoints
.
class
);
deviceEndpoints
=
retrofit
.
create
(
DeviceEndpoints
.
class
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment