Skip to content

Instantly share code, notes, and snippets.

View masve's full-sized avatar

Mark Ian Svenningsen masve

  • Copenhagen, Denmark
View GitHub Profile
@masve
masve / egvresponse
Created December 11, 2014 08:38
dexcom share bytearray last egvpage response
byte[] array = { 0x01, 0x16, 0x02, 0x01, 0xec, 0x23, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x02, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00 };
byte[] array = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x3c, 0xfc, 0xbc, 0xc0, 0x0a, 0x6b, 0x9a, 0x1f, 0x0b };
byte[] array = { 0x6e, 0x00, 0x14, 0xc7, 0x03, 0x28, 0xbe, 0xc0, 0x0a, 0x97, 0x9b, 0x1f, 0x0b, 0x6e, 0x00, 0x14, 0x1b, 0x2c, 0x54, 0xbf };
byte[] array = { 0xc0, 0x0a, 0xc3, 0x9c, 0x1f, 0x0b, 0x6e, 0x00, 0x14, 0x15, 0xe8, 0x80, 0xc0, 0xc0, 0x0a, 0xef, 0x9d, 0x1f, 0x0b, 0x6e };
byte[] array = { 0x00, 0x14, 0x1d, 0xd1, 0xac, 0xc1, 0xc0, 0x0a, 0x1b, 0x9f, 0x1f, 0x0b, 0x6e, 0x00, 0x14, 0xf5, 0x82, 0xd8, 0xc2, 0xc0 };
byte[] array = { 0x0a, 0x47, 0xa0, 0x1f, 0x0b, 0x6e, 0x00, 0x14, 0x9c, 0x8b, 0x04, 0xc4, 0xc0, 0x0a, 0x73, 0xa1, 0x1f, 0x0b, 0x6e, 0x00 };
byte[] array = { 0x14, 0x43, 0x4e, 0x2f, 0xc5, 0xc0, 0x0a, 0x9f, 0xa2, 0x1f, 0x0b, 0x6e, 0x00, 0x14, 0x60, 0xd5, 0xff, 0xff, 0xff, 0xff };
byte[] array = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
@masve
masve / egv_response
Created December 7, 2014 19:54
response from cgm requesting for latest glucose reading.
byte[] array0 = { 0x01, 0x16, 0x02, 0x01, 0xea, 0x1f, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x02, 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00 };
byte[] array1 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x66, 0x31, 0x0e, 0xbc, 0x0a, 0xa0, 0xeb, 0x1a, 0x0b };
byte[] array2 = { 0x6f, 0x00, 0x14, 0xb7, 0x45, 0x5d, 0x0f, 0xbc, 0x0a, 0xcc, 0xec, 0x1a, 0x0b, 0x6f, 0x00, 0x14, 0xa4, 0x1e, 0x89, 0x10 };
byte[] array3 = { 0xbc, 0x0a, 0xf8, 0xed, 0x1a, 0x0b, 0x6e, 0x00, 0x14, 0x5d, 0xff, 0xb5, 0x11, 0xbc, 0x0a, 0x24, 0xef, 0x1a, 0x0b, 0x6e };
byte[] array4 = { 0x00, 0x14, 0xd3, 0x04, 0xe1, 0x12, 0xbc, 0x0a, 0x50, 0xf0, 0x1a, 0x0b, 0x6e, 0x00, 0x14, 0x93, 0x6f, 0x0d, 0x14, 0xbc };
byte[] array5 = { 0x0a, 0x7c, 0xf1, 0x1a, 0x0b, 0x6e, 0x00, 0x14, 0xdd, 0xf1, 0x39, 0x15, 0xbc, 0x0a, 0xa8, 0xf2, 0x1a, 0x0b, 0x6e, 0x00 };
byte[] array6 = { 0x14, 0xd0, 0x7e, 0x65, 0x16, 0xbc, 0x0a, 0xd4, 0xf3, 0x1a, 0x0b, 0x6d, 0x00, 0x14, 0xc4, 0xe7, 0x91, 0x17, 0xbc, 0x0a };
byte[] array7 = { 0x00, 0xf5, 0x1a, 0x0b, 0x
@masve
masve / ble_log
Created December 5, 2014 16:13
Shows data exchange between android and cgm over ble. Flow: Authenticate -> SetIndicate -> Get last EGV page from internal db -> Get latest glucose reading.
12-05 17:05:58.800 11296-11296/com.dtu.marksv.dexcomble2 D/OpenGLRenderer﹕ Enabling debug mode 0
12-05 17:05:58.845 11296-11296/com.dtu.marksv.dexcomble2 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@41c28f20 time:6405211
12-05 17:06:05.255 11296-11296/com.dtu.marksv.dexcomble2 D/BluetoothGatt﹕ Restarting bluetooth adapter...
12-05 17:06:06.080 11296-11296/com.dtu.marksv.dexcomble2 D/BluetoothGatt﹕ Starting Scan...
12-05 17:06:06.085 11296-11296/com.dtu.marksv.dexcomble2 D/BluetoothAdapter﹕ startLeScan(): null
12-05 17:06:06.090 11296-11307/com.dtu.marksv.dexcomble2 D/BluetoothAdapter﹕ onClientRegistered() - status=0 clientIf=5
12-05 17:06:06.160 11296-11308/com.dtu.marksv.dexcomble2 I/BluetoothGatt﹕ New LE Device: DEXCOMRX @ -71
12-05 17:06:06.255 11296-11307/com.dtu.marksv.dexcomble2 I/BluetoothGatt﹕ New LE Device: DEXCOMRX @ -73
12-05 17:06:06.360 11296-11308/com.dtu.marksv.dexcomble2 I/BluetoothGatt﹕ New LE Device: DEXCOMRX @ -78
12-05 17:06:06.460 11296-11307/com.dtu.marksv.dex
@masve
masve / output.txt
Created November 8, 2014 11:47
stick output
howdy
{ _readableState:
{ highWaterMark: 0,
buffer: [],
length: 0,
pipes: null,
pipesCount: 0,
flowing: false,
ended: false,
endEmitted: false,
@masve
masve / caredroid-interface
Created October 5, 2014 14:33
carelink-android JockeyJS interface/event listeners
/**
* This is basically the interface, or the events from JockeyJS that Java listens to.
* This is how JockeyJS/Javascript will invoke functions in implemented in Java.
*/
private void setJockeyEvents() {
jockey.on("open", new JockeyHandler() {
@Override
protected void doPerform(Map<Object, Object> payload) {
Log.d(TAG, "Jockey called open");
@masve
masve / index.html
Created October 5, 2014 13:44
basic counter
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script type="text/javascript">
var x = 0;
setInterval(function () {
x++;
$('#counter').text(x);
@masve
masve / readAndWrite
Created October 5, 2014 12:58
Android Host API: read and write operations (asynchronous)
/**
* Gets the response from the connected device.
* @param outRequest UsbRequest referencing the request.
* @return Returns the response in a byte[].
* @throws UsbException
*/
public byte[] read(UsbRequest outRequest) throws UsbException {
if (mUsbDeviceConnection == null) {
throw new UsbException("no connection available");
}
@masve
masve / open.java
Created October 5, 2014 12:31
Andoid Host API: assigning interface, endpoints and open UsbDeviceConnection
// Assigning interface
UsbInterface mInterface = mUsbDevice.getInterface(0);
// Assigning endpoint in and out
UsbEndpoint epOUT = mInterface.getEndpoint(0);
UsbEndpoint epIN = mInterface.getEndpoint(1);
// Open connection
mUsbDeviceConnection = mUsbManager.openDevice(mUsbDevice);
@masve
masve / getDevice.java
Created October 5, 2014 12:16
Android Host API: enumerating usb device and finding UsbDevice with appropriate vendor and product id.
UsbManager mUsbManager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
Log.d(TAG, "Enumerating connected devices...");
UsbDevice mUsbDevice;
// Getting the CareLink UsbDevice object
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
while (deviceIterator.hasNext()) {
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<!-- JQuery isn't needed for JockeyJS, just used in this example. -->
<script type="text/javascript" src="file:///android_asset/jquery-1.9.1.js"></script>
<!-- Required includes. json2.js may not be required in specific instances. -->
<script type="text/javascript" src="file:///android_asset/jockey.js"></script>