All Projects → hansionit → H Ble

hansionit / H Ble

Android Ble类库,基于回调,暴露搜索、连接、发送、接收、断开连接等接口,无需关心细节操作即可进行Ble通信。

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to H Ble

ruuvitag-demo
Demo of reading Bluetooth Low Energy sensor measurements of RuuviTag environmental sensors and feeding them to MQTT, a database and dashboards
Stars: ✭ 14 (-91.81%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Web Bluetooth Terminal
Progressive Web Application for serial communication with your own Bluetooth Low Energy (Smart) devices
Stars: ✭ 130 (-23.98%)
Mutual labels:  ble, bluetooth-low-energy, bluetooth
IOS-DFU-Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 400 (+133.92%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Easyble
Android BLE framework
Stars: ✭ 155 (-9.36%)
Mutual labels:  ble, bluetooth-low-energy, bluetooth
Node Ble
Bluetooth Low Energy (BLE) library written with pure Node.js (no bindings) - baked by Bluez via DBus
Stars: ✭ 159 (-7.02%)
Mutual labels:  ble, bluetooth-low-energy, bluetooth
android-ble-made-easy
An Android Library for handling Bluetooth Low Energy on Android Easy
Stars: ✭ 34 (-80.12%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
JDY-08
JDY-08 Bluetooth transparent transmission module, with resource for KiCAD
Stars: ✭ 48 (-71.93%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
awesome-bluetooth-security
List of Bluetooth BR/EDR/LE security resources
Stars: ✭ 220 (+28.65%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Rxbluetoothkit
iOS & OSX Bluetooth library for RxSwift
Stars: ✭ 1,213 (+609.36%)
Mutual labels:  ble, bluetooth-low-energy, bluetooth
Rxbluetoothkotlin
Bluetooth low energy reactive framework for Android written in Kotlin
Stars: ✭ 68 (-60.23%)
Mutual labels:  ble, bluetooth-low-energy, bluetooth
Blueborne Scanner
Bluetooth scanner for local devices that may be vulnerable to Blueborne exploit
Stars: ✭ 125 (-26.9%)
Mutual labels:  ble, bluetooth-low-energy, bluetooth
Nimble Arduino
A fork of the NimBLE library structured for compilation with Ardruino, designed for use with ESP32.
Stars: ✭ 108 (-36.84%)
Mutual labels:  ble, bluetooth-low-energy, bluetooth
bluetooth-manager
Java Bluetooth Manager. A library/framework for managing bluetooth adapters, bluetooth devices, GATT services and characteristics
Stars: ✭ 75 (-56.14%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
ble-utilities-unreal
This is Unreal Engine plugin that allows to scan for BLE devices with Cycling Power service running, connect to one of them and subscribe for its notifications.
Stars: ✭ 48 (-71.93%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
python-sonicare
Python library to communicate with a Phillips Sonicare toothbrush via Bluetooth Low Energy
Stars: ✭ 46 (-73.1%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
IoT-iBeacon
An Ionic app for indoor localization and navigation using BLE iBeacons.
Stars: ✭ 39 (-77.19%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
H.E.L.P.
Home Environment Locating People 🍍
Stars: ✭ 19 (-88.89%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Bluetooth-ble-beamer-and-scanner-for-tracing-corona-virus-infected-individual
Bluetooth ble beacon beamer and scanner for tracing corona virus infected person similar to Trace Together app
Stars: ✭ 26 (-84.8%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Ios Pods Dfu Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 349 (+104.09%)
Mutual labels:  ble, bluetooth-low-energy, bluetooth
Extendable
Blocks Based Bluetooth LE Connectivity framework for iOS/watchOS/tvOS/OSX. Quickly configure centrals & peripherals, perform read/write operations, and respond characteristic updates.
Stars: ✭ 88 (-48.54%)
Mutual labels:  ble, bluetooth-low-energy, bluetooth

H-Ble

Android Ble类库,基于回调,暴露搜索、连接、发送、接收、断开连接等接口,无需关心细节操作即可进行Ble通信。

API

具体使用请参考本项目提供的例子

获取BleController实例并进行初始化(初始化只需执行一次)

  • BleController.getInstance().init(this);

搜所设备,获取设备列表

  • BleController.getInstance().scanBle(int time,ScanCallback scanCallbak);

连接设备

  • BleController.getInstance().connect(int time,String deviceAdress,ConnectCallback connectCallback);

发送数据

  • BleController.getInstance().writeBuffer(byte[] buf,OnWriteCallback onWriteCallback);

注册接收数据的监听

  • BleController.getInstance().registReciveListener(String requestKey,OnReceiverCallback onReceiveCallback);

注销接收数据的监听

  • BleController.getInstance().unregistReciveListener(String requestKey);

断开连接

  • BleController.getInstance().closeBleConn();

必备操作

添加权限

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

定位权限必须添加,否则Android 5.0以上的手机搜索不到设备

指定UUID

  • 打开BleController.class

  • 修改以下成员变量的值为自己所要通信的BLE模块对应的UUID

      private static final String BLUETOOTH_S = "0000fff0-0000-1000-8000-00805f9b34fb";
      private static final String BLUETOOTH_NOTIFY_C = "0000fff7-0000-1000-8000-00805f9b34fb";
      private static final String BLUETOOTH_WRITE_C = "0000fff6-0000-1000-8000-00805f9b34fb";
    

变量名最后一位字母:

S 代表service的UUID;

C 代表characteristic的UUID;

如果硬件没有提供UUID,可以下载Ble调试助手进行查看 http://download.csdn.net/detail/hansion3333/9753311


本库满足Android 4.3以上手机和BLE模块之间的连接与互发数据。

本库并未将常用Ble手表、心率计等设备的UUID加入其中自动匹配。所以有此需求可以使用其他支持的库。

个人博客:http://www.hansion.win

CSDN: http://blog.csdn.net/hansion3333

  • 注意:蓝牙的使用,与设备有莫大的关联,所以适配方面需要多加处理 此库在ZUK Z2 6.0/7.0,魅蓝note3 5.1,红米note3 5.0,一加7.0,华为7.0等手机上测试无问题,其他机型请自测
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].