Search in sources :

Example 6 with InformationList

use of seemoo.fitbit.information.InformationList in project fitness-app by seemoo-lab.

the class WorkActivity method collectBasicInformation.

/**
 * Collects basic information about the selected device, stores them in 'information' and displays them to the user.
 */
public void collectBasicInformation() {
    if (!firstPress) {
        saveButton.setVisibility(View.VISIBLE);
    }
    InformationList list = new InformationList("basic");
    currentInformationList = "basic";
    list.add(new Information("MAC Address: " + device.getAddress()));
    list.add(new Information("Name: " + device.getName()));
    int type = device.getType();
    if (type == BluetoothDevice.DEVICE_TYPE_UNKNOWN) {
        list.add(new Information(getString(R.string.device_type0)));
    } else if (type == BluetoothDevice.DEVICE_TYPE_CLASSIC) {
        list.add(new Information(getString(R.string.device_type1)));
    } else if (type == BluetoothDevice.DEVICE_TYPE_LE) {
        list.add(new Information(getString(R.string.device_type2)));
    } else if (type == BluetoothDevice.DEVICE_TYPE_DUAL) {
        list.add(new Information(getString(R.string.device_type3)));
    }
    int bondState = device.getBondState();
    if (bondState == BluetoothDevice.BOND_NONE) {
        list.add(new Information(getString(R.string.bond_state0)));
    } else if (bondState == BluetoothDevice.BOND_BONDING) {
        list.add(new Information(getString(R.string.bond_state1)));
    } else if (bondState == BluetoothDevice.BOND_BONDED) {
        list.add(new Information(getString(R.string.bond_state2)));
    }
    InternalStorage.loadAuthFiles(activity);
    if (AuthValues.AUTHENTICATION_KEY == null) {
        list.add(new Information("Authentication credentials unavailable, user login with previously associated tracker required. Association is only supported by the official Fitbit app."));
    } else {
        list.add(new Information("Authentication Key & Nonce: " + AuthValues.AUTHENTICATION_KEY + ", " + AuthValues.NONCE));
    }
    if (AuthValues.ENCRYPTION_KEY == null) {
        list.add(new Information("Encryption key unavailable, requires authenticated memory readout on vulnerable tracker models."));
    } else {
        list.add(new Information("Encryption Key: " + AuthValues.ENCRYPTION_KEY));
    }
    information.put("basic", list);
    informationToDisplay.override(information.get("basic"), mListView);
}
Also used : InformationList(seemoo.fitbit.information.InformationList) Information(seemoo.fitbit.information.Information)

Aggregations

InformationList (seemoo.fitbit.information.InformationList)6 Information (seemoo.fitbit.information.Information)5 Alarm (seemoo.fitbit.information.Alarm)2 View (android.view.View)1 WebView (android.webkit.WebView)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1