Android Open Source - ELM327 Device Broadcast Receiver






From Project

Back to project page ELM327.

License

The source code is released under:

Apache License

If you think the Android project ELM327 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.grabtaxi.elm327;
//w  w  w  . j  a  v  a  2  s  .  c om
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import de.greenrobot.event.EventBus;

/**
 * Created by admin on 12/15/14
 */
public class DeviceBroadcastReceiver extends BroadcastReceiver
{
    private static final String TAG = "DeviceBroadcastReceiver";

    @Override
    public void onReceive(Context context, Intent intent)
    {
        String action = intent.getAction();
        if (BluetoothDevice.ACTION_FOUND.equals(action))
        {
            BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
            EventBus.getDefault().post(device);
            displayLog("Device found: " + device.getName() + " (" + device.getAddress() + ")");
        }
    }

    private void displayLog(String msg)
    {
        Log.d(TAG, msg);
    }
}




Java Source Code List

com.grabtaxi.adapter.PairedListAdapter.java
com.grabtaxi.dialog.PairedDevicesDialog.java
com.grabtaxi.elm327.ApplicationTest.java
com.grabtaxi.elm327.BluetoothIOGateway.java
com.grabtaxi.elm327.DeviceBroadcastReceiver.java
com.grabtaxi.elm327.MainActivity.java
com.grabtaxi.utility.MyLog.java