diff --git a/.idea/libraries/acra_4_5_0.xml b/.idea/libraries/acra_4_5_0.xml
new file mode 100644
index 0000000..c54996c
--- /dev/null
+++ b/.idea/libraries/acra_4_5_0.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/gson_2_3.xml b/.idea/libraries/gson_2_3.xml
new file mode 100644
index 0000000..f7974c7
--- /dev/null
+++ b/.idea/libraries/gson_2_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/guava_14_0_1.xml b/.idea/libraries/guava_14_0_1.xml
new file mode 100644
index 0000000..5275114
--- /dev/null
+++ b/.idea/libraries/guava_14_0_1.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/mongo_java_driver_2_12_3.xml b/.idea/libraries/mongo_java_driver_2_12_3.xml
new file mode 100644
index 0000000..bca31c8
--- /dev/null
+++ b/.idea/libraries/mongo_java_driver_2_12_3.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/org_eclipse_paho_client_mqttv3_1_0_0.xml b/.idea/libraries/org_eclipse_paho_client_mqttv3_1_0_0.xml
new file mode 100644
index 0000000..ad5926d
--- /dev/null
+++ b/.idea/libraries/org_eclipse_paho_client_mqttv3_1_0_0.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_wearable_5_0_77.xml b/.idea/libraries/play_services_wearable_5_0_77.xml
new file mode 100644
index 0000000..cd236ac
--- /dev/null
+++ b/.idea/libraries/play_services_wearable_5_0_77.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/protobuf_java_2_5_0.xml b/.idea/libraries/protobuf_java_2_5_0.xml
new file mode 100644
index 0000000..b049cb7
--- /dev/null
+++ b/.idea/libraries/protobuf_java_2_5_0.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_annotations_20_0_0.xml b/.idea/libraries/support_annotations_20_0_0.xml
new file mode 100644
index 0000000..ce41c6b
--- /dev/null
+++ b/.idea/libraries/support_annotations_20_0_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_v13_20_0_0.xml b/.idea/libraries/support_v13_20_0_0.xml
new file mode 100644
index 0000000..2d52151
--- /dev/null
+++ b/.idea/libraries/support_v13_20_0_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_20_0_0.xml b/.idea/libraries/support_v4_20_0_0.xml
new file mode 100644
index 0000000..347fa3e
--- /dev/null
+++ b/.idea/libraries/support_v4_20_0_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/wearable_1_0_0.xml b/.idea/libraries/wearable_1_0_0.xml
new file mode 100644
index 0000000..58144b3
--- /dev/null
+++ b/.idea/libraries/wearable_1_0_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mobile/src/main/java/com/ktind/cgm/bgscout/RemoteMQTTDevice.java b/mobile/src/main/java/com/ktind/cgm/bgscout/RemoteMQTTDevice.java
index 872a6b6..3f3476f 100644
--- a/mobile/src/main/java/com/ktind/cgm/bgscout/RemoteMQTTDevice.java
+++ b/mobile/src/main/java/com/ktind/cgm/bgscout/RemoteMQTTDevice.java
@@ -85,7 +85,7 @@ public void run() {
mqttMgr.initConnect(url);
Log.d(TAG, "Subscribe start");
// mqttMgr.subscribe("/entries/sgv", "/uploader");
- mqttMgr.subscribe("/entries/sgv","/protobuf/test2");
+ mqttMgr.subscribe("/entries/sgv","/downloads/protobuf");
Log.d(TAG,"Connect ended");
}
}).start();
@@ -127,7 +127,7 @@ public void onMessage(String topic, MqttMessage msg) {
setLastDownloadObject(ddo);
onDownload(ddo);
}
- if (topic.equals("/protobuf/test2")){
+ if (topic.equals("/downloads/protobuf")){
try {
SGV.ProposedCookieMonsterG4Download protoBufDownload=SGV.ProposedCookieMonsterG4Download.parseFrom(msg.getPayload());
Log.d("XXX", "SGV Download status: "+protoBufDownload.getDownloadStatus().name());
@@ -149,6 +149,8 @@ public void onMessage(String topic, MqttMessage msg) {
.setEgvRecords(egvRecords)
.setRemoteDevice(false)
.setDeviceName("dexcom")
+ .setDeviceBattery(protoBufDownload.getReceiverBattery())
+ .setUploaderBattery(protoBufDownload.getUploaderBattery())
.setUnit(GlucoseUnit.values()[protoBufDownload.getUnits().getNumber()])
.setDeviceID("device_1")
.setLastReadingDate(egvRecords.get(egvRecords.size()-1).getDate())
diff --git a/mobile/src/main/java/com/ktind/cgm/bgscout/mqtt/MQTTMgr.java b/mobile/src/main/java/com/ktind/cgm/bgscout/mqtt/MQTTMgr.java
index 2cb1aef..2ee6c56 100644
--- a/mobile/src/main/java/com/ktind/cgm/bgscout/mqtt/MQTTMgr.java
+++ b/mobile/src/main/java/com/ktind/cgm/bgscout/mqtt/MQTTMgr.java
@@ -137,8 +137,6 @@ public void connect(String url, String lwt) {
Log.e(TAG, "User and/or password is null. Please verify arguments to the constructor");
return;
}
-// setupNetworkNotifications();
-// mClient=null;
stats.addConnect();
setupOpts(lwt);
// Save the URL for later re-connections
@@ -149,12 +147,13 @@ public void connect(String url, String lwt) {
mClient = new MqttClient(url, mDeviceId, mDataStore);
mClient.connect(mOpts);
StaticAlertMessages.removeMessage(MQTTDISCONNECT);
-// NotifHelper.clearMessage(context,"Disconnected from MQTT");
-// connected=true;
setNextKeepAlive();
state=State.CONNECTED;
} catch (MqttException e) {
Log.e(TAG, "Error while connecting: ", e);
+ } catch (IllegalArgumentException e) {
+ // TODO: here to catch malformed endpoints. Need to add more robust handling later
+ Log.e(TAG, "Error while connecting: ", e);
}
}
@@ -305,8 +304,6 @@ public void connectionLost(Throwable throwable) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "RemoteCGM "+deviceIDStr);
wl.acquire();
-// connected=false;
-// if (isOnline())
reconnectDelayed();
wl.release();
} else {