Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
tolot27 committed Nov 1, 2022
2 parents 613f02e + 3e2ec75 commit b81c666
Show file tree
Hide file tree
Showing 13 changed files with 512 additions and 10 deletions.
Binary file added aidex_text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
tools:ignore="InnerclassSeparator">
<!-- To receive data from HAPP. -->
<uses-permission android:name="com.eveningoutpost.dexdrip.permissions.RECEIVE_EXTERNAL_STATUSLINE" />
<!-- To receive data from Aidex -->
<uses-permission android:name="com.microtechmd.cgms.aidex.permissions.RECEIVE_BG_ESTIMATE" />

<uses-feature
android:name="android.hardware.bluetooth_le"
Expand Down Expand Up @@ -498,6 +500,16 @@
<action android:name="com.eveningoutpost.dexdrip.OOP2_BLUETOOTH_ENABLE_RESULT" />
</intent-filter>
</receiver>
<receiver android:name=".receivers.aidex.AidexReceiver">
<intent-filter>
<action android:name="com.microtechmd.cgms.aidex.action.BgEstimate" />
<action android:name="com.microtechmd.cgms.aidex.action.Calibration" />
<action android:name="com.microtechmd.cgms.aidex.action.SensorNew" />
<action android:name="com.microtechmd.cgms.aidex.action.SensorRestart" />
<action android:name="com.microtechmd.cgms.aidex.action.SensorStop" />
<action android:name="com.microtechmd.cgms.aidex.action.Notification" />
</intent-filter>
</receiver>
<receiver android:name=".watch.thinjam.io.ThinJamApiReceiver">
<intent-filter>
<action android:name="com.eveningoutpost.dexdrip.THINJAM_API" />
Expand Down Expand Up @@ -777,4 +789,4 @@
<service android:name=".cgm.webfollow.WebFollowService" />
</application>

</manifest>
</manifest>
17 changes: 17 additions & 0 deletions app/src/main/java/com/eveningoutpost/dexdrip/Models/Sensor.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ public static Sensor getByTimestamp(double started_at) {
.executeSingle();
}

public static Sensor restartSensor(String sensorUuid) {
Sensor sensor = getByUuid(sensorUuid);

sensor.stopped_at = 0;
UserError.Log.ueh("SENSOR", "Sensor restarted");
sensor.save();

Sensor currentSensor = currentSensor();
if (currentSensor != null) {
UserError.Log.wtf(TAG, "Failed to update sensor restart in database");
}
SensorSendQueue.addToQueue(currentSensor);
JoH.clearCache();

return currentSensor;
}

public static Sensor getByUuid(String xDrip_sensor_uuid) {
if(xDrip_sensor_uuid == null) {
Log.e("SENSOR", "xDrip_sensor_uuid is null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static void snoozeForType(long minutes, SnoozeType disableType, SharedPre

static final long infiniteSnoozeValueInMinutes = 5256000;//10 years
//static final int snoozeValues[] = new int []{5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 75, 90, 105, 120, 150, 180, 240, 300, 360, 420, 480, 540, 600};
static final int snoozeValues[] = new int []{ 10, 15, 20, 30, 40, 50, 60, 75, 90, 120, 150, 180, 240, 300, 360, 420, 480, 540, 600};
static final int snoozeValues[] = new int []{ 10, 15, 20, 30, 40, 50, 60, 75, 90, 120, 150, 180, 240, 300, 360, 420, 480, 540, 600, 720};

static int getSnoozeLocation(int time) {
for (int i=0; i < snoozeValues.length; i++) {
Expand Down Expand Up @@ -409,4 +409,4 @@ public void setSendRemoteSnoozeOnClick(View v) {
AlertPlayer.getPlayer().Snooze(xdrip.getAppContext(), -1);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package com.eveningoutpost.dexdrip.receivers.aidex;

/**
* created by Andy 4/3/2022
*/
public interface AidexBroadcastIntents {
// DON'T CHANGE THIS - START

/**
* Permission receiving application will need to use if not running in old model
*/
String RECEIVER_PERMISSION = "com.microtechmd.cgms.aidex.permissions.RECEIVE_BG_ESTIMATE";

/**
* Aidex Action: New Bg Estimate
*/
String ACTION_NEW_BG_ESTIMATE = "com.microtechmd.cgms.aidex.action.BgEstimate";

/**
* Aidex Action: Calibration
*/
String ACTION_CALIBRATION = "com.microtechmd.cgms.aidex.action.Calibration";

/**
* Aidex Action: New Sensor
*/
String ACTION_SENSOR_NEW = "com.microtechmd.cgms.aidex.action.SensorNew";

/**
* Aidex Action: Restart Sensor
*/
String ACTION_SENSOR_RESTART = "com.microtechmd.cgms.aidex.action.SensorRestart";

/**
* Aidex Action: Stop Sensor
*/
String ACTION_SENSOR_STOP = "com.microtechmd.cgms.aidex.action.SensorStop";

/**
* Aidex Action: Notification
*/
String ACTION_NOTIFICATION = "com.microtechmd.cgms.aidex.action.Notification";


// DATA
/**
* BG Type: Can be either mmol/l or mg/dl
*/
String AIDEX_BG_TYPE = "com.microtechmd.cgms.aidex.BgType";

/**
* BG Value: Its float (so it can be 10.0 or 181.0)
*/
String AIDEX_BG_VALUE = "com.microtechmd.cgms.aidex.BgValue";

/**
* BG Slope Name: following values are valid:
* "DoubleUp", "SingleUp", "FortyFiveUp", "Flat", "FortyFiveDown", "SingleDown",
* "DoubleDown", "NotComputable", "RateOutOfRange"
*/
String AIDEX_BG_SLOPE_NAME = "com.microtechmd.cgms.aidex.BgSlopeName";

/**
* Timestamp as Epoch (System.currentTimeMillis()) in miliseconds
*/
String AIDEX_TIMESTAMP = "com.microtechmd.cgms.aidex.Time"; // epoch in ms

/**
* Transmitter Id (String)
*/
String AIDEX_TRANSMITTER_SN = "com.microtechmd.cgms.aidex.TransmitterSerialNumber";

/**
* Sensor Id (String)
*/
String AIDEX_SENSOR_ID = "com.microtechmd.cgms.aidex.SensorId";

/**
* Message Type (SENSOR_ERROR, CALIBRATION_REQUESTED, BATTERY_LOW,
* BATTERY_EMPTY, SENSOR_EXPIRED, OTHER)
*/
String AIDEX_MESSAGE_TYPE = "com.microtechmd.cgms.aidex.MessageType";

/**
* Message Value
*/
String AIDEX_MESSAGE_VALUE = "com.microtechmd.cgms.aidex.MessageValue";

String UNIT_MMOL_L = "mmol/l";
String UNIT_MG_DL = "mg/dl";

// DON'T CHANGE THIS - END

// You can add your own data here

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.eveningoutpost.dexdrip.receivers.aidex;

import android.support.annotation.StringRes;

import com.eveningoutpost.dexdrip.R;

import java.util.HashMap;
import java.util.Map;

public enum AidexMessageType {
SENSOR_ERROR(null),
TRANSMITTER_ERROR(null),
CALIBRATION_REQUESTED(null),
GLUCOSE_INVALID(null),
BATTERY_LOW(null),
BATTERY_EMPTY(null),
SENSOR_EXPIRED(null),
OTHER(null);

static Map<String,AidexMessageType> mapByKey;
private @StringRes Integer resourceId;

static {
mapByKey = new HashMap<>();

for (AidexMessageType value : values()) {
mapByKey.put(value.name(), value);
}
}

AidexMessageType(@StringRes Integer resourceId) {
this.resourceId = resourceId;
}

public static AidexMessageType getByKey(String key) {
if (mapByKey.containsKey(key))
return mapByKey.get(key);
else
return OTHER;
}

public int getResourceId() {
return resourceId;
}
}
Loading

0 comments on commit b81c666

Please sign in to comment.