Search in sources :

Example 1 with ReadDataShare

use of com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.ReadDataShare in project xDrip-plus by jamorham.

the class DexShareCollectionService method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    Log.d(TAG, "onCreate: ENTER");
    readData = new ReadDataShare(this);
    service = this;
    // KS foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), service);
    // KS foregroundServiceStarter.start();
    final IntentFilter bondintent = new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
    registerReceiver(mPairReceiver, bondintent);
    prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    listenForChangeInSettings();
    // KS bgToSpeech = BgToSpeech.setupTTS(getApplicationContext()); //keep reference to not being garbage collected
    instance = JoH.ts();
}
Also used : IntentFilter(android.content.IntentFilter) ReadDataShare(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.ReadDataShare)

Example 2 with ReadDataShare

use of com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.ReadDataShare in project xDrip by NightscoutFoundation.

the class ShareTest method attemptRead.

public void attemptRead() {
    final ReadDataShare readData = new ReadDataShare(this);
    final Action1<Long> systemTimeListener = new Action1<Long>() {

        @Override
        public void call(Long s) {
            Log.d(TAG, "Made the full round trip, got " + s + " as the system time");
            Log.d("SYSTTIME", "Made the full round trip, got " + s + " as the system time");
            final long addativeSystemTimeOffset = new Date().getTime() - s;
            Log.d(TAG, "Made the full round trip, got " + addativeSystemTimeOffset + " offset");
            Log.d("SYSTTIME", "Made the full round trip, got " + addativeSystemTimeOffset + " offset");
            final Action1<CalRecord[]> calRecordListener = new Action1<CalRecord[]>() {

                @Override
                public void call(CalRecord[] calRecords) {
                    Log.d(TAG, "Made the full round trip, got " + calRecords.length + " Cal Records");
                    Calibration.create(calRecords, addativeSystemTimeOffset, getApplicationContext());
                    final Action1<SensorRecord[]> sensorRecordListener = new Action1<SensorRecord[]>() {

                        @Override
                        public void call(SensorRecord[] sensorRecords) {
                            Log.d(TAG, "Made the full round trip, got " + sensorRecords.length + " Sensor Records");
                            BgReading.create(sensorRecords, addativeSystemTimeOffset, getApplicationContext());
                            final Action1<EGVRecord[]> evgRecordListener = new Action1<EGVRecord[]>() {

                                @Override
                                public void call(EGVRecord[] egvRecords) {
                                    Log.d(TAG, "Made the full round trip, got " + egvRecords.length + " EVG Records");
                                    BgReading.create(egvRecords, addativeSystemTimeOffset, getApplicationContext());
                                }
                            };
                            readData.getRecentEGVs(evgRecordListener);
                        }
                    };
                    readData.getRecentSensorRecords(sensorRecordListener);
                }
            };
            readData.getRecentCalRecords(calRecordListener);
        }
    };
    readData.readSystemTime(systemTimeListener);
}
Also used : Action1(rx.functions.Action1) CalRecord(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.CalRecord) SensorRecord(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.SensorRecord) EGVRecord(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.EGVRecord) ReadDataShare(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.ReadDataShare) Date(java.util.Date)

Example 3 with ReadDataShare

use of com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.ReadDataShare in project xDrip by NightscoutFoundation.

the class DexShareCollectionService method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    Log.d(TAG, "onCreate: ENTER");
    readData = new ReadDataShare(this);
    service = this;
    // KS foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), service);
    // KS foregroundServiceStarter.start();
    final IntentFilter bondintent = new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
    registerReceiver(mPairReceiver, bondintent);
    prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    listenForChangeInSettings();
    // KS bgToSpeech = BgToSpeech.setupTTS(getApplicationContext()); //keep reference to not being garbage collected
    instance = JoH.ts();
}
Also used : IntentFilter(android.content.IntentFilter) ReadDataShare(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.ReadDataShare)

Example 4 with ReadDataShare

use of com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.ReadDataShare in project xDrip-plus by jamorham.

the class ShareTest method attemptRead.

public void attemptRead() {
    final ReadDataShare readData = new ReadDataShare(this);
    final Action1<Long> systemTimeListener = new Action1<Long>() {

        @Override
        public void call(Long s) {
            Log.d(TAG, "Made the full round trip, got " + s + " as the system time");
            Log.d("SYSTTIME", "Made the full round trip, got " + s + " as the system time");
            final long addativeSystemTimeOffset = new Date().getTime() - s;
            Log.d(TAG, "Made the full round trip, got " + addativeSystemTimeOffset + " offset");
            Log.d("SYSTTIME", "Made the full round trip, got " + addativeSystemTimeOffset + " offset");
            final Action1<CalRecord[]> calRecordListener = new Action1<CalRecord[]>() {

                @Override
                public void call(CalRecord[] calRecords) {
                    Log.d(TAG, "Made the full round trip, got " + calRecords.length + " Cal Records");
                    Calibration.create(calRecords, addativeSystemTimeOffset, getApplicationContext());
                    final Action1<SensorRecord[]> sensorRecordListener = new Action1<SensorRecord[]>() {

                        @Override
                        public void call(SensorRecord[] sensorRecords) {
                            Log.d(TAG, "Made the full round trip, got " + sensorRecords.length + " Sensor Records");
                            BgReading.create(sensorRecords, addativeSystemTimeOffset, getApplicationContext());
                            final Action1<EGVRecord[]> evgRecordListener = new Action1<EGVRecord[]>() {

                                @Override
                                public void call(EGVRecord[] egvRecords) {
                                    Log.d(TAG, "Made the full round trip, got " + egvRecords.length + " EVG Records");
                                    BgReading.create(egvRecords, addativeSystemTimeOffset, getApplicationContext());
                                }
                            };
                            readData.getRecentEGVs(evgRecordListener);
                        }
                    };
                    readData.getRecentSensorRecords(sensorRecordListener);
                }
            };
            readData.getRecentCalRecords(calRecordListener);
        }
    };
    readData.readSystemTime(systemTimeListener);
}
Also used : Action1(rx.functions.Action1) CalRecord(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.CalRecord) SensorRecord(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.SensorRecord) EGVRecord(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.EGVRecord) ReadDataShare(com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.ReadDataShare) Date(java.util.Date)

Aggregations

ReadDataShare (com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.ReadDataShare)4 IntentFilter (android.content.IntentFilter)2 CalRecord (com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.CalRecord)2 EGVRecord (com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.EGVRecord)2 SensorRecord (com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.records.SensorRecord)2 Date (java.util.Date)2 Action1 (rx.functions.Action1)2