All Projects → kdewald → nativeble

kdewald / nativeble

Licence: MIT license
A fully-fledged cross-platform BLE library for desktop.

Programming Languages

C++
36643 projects - #6 most used programming language
Objective-C++
1391 projects
CMake
9771 projects
objective c
16641 projects - #2 most used programming language
shell
77523 projects
powershell
5483 projects

Projects that are alternatives of or similar to nativeble

Bthps3
Windows kernel-mode Bluetooth Profile & Filter Drivers for PS3 peripherals
Stars: ✭ 94 (+526.67%)
Mutual labels:  driver, bluetooth
Rtl8723bs
Realtek SDIO Wi-Fi driver
Stars: ✭ 260 (+1633.33%)
Mutual labels:  driver, bluetooth
Mac Precision Touchpad
Windows Precision Touchpad Driver Implementation for Apple MacBook / Magic Trackpad
Stars: ✭ 5,107 (+33946.67%)
Mutual labels:  driver, bluetooth
Betterjoy
Allows the Nintendo Switch Pro Controller, Joycons and SNES controller to be used with CEMU, Citra, Dolphin, Yuzu and as generic XInput
Stars: ✭ 1,352 (+8913.33%)
Mutual labels:  driver, bluetooth
Shibari
Gaming input peripherals test platform for Windows
Stars: ✭ 136 (+806.67%)
Mutual labels:  driver, bluetooth
fix-linux-mouse
Hints how to fix USB mouse issues on Linux
Stars: ✭ 36 (+140%)
Mutual labels:  driver, bluetooth
BetterJoyForDolphin
Allows the Nintendo Switch Pro Controller and Joycons to be used with the Dolphin Emulator
Stars: ✭ 44 (+193.33%)
Mutual labels:  driver, bluetooth
SimpleBLE
The ultimate fully-fledged cross-platform BLE library, designed for simplicity and ease of use.
Stars: ✭ 122 (+713.33%)
Mutual labels:  driver, bluetooth
cordova-posprinter-sample
Cordova/Inoic sample for Epson ESC/POS printer
Stars: ✭ 24 (+60%)
Mutual labels:  bluetooth
bluetooth-gatt-parser
Bluetooth GATT service and characteristic parser
Stars: ✭ 61 (+306.67%)
Mutual labels:  bluetooth
soundshed-app
Desktop app to browse and manage guitar amp tones. Control your bluetooth amp, jam to video backing tracks.
Stars: ✭ 36 (+140%)
Mutual labels:  bluetooth
joycon
Device access library for Joycon(Nintendo Switch)
Stars: ✭ 59 (+293.33%)
Mutual labels:  bluetooth
linux nvidia jetson
Allied Vision CSI-2 camera driver for NVIDIA Jetson Systems. Currently supporting Nano, TX2, AGX Xavier, and Xavier NX. Support for TX2 NX coming soon.
Stars: ✭ 68 (+353.33%)
Mutual labels:  driver
GATT
Bluetooth Generic Attribute Profile (GATT) for Swift (Supports Linux)
Stars: ✭ 48 (+220%)
Mutual labels:  bluetooth
MobilECG-II
Open source ECG holter
Stars: ✭ 375 (+2400%)
Mutual labels:  bluetooth
awesome-bluetooth-security
List of Bluetooth BR/EDR/LE security resources
Stars: ✭ 220 (+1366.67%)
Mutual labels:  bluetooth
microbit-ble
Read data from micro:bit using Bluetooth from Linux
Stars: ✭ 40 (+166.67%)
Mutual labels:  bluetooth
SkotOS
Open Source version of the SkotOS narrative prose library, using the DGD driver.
Stars: ✭ 21 (+40%)
Mutual labels:  driver
bluetooth
Android Bluetooth examples
Stars: ✭ 80 (+433.33%)
Mutual labels:  bluetooth
pycom-ruuvitag
Pycom MicroPython RuuviTag BLE Sensor Beacon scanner
Stars: ✭ 18 (+20%)
Mutual labels:  bluetooth

IMPORTANT NOTICE

As of September 2021, NativeBLE will be deprecated and replaced by SimpleBLE. This is a new project that I've started that takes all the lessons learned from NativeBLE and makes it easier to use with far more functionality and stability.

NativeBLE

The purpose of NativeBLE is to add full-fledged BLE capability without the need to worry about specific platform compatibility issues. The API is designed to work on Windows, Linux, and macOS and allows you to write the same code for all three platforms.

The API is very simple and easy to use, giving developers the ability to interact with any BLE device. This library will allow you to:

  • Manage connections to BLE devices
  • Read and write to a characteristic
  • Subscribe to notifications or indications for characteristics

The provided tester application shows how the same code can be compiled and run on any platform.

For more information, read our TUTORIAL.

Code Structure

The code is organized as follows:

  • src-ble
    • An abstracted API that is platform-less (NativeBleController)
    • Internal code for each platform (NativeBleInternal)
  • src-ble-c-api
    • Wrapper in standard C for the API
  • src-ble-test
    • A tester application that uses the compiled src-ble library

Build Instructions

We have specific scripts to compile the library on each platform. By default, the C wrapper and the tester application will also be built. The flags to enable each of these can be found in CMakeLists.txt.

All binaries will be placed in the bin folder.

Windows

  • Install Visual Studio 2019, selecting the C++ toolchain.
  • Install CMake from https://cmake.org/
  • Run .\toolchains\windows\windows_compile.bat from Powershell.
    • Use -c or -clean to perform a full rebuild of the project.
    • Use -a=<ARCH> or -arch=<ARCH> to build the libraries for a specific architecture. (Supported values are x86 and x64.)

Linux

  • Run ./toolchains/linux/linux_install.sh to install the OS dependencies. This should be required only once.
  • Run ./toolchains/linux/linux_compile.sh to build the project.
    • Use -c or -clean to perform a full rebuild of the project.

macOS

  • Install Homebrew from https://brew.sh/
  • Run brew install cmake to install CMake.
  • Run ./toolchains/macos/macos_compile.sh to build the project.
    • Use -c or -clean to perform a full rebuild of the project. The library will be compiled into a .dylib and saved into bin/darwin.

License

All components within this project that have not been bundled from external creators, are licensed under the terms of the MIT Licence.

Important things about the macOS platform

Apple's Bluetooth API for its platforms macOS, iOS, and iPadOS is CoreBluetooth. NativeBLE uses CoreBluetooth for the macOS platform, and in turn, this library can be used for the other Apple platforms as well, without any major changes.

Maximum Message Size

In BLE, there is a term known as MTU (Maximum Transmission Unit). This defines the largest size a message can be that is transferred from the Peripheral to the Central. On most platforms, this number is set to 244 bytes, however this number differs on various Apple devices. Below is a list of some Apple devices and their MTU.

  • MacBook Pro 2016 and older without Touchbar: 104 bytes
  • MacBook Pro 2016 and newer with Touchbar: 244 bytes
  • iOS devices: 185 bytes

It is important to respect these numbers when developing an application with Apple devices, because sending a message larger than the MTU size will result in those bytes being clipped off without any indication. Unfortunately, CoreBluetooth does not expose any methods for identifying what the MTU of the device it is running on is, so this information must be passed to it from the peripheral.

CoreBluetooth will always negotiate the highest possible MTU at the beginning of a connection. For example, if a peripheral supports an MTU of 244 bytes and your MacBook supports an MTU of 104 bytes, CoreBluetooth on your Mac will choose 104 because it is the highest possible MTU supported by both parties.

MAC Addresses and UUIDs

In an effort to protect privacy, CoreBluetooth does not expose the MAC address of a device to a user. Instead, it randomizes the MAC address to a UUID (Universal Unique Identifier) that is exposed to the user. Because of this, you cannot manually input a Bluetooth MAC address into the connect method of NativeBleController on an Apple device. Instead, you will need to scan for devices and find the UUID of the desired device to connect to. This UUID will be passed into the connect method.

This will only be a problem if your application has hard-coded a Bluetooth MAC address to connect to. If you are scanning for devices, on Apple devices, the returned devices from the scan will have their address field filled with the UUID of the device and not the Bluetooth MAC address. This UUID can be used for the connect method.

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].