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
17c3f544
Commit
17c3f544
authored
8 years ago
by
Lennart Goedhart
Browse files
Options
Downloads
Patches
Plain Diff
Commit working version of Uploader before refactoring messages to be "classier".
parent
f1c29832
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.idea/vcs.xml
+1
-1
1 addition, 1 deletion
.idea/vcs.xml
app/src/main/java/com/nightscout/android/medtronic/MedtronicCNLReader.java
+19
-21
19 additions, 21 deletions
.../com/nightscout/android/medtronic/MedtronicCNLReader.java
with
20 additions
and
22 deletions
.idea/vcs.xml
+
1
−
1
View file @
17c3f544
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
""
vcs=
""
/>
<mapping
directory=
"
$PROJECT_DIR$
"
vcs=
"
Git
"
/>
</component>
</component>
</project>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/src/main/java/com/nightscout/android/medtronic/MedtronicCNLReader.java
+
19
−
21
View file @
17c3f544
...
@@ -4,8 +4,8 @@ import android.util.Log;
...
@@ -4,8 +4,8 @@ import android.util.Log;
import
com.nightscout.android.USB.UsbHidDriver
;
import
com.nightscout.android.USB.UsbHidDriver
;
import
com.nightscout.android.dexcom.USB.HexDump
;
import
com.nightscout.android.dexcom.USB.HexDump
;
import
com.nightscout.android.medtronic.message.ContourNextLinkBinaryMessage
;
import
com.nightscout.android.medtronic.message.ChannelNegotiateMessage
;
import
com.nightscout.android.medtronic.message.ChannelNegotiateMessage
;
import
com.nightscout.android.medtronic.message.ContourNextLinkBinaryMessage
;
import
com.nightscout.android.medtronic.service.MedtronicCNLService
;
import
com.nightscout.android.medtronic.service.MedtronicCNLService
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
...
@@ -24,25 +24,9 @@ public class MedtronicCNLReader {
...
@@ -24,25 +24,9 @@ public class MedtronicCNLReader {
private
static
final
String
BAYER_USB_HEADER
=
"ABC"
;
private
static
final
String
BAYER_USB_HEADER
=
"ABC"
;
private
static
final
byte
[]
RADIO_CHANNELS
=
{
0x14
,
0x11
,
0x0e
,
0x17
,
0x1a
};
private
static
final
byte
[]
RADIO_CHANNELS
=
{
0x14
,
0x11
,
0x0e
,
0x17
,
0x1a
};
public
String
deviceInfo
;
public
enum
ASCII
{
STX
(
0x02
),
EOT
(
0x04
),
ENQ
(
0x05
),
ACK
(
0x06
),
NAK
(
0x15
);
private
byte
value
;
ASCII
(
int
code
)
{
this
.
value
=
(
byte
)
code
;
}
}
private
UsbHidDriver
mDevice
;
private
UsbHidDriver
mDevice
;
private
MedtronicCNLSession
mPumpSession
=
new
MedtronicCNLSession
();
private
MedtronicCNLSession
mPumpSession
=
new
MedtronicCNLSession
();
public
String
deviceInfo
;
public
MedtronicCNLReader
(
UsbHidDriver
device
)
{
public
MedtronicCNLReader
(
UsbHidDriver
device
)
{
mDevice
=
device
;
mDevice
=
device
;
}
}
...
@@ -51,8 +35,8 @@ public class MedtronicCNLReader {
...
@@ -51,8 +35,8 @@ public class MedtronicCNLReader {
ByteArrayOutputStream
responseMessage
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
responseMessage
=
new
ByteArrayOutputStream
();
byte
[]
responseBuffer
=
new
byte
[
USB_BLOCKSIZE
];
byte
[]
responseBuffer
=
new
byte
[
USB_BLOCKSIZE
];
int
bytesRead
=
0
;
int
bytesRead
;
int
messageSize
=
0
;
int
messageSize
;
do
{
do
{
bytesRead
=
mDevice
.
read
(
responseBuffer
,
READ_TIMEOUT_MS
);
bytesRead
=
mDevice
.
read
(
responseBuffer
,
READ_TIMEOUT_MS
);
...
@@ -133,7 +117,7 @@ public class MedtronicCNLReader {
...
@@ -133,7 +117,7 @@ public class MedtronicCNLReader {
public
void
openConnection
()
throws
IOException
{
public
void
openConnection
()
throws
IOException
{
ContourNextLinkBinaryMessage
message
=
new
ContourNextLinkBinaryMessage
(
ContourNextLinkBinaryMessage
.
CommandType
.
OPEN_CONNECTION
,
mPumpSession
,
mPumpSession
.
getHMAC
());
ContourNextLinkBinaryMessage
message
=
new
ContourNextLinkBinaryMessage
(
ContourNextLinkBinaryMessage
.
CommandType
.
OPEN_CONNECTION
,
mPumpSession
,
mPumpSession
.
getHMAC
());
message
.
send
(
this
);
//
message.send(this);
sendMessage
(
message
.
encode
());
sendMessage
(
message
.
encode
());
// FIXME - We need to care what the response message is - wrong MAC and all that
// FIXME - We need to care what the response message is - wrong MAC and all that
readMessage
();
readMessage
();
...
@@ -152,4 +136,18 @@ public class MedtronicCNLReader {
...
@@ -152,4 +136,18 @@ public class MedtronicCNLReader {
sendMessage
(
message
.
encode
());
sendMessage
(
message
.
encode
());
}
}
}
}
public
enum
ASCII
{
STX
(
0x02
),
EOT
(
0x04
),
ENQ
(
0x05
),
ACK
(
0x06
),
NAK
(
0x15
);
private
byte
value
;
ASCII
(
int
code
)
{
this
.
value
=
(
byte
)
code
;
}
}
}
}
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