Skip to content

Instantly share code, notes, and snippets.

Rohan Mendon rohanmendon

Block or report user

Report or block rohanmendon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rohanmendon / lambda_process_data_stream.rb
Created Aug 28, 2019
Lambda to process the data stream from Kinesis in real time
View lambda_process_data_stream.rb
require 'json'
require 'base64'
require 'aws-sdk-s3'
def lambda_handler(event:, context:)
region = ''
bucket_name = ''
access_key = ''
secret_key = ''
Pattern WHITESPACE_PATTERN = Pattern.compile("\\s");
private class ConnectedThread extends Thread {
private final BluetoothSocket mmSocket;
private final InputStream mmInStream;
private final OutputStream mmOutStream;
private byte[] mmBuffer; // mmBuffer store for the stream
public ConnectedThread(BluetoothSocket socket) {
mmSocket = socket;
rohanmendon /
Created Aug 28, 2019
Connecting to the Paired OBD2 Device
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
BluetoothSocket mmSocket;
UUID MY_UUID = UUID.fromString("2cf6e0ab-5417-4595-8564-487134f99ccd");
try {
// Get a BluetoothSocket to connect with the given BluetoothDevice.
// MY_UUID is the app's UUID string, also used in the server code.
rohanmendon /
Created Aug 28, 2019
Creating an instance of the paired OBDII device
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
private static String OBD2_DEVICE_NAME = "OBDII"; // Name of the Device shipped by the manufacturer
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> bondedDevices = mBluetoothAdapter.getBondedDevices();
BluetoothDevice obd2Device;
for(BluetoothDevice bondedDevice: bondedDevices) {
if (bondedDevice.getName().contains(OBD2_DEVICE_NAME)) {
rohanmendon /
Created Aug 28, 2019
Android code to post data to that Kinesis Stream
import com.amazonaws.auth.CognitoCachingCredentialsProvider;
import com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.KinesisRecorder;
File directory = getApplicationContext().getCacheDir();
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(getApplicationContext(), "Identity pool ID", Regions.US_WEST_2);
KinesisRecorder kinesisRecorder = new KinesisRecorder(directory, Regions.US_WEST_2, credentialsProvider);
String kinesisStreamName = "test2-kinesis-data-stream";
JSONObject json = new JSONObject();
try {
You can’t perform that action at this time.