Java Code Examples for com.eveningoutpost.dexdrip.Services.DexCollectionService#last_transmitter_Data()
The following examples show how to use
com.eveningoutpost.dexdrip.Services.DexCollectionService#last_transmitter_Data() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Blukon.java From xDrip with GNU General Public License v3.0 | 6 votes |
private static synchronized void processNewTransmitterData(TransmitterData transmitterData) { if (transmitterData == null) { Log.e(TAG, "Got duplicated data! Last BG at " + JoH.dateTimeText(m_timeLastBg)); return; } final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.i(TAG, "processNewTransmitterData: No Active Sensor, Data only stored in Transmitter Data"); return; } DexCollectionService.last_transmitter_Data = transmitterData; Log.d(TAG, "BgReading.create: new BG reading at " + transmitterData.timestamp); BgReading.create(transmitterData.raw_data, transmitterData.filtered_data, xdrip.getAppContext(), transmitterData.timestamp); }
Example 2
Source File: Blukon.java From xDrip with GNU General Public License v3.0 | 6 votes |
private static synchronized void processNewTransmitterData(TransmitterData transmitterData) { if (transmitterData == null) { Log.e(TAG, "Got duplicated data! Last BG at " + JoH.dateTimeText(m_timeLastBg)); return; } final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.i(TAG, "processNewTransmitterData: No Active Sensor, Data only stored in Transmitter Data"); return; } DexCollectionService.last_transmitter_Data = transmitterData; Log.d(TAG, "BgReading.create: new BG reading at " + transmitterData.timestamp); BgReading.create(transmitterData.raw_data, transmitterData.filtered_data, xdrip.getAppContext(), transmitterData.timestamp); }
Example 3
Source File: Blukon.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private static synchronized void processNewTransmitterData(TransmitterData transmitterData) { if (transmitterData == null) { Log.e(TAG, "Got duplicated data! Last BG at " + JoH.dateTimeText(m_timeLastBg)); return; } final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.i(TAG, "processNewTransmitterData: No Active Sensor, Data only stored in Transmitter Data"); return; } DexCollectionService.last_transmitter_Data = transmitterData; Log.d(TAG, "BgReading.create: new BG reading at " + transmitterData.timestamp); BgReading.create(transmitterData.raw_data, transmitterData.filtered_data, xdrip.getAppContext(), transmitterData.timestamp); }
Example 4
Source File: Blukon.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private static synchronized void processNewTransmitterData(TransmitterData transmitterData) { if (transmitterData == null) { Log.e(TAG, "Got duplicated data! Last BG at " + JoH.dateTimeText(m_timeLastBg)); return; } final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.i(TAG, "processNewTransmitterData: No Active Sensor, Data only stored in Transmitter Data"); return; } DexCollectionService.last_transmitter_Data = transmitterData; Log.d(TAG, "BgReading.create: new BG reading at " + transmitterData.timestamp); BgReading.create(transmitterData.raw_data, transmitterData.filtered_data, xdrip.getAppContext(), transmitterData.timestamp); }
Example 5
Source File: BlueReaderTest.java From xDrip with GNU General Public License v3.0 | 5 votes |
@Test public void processNewTransmitterData_NormalBg_FullBattery() { // Setup String message = "150000 4300"; Sensor mockSensor = createMockSensor(); addMockBgReading(150, 15, mockSensor); addMockBgReading(150, 10, mockSensor); addMockBgReading(150, 5, mockSensor); Calibration.initialCalibration(150, 150, RuntimeEnvironment.application.getApplicationContext()); // Act byte[] bytes = blueReader.decodeblueReaderPacket(message.getBytes(), message.length()); // Verify assertThat(bytes).isNull(); assertThat(PersistentStore.getLong("blueReader_Full_Battery")).isEqualTo(4300); assertThat(PersistentStore.getString("bridge_battery_days")).isEqualTo("6.1"); assertThat(Pref.getInt("bridge_battery", -1)).isEqualTo(100); assertThat(getLogs()).contains("BgReading.create: new BG reading at "); assertThat(Sensor.currentSensor().latest_battery_level).isEqualTo(100); TransmitterData lastTransmitterData = DexCollectionService.last_transmitter_Data; assertThat(lastTransmitterData.filtered_data).isEqualTo(150000.0); assertThat(lastTransmitterData.raw_data).isEqualTo(150000.0); assertThat(lastTransmitterData.sensor_battery_level).isEqualTo(4300); BgReading lastBgReading = BgReading.last(); assertThat(lastBgReading.raw_data).isEqualTo(150.0d); assertThat(lastBgReading.filtered_data).isEqualTo(150.0d); }
Example 6
Source File: BlueReaderTest.java From xDrip with GNU General Public License v3.0 | 5 votes |
@Test public void processNewTransmitterData_NormalBg_SomeBattery() { // Setup String message = "150000 3900"; Sensor mockSensor = createMockSensor(); addMockBgReading(150, 15, mockSensor); addMockBgReading(150, 10, mockSensor); addMockBgReading(150, 5, mockSensor); Calibration.initialCalibration(150, 150, RuntimeEnvironment.application.getApplicationContext()); // Act byte[] bytes = blueReader.decodeblueReaderPacket(message.getBytes(), message.length()); // Verify assertThat(bytes).isNull(); assertThat(PersistentStore.getLong("blueReader_Full_Battery")).isEqualTo(4100); assertThat(PersistentStore.getString("bridge_battery_days")).isEqualTo("5.5"); assertThat(Pref.getInt("bridge_battery", -1)).isEqualTo(75); assertThat(getLogs()).contains("BgReading.create: new BG reading at "); assertThat(Sensor.currentSensor().latest_battery_level).isEqualTo(75); TransmitterData lastTransmitterData = DexCollectionService.last_transmitter_Data; assertThat(lastTransmitterData.filtered_data).isEqualTo(150000.0); assertThat(lastTransmitterData.raw_data).isEqualTo(150000.0); assertThat(lastTransmitterData.sensor_battery_level).isEqualTo(3900); BgReading lastBgReading = BgReading.last(); assertThat(lastBgReading.raw_data).isEqualTo(150.0d); assertThat(lastBgReading.filtered_data).isEqualTo(150.0d); }
Example 7
Source File: BlueReaderTest.java From xDrip with GNU General Public License v3.0 | 5 votes |
@Test public void processNewTransmitterData_NormalBg_LowBattery() { // Setup Pref.setBoolean("blueReader_turn_off", false); String message = "150000 3300"; Sensor mockSensor = createMockSensor(); addMockBgReading(150, 15, mockSensor); addMockBgReading(150, 10, mockSensor); addMockBgReading(150, 5, mockSensor); Calibration.initialCalibration(150, 150, RuntimeEnvironment.application.getApplicationContext()); // Act byte[] bytes = blueReader.decodeblueReaderPacket(message.getBytes(), message.length()); // Verify assertThat(bytes).isNull(); assertThat(PersistentStore.getLong("blueReader_Full_Battery")).isEqualTo(4100); assertThat(PersistentStore.getString("bridge_battery_days")).isEqualTo("0.1"); assertThat(Pref.getInt("bridge_battery", -1)).isEqualTo(0); assertThat(getLogs()).contains("BgReading.create: new BG reading at "); assertThat(Sensor.currentSensor().latest_battery_level).isEqualTo(0); TransmitterData lastTransmitterData = DexCollectionService.last_transmitter_Data; assertThat(lastTransmitterData.filtered_data).isEqualTo(150000.0); assertThat(lastTransmitterData.raw_data).isEqualTo(150000.0); assertThat(lastTransmitterData.sensor_battery_level).isEqualTo(3300); BgReading lastBgReading = BgReading.last(); assertThat(lastBgReading.raw_data).isEqualTo(150.0d); assertThat(lastBgReading.filtered_data).isEqualTo(150.0d); }
Example 8
Source File: BlueReaderTest.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
@Test public void processNewTransmitterData_NormalBg_FullBattery() { // Setup String message = "150000 4300"; Sensor mockSensor = createMockSensor(); addMockBgReading(150, 15, mockSensor); addMockBgReading(150, 10, mockSensor); addMockBgReading(150, 5, mockSensor); Calibration.initialCalibration(150, 150, RuntimeEnvironment.application.getApplicationContext()); // Act byte[] bytes = blueReader.decodeblueReaderPacket(message.getBytes(), message.length()); // Verify assertThat(bytes).isNull(); assertThat(PersistentStore.getLong("blueReader_Full_Battery")).isEqualTo(4300); assertThat(PersistentStore.getString("bridge_battery_days")).isEqualTo("6.1"); assertThat(Pref.getInt("bridge_battery", -1)).isEqualTo(100); assertThat(getLogs()).contains("BgReading.create: new BG reading at "); assertThat(Sensor.currentSensor().latest_battery_level).isEqualTo(100); TransmitterData lastTransmitterData = DexCollectionService.last_transmitter_Data; assertThat(lastTransmitterData.filtered_data).isEqualTo(150000.0); assertThat(lastTransmitterData.raw_data).isEqualTo(150000.0); assertThat(lastTransmitterData.sensor_battery_level).isEqualTo(4300); BgReading lastBgReading = BgReading.last(); assertThat(lastBgReading.raw_data).isEqualTo(150.0d); assertThat(lastBgReading.filtered_data).isEqualTo(150.0d); }
Example 9
Source File: BlueReaderTest.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
@Test public void processNewTransmitterData_NormalBg_SomeBattery() { // Setup String message = "150000 3900"; Sensor mockSensor = createMockSensor(); addMockBgReading(150, 15, mockSensor); addMockBgReading(150, 10, mockSensor); addMockBgReading(150, 5, mockSensor); Calibration.initialCalibration(150, 150, RuntimeEnvironment.application.getApplicationContext()); // Act byte[] bytes = blueReader.decodeblueReaderPacket(message.getBytes(), message.length()); // Verify assertThat(bytes).isNull(); assertThat(PersistentStore.getLong("blueReader_Full_Battery")).isEqualTo(4100); assertThat(PersistentStore.getString("bridge_battery_days")).isEqualTo("5.5"); assertThat(Pref.getInt("bridge_battery", -1)).isEqualTo(75); assertThat(getLogs()).contains("BgReading.create: new BG reading at "); assertThat(Sensor.currentSensor().latest_battery_level).isEqualTo(75); TransmitterData lastTransmitterData = DexCollectionService.last_transmitter_Data; assertThat(lastTransmitterData.filtered_data).isEqualTo(150000.0); assertThat(lastTransmitterData.raw_data).isEqualTo(150000.0); assertThat(lastTransmitterData.sensor_battery_level).isEqualTo(3900); BgReading lastBgReading = BgReading.last(); assertThat(lastBgReading.raw_data).isEqualTo(150.0d); assertThat(lastBgReading.filtered_data).isEqualTo(150.0d); }
Example 10
Source File: BlueReaderTest.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
@Test public void processNewTransmitterData_NormalBg_LowBattery() { // Setup Pref.setBoolean("blueReader_turn_off", false); String message = "150000 3300"; Sensor mockSensor = createMockSensor(); addMockBgReading(150, 15, mockSensor); addMockBgReading(150, 10, mockSensor); addMockBgReading(150, 5, mockSensor); Calibration.initialCalibration(150, 150, RuntimeEnvironment.application.getApplicationContext()); // Act byte[] bytes = blueReader.decodeblueReaderPacket(message.getBytes(), message.length()); // Verify assertThat(bytes).isNull(); assertThat(PersistentStore.getLong("blueReader_Full_Battery")).isEqualTo(4100); assertThat(PersistentStore.getString("bridge_battery_days")).isEqualTo("0.1"); assertThat(Pref.getInt("bridge_battery", -1)).isEqualTo(0); assertThat(getLogs()).contains("BgReading.create: new BG reading at "); assertThat(Sensor.currentSensor().latest_battery_level).isEqualTo(0); TransmitterData lastTransmitterData = DexCollectionService.last_transmitter_Data; assertThat(lastTransmitterData.filtered_data).isEqualTo(150000.0); assertThat(lastTransmitterData.raw_data).isEqualTo(150000.0); assertThat(lastTransmitterData.sensor_battery_level).isEqualTo(3300); BgReading lastBgReading = BgReading.last(); assertThat(lastBgReading.raw_data).isEqualTo(150.0d); assertThat(lastBgReading.filtered_data).isEqualTo(150.0d); }
Example 11
Source File: blueReader.java From xDrip with GNU General Public License v3.0 | 4 votes |
private static synchronized void processNewTransmitterData(TransmitterData transmitterData, long timestamp) { if (transmitterData == null) { return; } final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.i(TAG, "setSerialDataToTransmitterRawData: No Active Sensor, Data only stored in Transmitter Data"); return; } if(PersistentStore.getLong("blueReader_Full_Battery") <3000 ) PersistentStore.setLong("blueReader_Full_Battery", 4100); double blueReaderDays =0; if (transmitterData.sensor_battery_level > PersistentStore.getLong("blueReader_Full_Battery")) { PersistentStore.setLong("blueReader_Full_Battery", transmitterData.sensor_battery_level); Log.i(TAG, "blueReader_Full_Battery set to: " + transmitterData.sensor_battery_level) ; } int localBridgeBattery =((transmitterData.sensor_battery_level - 3300) * 100 / (((int) (long) PersistentStore.getLong("blueReader_Full_Battery"))-3300)); Pref.setInt("bridge_battery", localBridgeBattery); sensor.latest_battery_level = localBridgeBattery; blueReaderDays = 6.129200670865791d / (1d + Math.pow(((double)transmitterData.sensor_battery_level/3763.700630306379d),(-61.04241888028577d))); //todo compare with test-formular, and new Data of batterylog if (transmitterData.sensor_battery_level < 3600) { blueReaderDays=blueReaderDays + 0.1d; } blueReaderDays = ((Math.round((blueReaderDays)*10d)/10d)); PersistentStore.setString("bridge_battery_days", String.valueOf(blueReaderDays)); sensor.save(); if (Pref.getBooleanDefaultFalse("blueReader_writebatterylog")) { final String dir = getExternalDir(); makeSureDirectoryExists(dir); writeLog(dir + BatLog, DateFormat.format("yyyyMMdd-kkmmss", System.currentTimeMillis()).toString() + "|" + PersistentStore.getLong("blueReader_Full_Battery") + "|" + transmitterData.sensor_battery_level + "|" + sensor.latest_battery_level + "|" + blueReaderDays ); } DexCollectionService.last_transmitter_Data = transmitterData; Log.d(TAG, "BgReading.create: new BG reading at " + timestamp + " with a timestamp of " + transmitterData.timestamp); BgReading.create(transmitterData.raw_data, transmitterData.filtered_data, xdrip.getAppContext(), transmitterData.timestamp); }
Example 12
Source File: blueReader.java From xDrip with GNU General Public License v3.0 | 4 votes |
private static synchronized void processNewTransmitterData(TransmitterData transmitterData, long timestamp) { if (transmitterData == null) { return; } final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.i(TAG, "setSerialDataToTransmitterRawData: No Active Sensor, Data only stored in Transmitter Data"); return; } if(PersistentStore.getLong("blueReader_Full_Battery") <3000 ) PersistentStore.setLong("blueReader_Full_Battery", 4100); double blueReaderDays =0; if (transmitterData.sensor_battery_level > PersistentStore.getLong("blueReader_Full_Battery")) { PersistentStore.setLong("blueReader_Full_Battery", transmitterData.sensor_battery_level); Log.i(TAG, "blueReader_Full_Battery set to: " + transmitterData.sensor_battery_level) ; } int localBridgeBattery =((transmitterData.sensor_battery_level - 3300) * 100 / (((int) (long) PersistentStore.getLong("blueReader_Full_Battery"))-3300)); Pref.setInt("bridge_battery", localBridgeBattery); sensor.latest_battery_level = localBridgeBattery; blueReaderDays = 6.129200670865791d / (1d + Math.pow(((double)transmitterData.sensor_battery_level/3763.700630306379d),(-61.04241888028577d))); //todo compare with test-formular, and new Data of batterylog if (transmitterData.sensor_battery_level < 3600) { blueReaderDays=blueReaderDays + 0.1d; } blueReaderDays = ((Math.round((blueReaderDays)*10d)/10d)); PersistentStore.setString("bridge_battery_days", String.valueOf(blueReaderDays)); sensor.save(); if (Pref.getBooleanDefaultFalse("blueReader_writebatterylog")) { final String dir = getExternalDir(); makeSureDirectoryExists(dir); writeLog(dir + BatLog, DateFormat.format("yyyyMMdd-kkmmss", System.currentTimeMillis()).toString() + "|" + PersistentStore.getLong("blueReader_Full_Battery") + "|" + transmitterData.sensor_battery_level + "|" + sensor.latest_battery_level + "|" + blueReaderDays ); } DexCollectionService.last_transmitter_Data = transmitterData; Log.d(TAG, "BgReading.create: new BG reading at " + timestamp + " with a timestamp of " + transmitterData.timestamp); BgReading.create(transmitterData.raw_data, transmitterData.filtered_data, xdrip.getAppContext(), transmitterData.timestamp); }
Example 13
Source File: blueReader.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
private static synchronized void processNewTransmitterData(TransmitterData transmitterData, long timestamp) { if (transmitterData == null) { return; } final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.i(TAG, "setSerialDataToTransmitterRawData: No Active Sensor, Data only stored in Transmitter Data"); return; } if(PersistentStore.getLong("blueReader_Full_Battery") <3000 ) PersistentStore.setLong("blueReader_Full_Battery", 4100); double blueReaderDays =0; if (transmitterData.sensor_battery_level > PersistentStore.getLong("blueReader_Full_Battery")) { PersistentStore.setLong("blueReader_Full_Battery", transmitterData.sensor_battery_level); Log.i(TAG, "blueReader_Full_Battery set to: " + transmitterData.sensor_battery_level) ; } int localBridgeBattery =((transmitterData.sensor_battery_level - 3300) * 100 / (((int) (long) PersistentStore.getLong("blueReader_Full_Battery"))-3300)); Pref.setInt("bridge_battery", localBridgeBattery); sensor.latest_battery_level = localBridgeBattery; blueReaderDays = 6.129200670865791d / (1d + Math.pow(((double)transmitterData.sensor_battery_level/3763.700630306379d),(-61.04241888028577d))); //todo compare with test-formular, and new Data of batterylog if (transmitterData.sensor_battery_level < 3600) { blueReaderDays=blueReaderDays + 0.1d; } blueReaderDays = ((Math.round((blueReaderDays)*10d)/10d)); PersistentStore.setString("bridge_battery_days", String.valueOf(blueReaderDays)); sensor.save(); if (Pref.getBooleanDefaultFalse("blueReader_writebatterylog")) { final String dir = getExternalDir(); makeSureDirectoryExists(dir); writeLog(dir + BatLog, DateFormat.format("yyyyMMdd-kkmmss", System.currentTimeMillis()).toString() + "|" + PersistentStore.getLong("blueReader_Full_Battery") + "|" + transmitterData.sensor_battery_level + "|" + sensor.latest_battery_level + "|" + blueReaderDays ); } DexCollectionService.last_transmitter_Data = transmitterData; Log.d(TAG, "BgReading.create: new BG reading at " + timestamp + " with a timestamp of " + transmitterData.timestamp); BgReading.create(transmitterData.raw_data, transmitterData.filtered_data, xdrip.getAppContext(), transmitterData.timestamp); }
Example 14
Source File: blueReader.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
private static synchronized void processNewTransmitterData(TransmitterData transmitterData, long timestamp) { if (transmitterData == null) { return; } final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.i(TAG, "setSerialDataToTransmitterRawData: No Active Sensor, Data only stored in Transmitter Data"); return; } if(PersistentStore.getLong("blueReader_Full_Battery") <3000 ) PersistentStore.setLong("blueReader_Full_Battery", 4100); double blueReaderDays =0; if (transmitterData.sensor_battery_level > PersistentStore.getLong("blueReader_Full_Battery")) { PersistentStore.setLong("blueReader_Full_Battery", transmitterData.sensor_battery_level); Log.i(TAG, "blueReader_Full_Battery set to: " + transmitterData.sensor_battery_level) ; } int localBridgeBattery =((transmitterData.sensor_battery_level - 3300) * 100 / (((int) (long) PersistentStore.getLong("blueReader_Full_Battery"))-3300)); Pref.setInt("bridge_battery", localBridgeBattery); sensor.latest_battery_level = localBridgeBattery; blueReaderDays = 6.129200670865791d / (1d + Math.pow(((double)transmitterData.sensor_battery_level/3763.700630306379d),(-61.04241888028577d))); //todo compare with test-formular, and new Data of batterylog if (transmitterData.sensor_battery_level < 3600) { blueReaderDays=blueReaderDays + 0.1d; } blueReaderDays = ((Math.round((blueReaderDays)*10d)/10d)); PersistentStore.setString("bridge_battery_days", String.valueOf(blueReaderDays)); sensor.save(); if (Pref.getBooleanDefaultFalse("blueReader_writebatterylog")) { final String dir = getExternalDir(); makeSureDirectoryExists(dir); writeLog(dir + BatLog, DateFormat.format("yyyyMMdd-kkmmss", System.currentTimeMillis()).toString() + "|" + PersistentStore.getLong("blueReader_Full_Battery") + "|" + transmitterData.sensor_battery_level + "|" + sensor.latest_battery_level + "|" + blueReaderDays ); } DexCollectionService.last_transmitter_Data = transmitterData; Log.d(TAG, "BgReading.create: new BG reading at " + timestamp + " with a timestamp of " + transmitterData.timestamp); BgReading.create(transmitterData.raw_data, transmitterData.filtered_data, xdrip.getAppContext(), transmitterData.timestamp); }