All Projects → BasicAirData → BluetoothHelper

BasicAirData / BluetoothHelper

Licence: GPL-3.0 license
Bluetooth helper Java class

Programming Languages

java
68154 projects - #9 most used programming language
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to BluetoothHelper

Berry
A ultra-lightweight embedded scripting language optimized for microcontrollers.
Stars: ✭ 206 (+1484.62%)
Mutual labels:  microcontroller
chronosjs
JS Channels (Events / Commands / Reqest-Response / Courier) Mechanism
Stars: ✭ 35 (+169.23%)
Mutual labels:  communication
ember-window-messenger
This aims to be an simple window postMessage services provider.
Stars: ✭ 17 (+30.77%)
Mutual labels:  communication
Cwebsocket
cWebsocket is lightweight websocket server library
Stars: ✭ 241 (+1753.85%)
Mutual labels:  microcontroller
IntrOS
Free cooperative operating system (OS) for microcontrollers
Stars: ✭ 38 (+192.31%)
Mutual labels:  microcontroller
arduivis
a bi-directional communication paradigm for programming languages & microcontrollers
Stars: ✭ 48 (+269.23%)
Mutual labels:  microcontroller
Blog
A set of various projects based on ESP8266, ESP32, ATtiny13, ATtiny85, ATtiny2313, ATmega8, ATmega328, ATmega32, STM32 and more.
Stars: ✭ 198 (+1423.08%)
Mutual labels:  microcontroller
stm32f103xx
DEPRECATED
Stars: ✭ 31 (+138.46%)
Mutual labels:  microcontroller
bluetooth-terminal
ES6 class for serial communication with your own Bluetooth Low Energy (Smart) devices
Stars: ✭ 43 (+230.77%)
Mutual labels:  communication
post-messenger
👶 ~1 Kb wrapper of window.postMessage for cross-document communication.
Stars: ✭ 28 (+115.38%)
Mutual labels:  communication
Open Electronics
📚 💻 Great Resources for Electronics Enthusiasts
Stars: ✭ 242 (+1761.54%)
Mutual labels:  microcontroller
Talks
schedule and materials about my presentations
Stars: ✭ 245 (+1784.62%)
Mutual labels:  microcontroller
elm-lint
elm-lint lints Elm source code, to add additional guarantees to your project.
Stars: ✭ 27 (+107.69%)
Mutual labels:  communication
Microflo
Live dataflow programming for microcontrollers and embedded
Stars: ✭ 207 (+1492.31%)
Mutual labels:  microcontroller
timonel
ATtiny85/45/25 I2C bootloader
Stars: ✭ 108 (+730.77%)
Mutual labels:  microcontroller
U8g2
U8glib library for monochrome displays, version 2
Stars: ✭ 2,737 (+20953.85%)
Mutual labels:  microcontroller
GenuineChannels
Collection of custom .NET Remoting channels
Stars: ✭ 29 (+123.08%)
Mutual labels:  communication
alkemio
START HERE! Cross project collaboration and shared documentation.
Stars: ✭ 22 (+69.23%)
Mutual labels:  communication
qless-php
PHP Bindings for qless
Stars: ✭ 25 (+92.31%)
Mutual labels:  messages
micropy-stubs
Automatically Generated Stub Packages for Micropy-Cli and whomever else
Stars: ✭ 25 (+92.31%)
Mutual labels:  microcontroller

BasicAirData BluetoothHelper
Releases GitHub license

A Bluetooth Java Class for Android.
Offered by BasicAirData - Open and free DIY air data instrumentation and telemetry

Description

This Java Class implements an easy message-based Bluetooth wireless communication layer between an Android device (the client) and a Microcontroller (the server).
Using this class you can Connect, Disconnect, Send String messages, Receive String messages via Listener (best way) or by explicit polling, automatically reconnect and check the status of your Bluetooth connection in a simple and thread-safe way.

The library is compatible with android 4.0 (API 14) and newer.

Here in this repo (in the Arduino/BluetoothHelperExample folder) you can also find a very simple example (around 100 lines of code, including comments) that shows how to use it.
You can find a complete implementation of this library in BasicAirData Air Data Bridge.

For further information about this library and its usage you can read this article.

Dependencies

Use Gradle

dependencies {
    implementation 'eu.basicairdata:bluetoothhelper:1.0.5'
}

Or Maven

<dependency>
    <groupId>eu.basicairdata</groupId>
    <artifactId>bluetoothhelper</artifactId>
    <version>1.0.5</version>
    <type>pom</type>
</dependency>

Getting started

Setup

  • Add Bluetooth permissions to your AndroidManifest.xml:
<uses-permission android:name = "android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name = "android.permission.BLUETOOTH"/>
  • Declare a new BluetoothHelper instance into your activity:
BluetoothHelper mBluetoothHelper = new BluetoothHelper();
  • Setup a BluetoothHelperListener to receive the messages and the changes of the connection status:
mBluetoothHelper.setBluetoothHelperListener(new BluetoothHelper.BluetoothHelperListener() {
    @Override
    public void onBluetoothHelperMessageReceived(BluetoothHelper bluetoothhelper, final String message) {
        // Do something with the message received
        // runOnUiThread(new Runnable() {
        //     @Override
        //     public void run() {
        //         // Update your UI
        //     }
        // });
    }

    @Override
    public void onBluetoothHelperConnectionStateChanged(BluetoothHelper bluetoothhelper, boolean isConnected) {
        // Do something, depending on the new connection status
    }
});     

Common Usage

mBluetoothHelper.Connect(mBluetoothDevice);
  • As alternative, connect to a BluetoothDevice directly using its Device Name:
mBluetoothHelper.Connect("HC-05");
  • Send a message:
mBluetoothHelper.SendMessage("Hello World");
  • Check the connection status:
mBluetoothHelper.isConnected();
  • Disconnect:
mBluetoothHelper.Disconnect();

For further information you can read the full BluetoothHelper API Documentation.

This repository contains

  • Android/BluetoothHelper.class = The Helper Class for Android;

The repo includes also a very simple but fully functional example, that shows how to use the helper class:

  • Android/BluetoothHelperExample/ = Example app for Android - around 100 lines of code, including comments - that controls 2 leds (one ON/OFF using a button and one in PWM using a slider);
  • Arduino/BluetoothHelperExample/ = The sketch for Arduino; this example (ready to be uploaded on Arduino 2009) is made to communicate with the example app;
  • doc/ = The related documentation. The folder includes the API documentation of the Class and the electrical scheme of the microcontroller circuit, showing one of the possible hardware configurations (Arduino 2009 + BlueSMIRF Gold);

Reference documents

Code of conduct

Contributing Information

Repository License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].