Skip to content

A code plugin for Unreal Engine that allows developers to access the Bluetooth SDK from Blueprint and C++.

License

Notifications You must be signed in to change notification settings

Prikalel/UE-Bluetooth-Support

 
 

Repository files navigation

Bluetooth Support plugin for UE4

A code plugin for Unreal Engine that allows developers to access the Bluetooth SDK from Blueprint and C++. This is the source code of "Bluetooth Support" code plugin on https://www.unrealengine.com/marketplace/bluetooth-support

Prerequisites

Before adding the plugin to your projects, please take these points into consideration:

  1. This plugin relies on Android native SDK. Only Android is currently supported.
    It won't cause a problem for other platforms. It is safe to call any of the plugin methods on any platform.
    You can always wrap platform-specific features by checking the platform name.
  2. Android started supporting Bluetooth Low Energy since Android 4.3 (API level 18).
    • Accessing the device's default bluetooth adapter (API level 18)
    • Nearby device discovery, connection, characteristic reading (API level 21)
    • Getting a nearby device's TXpower, connectablity, advertising intervale (API level 26)
  3. These permissions and capabilities are required in the manifest file in order to be able to use Bluetooth LE on an Android device.
    Don't worry, you can do that easily by following this official guide
  4. Your app should request ACCESS_COARSE_LOCATION & ACCESS_FINE_LOCATION runtime permission in order to be able to discover other BLE devices and for checking if Geolocation is turned on.
    Here is how to check/request granted permissions at runtime on UE4.
  5. Be sure that while scanning, the device has Geolocation enabled, otherwise you will not get any scan results. In this plugin there is a special function that you can use to check if Geolocation is enabled.

Installation

  1. Clone/download zip this repository
  2. Move/unzip the plugin's downloaded folder inside your projects directory/Plugins/
  3. Restart Unreal Engine (if it is running)
  4. Find the plugin under the "Mobile" category and enable it.

Getting Started

Make sure that your target platform/device family satisfy the Prerequisites listed above

There is no better way to understand how to integrate the use this plugin than seeing it in action!
You can go ahead and clone this demo project. After opeining it on your UE4, you can naviguate to the project settings and take a look at the Blueprints to learn how to call the different functionnalities.

What to do to make it work properly?

Basicly, the process is simple.

  1. Check runtime permissions. If user denyed then you can make sad face :(
  2. Check that the device supports BLE, that bluetooth & geolocations are enabled. Otherwise ask user to enable geo, also you are able to enable bluetooth yourself via this plugin API.
  3. Do your work - run scan, obtain discovered devices.

Change log

Milestones on the "Release" channel of this repository.

  • Added 4.27 support. Added `GetBoundedDevices` function, `lastDiscovery` info is now type of `FDateTime` and added `OnScanFinished` pin to unified node (which will fire even when you call StopScan manually).
  • v4.19-4: Unified Scan node with optional filters
    • Scan all, and Scan by UUID are now unified an both support Async result callback, no need to call "getDiscoveredDevices" anymore.
    • Scan by MAC address added
  • v4.19-3: Async scan callback for "filterless" scan.

Donate

If you found this project helpful, consider buying me a ☕

paypal

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

About

A code plugin for Unreal Engine that allows developers to access the Bluetooth SDK from Blueprint and C++.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 95.5%
  • C# 4.5%