Java Code Examples for com.eveningoutpost.dexdrip.Models.UserError.Log#v()

The following examples show how to use com.eveningoutpost.dexdrip.Models.UserError.Log#v() . 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: ActiveBgAlert.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
public static AlertType alertTypegetOnly(final ActiveBgAlert aba) {

        if (aba == null) {
            Log.v(TAG, "ActiveBgAlert: alertTypegetOnly returning null");
            return null;
        }

        AlertType alert = AlertType.get_alert(aba.alert_uuid);
        if(alert == null) {
            Log.d(TAG, "alertTypegetOnly did not find the active alert as part of existing alerts. returning null");
            // removing the alert to be in a better state.
            ClearData();
            return null;
        }
        if(!alert.uuid.equals(aba.alert_uuid)) {
            Log.wtf(TAG, "AlertType.get_alert did not return the correct alert");
        }
        return alert;
    }
 
Example 2
Source File: ActiveBgAlert.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
public static ActiveBgAlert getOnly() {
    try {
        ActiveBgAlert aba = new Select()
                .from(ActiveBgAlert.class)
                .orderBy("_ID asc")
                .executeSingle();

        if (aba != null) {
            Log.v(TAG, "ActiveBgAlert getOnly aba = " + aba.toString());
        } else {
            Log.v(TAG, "ActiveBgAlert getOnly returning null");
        }
        return aba;
    } catch (android.database.sqlite.SQLiteException e) {
        Log.d(TAG,"ActiveBgAlert rebuilding table strcuture");
        fixUpTable();
        return null;
    }
}
 
Example 3
Source File: ActiveBgAlert.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public static AlertType alertTypegetOnly(final ActiveBgAlert aba) {

        if (aba == null) {
            Log.v(TAG, "ActiveBgAlert: alertTypegetOnly returning null");
            return null;
        }

        AlertType alert = AlertType.get_alert(aba.alert_uuid);
        if(alert == null) {
            Log.d(TAG, "alertTypegetOnly did not find the active alert as part of existing alerts. returning null");
            // removing the alert to be in a better state.
            ClearData();
            return null;
        }
        if(!alert.uuid.equals(aba.alert_uuid)) {
            Log.wtf(TAG, "AlertType.get_alert did not return the correct alert");
        }
        return alert;
    }
 
Example 4
Source File: ActiveBgAlert.java    From xDrip-Experimental with GNU General Public License v3.0 6 votes vote down vote up
public static AlertType alertTypegetOnly() {
    ActiveBgAlert aba = getOnly();

    if (aba == null) {
        Log.v(TAG, "ActiveBgAlert: alertTypegetOnly returning null");
        return null;
    }

    AlertType alert = AlertType.get_alert(aba.alert_uuid);
    if(alert == null) {
        Log.d(TAG, "alertTypegetOnly did not find the active alert as part of existing alerts. returning null");
        // removing the alert to be in a better state.
        ClearData();
        return null;
    }
    if(!alert.uuid.equals(aba.alert_uuid)) {
        Log.wtf(TAG, "AlertType.get_alert did not return the correct alert");
    }
    return alert;
}
 
Example 5
Source File: DexShareCollectionService.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public void authenticateConnection() {
    Log.i(TAG, "Trying to auth");
    String receiverSn = prefs.getString("share_key", "SM00000000").toUpperCase() + "000000";
    if(receiverSn.compareTo("SM00000000000000") == 0) { // They havnt set their serial number, dont bond!
        setRetryTimer();
        return;
    }
    byte[] bondkey = (receiverSn).getBytes(StandardCharsets.US_ASCII);
    if (mBluetoothGatt != null) {
        if (mShareService != null) {
            if(!share2) {
                mAuthenticationCharacteristic = mShareService.getCharacteristic(DexShareAttributes.AuthenticationCode);
            } else {
                mAuthenticationCharacteristic = mShareService.getCharacteristic(DexShareAttributes.AuthenticationCode2);
            }
            if (mAuthenticationCharacteristic != null) {
                Log.v(TAG, "Auth Characteristic found: " + mAuthenticationCharacteristic.toString());
                if (mAuthenticationCharacteristic.setValue(bondkey)) {
                    mBluetoothGatt.writeCharacteristic(mAuthenticationCharacteristic);
                } else {
                    setRetryTimer();
                }
            } else {
                Log.w(TAG, "Authentication Characteristic IS NULL");
                setRetryTimer();
            }
        } else {
            Log.w(TAG, "CRADLE SERVICE IS NULL");
        }
    } else {
        setRetryTimer();
    }
}
 
Example 6
Source File: ActiveBgAlert.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static ActiveBgAlert getOnly() {
    ActiveBgAlert aba = new Select()
            .from(ActiveBgAlert.class)
            .orderBy("_ID asc")
            .executeSingle();

    if (aba != null) {
        Log.v(TAG, "ActiveBgAlert getOnly aba = " + aba.toString());
    } else {
        Log.v(TAG, "ActiveBgAlert getOnly returning null");
    }

    return aba;
}
 
Example 7
Source File: DexShareCollectionService.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
    if (status == BluetoothGatt.GATT_SUCCESS) {
        Log.v(TAG, "Characteristic Read " + characteristic.getUuid());
        if(mHeartBeatCharacteristic.getUuid().equals(characteristic.getUuid())) {
            Log.v(TAG, "Characteristic Read " + characteristic.getUuid() + " " + characteristic.getValue());
            setCharacteristicNotification(mHeartBeatCharacteristic);
        }
        gatt.readCharacteristic(mHeartBeatCharacteristic);
    } else {
        Log.e(TAG, "Characteristic failed to read");
    }
}
 
Example 8
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private void logAvailableSensors() {
    final List<android.hardware.Sensor> sensors = mSensorManager.getSensorList(android.hardware.Sensor.TYPE_ALL);
    Log.d(TAG, "=== LIST AVAILABLE SENSORS ===");
    Log.d(TAG, String.format(Locale.getDefault(), "|%-35s|%-38s|%-6s|", "SensorName", "StringType", "Type"));
    for (android.hardware.Sensor sensor : sensors) {
        Log.v(TAG, String.format(Locale.getDefault(), "|%-35s|%-38s|%-6s|", sensor.getName(), sensor.getStringType(), sensor.getType()));
    }
    Log.d(TAG, "=== LIST AVAILABLE SENSORS ===");
}
 
Example 9
Source File: DexShareCollectionService.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
public boolean connect(final String address) {
    PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(POWER_SERVICE);
    PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
            "DexShareCollectionStart");
    wakeLock.acquire(30000);
    Log.i(TAG, "going to connect to device at address" + address);
    if (mBluetoothAdapter == null || address == null) {
        Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
        setRetryTimer();
        return false;
    }
    if (mBluetoothGatt != null) {
        Log.i(TAG, "BGatt isnt null, Closing.");
        mBluetoothGatt.close();
        mBluetoothGatt = null;
    }
    for (BluetoothDevice bluetoothDevice : mBluetoothAdapter.getBondedDevices()) {
        if (bluetoothDevice.getAddress().compareTo(address) == 0) {
            Log.v(TAG, "Device found, already bonded, going to connect");
           if(mBluetoothAdapter.getRemoteDevice(bluetoothDevice.getAddress()) != null) {
               device = bluetoothDevice;
               mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
               return true;
           }
        }
    }
    device = mBluetoothAdapter.getRemoteDevice(address);
    if (device == null) {
        Log.w(TAG, "Device not found.  Unable to connect.");
        setRetryTimer();
        return false;
    }
    Log.i(TAG, "Trying to create a new connection.");
    mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
    mConnectionState = STATE_CONNECTING;
    return true;
}
 
Example 10
Source File: PebbleDisplayStandard.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
private PebbleDictionary buildDictionary() {
    PebbleDictionary dictionary = new PebbleDictionary();
    TimeZone tz = TimeZone.getDefault();
    Date now = new Date();
    int offsetFromUTC = tz.getOffset(now.getTime());

    final String bgDelta = getBgDelta();
    final String bgReadingS = getBgReading();
    final String slopeOrdinal = getSlopeOrdinal();
    //boolean no_signal;

    if (use_best_glucose) {
        Log.v(TAG, "buildDictionary: slopeOrdinal-" + slopeOrdinal + " bgReading-" + bgReadingS + //
                " now-" + (int) now.getTime() / 1000 + " bgTime-" + (int) (dg.timestamp / 1000) + //
                " phoneTime-" + (int) (new Date().getTime() / 1000) + " getBgDelta-" + getBgDelta());
        //   no_signal = (dg.mssince > Home.stale_data_millis());
    } else {
        Log.v(TAG, "buildDictionary: slopeOrdinal-" + slopeOrdinal + " bgReading-" + bgReadingS + //
                " now-" + (int) now.getTime() / 1000 + " bgTime-" + (int) (this.bgReading.timestamp / 1000) + //
                " phoneTime-" + (int) (new Date().getTime() / 1000) + " getBgDelta-" + getBgDelta());
        //   no_signal = ((new Date().getTime()) - Home.stale_data_millis() - this.bgReading.timestamp > 0);
    }

    dictionary.addString(ICON_KEY, slopeOrdinal);
    dictionary.addString(BG_KEY, bgReadingS);

    if (use_best_glucose) {
        dictionary.addUint32(RECORD_TIME_KEY, (int) (((dg.timestamp + offsetFromUTC) / 1000)));
    } else {
        dictionary.addUint32(RECORD_TIME_KEY, (int) (((this.bgReading.timestamp + offsetFromUTC) / 1000)));
    }

    dictionary.addUint32(PHONE_TIME_KEY, (int) ((new Date().getTime() + offsetFromUTC) / 1000));
    dictionary.addString(BG_DELTA_KEY, bgDelta);

    addBatteryStatusToDictionary(dictionary);

    return dictionary;
}
 
Example 11
Source File: DexShareCollectionService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public void authenticateConnection() {
    Log.i(TAG, "Trying to auth");
    String receiverSn = prefs.getString("share_key", "SM00000000").toUpperCase() + "000000";
    if(receiverSn.compareTo("SM00000000000000") == 0) { // They havnt set their serial number, dont bond!
        setRetryTimer();
        return;
    }
    byte[] bondkey = (receiverSn).getBytes(StandardCharsets.US_ASCII);
    if (mBluetoothGatt != null) {
        if (mShareService != null) {
            if(!share2) {
                mAuthenticationCharacteristic = mShareService.getCharacteristic(DexShareAttributes.AuthenticationCode);
            } else {
                mAuthenticationCharacteristic = mShareService.getCharacteristic(DexShareAttributes.AuthenticationCode2);
            }
            if (mAuthenticationCharacteristic != null) {
                Log.v(TAG, "Auth Characteristic found: " + mAuthenticationCharacteristic.toString());
                if (mAuthenticationCharacteristic.setValue(bondkey)) {
                    mBluetoothGatt.writeCharacteristic(mAuthenticationCharacteristic);
                } else {
                    setRetryTimer();
                }
            } else {
                Log.w(TAG, "Authentication Characteristic IS NULL");
                setRetryTimer();
            }
        } else {
            Log.w(TAG, "CRADLE SERVICE IS NULL");
        }
    } else {
        setRetryTimer();
    }
}
 
Example 12
Source File: ActiveBgAlert.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public static ActiveBgAlert getOnly() {
    ActiveBgAlert aba = new Select()
            .from(ActiveBgAlert.class)
            .orderBy("_ID asc")
            .executeSingle();

    if (aba != null) {
        Log.v(TAG, "ActiveBgAlert getOnly aba = " + aba.toString());
    } else {
        Log.v(TAG, "ActiveBgAlert getOnly returning null");
    }

    return aba;
}
 
Example 13
Source File: DexShareCollectionService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
    if (status == BluetoothGatt.GATT_SUCCESS) {
        Log.v(TAG, "Characteristic Read " + characteristic.getUuid());
        if(mHeartBeatCharacteristic.getUuid().equals(characteristic.getUuid())) {
            Log.v(TAG, "Characteristic Read " + characteristic.getUuid() + " " + characteristic.getValue());
            setCharacteristicNotification(mHeartBeatCharacteristic);
        }
        gatt.readCharacteristic(mHeartBeatCharacteristic);
    } else {
        Log.e(TAG, "Characteristic failed to read");
    }
}
 
Example 14
Source File: DexShareCollectionService.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
    if (status == BluetoothGatt.GATT_SUCCESS) {
        Log.v(TAG, "Characteristic Read " + characteristic.getUuid());
        if(mHeartBeatCharacteristic.getUuid().equals(characteristic.getUuid())) {
            Log.v(TAG, "Characteristic Read " + characteristic.getUuid() + " " + characteristic.getValue());
            setCharacteristicNotification(mHeartBeatCharacteristic);
        }
        gatt.readCharacteristic(mHeartBeatCharacteristic);
    } else {
        Log.e(TAG, "Characteristic failed to read");
    }
}
 
Example 15
Source File: DexShareCollectionService.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
public void authenticateConnection() {
    Log.i(TAG, "Trying to auth");
    String receiverSn = prefs.getString("share_key", "SM00000000").toUpperCase() + "000000";
    if(receiverSn.compareTo("SM00000000000000") == 0) { // They havnt set their serial number, dont bond!
        setRetryTimer();
        return;
    }
    byte[] bondkey = (receiverSn).getBytes(StandardCharsets.US_ASCII);
    if (mBluetoothGatt != null) {
        if (mShareService != null) {
            if(!share2) {
                mAuthenticationCharacteristic = mShareService.getCharacteristic(DexShareAttributes.AuthenticationCode);
            } else {
                mAuthenticationCharacteristic = mShareService.getCharacteristic(DexShareAttributes.AuthenticationCode2);
            }
            if (mAuthenticationCharacteristic != null) {
                Log.v(TAG, "Auth Characteristic found: " + mAuthenticationCharacteristic.toString());
                if (mAuthenticationCharacteristic.setValue(bondkey)) {
                    mBluetoothGatt.writeCharacteristic(mAuthenticationCharacteristic);
                } else {
                    setRetryTimer();
                }
            } else {
                Log.w(TAG, "Authentication Characteristic IS NULL");
                setRetryTimer();
            }
        } else {
            Log.w(TAG, "CRADLE SERVICE IS NULL");
        }
    } else {
        setRetryTimer();
    }
}
 
Example 16
Source File: DexShareCollectionService.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public synchronized boolean connect(final String address) {
    PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(POWER_SERVICE);
    PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
            "DexShareCollectionStart");
    wakeLock.acquire(30000);
    Log.i(TAG, "going to connect to device at address" + address);
    if (mBluetoothAdapter == null || address == null) {
        Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
        setRetryTimer();
        return false;
    }
    if (mBluetoothGatt != null) {
        Log.i(TAG, "BGatt isnt null, Closing.");
        try {
            mBluetoothGatt.close();
        } catch (NullPointerException e) {
            Log.d(TAG, "concurrency related null pointer exception in connect");
        }
        mBluetoothGatt = null;
    }
    for (BluetoothDevice bluetoothDevice : mBluetoothAdapter.getBondedDevices()) {
        if (bluetoothDevice.getAddress().compareTo(address) == 0) {
            Log.v(TAG, "Device found, already bonded, going to connect");
           if(mBluetoothAdapter.getRemoteDevice(bluetoothDevice.getAddress()) != null) {
               device = bluetoothDevice;
               mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
               return true;
           }
        }
    }
    device = mBluetoothAdapter.getRemoteDevice(address);
    if (device == null) {
        Log.w(TAG, "Device not found.  Unable to connect.");
        setRetryTimer();
        return false;
    }
    Log.i(TAG, "Trying to create a new connection.");
    mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
    mConnectionState = STATE_CONNECTING;
    return true;
}
 
Example 17
Source File: DexShareCollectionService.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public synchronized boolean connect(final String address) {
    PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(POWER_SERVICE);
    PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
            "DexShareCollectionStart");
    wakeLock.acquire(30000);
    Log.i(TAG, "going to connect to device at address" + address);
    if (mBluetoothAdapter == null || address == null) {
        Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
        setRetryTimer();
        return false;
    }
    if (mBluetoothGatt != null) {
        Log.i(TAG, "BGatt isnt null, Closing.");
        try {
            mBluetoothGatt.close();
        } catch (NullPointerException e) {
            Log.d(TAG, "concurrency related null pointer exception in connect");
        }
        mBluetoothGatt = null;
    }
    for (BluetoothDevice bluetoothDevice : mBluetoothAdapter.getBondedDevices()) {
        if (bluetoothDevice.getAddress().compareTo(address) == 0) {
            Log.v(TAG, "Device found, already bonded, going to connect");
           if(mBluetoothAdapter.getRemoteDevice(bluetoothDevice.getAddress()) != null) {
               device = bluetoothDevice;
               mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
               return true;
           }
        }
    }
    device = mBluetoothAdapter.getRemoteDevice(address);
    if (device == null) {
        Log.w(TAG, "Device not found.  Unable to connect.");
        setRetryTimer();
        return false;
    }
    Log.i(TAG, "Trying to create a new connection.");
    mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
    mConnectionState = STATE_CONNECTING;
    return true;
}
 
Example 18
Source File: DexShareCollectionService.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public synchronized boolean connect(final String address) {
    PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(POWER_SERVICE);
    PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
            "DexShareCollectionStart");
    wakeLock.acquire(30000);
    Log.i(TAG, "going to connect to device at address" + address);
    if (mBluetoothAdapter == null || address == null) {
        Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
        setRetryTimer();
        return false;
    }
    if (mBluetoothGatt != null) {
        Log.i(TAG, "BGatt isnt null, Closing.");
        try {
            mBluetoothGatt.close();
        } catch (NullPointerException e) {
            Log.d(TAG, "concurrency related null pointer exception in connect");
        }
        mBluetoothGatt = null;
    }
    for (BluetoothDevice bluetoothDevice : mBluetoothAdapter.getBondedDevices()) {
        if (bluetoothDevice.getAddress().compareTo(address) == 0) {
            Log.v(TAG, "Device found, already bonded, going to connect");
           if(mBluetoothAdapter.getRemoteDevice(bluetoothDevice.getAddress()) != null) {
               device = bluetoothDevice;
               mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
               return true;
           }
        }
    }
    device = mBluetoothAdapter.getRemoteDevice(address);
    if (device == null) {
        Log.w(TAG, "Device not found.  Unable to connect.");
        setRetryTimer();
        return false;
    }
    Log.i(TAG, "Trying to create a new connection.");
    mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
    mConnectionState = STATE_CONNECTING;
    return true;
}
 
Example 19
Source File: DexShareCollectionService.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public synchronized boolean connect(final String address) {
    PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(POWER_SERVICE);
    PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
            "DexShareCollectionStart");
    wakeLock.acquire(30000);
    Log.i(TAG, "going to connect to device at address" + address);
    if (mBluetoothAdapter == null || address == null) {
        Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
        setRetryTimer();
        return false;
    }
    if (mBluetoothGatt != null) {
        Log.i(TAG, "BGatt isnt null, Closing.");
        try {
            mBluetoothGatt.close();
        } catch (NullPointerException e) {
            Log.d(TAG, "concurrency related null pointer exception in connect");
        }
        mBluetoothGatt = null;
    }
    for (BluetoothDevice bluetoothDevice : mBluetoothAdapter.getBondedDevices()) {
        if (bluetoothDevice.getAddress().compareTo(address) == 0) {
            Log.v(TAG, "Device found, already bonded, going to connect");
           if(mBluetoothAdapter.getRemoteDevice(bluetoothDevice.getAddress()) != null) {
               device = bluetoothDevice;
               mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
               return true;
           }
        }
    }
    device = mBluetoothAdapter.getRemoteDevice(address);
    if (device == null) {
        Log.w(TAG, "Device not found.  Unable to connect.");
        setRetryTimer();
        return false;
    }
    Log.i(TAG, "Trying to create a new connection.");
    mBluetoothGatt = device.connectGatt(getApplicationContext(), false, mGattCallback);
    mConnectionState = STATE_CONNECTING;
    return true;
}
 
Example 20
Source File: DexCollectionService.java    From xDrip-Experimental with GNU General Public License v3.0 4 votes vote down vote up
public void setSerialDataToTransmitterRawData(byte[] buffer, int len) {
    long timestamp = new Date().getTime();
    if (CollectionServiceStarter.isDexbridgeWixelorWifiandDexbridgeWixel(getApplicationContext())) {
        Log.i(TAG, "setSerialDataToTransmitterRawData: Dealing with Dexbridge packet!");
        int DexSrc;
        int TransmitterID;
        String TxId;
        Calendar c = Calendar.getInstance();
        long secondsNow = c.getTimeInMillis();
        ByteBuffer tmpBuffer = ByteBuffer.allocate(len);
        tmpBuffer.order(ByteOrder.LITTLE_ENDIAN);
        tmpBuffer.put(buffer, 0, len);
        ByteBuffer txidMessage = ByteBuffer.allocate(6);
        txidMessage.order(ByteOrder.LITTLE_ENDIAN);
        if (buffer[0] == 0x07 && buffer[1] == -15) {
            //We have a Beacon packet.  Get the TXID value and compare with dex_txid
            Log.i(TAG, "setSerialDataToTransmitterRawData: Received Beacon packet.");
            //DexSrc starts at Byte 2 of a Beacon packet.
            DexSrc = tmpBuffer.getInt(2);
            TxId = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("dex_txid", "00000");
            TransmitterID = convertSrc(TxId);
            if (TxId.compareTo("00000") != 0 && Integer.compare(DexSrc, TransmitterID) != 0) {
                Log.w(TAG, "setSerialDataToTransmitterRawData: TXID wrong.  Expected " + TransmitterID + " but got " + DexSrc);
                txidMessage.put(0, (byte) 0x06);
                txidMessage.put(1, (byte) 0x01);
                txidMessage.putInt(2, TransmitterID);
                sendBtMessage(txidMessage);
            }
            return;
        }
        if (buffer[0] == 0x11 && buffer[1] == 0x00) {
            //we have a data packet.  Check to see if the TXID is what we are expecting.
            Log.i(TAG, "setSerialDataToTransmitterRawData: Received Data packet");
            if (len >= 0x11) {
                //DexSrc starts at Byte 12 of a data packet.
                DexSrc = tmpBuffer.getInt(12);
                TxId = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("dex_txid", "00000");
                TransmitterID = convertSrc(TxId);
                if (Integer.compare(DexSrc, TransmitterID) != 0) {
                    Log.w(TAG, "TXID wrong.  Expected " + TransmitterID + " but got " + DexSrc);
                    txidMessage.put(0, (byte) 0x06);
                    txidMessage.put(1, (byte) 0x01);
                    txidMessage.putInt(2, TransmitterID);
                    sendBtMessage(txidMessage);
                }
                PreferenceManager.getDefaultSharedPreferences(mContext).edit().putInt("bridge_battery", ByteBuffer.wrap(buffer).get(11)).apply();
                //All is OK, so process it.
                //first, tell the wixel it is OK to sleep.
                Log.d(TAG, "setSerialDataToTransmitterRawData: Sending Data packet Ack, to put wixel to sleep");
                ByteBuffer ackMessage = ByteBuffer.allocate(2);
                ackMessage.put(0, (byte) 0x02);
                ackMessage.put(1, (byte) 0xF0);
                sendBtMessage(ackMessage);
                //make sure we are not processing a packet we already have
                if (secondsNow - lastPacketTime < 60000) {
                    Log.v(TAG, "setSerialDataToTransmitterRawData: Received Duplicate Packet.  Exiting.");
                    return;
                } else {
                    lastPacketTime = secondsNow;
                }
                Log.v(TAG, "setSerialDataToTransmitterRawData: Creating TransmitterData at " + timestamp);
                processNewTransmitterData(TransmitterData.create(buffer, len, timestamp), timestamp);
            }
        }
    } else {
        processNewTransmitterData(TransmitterData.create(buffer, len, timestamp), timestamp);
    }
}