<commit_before>package com.openxc.examples.dashboard;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import android.widget.TextView;

import com.openxc.VehicleService;
import com.openxc.examples.R;
import com.openxc.measurements.BrakePedalStatus;
import com.openxc.measurements.EngineSpeed;
import com.openxc.measurements.Latitude;
import com.openxc.measurements.Longitude;
import com.openxc.measurements.NoValueException;
import com.openxc.measurements.SteeringWheelAngle;
import com.openxc.measurements.TransmissionGearPosition;
import com.openxc.measurements.UnrecognizedMeasurementTypeException;
import com.openxc.measurements.VehicleButtonEvent;
import com.openxc.measurements.VehicleMeasurement;
import com.openxc.measurements.VehicleSpeed;
import com.openxc.measurements.WindshieldWiperSpeed;
import com.openxc.remote.RemoteVehicleServiceException;

public class VehicleDashboardActivity extends Activity {

    private static String TAG = "VehicleDashboard";

    private VehicleService mVehicleService;
    private boolean mIsBound;
    private final Handler mHandler = new Handler();
    private TextView mSteeringWheelAngleView;
    private TextView mVehicleSpeedView;
    private TextView mVehicleBrakeStatusView;
    private TextView mVehicleEngineSpeedView;
    private TextView mTransmissionGearPosView;
    private TextView mLatitudeView;
    private TextView mLongitudeView;
    private TextView mVehButtonEventView;
    private TextView mWiperSpeedView;
    StringBuffer mBuffer;

    WindshieldWiperSpeed.Listener mWiperListener =
            new WindshieldWiperSpeed.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final WindshieldWiperSpeed wiperSpeed =
                (WindshieldWiperSpeed) measurement;
            if(!wiperSpeed.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try {
                            if(wiperSpeed.getValue().doubleValue() > 0) {
                                mWiperSpeedView.setText("On");
                            } else {
                                mWiperSpeedView.setText("Off");
                            }
                        } catch(NoValueException e) { }
                    }
                });
            }
        }
    };

    VehicleSpeed.Listener mSpeedListener = new VehicleSpeed.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final VehicleSpeed speed = (VehicleSpeed) measurement;
            if(!speed.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try {
                            mVehicleSpeedView.setText(
                                "" + speed.getValue().doubleValue());
                        } catch(NoValueException e) { }
                    }
                });
            }
        }
    };

    BrakePedalStatus.Listener mBrPedalStatus = new BrakePedalStatus.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final BrakePedalStatus status = (BrakePedalStatus) measurement;
            if(!status.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try{
                            mVehicleBrakeStatusView.setText(
                                "" + status.getValue().booleanValue());
                        } catch(NoValueException e) {}
                    }
                });
            }
        }
    };

    EngineSpeed.Listener mEngineSpeed = new EngineSpeed.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final EngineSpeed status = (EngineSpeed) measurement;
            if(!status.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try{
                            mVehicleEngineSpeedView.setText(
                                "" + status.getValue().doubleValue());
                        } catch(NoValueException e) {}
                    }
                });
            }
        }
    };

    TransmissionGearPosition.Listener mTransmissionGearPos = new TransmissionGearPosition.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final TransmissionGearPosition status = (TransmissionGearPosition) measurement;
            if(!status.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try{
                            mTransmissionGearPosView.setText(
                                "" + status.getValue().enumValue());
                        } catch(NoValueException e) {}
                    }
                });
            }
        }
    };

    VehicleButtonEvent.Listener mVehButtonEvent = new VehicleButtonEvent.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final VehicleButtonEvent event = (VehicleButtonEvent) measurement;
            if(!event.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try{
                            mVehButtonEventView.setText(
                                "" + event.getValue().enumValue());
                        } catch(NoValueException e) {}
                    }
                });
            }
        }
    };<commit_msg>Print out both value and event for button events.<commit_after>package com.openxc.examples.dashboard;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import android.widget.TextView;

import com.openxc.VehicleService;
import com.openxc.examples.R;
import com.openxc.measurements.BrakePedalStatus;
import com.openxc.measurements.EngineSpeed;
import com.openxc.measurements.Latitude;
import com.openxc.measurements.Longitude;
import com.openxc.measurements.NoValueException;
import com.openxc.measurements.SteeringWheelAngle;
import com.openxc.measurements.TransmissionGearPosition;
import com.openxc.measurements.UnrecognizedMeasurementTypeException;
import com.openxc.measurements.VehicleButtonEvent;
import com.openxc.measurements.VehicleMeasurement;
import com.openxc.measurements.VehicleSpeed;
import com.openxc.measurements.WindshieldWiperSpeed;
import com.openxc.remote.RemoteVehicleServiceException;

public class VehicleDashboardActivity extends Activity {

    private static String TAG = "VehicleDashboard";

    private VehicleService mVehicleService;
    private boolean mIsBound;
    private final Handler mHandler = new Handler();
    private TextView mSteeringWheelAngleView;
    private TextView mVehicleSpeedView;
    private TextView mVehicleBrakeStatusView;
    private TextView mVehicleEngineSpeedView;
    private TextView mTransmissionGearPosView;
    private TextView mLatitudeView;
    private TextView mLongitudeView;
    private TextView mVehButtonEventView;
    private TextView mWiperSpeedView;
    StringBuffer mBuffer;

    WindshieldWiperSpeed.Listener mWiperListener =
            new WindshieldWiperSpeed.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final WindshieldWiperSpeed wiperSpeed =
                (WindshieldWiperSpeed) measurement;
            if(!wiperSpeed.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try {
                            if(wiperSpeed.getValue().doubleValue() > 0) {
                                mWiperSpeedView.setText("On");
                            } else {
                                mWiperSpeedView.setText("Off");
                            }
                        } catch(NoValueException e) { }
                    }
                });
            }
        }
    };

    VehicleSpeed.Listener mSpeedListener = new VehicleSpeed.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final VehicleSpeed speed = (VehicleSpeed) measurement;
            if(!speed.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try {
                            mVehicleSpeedView.setText(
                                "" + speed.getValue().doubleValue());
                        } catch(NoValueException e) { }
                    }
                });
            }
        }
    };

    BrakePedalStatus.Listener mBrPedalStatus = new BrakePedalStatus.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final BrakePedalStatus status = (BrakePedalStatus) measurement;
            if(!status.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try{
                            mVehicleBrakeStatusView.setText(
                                "" + status.getValue().booleanValue());
                        } catch(NoValueException e) {}
                    }
                });
            }
        }
    };

    EngineSpeed.Listener mEngineSpeed = new EngineSpeed.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final EngineSpeed status = (EngineSpeed) measurement;
            if(!status.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try{
                            mVehicleEngineSpeedView.setText(
                                "" + status.getValue().doubleValue());
                        } catch(NoValueException e) {}
                    }
                });
            }
        }
    };

    TransmissionGearPosition.Listener mTransmissionGearPos = new TransmissionGearPosition.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final TransmissionGearPosition status = (TransmissionGearPosition) measurement;
            if(!status.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try{
                            mTransmissionGearPosView.setText(
                                "" + status.getValue().enumValue());
                        } catch(NoValueException e) {}
                    }
                });
            }
        }
    };

    VehicleButtonEvent.Listener mVehButtonEvent = new VehicleButtonEvent.Listener() {
        public void receive(VehicleMeasurement measurement) {
            final VehicleButtonEvent event = (VehicleButtonEvent) measurement;
            if(!event.isNone()) {
                mHandler.post(new Runnable() {
                    public void run() {
                        try{
                            mVehButtonEventView.setText(
                                event.getValue().enumValue() + " is " +
                                event.getEvent().enumValue());
                        } catch(NoValueException e) {}
                    }
                });
            }
        }
    };
{'fraction_non_alphanumeric': 0.08037496745074213, 'fraction_numerical': 0.00017359604201024216, 'mean_word_length': 1.7277462121212122, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6275836', 'n_tokens_mistral': 2856, 'n_tokens_neox': 2714, 'n_words': 510}